| Previous | 199869 Revisions | Next |
| r37129 Sunday 12th April, 2015 at 06:05:43 UTC by Miodrag Milanović |
|---|
| There is no implicit conversion to char* in std::string (nw) |
| [src/emu] | addrmap.c audit.c cheat.c cheat.h clifront.c devfind.h device.c device.h diexec.c digfx.c diimage.c diimage.h dimemory.c disound.c distate.c distate.h emuopts.c fileio.c fileio.h hash.c image.c info.c input.c input.h ioport.c ioport.h machine.c machine.h memory.c memory.h output.c parameters.c profiler.c render.c rendfont.c rendlay.c rendlay.h rendutil.c romload.c save.c save.h schedule.c screen.c softlist.c softlist.h sound.c validity.c video.c webengine.c |
| [src/emu/bus/a1bus] | a1cassette.c a1cffa.c |
| [src/emu/bus/a2bus] | a2applicard.c a2cffa.c a2corvus.c a2diskii.c a2diskiing.c a2hsscsi.c a2memexp.c a2pic.c a2scsi.c a2ssc.c a2swyft.c a2thunderclock.c a2ultraterm.c a2videoterm.c a2vulcan.c a2zipdrive.c corvfdc01.c corvfdc02.c mouse.c timemasterho.c |
| [src/emu/bus/a7800] | a78_slot.c |
| [src/emu/bus/a800] | a800_slot.c |
| [src/emu/bus/apf] | slot.c |
| [src/emu/bus/arcadia] | slot.c |
| [src/emu/bus/astrocde] | slot.c |
| [src/emu/bus/chanf] | slot.c |
| [src/emu/bus/crvision] | slot.c |
| [src/emu/bus/gameboy] | gb_slot.c |
| [src/emu/bus/gba] | gba_slot.c |
| [src/emu/bus/generic] | slot.c |
| [src/emu/bus/intv] | ecs.c slot.c |
| [src/emu/bus/isa] | cga.c ega.c hdc.c isa.c mda.c mufdc.c pc1640_iga.c |
| [src/emu/bus/macpds] | macpds.c pds_tpdfpd.c |
| [src/emu/bus/megadrive] | md_slot.c |
| [src/emu/bus/nes] | nes_ines.inc nes_slot.c |
| [src/emu/bus/nubus] | nubus.c nubus_48gc.c nubus_m2hires.c nubus_m2video.c nubus_radiustpd.c nubus_spec8.c nubus_specpdq.c nubus_wsportrait.c pds30_30hr.c pds30_cb264.c pds30_mc30.c pds30_procolor816.c pds30_sigmalview.c |
| [src/emu/bus/odyssey2] | slot.c |
| [src/emu/bus/oricext] | jasmin.c microdisc.c |
| [src/emu/bus/pce] | pce_slot.c |
| [src/emu/bus/saturn] | sat_slot.c |
| [src/emu/bus/scv] | slot.c |
| [src/emu/bus/sega8] | sega8_slot.c |
| [src/emu/bus/snes] | snes_slot.c |
| [src/emu/bus/vboy] | slot.c |
| [src/emu/bus/vc4000] | slot.c |
| [src/emu/bus/vcs] | vcs_slot.c |
| [src/emu/bus/vectrex] | slot.c |
| [src/emu/bus/wswan] | slot.c |
| [src/emu/bus/x68k] | x68k_scsiext.c |
| [src/emu/cpu] | drcbex64.c drcbex86.c drcuml.c uml.c uml.h x86log.c |
| [src/emu/cpu/adsp2100] | adsp2100.c |
| [src/emu/cpu/asap] | asap.c |
| [src/emu/cpu/cosmac] | cosmac.c |
| [src/emu/cpu/dsp32] | dsp32.c |
| [src/emu/cpu/hd61700] | hd61700.c |
| [src/emu/cpu/i4004] | i4004.c |
| [src/emu/cpu/i8008] | i8008.c |
| [src/emu/cpu/ie15] | ie15.c |
| [src/emu/cpu/m68000] | m68kcpu.c |
| [src/emu/cpu/mcs48] | mcs48.c |
| [src/emu/cpu/tms34010] | tms34010.c |
| [src/emu/cpu/z8] | z8.c |
| [src/emu/debug] | debugcmd.c debugcon.c debugcpu.c debugcpu.h debugvw.c debugvw.h dvdisasm.c dvmemory.c dvstate.c express.c express.h |
| [src/emu/imagedev] | chd_cd.c diablo.c floppy.c harddriv.c |
| [src/emu/machine] | laserdsc.c wozfdc.c |
| [src/emu/sound] | 2610intf.c fm.c |
| [src/emu/ui] | barcode.c cheatopt.c devopt.c filemngr.c filesel.c imgcntrl.c info.c inputmap.c miscmenu.c selgame.c sliders.c slotopt.c tapectrl.c ui.c videoopt.c |
| [src/emu/video] | pc_vga.c |
| [src/ldplayer] | ldplayer.c |
| [src/lib/util] | astring.h cdrom.c chd.c chdcd.c chdcodec.c harddisk.c hashing.c options.c options.h zippath.c |
| [src/mame/drivers] | cps3.c megatech.c stv.c |
| [src/mame/machine] | atarigen.h |
| [src/mess/drivers] | beta.c cc40.c gameking.c gba.c kyocera.c leapster.c nc.c ngp.c pasogo.c pb1000.c pc2000.c pc6001.c pc8401a.c pockstat.c prestige.c pv1000.c px4.c socrates.c svision.c timex.c tispeak.c tutor.c tvc.c vboy.c vii.c |
| [src/mess/machine] | advision.c amstrad.c bbc.c cuda.c egret.c electron.c gamecom.c primo.c svi318.c vtech2.c |
| [src/osd/modules] | osdmodule.h |
| [src/osd/modules/debugger] | debugint.c |
| [src/osd/modules/debugger/qt] | deviceinformationwindow.c mainwindow.c |
| [src/osd/modules/debugger/win] | consolewininfo.c disasmbasewininfo.c disasmwininfo.c editwininfo.c logwininfo.c memorywininfo.c pointswininfo.c |
| [src/osd/modules/font] | font_windows.c |
| [src/osd/modules/lib] | osdobj_common.h |
| [src/osd/modules/render/d3d] | d3dhlsl.c |
| [src/osd/sdl] | input.c osdsdl.h |
| [src/osd/windows] | winmain.c |
| [src/tools] | chdman.c ldresample.c ldverify.c pngcmp.c regrep.c split.c src2html.c |
| r245640 | r245641 | |
|---|---|---|
| 492 | 492 | { |
| 493 | 493 | astring tag; |
| 494 | 494 | owner.subtag(tag, entry->m_read.m_tag); |
| 495 | device_t *mapdevice = machine.device(tag); | |
| 495 | device_t *mapdevice = machine.device(tag.c_str()); | |
| 496 | 496 | if (mapdevice == NULL) { |
| 497 | 497 | throw emu_fatalerror("Attempted to submap a non-existent device '%s' in space %d of device '%s'\n", tag.c_str(), m_spacenum, device.basetag()); |
| 498 | 498 | } |
| r245640 | r245641 | |
|---|---|---|
| 67 | 67 | astring combinedpath(device->searchpath(), ";", driverpath); |
| 68 | 68 | if (device->shortname()) |
| 69 | 69 | combinedpath.cat(";").cat(device->shortname()); |
| 70 | m_searchpath = combinedpath; | |
| 70 | m_searchpath = combinedpath.c_str(); | |
| 71 | 71 | |
| 72 | 72 | for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) |
| 73 | 73 | { |
| r245640 | r245641 | |
| 195 | 195 | locationtag.cat(swinfo->parentname()); |
| 196 | 196 | combinedpath.cat(";").cat(swinfo->parentname()).cat(";").cat(list_name).cat(PATH_SEPARATOR).cat(swinfo->parentname()); |
| 197 | 197 | } |
| 198 | m_searchpath = combinedpath; | |
| 198 | m_searchpath = combinedpath.c_str(); | |
| 199 | 199 | |
| 200 | 200 | int found = 0; |
| 201 | 201 | int required = 0; |
| r245640 | r245641 | |
| 226 | 226 | // audit a disk |
| 227 | 227 | else if (ROMREGION_ISDISKDATA(region)) |
| 228 | 228 | { |
| 229 | record = audit_one_disk(rom, | |
| 229 | record = audit_one_disk(rom, locationtag.c_str()); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // count the number of files that are found. |
| r245640 | r245641 | |
| 284 | 284 | |
| 285 | 285 | // look for the files |
| 286 | 286 | emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); |
| 287 | path_iterator path(searchpath); | |
| 287 | path_iterator path(searchpath.c_str()); | |
| 288 | 288 | astring curpath; |
| 289 | 289 | while (path.next(curpath, samplename)) |
| 290 | 290 | { |
| 291 | 291 | // attempt to access the file (.flac) or (.wav) |
| 292 | file_error filerr = file.open(curpath, ".flac"); | |
| 292 | file_error filerr = file.open(curpath.c_str(), ".flac"); | |
| 293 | 293 | if (filerr != FILERR_NONE) |
| 294 | filerr = file.open(curpath, ".wav"); | |
| 294 | filerr = file.open(curpath.c_str(), ".wav"); | |
| 295 | 295 | |
| 296 | 296 | if (filerr == FILERR_NONE) |
| 297 | 297 | { |
| r245640 | r245641 | |
| 429 | 429 | // open the file if we can |
| 430 | 430 | file_error filerr; |
| 431 | 431 | if (has_crc) |
| 432 | filerr = file.open(curpath, crc); | |
| 432 | filerr = file.open(curpath.c_str(), crc); | |
| 433 | 433 | else |
| 434 | filerr = file.open(curpath); | |
| 434 | filerr = file.open(curpath.c_str()); | |
| 435 | 435 | |
| 436 | 436 | // if it worked, get the actual length and hashes, then stop |
| 437 | 437 | if (filerr == FILERR_NONE) |
| r245640 | r245641 | |
|---|---|---|
| 79 | 79 | set_a1bus_device(); |
| 80 | 80 | |
| 81 | 81 | astring tempstring; |
| 82 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CASSETTE_ROM_REGION))->base(); | |
| 82 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CASSETTE_ROM_REGION).c_str())->base(); | |
| 83 | 83 | |
| 84 | 84 | install_device(0xc000, 0xc0ff, read8_delegate(FUNC(a1bus_cassette_device::cassette_r), this), write8_delegate(FUNC(a1bus_cassette_device::cassette_w), this)); |
| 85 | 85 | install_bank(0xc100, 0xc1ff, 0, 0, (char *)"bank_a1cas", m_rom); |
| r245640 | r245641 | |
|---|---|---|
| 74 | 74 | set_a1bus_device(); |
| 75 | 75 | |
| 76 | 76 | astring tempstring; |
| 77 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA_ROM_REGION))->base(); | |
| 77 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA_ROM_REGION).c_str())->base(); | |
| 78 | 78 | |
| 79 | 79 | install_device(0xafe0, 0xafff, read8_delegate(FUNC(a1bus_cffa_device::cffa_r), this), write8_delegate(FUNC(a1bus_cffa_device::cffa_w), this)); |
| 80 | 80 | install_bank(0x9000, 0xafdf, 0, 0, (char *)"bank_cffa1", m_rom); |
| r245640 | r245641 | |
|---|---|---|
| 98 | 98 | |
| 99 | 99 | // locate Z80 ROM |
| 100 | 100 | astring tempstring; |
| 101 | m_z80rom = device().machine().root_device().memregion(this->subtag(tempstring, Z80_ROM_REGION))->base(); | |
| 101 | m_z80rom = device().machine().root_device().memregion(this->subtag(tempstring, Z80_ROM_REGION).c_str())->base(); | |
| 102 | 102 | |
| 103 | 103 | save_item(NAME(m_bROMAtZ80Zero)); |
| 104 | 104 | save_item(NAME(m_z80stat)); |
| r245640 | r245641 | |
|---|---|---|
| 110 | 110 | set_a2bus_device(); |
| 111 | 111 | |
| 112 | 112 | astring tempstring; |
| 113 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA2_ROM_REGION))->base(); | |
| 113 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA2_ROM_REGION).c_str())->base(); | |
| 114 | 114 | |
| 115 | 115 | // patch default setting so slave device is enabled and up to 13 devices on both connectors |
| 116 | 116 | m_rom[0x800] = 13; |
| r245640 | r245641 | |
|---|---|---|
| 123 | 123 | set_a2bus_device(); |
| 124 | 124 | |
| 125 | 125 | astring tempstring; |
| 126 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CORVUS_ROM_REGION))->base(); | |
| 126 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CORVUS_ROM_REGION).c_str())->base(); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | void a2bus_corvus_device::device_reset() |
| r245640 | r245641 | |
|---|---|---|
| 115 | 115 | set_a2bus_device(); |
| 116 | 116 | |
| 117 | 117 | astring tempstring; |
| 118 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, DISKII_ROM_REGION))->base(); | |
| 118 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, DISKII_ROM_REGION).c_str())->base(); | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | void a2bus_floppy_device::device_reset() |
| r245640 | r245641 | |
|---|---|---|
| 85 | 85 | set_a2bus_device(); |
| 86 | 86 | |
| 87 | 87 | astring tempstring; |
| 88 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, DISKII_ROM_REGION))->base(); | |
| 88 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, DISKII_ROM_REGION).c_str())->base(); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | void a2bus_diskiing_device::device_reset() |
| r245640 | r245641 | |
|---|---|---|
| 137 | 137 | set_a2bus_device(); |
| 138 | 138 | |
| 139 | 139 | astring tempstring; |
| 140 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SCSI_ROM_REGION))->base(); | |
| 140 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SCSI_ROM_REGION).c_str())->base(); | |
| 141 | 141 | |
| 142 | 142 | memset(m_ram, 0, 8192); |
| 143 | 143 |
| r245640 | r245641 | |
|---|---|---|
| 103 | 103 | set_a2bus_device(); |
| 104 | 104 | |
| 105 | 105 | astring tempstring; |
| 106 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, MEMEXP_ROM_REGION))->base(); | |
| 106 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, MEMEXP_ROM_REGION).c_str())->base(); | |
| 107 | 107 | |
| 108 | 108 | memset(m_ram, 0xff, 1024*1024*sizeof(UINT8)); |
| 109 | 109 |
| r245640 | r245641 | |
|---|---|---|
| 128 | 128 | set_a2bus_device(); |
| 129 | 129 | |
| 130 | 130 | astring tempstring; |
| 131 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, PIC_ROM_REGION))->base(); | |
| 131 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, PIC_ROM_REGION).c_str())->base(); | |
| 132 | 132 | |
| 133 | 133 | m_timer = timer_alloc(0, NULL); |
| 134 | 134 | m_timer->adjust(attotime::never); |
| r245640 | r245641 | |
|---|---|---|
| 130 | 130 | set_a2bus_device(); |
| 131 | 131 | |
| 132 | 132 | astring tempstring; |
| 133 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SCSI_ROM_REGION))->base(); | |
| 133 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SCSI_ROM_REGION).c_str())->base(); | |
| 134 | 134 | |
| 135 | 135 | memset(m_ram, 0, 8192); |
| 136 | 136 |
| r245640 | r245641 | |
|---|---|---|
| 155 | 155 | set_a2bus_device(); |
| 156 | 156 | |
| 157 | 157 | astring tempstring; |
| 158 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SSC_ROM_REGION))->base(); | |
| 158 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SSC_ROM_REGION).c_str())->base(); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | void a2bus_ssc_device::device_reset() |
| r245640 | r245641 | |
|---|---|---|
| 65 | 65 | set_a2bus_device(); |
| 66 | 66 | |
| 67 | 67 | astring tempstring; |
| 68 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SWYFT_ROM_REGION))->base(); | |
| 68 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SWYFT_ROM_REGION).c_str())->base(); | |
| 69 | 69 | |
| 70 | 70 | save_item(NAME(m_rombank)); |
| 71 | 71 | } |
| r245640 | r245641 | |
|---|---|---|
| 98 | 98 | set_a2bus_device(); |
| 99 | 99 | |
| 100 | 100 | astring tempstring; |
| 101 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, THUNDERCLOCK_ROM_REGION))->base(); | |
| 101 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, THUNDERCLOCK_ROM_REGION).c_str())->base(); | |
| 102 | 102 | |
| 103 | 103 | save_item(NAME(m_dataout)); |
| 104 | 104 | } |
| r245640 | r245641 | |
|---|---|---|
| 163 | 163 | set_a2bus_device(); |
| 164 | 164 | |
| 165 | 165 | astring tempstring; |
| 166 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, ULTRATERM_ROM_REGION))->base(); | |
| 166 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, ULTRATERM_ROM_REGION).c_str())->base(); | |
| 167 | 167 | |
| 168 | 168 | astring tempstring2; |
| 169 | m_chrrom = device().machine().root_device().memregion(this->subtag(tempstring2, ULTRATERM_GFX_REGION))->base(); | |
| 169 | m_chrrom = device().machine().root_device().memregion(this->subtag(tempstring2, ULTRATERM_GFX_REGION).c_str())->base(); | |
| 170 | 170 | |
| 171 | 171 | memset(m_ram, 0, 256*16); |
| 172 | 172 |
| r245640 | r245641 | |
|---|---|---|
| 218 | 218 | set_a2bus_device(); |
| 219 | 219 | |
| 220 | 220 | astring tempstring; |
| 221 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, VIDEOTERM_ROM_REGION))->base(); | |
| 221 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, VIDEOTERM_ROM_REGION).c_str())->base(); | |
| 222 | 222 | |
| 223 | 223 | astring tempstring2; |
| 224 | m_chrrom = device().machine().root_device().memregion(this->subtag(tempstring2, VIDEOTERM_GFX_REGION))->base(); | |
| 224 | m_chrrom = device().machine().root_device().memregion(this->subtag(tempstring2, VIDEOTERM_GFX_REGION).c_str())->base(); | |
| 225 | 225 | |
| 226 | 226 | memset(m_ram, 0, 4*512); |
| 227 | 227 |
| r245640 | r245641 | |
|---|---|---|
| 139 | 139 | set_a2bus_device(); |
| 140 | 140 | |
| 141 | 141 | astring tempstring; |
| 142 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, VULCAN_ROM_REGION))->base(); | |
| 142 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, VULCAN_ROM_REGION).c_str())->base(); | |
| 143 | 143 | |
| 144 | 144 | save_item(NAME(m_lastdata)); |
| 145 | 145 | save_item(NAME(m_ram)); |
| r245640 | r245641 | |
|---|---|---|
| 89 | 89 | set_a2bus_device(); |
| 90 | 90 | |
| 91 | 91 | astring tempstring; |
| 92 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, ZIPDRIVE_ROM_REGION))->base(); | |
| 92 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, ZIPDRIVE_ROM_REGION).c_str())->base(); | |
| 93 | 93 | |
| 94 | 94 | save_item(NAME(m_lastdata)); |
| 95 | 95 | } |
| r245640 | r245641 | |
|---|---|---|
| 140 | 140 | set_a2bus_device(); |
| 141 | 141 | |
| 142 | 142 | astring tempstring; |
| 143 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, FDC01_ROM_REGION))->base(); | |
| 143 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, FDC01_ROM_REGION).c_str())->base(); | |
| 144 | 144 | |
| 145 | 145 | save_item(NAME(m_fdc_local_status)); |
| 146 | 146 | save_item(NAME(m_fdc_local_command)); |
| r245640 | r245641 | |
|---|---|---|
| 109 | 109 | set_a2bus_device(); |
| 110 | 110 | |
| 111 | 111 | astring tempstring; |
| 112 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, FDC02_ROM_REGION))->base(); | |
| 112 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, FDC02_ROM_REGION).c_str())->base(); | |
| 113 | 113 | |
| 114 | 114 | m_timer = timer_alloc(0); |
| 115 | 115 |
| r245640 | r245641 | |
|---|---|---|
| 206 | 206 | set_a2bus_device(); |
| 207 | 207 | |
| 208 | 208 | astring tempstring; |
| 209 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, MOUSE_ROM_REGION))->base(); | |
| 209 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, MOUSE_ROM_REGION).c_str())->base(); | |
| 210 | 210 | |
| 211 | 211 | // allocate two timers: one for the 68705, one for the quadrature magic |
| 212 | 212 | m_timer = timer_alloc(TIMER_68705, NULL); |
| r245640 | r245641 | |
|---|---|---|
| 149 | 149 | set_a2bus_device(); |
| 150 | 150 | |
| 151 | 151 | astring tempstring; |
| 152 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, TIMEMASTER_ROM_REGION))->base(); | |
| 152 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, TIMEMASTER_ROM_REGION).c_str())->base(); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | void a2bus_timemasterho_device::device_reset() |
| r245640 | r245641 | |
|---|---|---|
| 68 | 68 | { |
| 69 | 69 | astring tempstring(tag); |
| 70 | 70 | tempstring.cat(A78SLOT_ROM_REGION_TAG); |
| 71 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 71 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 72 | 72 | m_rom_size = size; |
| 73 | 73 | |
| 74 | 74 | // setup other helpers |
| r245640 | r245641 | |
|---|---|---|
| 65 | 65 | { |
| 66 | 66 | astring tempstring(tag); |
| 67 | 67 | tempstring.cat(A800SLOT_ROM_REGION_TAG); |
| 68 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 68 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 69 | 69 | m_rom_size = size; |
| 70 | 70 | |
| 71 | 71 | // setup other helpers |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(APFSLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(EA2001SLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(ASTROCADESLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(CHANFSLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(CRVSLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 63 | 63 | { |
| 64 | 64 | astring tempstring(tag); |
| 65 | 65 | tempstring.cat(GBSLOT_ROM_REGION_TAG); |
| 66 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 66 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 67 | 67 | m_rom_size = size; |
| 68 | 68 | } |
| 69 | 69 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | astring tempstring(tag); |
| 52 | 52 | tempstring.cat(GBASLOT_ROM_REGION_TAG); |
| 53 | 53 | // we always alloc 32MB of rom region! |
| 54 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring, 0x2000000, 4, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring.c_str(), 0x2000000, 4, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 61 | 61 | { |
| 62 | 62 | astring tempstring(tag); |
| 63 | 63 | tempstring.cat(GENERIC_ROM_REGION_TAG); |
| 64 | m_rom = device().machine().memory().region_alloc(tempstring, size, width, endian)->base(); | |
| 64 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, width, endian)->base(); | |
| 65 | 65 | m_rom_size = size; |
| 66 | 66 | } |
| 67 | 67 | } |
| r245640 | r245641 | |
|---|---|---|
| 55 | 55 | if (m_rom == NULL) |
| 56 | 56 | { |
| 57 | 57 | astring region_tag; |
| 58 | m_rom = memregion(region_tag.cpy(tag()).cat(":ecs"))->base(); | |
| 58 | m_rom = memregion(region_tag.cpy(tag()).cat(":ecs").c_str())->base(); | |
| 59 | 59 | } |
| 60 | 60 | if (!m_ram.count()) |
| 61 | 61 | { |
| r245640 | r245641 | |
|---|---|---|
| 120 | 120 | { |
| 121 | 121 | astring tempstring(tag); |
| 122 | 122 | tempstring.cat(INTVSLOT_ROM_REGION_TAG); |
| 123 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 123 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 124 | 124 | memset(m_rom, 0xff, size); |
| 125 | 125 | m_rom_size = size; |
| 126 | 126 | } |
| r245640 | r245641 | |
|---|---|---|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | astring tempstring; |
| 366 | m_chr_gen_base = memregion(subtag(tempstring, "gfx1"))->base(); | |
| 366 | m_chr_gen_base = memregion(subtag(tempstring, "gfx1").c_str())->base(); | |
| 367 | 367 | m_chr_gen = m_chr_gen_base + m_chr_gen_offset[1]; |
| 368 | 368 | |
| 369 | 369 | save_item(NAME(m_framecnt)); |
| r245640 | r245641 | |
|---|---|---|
| 608 | 608 | |
| 609 | 609 | if(m_default_bios_tag != "iskr3104") |
| 610 | 610 | { |
| 611 | UINT8 *dst = memregion(subtag(tempstring, "user2" ))->base() + 0x0000; | |
| 612 | UINT8 *src = memregion(subtag(tempstring, "user1" ))->base() + 0x3fff; | |
| 611 | UINT8 *dst = memregion(subtag(tempstring, "user2").c_str())->base() + 0x0000; | |
| 612 | UINT8 *src = memregion(subtag(tempstring, "user1").c_str())->base() + 0x3fff; | |
| 613 | 613 | int i; |
| 614 | 614 | |
| 615 | 615 | /* Perform the EGA bios address line swaps */ |
| r245640 | r245641 | |
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | else |
| 622 | memcpy(memregion(subtag(tempstring, "user2" | |
| 622 | memcpy(memregion(subtag(tempstring, "user2").c_str())->base(), memregion(subtag(tempstring, "user1").c_str())->base(), 0x4000); | |
| 623 | 623 | |
| 624 | 624 | /* Install 256KB Video ram on our EGA card */ |
| 625 | m_vram = machine().memory().region_alloc(subtag(tempstring,"vram"), 256*1024, 1, ENDIANNESS_LITTLE); | |
| 625 | m_vram = machine().memory().region_alloc(subtag(tempstring, "vram").c_str(), 256 * 1024, 1, ENDIANNESS_LITTLE); | |
| 626 | 626 | |
| 627 | 627 | m_videoram = m_vram->base(); |
| 628 | 628 | m_plane[0] = m_videoram + 0x00000; |
| r245640 | r245641 | |
|---|---|---|
| 261 | 261 | switch( id ) |
| 262 | 262 | { |
| 263 | 263 | case 0: |
| 264 | img = dynamic_cast<harddisk_image_device *>(machine().device(subtag(tempstring,"primary"))); | |
| 264 | img = dynamic_cast<harddisk_image_device *>(machine().device(subtag(tempstring, "primary").c_str())); | |
| 265 | 265 | break; |
| 266 | 266 | case 1: |
| 267 | img = dynamic_cast<harddisk_image_device *>(machine().device(subtag(tempstring,"slave"))); | |
| 267 | img = dynamic_cast<harddisk_image_device *>(machine().device(subtag(tempstring, "slave").c_str())); | |
| 268 | 268 | break; |
| 269 | 269 | } |
| 270 | 270 | if ( img == NULL ) |
| r245640 | r245641 | |
|---|---|---|
| 337 | 337 | } else { |
| 338 | 338 | m_prgspace->install_read_bank(start, end, mask, mirror, tag); |
| 339 | 339 | m_prgspace->unmap_write(start, end, mask, mirror); |
| 340 | machine().root_device().membank(tag)->set_base(machine().root_device().memregion(dev->subtag(tempstring, region))->base()); | |
| 340 | machine().root_device().membank(tag)->set_base(machine().root_device().memregion(dev->subtag(tempstring, region).c_str())->base()); | |
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 |
| r245640 | r245641 | |
|---|---|---|
| 196 | 196 | m_pixel = 0; |
| 197 | 197 | |
| 198 | 198 | astring tempstring; |
| 199 | m_chr_gen = memregion(subtag(tempstring, "gfx1"))->base(); | |
| 199 | m_chr_gen = memregion(subtag(tempstring, "gfx1").c_str())->base(); | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /*************************************************************************** |
| r245640 | r245641 | |
| 613 | 613 | m_configuration_switch = 0; |
| 614 | 614 | |
| 615 | 615 | astring tempstring; |
| 616 | m_chr_gen = memregion(subtag(tempstring, "gfx1"))->base(); | |
| 616 | m_chr_gen = memregion(subtag(tempstring, "gfx1").c_str())->base(); | |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | /*************************************************************************** |
| r245640 | r245641 | |
|---|---|---|
| 163 | 163 | |
| 164 | 164 | void mufdc_device::device_reset() |
| 165 | 165 | { |
| 166 | m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, m_shortname, "option"); | |
| 166 | m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, m_shortname.c_str(), "option"); | |
| 167 | 167 | m_isa->install_device(0x3f0, 0x3f7, *m_fdc, &pc_fdc_interface::map); |
| 168 | 168 | m_isa->set_dma_channel(2, this, true); |
| 169 | 169 | } |
| r245640 | r245641 | |
|---|---|---|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /* Install 256KB Video ram on our EGA card */ |
| 102 | m_vram = machine().memory().region_alloc(subtag(tempstring,"vram"), 256*1024, 1, ENDIANNESS_LITTLE); | |
| 102 | m_vram = machine().memory().region_alloc(subtag(tempstring, "vram").c_str(), 256 * 1024, 1, ENDIANNESS_LITTLE); | |
| 103 | 103 | |
| 104 | 104 | m_videoram = m_vram->base(); |
| 105 | 105 | m_plane[0] = m_videoram + 0x00000; |
| r245640 | r245641 | |
|---|---|---|
| 188 | 188 | void device_macpds_card_interface::install_rom(device_t *dev, const char *romregion, UINT32 addr) |
| 189 | 189 | { |
| 190 | 190 | astring tempstring; |
| 191 | UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->base(); | |
| 192 | UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->bytes(); | |
| 191 | UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion).c_str())->base(); | |
| 192 | UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion).c_str())->bytes(); | |
| 193 | 193 | char bankname[128]; |
| 194 | 194 | sprintf(bankname, "rom_%x", addr); |
| 195 | 195 |
| r245640 | r245641 | |
|---|---|---|
| 89 | 89 | device_macpds_card_interface(mconfig, *this), |
| 90 | 90 | m_assembled_tag(tag, ":", SEDISPLAY_SCREEN_NAME) |
| 91 | 91 | { |
| 92 | m_screen_tag = m_assembled_tag; | |
| 92 | m_screen_tag = m_assembled_tag.c_str(); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | macpds_sedisplay_device::macpds_sedisplay_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 98 | 98 | device_macpds_card_interface(mconfig, *this), |
| 99 | 99 | m_assembled_tag(tag, ":", SEDISPLAY_SCREEN_NAME) |
| 100 | 100 | { |
| 101 | m_screen_tag = m_assembled_tag; | |
| 101 | m_screen_tag = m_assembled_tag.c_str(); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 87 | 87 | { |
| 88 | 88 | astring tempstring(tag); |
| 89 | 89 | tempstring.cat(MDSLOT_ROM_REGION_TAG); |
| 90 | m_rom = (UINT16 *)device().machine().memory().region_alloc(tempstring, size, 2, ENDIANNESS_LITTLE)->base(); | |
| 90 | m_rom = (UINT16 *)device().machine().memory().region_alloc(tempstring.c_str(), size, 2, ENDIANNESS_LITTLE)->base(); | |
| 91 | 91 | m_rom_size = size; |
| 92 | 92 | } |
| 93 | 93 | } |
| r245640 | r245641 | |
|---|---|---|
| 379 | 379 | // use info from nes.hsi if available! |
| 380 | 380 | if (hashfile_extrainfo(*this, mapinfo)) |
| 381 | 381 | { |
| 382 | if (4 == sscanf(mapinfo,"%d %d %d %d", &mapint1, &mapint2, &mapint3, &mapint4)) | |
| 382 | if (4 == sscanf(mapinfo.c_str(),"%d %d %d %d", &mapint1, &mapint2, &mapint3, &mapint4)) | |
| 383 | 383 | { |
| 384 | 384 | /* image is present in nes.hsi: overwrite the header settings with these */ |
| 385 | 385 | mapper = mapint1; |
| r245640 | r245641 | |
| 837 | 837 | // use info from nes.hsi if available! |
| 838 | 838 | if (hashfile_extrainfo(*this, mapinfo)) |
| 839 | 839 | { |
| 840 | if (4 == sscanf(mapinfo,"%d %d %d %d", &mapint1, &mapint2, &mapint3, &mapint4)) | |
| 840 | if (4 == sscanf(mapinfo.c_str(),"%d %d %d %d", &mapint1, &mapint2, &mapint3, &mapint4)) | |
| 841 | 841 | { |
| 842 | 842 | /* image is present in nes.hsi: overwrite the header settings with these */ |
| 843 | 843 | mapper = mapint1; |
| r245640 | r245641 | |
|---|---|---|
| 150 | 150 | { |
| 151 | 151 | astring tempstring(tag); |
| 152 | 152 | tempstring.cat(NESSLOT_PRGROM_REGION_TAG); |
| 153 | m_prg = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 153 | m_prg = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 154 | 154 | m_prg_size = size; |
| 155 | 155 | m_prg_chunks = size / 0x4000; |
| 156 | 156 | if (size % 0x2000) |
| r245640 | r245641 | |
| 219 | 219 | { |
| 220 | 220 | astring tempstring(tag); |
| 221 | 221 | tempstring.cat(NESSLOT_CHRROM_REGION_TAG); |
| 222 | m_vrom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 222 | m_vrom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 223 | 223 | m_vrom_size = size; |
| 224 | 224 | m_vrom_chunks = size / 0x2000; |
| 225 | 225 | } |
| r245640 | r245641 | |
|---|---|---|
| 326 | 326 | bool inverted = false; |
| 327 | 327 | |
| 328 | 328 | astring tempstring; |
| 329 | UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->base(); | |
| 330 | UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->bytes(); | |
| 329 | UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion).c_str())->base(); | |
| 330 | UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion).c_str())->bytes(); | |
| 331 | 331 | |
| 332 | 332 | // printf("ROM length is %x, last bytes are %02x %02x\n", romlen, rom[romlen-2], rom[romlen-1]); |
| 333 | 333 |
| r245640 | r245641 | |
|---|---|---|
| 80 | 80 | device_nubus_card_interface(mconfig, *this), |
| 81 | 81 | m_assembled_tag(tag, ":", GC48_SCREEN_NAME) |
| 82 | 82 | { |
| 83 | m_screen_tag = m_assembled_tag; | |
| 83 | m_screen_tag = m_assembled_tag.c_str(); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | nubus_48gc_device::nubus_48gc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| r245640 | r245641 | |
|---|---|---|
| 69 | 69 | device_nubus_card_interface(mconfig, *this), |
| 70 | 70 | m_assembled_tag(tag, ":", M2HIRES_SCREEN_NAME) |
| 71 | 71 | { |
| 72 | m_screen_tag = m_assembled_tag; | |
| 72 | m_screen_tag = m_assembled_tag.c_str(); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | nubus_m2hires_device::nubus_m2hires_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 78 | 78 | device_nubus_card_interface(mconfig, *this), |
| 79 | 79 | m_assembled_tag(tag, ":", M2HIRES_SCREEN_NAME) |
| 80 | 80 | { |
| 81 | m_screen_tag = m_assembled_tag; | |
| 81 | m_screen_tag = m_assembled_tag.c_str(); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 70 | 70 | device_nubus_card_interface(mconfig, *this), |
| 71 | 71 | m_assembled_tag(tag, ":", M2VIDEO_SCREEN_NAME) |
| 72 | 72 | { |
| 73 | m_screen_tag = m_assembled_tag; | |
| 73 | m_screen_tag = m_assembled_tag.c_str(); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | nubus_m2video_device::nubus_m2video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 79 | 79 | device_nubus_card_interface(mconfig, *this), |
| 80 | 80 | m_assembled_tag(tag, ":", M2VIDEO_SCREEN_NAME) |
| 81 | 81 | { |
| 82 | m_screen_tag = m_assembled_tag; | |
| 82 | m_screen_tag = m_assembled_tag.c_str(); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 69 | 69 | device_nubus_card_interface(mconfig, *this), |
| 70 | 70 | m_assembled_tag(tag, ":", RADIUSTPD_SCREEN_NAME) |
| 71 | 71 | { |
| 72 | m_screen_tag = m_assembled_tag; | |
| 72 | m_screen_tag = m_assembled_tag.c_str(); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | nubus_radiustpd_device::nubus_radiustpd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 78 | 78 | device_nubus_card_interface(mconfig, *this), |
| 79 | 79 | m_assembled_tag(tag, ":", RADIUSTPD_SCREEN_NAME) |
| 80 | 80 | { |
| 81 | m_screen_tag = m_assembled_tag; | |
| 81 | m_screen_tag = m_assembled_tag.c_str(); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 71 | 71 | device_nubus_card_interface(mconfig, *this), |
| 72 | 72 | m_assembled_tag(tag, ":", SPEC8S3_SCREEN_NAME) |
| 73 | 73 | { |
| 74 | m_screen_tag = m_assembled_tag; | |
| 74 | m_screen_tag = m_assembled_tag.c_str(); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | nubus_spec8s3_device::nubus_spec8s3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 80 | 80 | device_nubus_card_interface(mconfig, *this), |
| 81 | 81 | m_assembled_tag(tag, ":", SPEC8S3_SCREEN_NAME) |
| 82 | 82 | { |
| 83 | m_screen_tag = m_assembled_tag; | |
| 83 | m_screen_tag = m_assembled_tag.c_str(); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 87 | 87 | m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME), |
| 88 | 88 | m_palette(*this, "palette") |
| 89 | 89 | { |
| 90 | m_screen_tag = m_assembled_tag; | |
| 90 | m_screen_tag = m_assembled_tag.c_str(); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 97 | 97 | m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME), |
| 98 | 98 | m_palette(*this, "palette") |
| 99 | 99 | { |
| 100 | m_screen_tag = m_assembled_tag; | |
| 100 | m_screen_tag = m_assembled_tag.c_str(); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 72 | 72 | device_nubus_card_interface(mconfig, *this), |
| 73 | 73 | m_assembled_tag(tag, ":", WSPORTRAIT_SCREEN_NAME) |
| 74 | 74 | { |
| 75 | m_screen_tag = m_assembled_tag; | |
| 75 | m_screen_tag = m_assembled_tag.c_str(); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | nubus_wsportrait_device::nubus_wsportrait_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 81 | 81 | device_nubus_card_interface(mconfig, *this), |
| 82 | 82 | m_assembled_tag(tag, ":", WSPORTRAIT_SCREEN_NAME) |
| 83 | 83 | { |
| 84 | m_screen_tag = m_assembled_tag; | |
| 84 | m_screen_tag = m_assembled_tag.c_str(); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 72 | 72 | device_nubus_card_interface(mconfig, *this), |
| 73 | 73 | m_assembled_tag(tag, ":", XCEED30HR_SCREEN_NAME) |
| 74 | 74 | { |
| 75 | m_screen_tag = m_assembled_tag; | |
| 75 | m_screen_tag = m_assembled_tag.c_str(); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 81 | 81 | device_nubus_card_interface(mconfig, *this), |
| 82 | 82 | m_assembled_tag(tag, ":", XCEED30HR_SCREEN_NAME) |
| 83 | 83 | { |
| 84 | m_screen_tag = m_assembled_tag; | |
| 84 | m_screen_tag = m_assembled_tag.c_str(); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 65 | 65 | device_nubus_card_interface(mconfig, *this), |
| 66 | 66 | m_assembled_tag(tag, ":", CB264SE30_SCREEN_NAME) |
| 67 | 67 | { |
| 68 | m_screen_tag = m_assembled_tag; | |
| 68 | m_screen_tag = m_assembled_tag.c_str(); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | nubus_cb264se30_device::nubus_cb264se30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 74 | 74 | device_nubus_card_interface(mconfig, *this), |
| 75 | 75 | m_assembled_tag(tag, ":", CB264SE30_SCREEN_NAME) |
| 76 | 76 | { |
| 77 | m_screen_tag = m_assembled_tag; | |
| 77 | m_screen_tag = m_assembled_tag.c_str(); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 68 | 68 | device_nubus_card_interface(mconfig, *this), |
| 69 | 69 | m_assembled_tag(tag, ":", XCEEDMC30_SCREEN_NAME) |
| 70 | 70 | { |
| 71 | m_screen_tag = m_assembled_tag; | |
| 71 | m_screen_tag = m_assembled_tag.c_str(); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | nubus_xceedmc30_device::nubus_xceedmc30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 77 | 77 | device_nubus_card_interface(mconfig, *this), |
| 78 | 78 | m_assembled_tag(tag, ":", XCEEDMC30_SCREEN_NAME) |
| 79 | 79 | { |
| 80 | m_screen_tag = m_assembled_tag; | |
| 80 | m_screen_tag = m_assembled_tag.c_str(); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 71 | 71 | device_nubus_card_interface(mconfig, *this), |
| 72 | 72 | m_assembled_tag(tag, ":", PROCOLOR816_SCREEN_NAME) |
| 73 | 73 | { |
| 74 | m_screen_tag = m_assembled_tag; | |
| 74 | m_screen_tag = m_assembled_tag.c_str(); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 80 | 80 | device_nubus_card_interface(mconfig, *this), |
| 81 | 81 | m_assembled_tag(tag, ":", PROCOLOR816_SCREEN_NAME) |
| 82 | 82 | { |
| 83 | m_screen_tag = m_assembled_tag; | |
| 83 | m_screen_tag = m_assembled_tag.c_str(); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 65 | 65 | device_nubus_card_interface(mconfig, *this), |
| 66 | 66 | m_assembled_tag(tag, ":", LVIEW_SCREEN_NAME) |
| 67 | 67 | { |
| 68 | m_screen_tag = m_assembled_tag; | |
| 68 | m_screen_tag = m_assembled_tag.c_str(); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | nubus_lview_device::nubus_lview_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| r245640 | r245641 | |
| 74 | 74 | device_nubus_card_interface(mconfig, *this), |
| 75 | 75 | m_assembled_tag(tag, ":", LVIEW_SCREEN_NAME) |
| 76 | 76 | { |
| 77 | m_screen_tag = m_assembled_tag; | |
| 77 | m_screen_tag = m_assembled_tag.c_str(); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(O2SLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 54 | 54 | { |
| 55 | 55 | oricext_device::device_start(); |
| 56 | 56 | astring tempstring; |
| 57 | jasmin_rom = device().machine().root_device().memregion(this->subtag(tempstring, "jasmin"))->base(); | |
| 57 | jasmin_rom = device().machine().root_device().memregion(this->subtag(tempstring, "jasmin").c_str())->base(); | |
| 58 | 58 | cpu->space(AS_PROGRAM).install_device(0x0000, 0xffff, *this, &jasmin_device::map); |
| 59 | 59 | |
| 60 | 60 | for(int i=0; i<4; i++) { |
| r245640 | r245641 | |
|---|---|---|
| 49 | 49 | { |
| 50 | 50 | oricext_device::device_start(); |
| 51 | 51 | astring tempstring; |
| 52 | microdisc_rom = device().machine().root_device().memregion(this->subtag(tempstring, "microdisc"))->base(); | |
| 52 | microdisc_rom = device().machine().root_device().memregion(this->subtag(tempstring, "microdisc").c_str())->base(); | |
| 53 | 53 | cpu->space(AS_PROGRAM).install_device(0x0000, 0xffff, *this, µdisc_device::map); |
| 54 | 54 | |
| 55 | 55 | for(int i=0; i<4; i++) { |
| r245640 | r245641 | |
|---|---|---|
| 53 | 53 | { |
| 54 | 54 | astring tempstring(tag); |
| 55 | 55 | tempstring.cat(PCESLOT_ROM_REGION_TAG); |
| 56 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 56 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 57 | 57 | m_rom_size = size; |
| 58 | 58 | } |
| 59 | 59 | } |
| r245640 | r245641 | |
|---|---|---|
| 60 | 60 | { |
| 61 | 61 | astring tempstring(tag); |
| 62 | 62 | tempstring.cat(SATSLOT_ROM_REGION_TAG); |
| 63 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring, size, 4, ENDIANNESS_LITTLE)->base(); | |
| 63 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring.c_str(), size, 4, ENDIANNESS_LITTLE)->base(); | |
| 64 | 64 | m_rom_size = size; |
| 65 | 65 | } |
| 66 | 66 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(SCVSLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 78 | 78 | { |
| 79 | 79 | astring tempstring(tag); |
| 80 | 80 | tempstring.cat(S8SLOT_ROM_REGION_TAG); |
| 81 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 81 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 82 | 82 | m_rom_size = size; |
| 83 | 83 | m_rom_page_count = size / 0x4000; |
| 84 | 84 | if (!m_rom_page_count) |
| r245640 | r245641 | |
|---|---|---|
| 92 | 92 | { |
| 93 | 93 | astring tempstring(tag); |
| 94 | 94 | tempstring.cat(SNSSLOT_ROM_REGION_TAG); |
| 95 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 95 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 96 | 96 | m_rom_size = size; |
| 97 | 97 | } |
| 98 | 98 | } |
| r245640 | r245641 | |
| 802 | 802 | switch (m_addon) |
| 803 | 803 | { |
| 804 | 804 | case ADDON_DSP1: |
| 805 | ROM = machine().root_device().memregion(region)->base(); | |
| 805 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 806 | 806 | m_cart->addon_bios_alloc(0x2800); |
| 807 | 807 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x2800); |
| 808 | 808 | break; |
| 809 | 809 | case ADDON_DSP1B: |
| 810 | ROM = machine().root_device().memregion(region)->base(); | |
| 810 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 811 | 811 | m_cart->addon_bios_alloc(0x2800); |
| 812 | 812 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x2800); |
| 813 | 813 | break; |
| 814 | 814 | case ADDON_DSP2: |
| 815 | ROM = machine().root_device().memregion(region)->base(); | |
| 815 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 816 | 816 | m_cart->addon_bios_alloc(0x2800); |
| 817 | 817 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x2800); |
| 818 | 818 | break; |
| 819 | 819 | case ADDON_DSP3: |
| 820 | ROM = machine().root_device().memregion(region)->base(); | |
| 820 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 821 | 821 | m_cart->addon_bios_alloc(0x2800); |
| 822 | 822 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x2800); |
| 823 | 823 | break; |
| 824 | 824 | case ADDON_DSP4: |
| 825 | ROM = machine().root_device().memregion(region)->base(); | |
| 825 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 826 | 826 | m_cart->addon_bios_alloc(0x2800); |
| 827 | 827 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x2800); |
| 828 | 828 | break; |
| 829 | 829 | case ADDON_ST010: |
| 830 | ROM = machine().root_device().memregion(region)->base(); | |
| 830 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 831 | 831 | m_cart->addon_bios_alloc(0x11000); |
| 832 | 832 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x11000); |
| 833 | 833 | break; |
| 834 | 834 | case ADDON_ST011: |
| 835 | ROM = machine().root_device().memregion(region)->base(); | |
| 835 | ROM = machine().root_device().memregion(region.c_str())->base(); | |
| 836 | 836 | m_cart->addon_bios_alloc(0x11000); |
| 837 | 837 | memcpy(m_cart->get_addon_bios_base(), ROM, 0x11000); |
| 838 | 838 | break; |
| r245640 | r245641 | |
|---|---|---|
| 52 | 52 | { |
| 53 | 53 | astring tempstring(tag); |
| 54 | 54 | tempstring.cat(VBOYSLOT_ROM_REGION_TAG); |
| 55 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring, size, 4, ENDIANNESS_LITTLE)->base(); | |
| 55 | m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring.c_str(), size, 4, ENDIANNESS_LITTLE)->base(); | |
| 56 | 56 | m_rom_size = size/4; |
| 57 | 57 | m_rom_mask = m_rom_size - 1; |
| 58 | 58 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(VC4000SLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 53 | 53 | { |
| 54 | 54 | astring tempstring(tag); |
| 55 | 55 | tempstring.cat(A26SLOT_ROM_REGION_TAG); |
| 56 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 56 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 57 | 57 | m_rom_size = size; |
| 58 | 58 | } |
| 59 | 59 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | astring tempstring(tag); |
| 53 | 53 | tempstring.cat(VECSLOT_ROM_REGION_TAG); |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 54 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | 55 | m_rom_size = size; |
| 56 | 56 | } |
| 57 | 57 | } |
| r245640 | r245641 | |
|---|---|---|
| 52 | 52 | { |
| 53 | 53 | astring tempstring(tag); |
| 54 | 54 | tempstring.cat(WSSLOT_ROM_REGION_TAG); |
| 55 | m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); | |
| 55 | m_rom = device().machine().memory().region_alloc(tempstring.c_str(), size, 1, ENDIANNESS_LITTLE)->base(); | |
| 56 | 56 | m_rom_size = size; |
| 57 | 57 | m_bank_mask = ((m_rom_size >> 16) - 1); |
| 58 | 58 | } |
| r245640 | r245641 | |
|---|---|---|
| 70 | 70 | m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner()); |
| 71 | 71 | space.install_read_bank(0xea0020,0xea1fff,0,0,"scsi_ext"); |
| 72 | 72 | space.unmap_write(0xea0020,0xea1fff,0,0); |
| 73 | ROM = machine().root_device().memregion(subtag(temp,"scsiexrom"))->base(); | |
| 73 | ROM = machine().root_device().memregion(subtag(temp, "scsiexrom").c_str())->base(); | |
| 74 | 74 | machine().root_device().membank("scsi_ext")->set_base(ROM); |
| 75 | 75 | space.install_readwrite_handler(0xea0000,0xea001f,0,0,read8_delegate(FUNC(x68k_scsiext_device::register_r),this),write8_delegate(FUNC(x68k_scsiext_device::register_w),this),0x00ff00ff); |
| 76 | 76 | } |
| r245640 | r245641 | |
|---|---|---|
| 122 | 122 | string.printf("0x%X", (UINT32)m_value); |
| 123 | 123 | break; |
| 124 | 124 | } |
| 125 | return string; | |
| 125 | return string.c_str(); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| r245640 | r245641 | |
| 191 | 191 | break; |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | return m_curtext; | |
| 194 | return m_curtext.c_str(); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
| r245640 | r245641 | |
| 507 | 507 | curarg += arg->values(argindex, ¶ms[curarg]); |
| 508 | 508 | |
| 509 | 509 | // generate the astring |
| 510 | manager.get_output_astring(m_line, m_justify).printf(m_format, | |
| 510 | manager.get_output_astring(m_line, m_justify).printf(m_format.c_str(), | |
| 511 | 511 | (UINT32)params[0], (UINT32)params[1], (UINT32)params[2], (UINT32)params[3], |
| 512 | 512 | (UINT32)params[4], (UINT32)params[5], (UINT32)params[6], (UINT32)params[7], |
| 513 | 513 | (UINT32)params[8], (UINT32)params[9], (UINT32)params[10], (UINT32)params[11], |
| r245640 | r245641 | |
| 577 | 577 | argsprovided += curarg->count(); |
| 578 | 578 | |
| 579 | 579 | // now scan the string for valid argument usage |
| 580 | const char *p = strchr(m_format, '%'); | |
| 580 | const char *p = strchr(m_format.c_str(), '%'); | |
| 581 | 581 | int argscounted = 0; |
| 582 | 582 | while (p != NULL) |
| 583 | 583 | { |
| r245640 | r245641 | |
| 711 | 711 | m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex); |
| 712 | 712 | astring tempname; |
| 713 | 713 | for (int curtemp = 0; curtemp < tempcount; curtemp++) |
| 714 | m_symbols.add(tempname.format("temp%d", curtemp), symbol_table::READ_WRITE); | |
| 714 | m_symbols.add(tempname.format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE); | |
| 715 | 715 | |
| 716 | 716 | // read the first comment node |
| 717 | 717 | xml_data_node *commentnode = xml_get_sibling(cheatnode.child, "comment"); |
| r245640 | r245641 | |
| 1151 | 1151 | { |
| 1152 | 1152 | astring filename; |
| 1153 | 1153 | filename.printf("%08X", crc); |
| 1154 | load_cheats(filename); | |
| 1154 | load_cheats(filename.c_str()); | |
| 1155 | 1155 | break; |
| 1156 | 1156 | } |
| 1157 | 1157 | } |
| r245640 | r245641 | |
| 1221 | 1221 | if (m_output[linenum]) |
| 1222 | 1222 | { |
| 1223 | 1223 | // output the text |
| 1224 | machine().ui().draw_text_full(&container, m_output[linenum], | |
| 1224 | machine().ui().draw_text_full(&container, m_output[linenum].c_str(), | |
| 1225 | 1225 | 0.0f, (float)linenum * machine().ui().get_line_height(), 1.0f, |
| 1226 | 1226 | m_justify[linenum], WRAP_NEVER, DRAW_OPAQUE, |
| 1227 | 1227 | ARGB_WHITE, ARGB_BLACK, NULL, NULL); |
| r245640 | r245641 | |
| 1292 | 1292 | string.replace(0, "<< ", " lshift "); |
| 1293 | 1293 | string.replace(0, "<<", " lshift "); |
| 1294 | 1294 | |
| 1295 | return string; | |
| 1295 | return string.c_str(); | |
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 |
| r245640 | r245641 | |
|---|---|---|
| 104 | 104 | // getters |
| 105 | 105 | item *next() const { return m_next; } |
| 106 | 106 | const number_and_format &value() const { return m_value; } |
| 107 | const char *text() const { return m_text; } | |
| 107 | const char *text() const { return m_text.c_str(); } | |
| 108 | 108 | |
| 109 | 109 | private: |
| 110 | 110 | // internal state |
| r245640 | r245641 | |
| 221 | 221 | cheat_manager &manager() const { return m_manager; } |
| 222 | 222 | cheat_entry *next() const { return m_next; } |
| 223 | 223 | script_state state() const { return m_state; } |
| 224 | const char *description() const { return m_description; } | |
| 225 | const char *comment() const { return m_comment; } | |
| 224 | const char *description() const { return m_description.c_str(); } | |
| 225 | const char *comment() const { return m_comment.c_str(); } | |
| 226 | 226 | |
| 227 | 227 | // script detection |
| 228 | 228 | bool has_run_script() const { return (m_run_script != NULL); } |
| r245640 | r245641 | |
|---|---|---|
| 195 | 195 | |
| 196 | 196 | // if we have a command, execute that |
| 197 | 197 | if (*(m_options.command()) != 0) |
| 198 | execute_commands(exename); | |
| 198 | execute_commands(exename.c_str()); | |
| 199 | 199 | |
| 200 | 200 | // otherwise, check for a valid system |
| 201 | 201 | else |
| r245640 | r245641 | |
| 1687 | 1687 | if (entry->type == ENTTYPE_FILE) |
| 1688 | 1688 | { |
| 1689 | 1689 | astring curfile(filename, PATH_SEPARATOR, entry->name); |
| 1690 | identify(curfile); | |
| 1690 | identify(curfile.c_str()); | |
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | // close the directory and be done |
| r245640 | r245641 | |
|---|---|---|
| 546 | 546 | |
| 547 | 547 | astring tempstring; |
| 548 | 548 | for (int ireg = 0; ireg < 8; ireg++) |
| 549 | state_add(ADSP2100_I0 + ireg, tempstring.format("I%d", ireg), m_i[ireg]).mask(0x3fff).callimport(); | |
| 549 | state_add(ADSP2100_I0 + ireg, tempstring.format("I%d", ireg).c_str(), m_i[ireg]).mask(0x3fff).callimport(); | |
| 550 | 550 | |
| 551 | 551 | for (int lreg = 0; lreg < 8; lreg++) |
| 552 | state_add(ADSP2100_L0 + lreg, tempstring.format("L%d", lreg), m_l[lreg]).mask(0x3fff).callimport(); | |
| 552 | state_add(ADSP2100_L0 + lreg, tempstring.format("L%d", lreg).c_str(), m_l[lreg]).mask(0x3fff).callimport(); | |
| 553 | 553 | |
| 554 | 554 | for (int mreg = 0; mreg < 8; mreg++) |
| 555 | state_add(ADSP2100_M0 + mreg, tempstring.format("M%d", mreg), m_m[mreg]).signed_mask(0x3fff); | |
| 555 | state_add(ADSP2100_M0 + mreg, tempstring.format("M%d", mreg).c_str(), m_m[mreg]).signed_mask(0x3fff); | |
| 556 | 556 | |
| 557 | 557 | state_add(ADSP2100_PX, "PX", m_px); |
| 558 | 558 | state_add(ADSP2100_CNTR, "CNTR", m_cntr).mask(0x3fff); |
| r245640 | r245641 | |
| 571 | 571 | |
| 572 | 572 | for (int irqnum = 0; irqnum < 4; irqnum++) |
| 573 | 573 | if (irqnum < 4 || m_chip_type == CHIP_TYPE_ADSP2100) |
| 574 | state_add(ADSP2100_IRQSTATE0 + irqnum, tempstring.format("IRQ%d", irqnum), m_irq_state[irqnum]).mask(1).callimport(); | |
| 574 | state_add(ADSP2100_IRQSTATE0 + irqnum, tempstring.format("IRQ%d", irqnum).c_str(), m_irq_state[irqnum]).mask(1).callimport(); | |
| 575 | 575 | |
| 576 | 576 | state_add(ADSP2100_FLAGIN, "FLAGIN", m_flagin).mask(1); |
| 577 | 577 | state_add(ADSP2100_FLAGOUT, "FLAGOUT", m_flagout).mask(1); |
| r245640 | r245641 | |
|---|---|---|
| 194 | 194 | state_add(ASAP_PC, "PC", m_pc); |
| 195 | 195 | state_add(ASAP_PS, "PS", m_flagsio).callimport().callexport(); |
| 196 | 196 | for (int regnum = 0; regnum < 32; regnum++) |
| 197 | state_add(ASAP_R0 + regnum, tempstr.format("R%d", regnum), m_src2val[REGBASE + regnum]); | |
| 197 | state_add(ASAP_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_src2val[REGBASE + regnum]); | |
| 198 | 198 | |
| 199 | 199 | // register our state for saving |
| 200 | 200 | save_item(NAME(m_pc)); |
| r245640 | r245641 | |
|---|---|---|
| 358 | 358 | |
| 359 | 359 | astring tempstr; |
| 360 | 360 | for (int regnum = 0; regnum < 16; regnum++) |
| 361 | state_add(COSMAC_R0 + regnum, tempstr.format("R%x", regnum), m_r[regnum]); | |
| 361 | state_add(COSMAC_R0 + regnum, tempstr.format("R%x", regnum).c_str(), m_r[regnum]); | |
| 362 | 362 | |
| 363 | 363 | state_add(COSMAC_DF, "DF", m_df).mask(0x1).noshow(); |
| 364 | 364 | state_add(COSMAC_IE, "IE", m_ie).mask(0x1).noshow(); |
| r245640 | r245641 | |
|---|---|---|
| 808 | 808 | if (inst.opcode() == OP_HANDLE) |
| 809 | 809 | blockname = inst.param(0).handle().string(); |
| 810 | 810 | else if (inst.opcode() == OP_HASH) |
| 811 | blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()); | |
| 811 | blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); | |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // generate code |
| r245640 | r245641 | |
|---|---|---|
| 791 | 791 | if (inst.opcode() == OP_HANDLE) |
| 792 | 792 | blockname = inst.param(0).handle().string(); |
| 793 | 793 | else if (inst.opcode() == OP_HASH) |
| 794 | blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()); | |
| 794 | blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); | |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // generate code |
| r245640 | r245641 | |
|---|---|---|
| 253 | 253 | // return the offset and name |
| 254 | 254 | if (offset != NULL) |
| 255 | 255 | *offset = search - cursym->m_base; |
| 256 | return cursym->m_name; | |
| 256 | return cursym->m_name.c_str(); | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // not found; return NULL |
| r245640 | r245641 | |
| 396 | 396 | char *comment = (char *)m_drcuml.cache().alloc_temporary(temp.len() + 1); |
| 397 | 397 | if (comment == NULL) |
| 398 | 398 | return; |
| 399 | strcpy(comment, temp); | |
| 399 | strcpy(comment, temp.c_str()); | |
| 400 | 400 | |
| 401 | 401 | // add an instruction with a pointer |
| 402 | 402 | append().comment(comment); |
| r245640 | r245641 | |
| 524 | 524 | { |
| 525 | 525 | // comments return their strings |
| 526 | 526 | if (inst.opcode() == OP_COMMENT) |
| 527 | return comment.cpy(inst.param(0).string()); | |
| 527 | return comment.cpy(inst.param(0).string()).c_str(); | |
| 528 | 528 | |
| 529 | 529 | // mapvars comment about their values |
| 530 | 530 | else if (inst.opcode() == OP_MAPVAR) |
| 531 | return comment.format("m%d = $%X", (int)inst.param(0).mapvar() - MAPVAR_M0, (UINT32)inst.param(1).immediate()); | |
| 531 | return comment.format("m%d = $%X", (int)inst.param(0).mapvar() - MAPVAR_M0, (UINT32)inst.param(1).immediate()).c_str(); | |
| 532 | 532 | |
| 533 | 533 | // everything else is NULL |
| 534 | 534 | return NULL; |
| r245640 | r245641 | |
|---|---|---|
| 201 | 201 | state_add(STATE_GENFLAGS, "GENFLAGS", m_iotemp).callimport().callexport().formatstr("%6s").noshow(); |
| 202 | 202 | state_add(DSP32_PC, "PC", m_r[15]).mask(0xffffff); |
| 203 | 203 | for (int regnum = 0; regnum <= 14; regnum++) |
| 204 | state_add(DSP32_R0 + regnum, tempstr.format("R%d", regnum), m_r[regnum]).mask(0xffffff); | |
| 204 | state_add(DSP32_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_r[regnum]).mask(0xffffff); | |
| 205 | 205 | state_add(DSP32_R15, "R15", m_r[17]).mask(0xffffff); |
| 206 | 206 | state_add(DSP32_R16, "R16", m_r[18]).mask(0xffffff); |
| 207 | 207 | state_add(DSP32_R17, "R17", m_r[19]).mask(0xffffff); |
| r245640 | r245641 | |
|---|---|---|
| 184 | 184 | for (int ireg=0; ireg<32; ireg++) |
| 185 | 185 | { |
| 186 | 186 | astring tmpstr; |
| 187 | state_add(HD61700_MAINREG + ireg, tmpstr.format("R%d", ireg), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); | |
| 187 | state_add(HD61700_MAINREG + ireg, tmpstr.format("R%d", ireg).c_str(), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | state_add(STATE_GENPC, "curpc", m_curpc).callimport().callexport().formatstr("%8s").noshow(); |
| r245640 | r245641 | |
|---|---|---|
| 422 | 422 | astring tempstr; |
| 423 | 423 | for (int regnum = 0; regnum < 8; regnum++) |
| 424 | 424 | { |
| 425 | state_add(I4004_R01 + regnum, tempstr.format("R%X%X", regnum*2, regnum*2+1), m_R[regnum]); | |
| 425 | state_add(I4004_R01 + regnum, tempstr.format("R%X%X", regnum * 2, regnum * 2 + 1).c_str(), m_R[regnum]); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | for (int addrnum = 0; addrnum < 4; addrnum++) |
| 429 | 429 | { |
| 430 | state_add(I4004_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1), m_ADDR[addrnum].w.l).mask(0xfff); | |
| 430 | state_add(I4004_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | state_add(I4004_RAM, "RAM", m_RAM.w.l).mask(0x0fff); |
| r245640 | r245641 | |
|---|---|---|
| 94 | 94 | |
| 95 | 95 | astring tempstr; |
| 96 | 96 | for (int addrnum = 0; addrnum < 8; addrnum++) |
| 97 | state_add(I8008_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1), m_ADDR[addrnum].w.l).mask(0xfff); | |
| 97 | state_add(I8008_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); | |
| 98 | 98 | |
| 99 | 99 | init_tables(); |
| 100 | 100 | } |
| r245640 | r245641 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | astring tempstring; |
| 66 | 66 | for (int ireg = 0; ireg < 32; ireg++) |
| 67 | state_add(IE15_R0 + ireg, tempstring.format("R%d", ireg), m_REGS[ireg]); | |
| 67 | state_add(IE15_R0 + ireg, tempstring.format("R%d", ireg).c_str(), m_REGS[ireg]); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | //------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 1739 | 1739 | |
| 1740 | 1740 | astring tempstr; |
| 1741 | 1741 | for (int regnum = 0; regnum < 8; regnum++) |
| 1742 | state_add(M68K_D0 + regnum, tempstr.format("D%d", regnum), dar[regnum]); | |
| 1742 | state_add(M68K_D0 + regnum, tempstr.format("D%d", regnum).c_str(), dar[regnum]); | |
| 1743 | 1743 | for (int regnum = 0; regnum < 8; regnum++) |
| 1744 | state_add(M68K_A0 + regnum, tempstr.format("A%d", regnum), dar[8 + regnum]); | |
| 1744 | state_add(M68K_A0 + regnum, tempstr.format("A%d", regnum).c_str(), dar[8 + regnum]); | |
| 1745 | 1745 | |
| 1746 | 1746 | state_add(M68K_PREF_ADDR, "PREF_ADDR", pref_addr).mask(addrmask); |
| 1747 | 1747 | state_add(M68K_PREF_DATA, "PREF_DATA", pref_data); |
| r245640 | r245641 | |
| 1762 | 1762 | if (cpu_type & MASK_030_OR_LATER) |
| 1763 | 1763 | { |
| 1764 | 1764 | for (int regnum = 0; regnum < 8; regnum++) |
| 1765 | state_add(M68K_FP0 + regnum, tempstr.format("FP%d", regnum), iotemp).callimport().callexport().formatstr("%10s"); | |
| 1765 | state_add(M68K_FP0 + regnum, tempstr.format("FP%d", regnum).c_str(), iotemp).callimport().callexport().formatstr("%10s"); | |
| 1766 | 1766 | state_add(M68K_FPSR, "FPSR", fpsr); |
| 1767 | 1767 | state_add(M68K_FPCR, "FPCR", fpcr); |
| 1768 | 1768 | } |
| r245640 | r245641 | |
|---|---|---|
| 978 | 978 | |
| 979 | 979 | astring tempstr; |
| 980 | 980 | for (int regnum = 0; regnum < 8; regnum++) |
| 981 | state_add(MCS48_R0 + regnum, tempstr.format("R%d", regnum), m_rtemp).callimport().callexport(); | |
| 981 | state_add(MCS48_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_rtemp).callimport().callexport(); | |
| 982 | 982 | |
| 983 | 983 | state_add(MCS48_EA, "EA", m_ea).mask(0x1); |
| 984 | 984 |
| r245640 | r245641 | |
|---|---|---|
| 593 | 593 | astring tempstr; |
| 594 | 594 | for (int regnum = 0; regnum < 15; regnum++) |
| 595 | 595 | { |
| 596 | state_add(TMS34010_A0 + regnum, tempstr.format("A%d", regnum), m_regs[regnum].reg); | |
| 596 | state_add(TMS34010_A0 + regnum, tempstr.format("A%d", regnum).c_str(), m_regs[regnum].reg); | |
| 597 | 597 | } |
| 598 | 598 | for (int regnum = 0; regnum < 15; regnum++) |
| 599 | 599 | { |
| 600 | state_add(TMS34010_B0 + regnum, tempstr.format("B%d", regnum), m_regs[30 - regnum].reg); | |
| 600 | state_add(TMS34010_B0 + regnum, tempstr.format("B%d", regnum).c_str(), m_regs[30 - regnum].reg); | |
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 |
| r245640 | r245641 | |
|---|---|---|
| 1026 | 1026 | if (m_flags & FLAG_C) |
| 1027 | 1027 | buffer.cat('C'); |
| 1028 | 1028 | } |
| 1029 | return buffer; | |
| 1029 | return buffer.c_str(); | |
| 1030 | 1030 | } |
| r245640 | r245641 | |
|---|---|---|
| 239 | 239 | code_handle *next() const { return m_next; } |
| 240 | 240 | drccodeptr codeptr() const { return *m_code; } |
| 241 | 241 | drccodeptr *codeptr_addr() { return m_code; } |
| 242 | const char *string() const { return m_string; } | |
| 242 | const char *string() const { return m_string.c_str(); } | |
| 243 | 243 | |
| 244 | 244 | // setters |
| 245 | 245 | void set_codeptr(drccodeptr code); |
| r245640 | r245641 | |
|---|---|---|
| 269 | 269 | |
| 270 | 270 | /* open the file, creating it if necessary */ |
| 271 | 271 | if (log->file == NULL) |
| 272 | log->file = fopen(log->filename, "w"); | |
| 272 | log->file = fopen(log->filename.c_str(), "w"); | |
| 273 | 273 | if (log->file == NULL) |
| 274 | 274 | return; |
| 275 | 275 |
| r245640 | r245641 | |
|---|---|---|
| 680 | 680 | |
| 681 | 681 | astring tempstr; |
| 682 | 682 | for (int regnum = 0; regnum < 16; regnum++) |
| 683 | state_add(Z8_R0 + regnum, tempstr.format("R%d", regnum), m_fake_r[regnum]).callimport().callexport(); | |
| 683 | state_add(Z8_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport(); | |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | /* find address spaces */ |
| r245640 | r245641 | |
|---|---|---|
| 1702 | 1702 | static void execute_statesave(running_machine &machine, int ref, int params, const char *param[]) |
| 1703 | 1703 | { |
| 1704 | 1704 | astring filename(param[0]); |
| 1705 | machine.immediate_save(filename); | |
| 1705 | machine.immediate_save(filename.c_str()); | |
| 1706 | 1706 | debug_console_printf(machine, "State save attempted. Please refer to window message popup for results.\n"); |
| 1707 | 1707 | } |
| 1708 | 1708 | |
| r245640 | r245641 | |
| 1714 | 1714 | static void execute_stateload(running_machine &machine, int ref, int params, const char *param[]) |
| 1715 | 1715 | { |
| 1716 | 1716 | astring filename(param[0]); |
| 1717 | machine.immediate_load(filename); | |
| 1717 | machine.immediate_load(filename.c_str()); | |
| 1718 | 1718 | |
| 1719 | 1719 | // Clear all PC & memory tracks |
| 1720 | 1720 | device_iterator iter(machine.root_device()); |
| r245640 | r245641 | |
| 2583 | 2583 | return; |
| 2584 | 2584 | |
| 2585 | 2585 | /* open the file */ |
| 2586 | if (core_stricmp(filename, "off") != 0) | |
| 2586 | if (core_stricmp(filename.c_str(), "off") != 0) | |
| 2587 | 2587 | { |
| 2588 | 2588 | mode = "w"; |
| 2589 | 2589 | |
| r245640 | r245641 | |
| 2594 | 2594 | filename = filename.substr(2); |
| 2595 | 2595 | } |
| 2596 | 2596 | |
| 2597 | f = fopen(filename, mode); | |
| 2597 | f = fopen(filename.c_str(), mode); | |
| 2598 | 2598 | if (!f) |
| 2599 | 2599 | { |
| 2600 | 2600 | debug_console_printf(machine, "Error opening file '%s'\n", param[0]); |
| r245640 | r245641 | |
| 2835 | 2835 | if (fname.find(0, ".png") == -1) |
| 2836 | 2836 | fname.cat(".png"); |
| 2837 | 2837 | emu_file file(machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 2838 | file_error filerr = file.open(fname); | |
| 2838 | file_error filerr = file.open(fname.c_str()); | |
| 2839 | 2839 | |
| 2840 | 2840 | if (filerr != FILERR_NONE) |
| 2841 | 2841 | { |
| r245640 | r245641 | |
|---|---|---|
| 482 | 482 | buffer.vprintf(format, arg); |
| 483 | 483 | va_end(arg); |
| 484 | 484 | |
| 485 | text_buffer_print(console_textbuf, buffer); | |
| 485 | text_buffer_print(console_textbuf, buffer.c_str()); | |
| 486 | 486 | |
| 487 | 487 | /* force an update of any console views */ |
| 488 | 488 | machine.debug_view().update_all(DVT_CONSOLE); |
| r245640 | r245641 | |
| 500 | 500 | astring buffer; |
| 501 | 501 | |
| 502 | 502 | buffer.vprintf(format, args); |
| 503 | text_buffer_print(console_textbuf, buffer); | |
| 503 | text_buffer_print(console_textbuf, buffer.c_str()); | |
| 504 | 504 | |
| 505 | 505 | /* force an update of any console views */ |
| 506 | 506 | machine.debug_view().update_all(DVT_CONSOLE); |
| r245640 | r245641 | |
| 522 | 522 | buffer.vprintf(format, arg); |
| 523 | 523 | va_end(arg); |
| 524 | 524 | |
| 525 | text_buffer_print_wrap(console_textbuf, buffer, wrapcol); | |
| 525 | text_buffer_print_wrap(console_textbuf, buffer.c_str(), wrapcol); | |
| 526 | 526 | |
| 527 | 527 | /* force an update of any console views */ |
| 528 | 528 | machine.debug_view().update_all(DVT_CONSOLE); |
| r245640 | r245641 | |
|---|---|---|
| 1111 | 1111 | // convert to lowercase then lookup the name (tags are enforced to be all lower case) |
| 1112 | 1112 | astring fullname(tag); |
| 1113 | 1113 | fullname.makelower(); |
| 1114 | return machine.device(fullname); | |
| 1114 | return machine.device(fullname.c_str()); | |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | |
| r245640 | r245641 | |
| 1668 | 1668 | // add all registers into it |
| 1669 | 1669 | astring tempstr; |
| 1670 | 1670 | for (const device_state_entry *entry = m_state->state_first(); entry != NULL; entry = entry->next()) |
| 1671 | m_symtable.add(tempstr.cpy(entry->symbol()).makelower(), (void *)(FPTR)entry->index(), get_state, set_state); | |
| 1671 | m_symtable.add(tempstr.cpy(entry->symbol()).makelower().c_str(), (void *)(FPTR)entry->index(), get_state, set_state); | |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | 1674 | // set up execution-related stuff |
| r245640 | r245641 | |
| 2668 | 2668 | const UINT32 crc = compute_opcode_crc32(addr); |
| 2669 | 2669 | std::set<dasm_comment>::iterator comment = m_comment_set.find(dasm_comment(addr, crc, "", 0)); |
| 2670 | 2670 | if (comment == m_comment_set.end()) return NULL; |
| 2671 | return comment->m_text; | |
| 2671 | return comment->m_text.c_str(); | |
| 2672 | 2672 | } |
| 2673 | 2673 | |
| 2674 | 2674 | |
| r245640 | r245641 | |
| 2683 | 2683 | astring crc_buf; |
| 2684 | 2684 | for (std::set<dasm_comment>::iterator item = m_comment_set.begin(); item != m_comment_set.end(); ++item) |
| 2685 | 2685 | { |
| 2686 | xml_data_node *datanode = xml_add_child(&curnode, "comment", xml_normalize_string(item->m_text)); | |
| 2686 | xml_data_node *datanode = xml_add_child(&curnode, "comment", xml_normalize_string(item->m_text.c_str())); | |
| 2687 | 2687 | if (datanode == NULL) |
| 2688 | 2688 | return false; |
| 2689 | 2689 | xml_set_attribute_int(datanode, "address", item->m_address); |
| 2690 | 2690 | xml_set_attribute_int(datanode, "color", item->m_color); |
| 2691 | 2691 | crc_buf.printf("%08X", item->m_crc); |
| 2692 | xml_set_attribute(datanode, "crc", crc_buf); | |
| 2692 | xml_set_attribute(datanode, "crc", crc_buf.c_str()); | |
| 2693 | 2693 | } |
| 2694 | 2694 | return true; |
| 2695 | 2695 | } |
| r245640 | r245641 | |
| 2908 | 2908 | |
| 2909 | 2909 | // if we hit, evaluate the action |
| 2910 | 2910 | if (bp->m_action) |
| 2911 | debug_console_execute_command(m_device.machine(), bp->m_action, 0); | |
| 2911 | debug_console_execute_command(m_device.machine(), bp->m_action.c_str(), 0); | |
| 2912 | 2912 | |
| 2913 | 2913 | // print a notification, unless the action made us go again |
| 2914 | 2914 | if (global->execution_state == EXECUTION_STATE_STOPPED) |
| r245640 | r245641 | |
| 2928 | 2928 | // if we hit, evaluate the action |
| 2929 | 2929 | if (rp->m_action) |
| 2930 | 2930 | { |
| 2931 | debug_console_execute_command(m_device.machine(), rp->m_action, 0); | |
| 2931 | debug_console_execute_command(m_device.machine(), rp->m_action.c_str(), 0); | |
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | 2934 | // print a notification, unless the action made us go again |
| r245640 | r245641 | |
| 3037 | 3037 | |
| 3038 | 3038 | // if we hit, evaluate the action |
| 3039 | 3039 | if (wp->m_action) |
| 3040 | debug_console_execute_command(space.machine(), wp->m_action, 0); | |
| 3040 | debug_console_execute_command(space.machine(), wp->m_action.c_str(), 0); | |
| 3041 | 3041 | |
| 3042 | 3042 | // print a notification, unless the action made us go again |
| 3043 | 3043 | if (global->execution_state == EXECUTION_STATE_STOPPED) |
| r245640 | r245641 | |
| 3480 | 3480 | |
| 3481 | 3481 | // execute any trace actions first |
| 3482 | 3482 | if (m_action) |
| 3483 | debug_console_execute_command(m_debug.m_device.machine(), m_action, 0); | |
| 3483 | debug_console_execute_command(m_debug.m_device.machine(), m_action.c_str(), 0); | |
| 3484 | 3484 | |
| 3485 | 3485 | // print the address |
| 3486 | 3486 | astring buffer; |
| r245640 | r245641 | |
|---|---|---|
| 68 | 68 | bool enabled() const { return m_enabled; } |
| 69 | 69 | offs_t address() const { return m_address; } |
| 70 | 70 | const char *condition() const { return m_condition.original_string(); } |
| 71 | const char *action() const { return m_action; } | |
| 71 | const char *action() const { return m_action.c_str(); } | |
| 72 | 72 | |
| 73 | 73 | // setters |
| 74 | 74 | void setEnabled(bool value) { m_enabled = value; } |
| r245640 | r245641 | |
| 113 | 113 | offs_t address() const { return m_address; } |
| 114 | 114 | offs_t length() const { return m_length; } |
| 115 | 115 | const char *condition() const { return m_condition.original_string(); } |
| 116 | const char *action() const { return m_action; } | |
| 116 | const char *action() const { return m_action.c_str(); } | |
| 117 | 117 | |
| 118 | 118 | // setters |
| 119 | 119 | void setEnabled(bool value) { m_enabled = value; } |
| r245640 | r245641 | |
| 148 | 148 | int index() const { return m_index; } |
| 149 | 149 | bool enabled() const { return m_enabled; } |
| 150 | 150 | const char *condition() const { return m_condition.original_string(); } |
| 151 | const char *action() const { return m_action; } | |
| 151 | const char *action() const { return m_action.c_str(); } | |
| 152 | 152 | |
| 153 | 153 | private: |
| 154 | 154 | // internals |
| r245640 | r245641 | |
|---|---|---|
| 504 | 504 | astring oldstring(m_parsed.original_string()); |
| 505 | 505 | try |
| 506 | 506 | { |
| 507 | m_parsed.parse(m_string); | |
| 507 | m_parsed.parse(m_string.c_str()); | |
| 508 | 508 | } |
| 509 | 509 | catch (expression_error &) |
| 510 | 510 | { |
| 511 | m_parsed.parse(oldstring); | |
| 511 | m_parsed.parse(oldstring.c_str()); | |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 |
| r245640 | r245641 | |
|---|---|---|
| 121 | 121 | virtual ~debug_view_source(); |
| 122 | 122 | |
| 123 | 123 | // getters |
| 124 | const char *name() const { return m_name; } | |
| 124 | const char *name() const { return m_name.c_str(); } | |
| 125 | 125 | debug_view_source *next() const { return m_next; } |
| 126 | 126 | device_t *device() const { return m_device; } |
| 127 | 127 | bool is_octal() const { return m_is_octal; } |
| r245640 | r245641 | |
| 266 | 266 | bool dirty() const { return m_dirty; } |
| 267 | 267 | UINT64 last_value() const { return m_result; } |
| 268 | 268 | UINT64 value() { recompute(); return m_result; } |
| 269 | const char *string() const { return m_string; } | |
| 269 | const char *string() const { return m_string.c_str(); } | |
| 270 | 270 | symbol_table *context() const { return m_parsed.symbols(); } |
| 271 | 271 | |
| 272 | 272 | // setters |
| r245640 | r245641 | |
|---|---|---|
| 99 | 99 | for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next()) |
| 100 | 100 | { |
| 101 | 101 | name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); |
| 102 | m_source_list.append(*global_alloc(debug_view_disasm_source(name, dasm->device()))); | |
| 102 | m_source_list.append(*global_alloc(debug_view_disasm_source(name.c_str(), dasm->device()))); | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // reset the source to a known good entry |
| r245640 | r245641 | |
|---|---|---|
| 138 | 138 | { |
| 139 | 139 | address_space &space = memintf->space(spacenum); |
| 140 | 140 | name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name()); |
| 141 | m_source_list.append(*global_alloc(debug_view_memory_source(name, space))); | |
| 141 | m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), space))); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // then add all the memory regions |
| 145 | 145 | for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next()) |
| 146 | 146 | { |
| 147 | 147 | name.printf("Region '%s'", region->name()); |
| 148 | m_source_list.append(*global_alloc(debug_view_memory_source(name, *region))); | |
| 148 | m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), *region))); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // finally add all global array symbols |
| r245640 | r245641 | |
| 163 | 163 | if (strncmp(itemname, "timer/", 6)) |
| 164 | 164 | { |
| 165 | 165 | name.cpy(itemname); |
| 166 | m_source_list.append(*global_alloc(debug_view_memory_source(name, base, valsize, valcount))); | |
| 166 | m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), base, valsize, valcount))); | |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| r245640 | r245641 | |
| 245 | 245 | char addrtext[20]; |
| 246 | 246 | |
| 247 | 247 | // generate the address |
| 248 | sprintf(addrtext, m_addrformat, address); | |
| 248 | sprintf(addrtext, m_addrformat.c_str(), address); | |
| 249 | 249 | dest = destrow + m_section[0].m_pos + 1; |
| 250 | 250 | for (int ch = 0; addrtext[ch] != 0 && ch < m_section[0].m_width - 1; ch++, dest++) |
| 251 | 251 | if (dest >= destmin && dest < destmax) |
| r245640 | r245641 | |
|---|---|---|
| 79 | 79 | for (device_state_interface *state = iter.first(); state != NULL; state = iter.next()) |
| 80 | 80 | { |
| 81 | 81 | name.printf("%s '%s'", state->device().name(), state->device().tag()); |
| 82 | m_source_list.append(*global_alloc(debug_view_state_source(name, state->device()))); | |
| 82 | m_source_list.append(*global_alloc(debug_view_state_source(name.c_str(), state->device()))); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // reset the source to a known good entry |
| r245640 | r245641 | |
|---|---|---|
| 703 | 703 | void parsed_expression::parse_string_into_tokens() |
| 704 | 704 | { |
| 705 | 705 | // loop until done |
| 706 | const char *stringstart = m_original_string; | |
| 706 | const char *stringstart = m_original_string.c_str(); | |
| 707 | 707 | const char *string = stringstart; |
| 708 | 708 | while (string[0] != 0) |
| 709 | 709 | { |
| r245640 | r245641 | |
| 876 | 876 | if (string[0] == '@') |
| 877 | 877 | { |
| 878 | 878 | string += 1; |
| 879 | return parse_memory_operator(token, buffer); | |
| 879 | return parse_memory_operator(token, buffer.c_str()); | |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | // empty string is automatically invalid |
| r245640 | r245641 | |
| 938 | 938 | return parse_number(token, buffer.c_str() + 1, 16, expression_error::INVALID_NUMBER); |
| 939 | 939 | |
| 940 | 940 | // check for a symbol match |
| 941 | symbol_entry *symbol = m_symtable->find_deep(buffer); | |
| 941 | symbol_entry *symbol = m_symtable->find_deep(buffer.c_str()); | |
| 942 | 942 | if (symbol != NULL) |
| 943 | 943 | { |
| 944 | 944 | token.configure_symbol(*symbol); |
| r245640 | r245641 | |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | // attempt to parse as a number in the default base |
| 956 | parse_number(token, buffer, DEFAULT_BASE, expression_error::UNKNOWN_SYMBOL); | |
| 956 | parse_number(token, buffer.c_str(), DEFAULT_BASE, expression_error::UNKNOWN_SYMBOL); | |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | |
| r245640 | r245641 | |
| 1052 | 1052 | string++; |
| 1053 | 1053 | |
| 1054 | 1054 | // make the token |
| 1055 | token.configure_string(m_stringlist.append(*global_alloc(expression_string(buffer)))); | |
| 1055 | token.configure_string(m_stringlist.append(*global_alloc(expression_string(buffer.c_str())))); | |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 |
| r245640 | r245641 | |
|---|---|---|
| 120 | 120 | public: |
| 121 | 121 | // getters |
| 122 | 122 | symbol_entry *next() const { return m_next; } |
| 123 | const char *name() const { return m_name; } | |
| 123 | const char *name() const { return m_name.c_str(); } | |
| 124 | 124 | |
| 125 | 125 | // type checking |
| 126 | 126 | bool is_function() const { return (m_type == SMT_FUNCTION); } |
| r245640 | r245641 | |
| 221 | 221 | |
| 222 | 222 | // getters |
| 223 | 223 | bool is_empty() const { return (m_tokenlist.count() == 0); } |
| 224 | const char *original_string() const { return m_original_string; } | |
| 224 | const char *original_string() const { return m_original_string.c_str(); } | |
| 225 | 225 | symbol_table *symbols() const { return m_symtable; } |
| 226 | 226 | |
| 227 | 227 | // setters |
| r245640 | r245641 | |
| 335 | 335 | m_string(string, (length == 0) ? strlen(string) : length) { } |
| 336 | 336 | |
| 337 | 337 | // operators |
| 338 | operator const char *() { return m_string; } | |
| 339 | operator const char *() const { return m_string; } | |
| 338 | operator const char *() { return m_string.c_str(); } | |
| 339 | operator const char *() const { return m_string.c_str(); } | |
| 340 | 340 | |
| 341 | 341 | private: |
| 342 | 342 | // internal state |
| r245640 | r245641 | |
|---|---|---|
| 268 | 268 | ioport_array_finder(device_t &base, const char *basetag) |
| 269 | 269 | { |
| 270 | 270 | for (int index = 0; index < _Count; index++) |
| 271 | m_array[index].reset(global_alloc(ioport_finder_type(base, m_tag[index].format("%s.%d", basetag, index)))); | |
| 271 | m_array[index].reset(global_alloc(ioport_finder_type(base, m_tag[index].format("%s.%d", basetag, index).c_str()))); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | ioport_array_finder(device_t &base, const char * const *tags) |
| r245640 | r245641 | |
| 436 | 436 | shared_ptr_array_finder(device_t &base, const char *basetag, UINT8 width = sizeof(_PointerType) * 8) |
| 437 | 437 | { |
| 438 | 438 | for (int index = 0; index < _Count; index++) |
| 439 | m_array[index].reset(global_alloc(shared_ptr_type(base, m_tag[index].format("%s.%d", basetag, index), width))); | |
| 439 | m_array[index].reset(global_alloc(shared_ptr_type(base, m_tag[index].format("%s.%d", basetag, index).c_str(), width))); | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // array accessors |
| r245640 | r245641 | |
|---|---|---|
| 130 | 130 | |
| 131 | 131 | // build a fully-qualified name and look it up |
| 132 | 132 | astring fullpath; |
| 133 | return machine().memory().region(subtag(fullpath, _tag)); | |
| 133 | return machine().memory().region(subtag(fullpath, _tag).c_str()); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| r245640 | r245641 | |
| 147 | 147 | |
| 148 | 148 | // build a fully-qualified name and look it up |
| 149 | 149 | astring fullpath; |
| 150 | return machine().memory().shared(subtag(fullpath, _tag)); | |
| 150 | return machine().memory().shared(subtag(fullpath, _tag).c_str()); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| r245640 | r245641 | |
| 164 | 164 | |
| 165 | 165 | // build a fully-qualified name and look it up |
| 166 | 166 | astring fullpath; |
| 167 | return machine().memory().bank(subtag(fullpath, _tag)); | |
| 167 | return machine().memory().bank(subtag(fullpath, _tag).c_str()); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| r245640 | r245641 | |
| 181 | 181 | |
| 182 | 182 | // build a fully-qualified name and look it up |
| 183 | 183 | astring fullpath; |
| 184 | return machine().ioport().port(subtag(fullpath, tag)); | |
| 184 | return machine().ioport().port(subtag(fullpath, tag).c_str()); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 |
| r245640 | r245641 | |
|---|---|---|
| 111 | 111 | |
| 112 | 112 | // getters |
| 113 | 113 | running_machine &machine() const { /*assert(m_machine != NULL);*/ return *m_machine; } |
| 114 | const char *tag() const { return m_tag; } | |
| 115 | const char *basetag() const { return m_basetag; } | |
| 114 | const char *tag() const { return m_tag.c_str(); } | |
| 115 | const char *basetag() const { return m_basetag.c_str(); } | |
| 116 | 116 | device_type type() const { return m_type; } |
| 117 | const char *name() const { return m_name; } | |
| 118 | const char *shortname() const { return m_shortname; } | |
| 119 | const char *searchpath() const { return m_searchpath; } | |
| 120 | const char *source() const { return m_source; } | |
| 117 | const char *name() const { return m_name.c_str(); } | |
| 118 | const char *shortname() const { return m_shortname.c_str(); } | |
| 119 | const char *searchpath() const { return m_searchpath.c_str(); } | |
| 120 | const char *source() const { return m_source.c_str(); } | |
| 121 | 121 | device_t *owner() const { return m_owner; } |
| 122 | 122 | device_t *next() const { return m_next; } |
| 123 | 123 | UINT32 configured_clock() const { return m_configured_clock; } |
| r245640 | r245641 | |
|---|---|---|
| 548 | 548 | { |
| 549 | 549 | // get the screen that will trigger the VBLANK |
| 550 | 550 | astring tempstring; |
| 551 | screen_device *screen = downcast<screen_device *>(device().machine().device(device().siblingtag(tempstring,m_vblank_interrupt_screen))); | |
| 551 | screen_device *screen = downcast<screen_device *>(device().machine().device(device().siblingtag(tempstring, m_vblank_interrupt_screen).c_str())); | |
| 552 | 552 | |
| 553 | 553 | assert(screen != NULL); |
| 554 | 554 | screen->register_vblank_callback(vblank_state_delegate(FUNC(device_execute_interface::on_vblank), this)); |
| r245640 | r245641 | |
|---|---|---|
| 325 | 325 | else |
| 326 | 326 | device().owner()->subtag(gfxregion, region); |
| 327 | 327 | |
| 328 | UINT32 region_length = valid.region_length(gfxregion); | |
| 328 | UINT32 region_length = valid.region_length(gfxregion.c_str()); | |
| 329 | 329 | if (region_length == 0) |
| 330 | 330 | osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.c_str()); |
| 331 | 331 |
| r245640 | r245641 | |
|---|---|---|
| 312 | 312 | |
| 313 | 313 | /* did we successfully identify the directory? */ |
| 314 | 314 | if (success) |
| 315 | zippath_combine(m_working_directory, m_working_directory, subdir); | |
| 315 | zippath_combine(m_working_directory, m_working_directory.c_str(), subdir); | |
| 316 | 316 | |
| 317 | 317 | return success; |
| 318 | 318 | } |
| r245640 | r245641 | |
| 354 | 354 | if (!m_working_directory) |
| 355 | 355 | setup_working_directory(); |
| 356 | 356 | |
| 357 | return m_working_directory; | |
| 357 | return m_working_directory.c_str(); | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
| r245640 | r245641 | |
| 499 | 499 | -------------------------------------------------*/ |
| 500 | 500 | void device_image_interface::battery_load(void *buffer, int length, int fill) |
| 501 | 501 | { |
| 502 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext, ".nv"); | |
| 503 | image_battery_load_by_name(device().machine().options(), fname, buffer, length, fill); | |
| 502 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); | |
| 503 | image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, fill); | |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | void device_image_interface::battery_load(void *buffer, int length, void *def_buffer) |
| 507 | 507 | { |
| 508 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext, ".nv"); | |
| 509 | image_battery_load_by_name(device().machine().options(), fname, buffer, length, def_buffer); | |
| 508 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); | |
| 509 | image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, def_buffer); | |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | /*------------------------------------------------- |
| r245640 | r245641 | |
| 517 | 517 | -------------------------------------------------*/ |
| 518 | 518 | void device_image_interface::battery_save(const void *buffer, int length) |
| 519 | 519 | { |
| 520 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext, ".nv"); | |
| 520 | astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); | |
| 521 | 521 | |
| 522 | image_battery_save_by_name(device().machine().options(), fname, buffer, length); | |
| 522 | image_battery_save_by_name(device().machine().options(), fname.c_str(), buffer, length); | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | //------------------------------------------------- |
| r245640 | r245641 | |
| 614 | 614 | |
| 615 | 615 | /* if successful, set the file name */ |
| 616 | 616 | if (filerr == FILERR_NONE) |
| 617 | set_image_filename(revised_path); | |
| 617 | set_image_filename(revised_path.c_str()); | |
| 618 | 618 | |
| 619 | 619 | return err; |
| 620 | 620 | } |
| r245640 | r245641 | |
| 668 | 668 | |
| 669 | 669 | /* if successful, set the file name */ |
| 670 | 670 | if (filerr == FILERR_NONE) |
| 671 | set_image_filename(revised_path); | |
| 671 | set_image_filename(revised_path.c_str()); | |
| 672 | 672 | |
| 673 | 673 | return err; |
| 674 | 674 | } |
| r245640 | r245641 | |
| 900 | 900 | // if we had launched from softlist with a specified part, e.g. "shortname:part" |
| 901 | 901 | // we would have recorded the wrong name, so record it again based on software_info |
| 902 | 902 | if (m_software_info_ptr && m_full_software_name) |
| 903 | m_err = set_image_filename(m_full_software_name); | |
| 903 | m_err = set_image_filename(m_full_software_name.c_str()); | |
| 904 | 904 | |
| 905 | 905 | // check if image should be read-only |
| 906 | 906 | const char *read_only = get_feature("read_only"); |
| r245640 | r245641 | |
| 1218 | 1218 | { |
| 1219 | 1219 | if (swlist_name == swlistdev->list_name() || !(swlist_name.len() > 0)) |
| 1220 | 1220 | { |
| 1221 | software_info *info = swlistdev->find(swinfo_name); | |
| 1221 | software_info *info = swlistdev->find(swinfo_name.c_str()); | |
| 1222 | 1222 | if (info != NULL) |
| 1223 | 1223 | { |
| 1224 | software_part *part = info->find_part(swpart_name, interface); | |
| 1224 | software_part *part = info->find_part(swpart_name.c_str(), interface); | |
| 1225 | 1225 | if (part != NULL) |
| 1226 | 1226 | return part; |
| 1227 | 1227 | } |
| r245640 | r245641 | |
| 1233 | 1233 | // gameboy:sml) which is not handled properly by software_name_split |
| 1234 | 1234 | // since the function cannot distinguish between this and the case |
| 1235 | 1235 | // path = swinfo_name:swpart_name |
| 1236 | software_info *info = swlistdev->find(swpart_name); | |
| 1236 | software_info *info = swlistdev->find(swpart_name.c_str()); | |
| 1237 | 1237 | if (info != NULL) |
| 1238 | 1238 | { |
| 1239 | 1239 | software_part *part = info->find_part(NULL, interface); |
| r245640 | r245641 | |
|---|---|---|
| 80 | 80 | m_optspec(optspec) { } |
| 81 | 81 | |
| 82 | 82 | image_device_format *next() const { return m_next; } |
| 83 | const char *name() const { return m_name; } | |
| 84 | const char *description() const { return m_description; } | |
| 85 | const char *extensions() const { return m_extensions; } | |
| 86 | const char *optspec() const { return m_optspec; } | |
| 83 | const char *name() const { return m_name.c_str(); } | |
| 84 | const char *description() const { return m_description.c_str(); } | |
| 85 | const char *extensions() const { return m_extensions.c_str(); } | |
| 86 | const char *optspec() const { return m_optspec.c_str(); } | |
| 87 | 87 | |
| 88 | 88 | private: |
| 89 | 89 | image_device_format *m_next; |
| r245640 | r245641 | |
| 171 | 171 | void message(const char *format, ...) ATTR_PRINTF(2,3); |
| 172 | 172 | |
| 173 | 173 | bool exists() { return m_image_name; } |
| 174 | const char *filename() { if (!m_image_name) return NULL; else return m_image_name; } | |
| 175 | const char *basename() { if (!m_basename) return NULL; else return m_basename; } | |
| 176 | const char *basename_noext() { if (!m_basename_noext) return NULL; else return m_basename_noext; } | |
| 177 | const char *filetype() { if (!m_filetype) return NULL; else return m_filetype; } | |
| 174 | const char *filename() { if (!m_image_name) return NULL; else return m_image_name.c_str(); } | |
| 175 | const char *basename() { if (!m_basename) return NULL; else return m_basename.c_str(); } | |
| 176 | const char *basename_noext() { if (!m_basename_noext) return NULL; else return m_basename_noext.c_str(); } | |
| 177 | const char *filetype() { if (!m_filetype) return NULL; else return m_filetype.c_str(); } | |
| 178 | 178 | core_file *image_core_file() { return m_file; } |
| 179 | 179 | UINT64 length() { check_for_file(); return core_fsize(m_file); } |
| 180 | 180 | bool is_readonly() { return m_readonly; } |
| r245640 | r245641 | |
| 193 | 193 | // configuration access |
| 194 | 194 | void set_init_phase() { m_init_phase = TRUE; } |
| 195 | 195 | |
| 196 | const char* longname() { return m_longname; } | |
| 197 | const char* manufacturer() { return m_manufacturer; } | |
| 198 | const char* year() { return m_year; } | |
| 196 | const char* longname() { return m_longname.c_str(); } | |
| 197 | const char* manufacturer() { return m_manufacturer.c_str(); } | |
| 198 | const char* year() { return m_year.c_str(); } | |
| 199 | 199 | UINT32 supported() { return m_supported; } |
| 200 | 200 | |
| 201 | 201 | const software_info *software_entry() { return m_software_info_ptr; } |
| 202 | 202 | const software_part *part_entry() { return m_software_part_ptr; } |
| 203 | const char *software_list_name() { return m_software_list_name; } | |
| 203 | const char *software_list_name() { return m_software_list_name.c_str(); } | |
| 204 | 204 | |
| 205 | 205 | void set_working_directory(const char *working_directory) { m_working_directory = working_directory; } |
| 206 | 206 | const char * working_directory(); |
| r245640 | r245641 | |
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | |
| 224 | const char *instance_name() const { return m_instance_name; } | |
| 225 | const char *brief_instance_name() const { return m_brief_instance_name; } | |
| 224 | const char *instance_name() const { return m_instance_name.c_str(); } | |
| 225 | const char *brief_instance_name() const { return m_brief_instance_name.c_str(); } | |
| 226 | 226 | bool uses_file_extension(const char *file_extension) const; |
| 227 | 227 | image_device_format *formatlist() const { return m_formatlist.first(); } |
| 228 | 228 |
| r245640 | r245641 | |
|---|---|---|
| 327 | 327 | if (entry->m_read.m_type == AMH_DEVICE_DELEGATE && entry->m_read.m_tag != NULL) |
| 328 | 328 | { |
| 329 | 329 | astring temp(entry->m_read.m_tag); |
| 330 | if (device().siblingdevice(temp) == NULL) | |
| 330 | if (device().siblingdevice(temp.c_str()) == NULL) | |
| 331 | 331 | osd_printf_error("%s space memory map entry references nonexistant device '%s'\n", spaceconfig->m_name, entry->m_read.m_tag); |
| 332 | 332 | } |
| 333 | 333 | if (entry->m_write.m_type == AMH_DEVICE_DELEGATE && entry->m_write.m_tag != NULL) |
| 334 | 334 | { |
| 335 | 335 | astring temp(entry->m_write.m_tag); |
| 336 | if (device().siblingdevice(temp) == NULL) | |
| 336 | if (device().siblingdevice(temp.c_str()) == NULL) | |
| 337 | 337 | osd_printf_error("%s space memory map entry references nonexistant device '%s'\n", spaceconfig->m_name, entry->m_write.m_tag); |
| 338 | 338 | } |
| 339 | 339 |
| r245640 | r245641 | |
|---|---|---|
| 265 | 265 | for (const sound_route *route = sound->first_route(); route != NULL; route = route->next()) |
| 266 | 266 | { |
| 267 | 267 | // see if we are the target of this route; if we are, make sure the source device is started |
| 268 | device_t *target_device = sound->device().siblingdevice(route->m_target); | |
| 268 | device_t *target_device = sound->device().siblingdevice(route->m_target.c_str()); | |
| 269 | 269 | if (target_device == &m_device && !sound->device().started()) |
| 270 | 270 | throw device_missing_dependencies(); |
| 271 | 271 | } |
| r245640 | r245641 | |
| 279 | 279 | for (const sound_route *route = sound->first_route(); route != NULL; route = route->next()) |
| 280 | 280 | { |
| 281 | 281 | // see if we are the target of this route |
| 282 | device_t *target_device = sound->device().siblingdevice(route->m_target); | |
| 282 | device_t *target_device = sound->device().siblingdevice(route->m_target.c_str()); | |
| 283 | 283 | if (target_device == &m_device && route->m_input == AUTO_ALLOC_INPUT) |
| 284 | 284 | { |
| 285 | 285 | const_cast<sound_route *>(route)->m_input = m_auto_allocated_inputs; |
| r245640 | r245641 | |
| 305 | 305 | for (const sound_route *route = sound->first_route(); route != NULL; route = route->next()) |
| 306 | 306 | { |
| 307 | 307 | // if we are the target of this route, hook it up |
| 308 | device_t *target_device = sound->device().siblingdevice(route->m_target); | |
| 308 | device_t *target_device = sound->device().siblingdevice(route->m_target.c_str()); | |
| 309 | 309 | if (target_device == &m_device) |
| 310 | 310 | { |
| 311 | 311 | // iterate over all outputs, matching any that apply |
| r245640 | r245641 | |
| 421 | 421 | for (const sound_route *route = sound->first_route(); route != NULL; route = route->next()) |
| 422 | 422 | { |
| 423 | 423 | // see if we are the target of this route |
| 424 | device_t *target_device = sound->device().siblingdevice(route->m_target); | |
| 424 | device_t *target_device = sound->device().siblingdevice(route->m_target.c_str()); | |
| 425 | 425 | if (target_device == &device() && route->m_input < m_auto_allocated_inputs) |
| 426 | 426 | { |
| 427 | 427 | int count = (route->m_output == ALL_OUTPUTS) ? sound->outputs() : 1; |
| r245640 | r245641 | |
|---|---|---|
| 175 | 175 | bool hitnonzero = false; |
| 176 | 176 | bool reset = true; |
| 177 | 177 | int width = 0; |
| 178 | for (const char *fptr = m_format; *fptr != 0; fptr++) | |
| 178 | for (const char *fptr = m_format.c_str(); *fptr != 0; fptr++) | |
| 179 | 179 | { |
| 180 | 180 | // reset any accumulated state |
| 181 | 181 | if (reset) |
| r245640 | r245641 | |
| 449 | 449 | state_string_export(*entry, custom); |
| 450 | 450 | |
| 451 | 451 | // ask the entry to format itself |
| 452 | return entry->format(dest, custom); | |
| 452 | return entry->format(dest, custom.c_str()); | |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 |
| r245640 | r245641 | |
|---|---|---|
| 66 | 66 | // query information |
| 67 | 67 | int index() const { return m_index; } |
| 68 | 68 | void *dataptr() const { return m_dataptr.v; } |
| 69 | const char *symbol() const { return m_symbol; } | |
| 69 | const char *symbol() const { return m_symbol.c_str(); } | |
| 70 | 70 | bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); } |
| 71 | 71 | bool divider() const { return m_flags & DSF_DIVIDER; } |
| 72 | 72 | device_state_interface *parent_state() const {return m_device_state;} |
| r245640 | r245641 | |
|---|---|---|
| 275 | 275 | slot->get_default_card_software(defvalue); |
| 276 | 276 | if (defvalue.len() > 0) |
| 277 | 277 | { |
| 278 | set_default_value(name, defvalue); | |
| 279 | const device_slot_option *option = slot->option(defvalue); | |
| 278 | set_default_value(name, defvalue.c_str()); | |
| 279 | const device_slot_option *option = slot->option(defvalue.c_str()); | |
| 280 | 280 | set_flag(name, ~OPTION_FLAG_INTERNAL, (option != NULL && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); |
| 281 | 281 | } |
| 282 | 282 | } |
| r245640 | r245641 | |
| 317 | 317 | |
| 318 | 318 | // add the option |
| 319 | 319 | if (!exists(image->instance_name())) |
| 320 | add_entry(option_name, NULL, OPTION_STRING | OPTION_FLAG_DEVICE, NULL, true); | |
| 320 | add_entry(option_name.c_str(), NULL, OPTION_STRING | OPTION_FLAG_DEVICE, NULL, true); | |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| r245640 | r245641 | |
| 444 | 444 | // next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini |
| 445 | 445 | astring sourcename; |
| 446 | 446 | core_filename_extract_base(sourcename, cursystem->source_file, true).ins(0, "source" PATH_SEPARATOR); |
| 447 | if (!parse_one_ini(sourcename, OPTION_PRIORITY_SOURCE_INI, &error_string)) | |
| 447 | if (!parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) | |
| 448 | 448 | { |
| 449 | 449 | core_filename_extract_base(sourcename, cursystem->source_file, true); |
| 450 | parse_one_ini(sourcename, OPTION_PRIORITY_SOURCE_INI, &error_string); | |
| 450 | parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string); | |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // then parse the grandparent, parent, and system-specific INIs |
| r245640 | r245641 | |
| 472 | 472 | const game_driver *emu_options::system() const |
| 473 | 473 | { |
| 474 | 474 | astring tempstr; |
| 475 | int index = driver_list::find(core_filename_extract_base(tempstr, system_name(), true)); | |
| 475 | int index = driver_list::find(core_filename_extract_base(tempstr, system_name(), true).c_str()); | |
| 476 | 476 | return (index != -1) ? &driver_list::driver(index) : NULL; |
| 477 | 477 | } |
| 478 | 478 | |
| r245640 | r245641 | |
| 551 | 551 | { |
| 552 | 552 | astring tmp(",", subname, "="); |
| 553 | 553 | buffer = value(name); |
| 554 | int pos = buffer.find(0, tmp); | |
| 554 | int pos = buffer.find(0, tmp.c_str()); | |
| 555 | 555 | if (pos != -1) |
| 556 | 556 | { |
| 557 | 557 | int endpos = buffer.chr(pos + 1, ','); |
| r245640 | r245641 | |
|---|---|---|
| 114 | 114 | return NULL; |
| 115 | 115 | |
| 116 | 116 | // open the path |
| 117 | m_curdir = osd_opendir(m_pathbuffer); | |
| 117 | m_curdir = osd_opendir(m_pathbuffer.c_str()); | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // get the next entry from the current directory |
| r245640 | r245641 | |
| 241 | 241 | // if we have ZIP data, just hash that directly |
| 242 | 242 | if (m__7zdata.count() != 0) |
| 243 | 243 | { |
| 244 | m_hashes.compute(m__7zdata, m__7zdata.count(), needed); | |
| 244 | m_hashes.compute(m__7zdata, m__7zdata.count(), needed.c_str()); | |
| 245 | 245 | return m_hashes; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if (m_zipdata.count() != 0) |
| 249 | 249 | { |
| 250 | m_hashes.compute(m_zipdata, m_zipdata.count(), needed); | |
| 250 | m_hashes.compute(m_zipdata, m_zipdata.count(), needed.c_str()); | |
| 251 | 251 | return m_hashes; |
| 252 | 252 | } |
| 253 | 253 | |
| r245640 | r245641 | |
| 257 | 257 | return m_hashes; |
| 258 | 258 | |
| 259 | 259 | // compute the hash |
| 260 | m_hashes.compute(filedata, core_fsize(m_file), needed); | |
| 260 | m_hashes.compute(filedata, core_fsize(m_file), needed.c_str()); | |
| 261 | 261 | return m_hashes; |
| 262 | 262 | } |
| 263 | 263 | |
| r245640 | r245641 | |
| 282 | 282 | { |
| 283 | 283 | // concatenate the strings and do a standard open |
| 284 | 284 | astring name(name1, name2); |
| 285 | return open(name); | |
| 285 | return open(name.c_str()); | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | file_error emu_file::open(const char *name1, const char *name2, const char *name3) |
| 289 | 289 | { |
| 290 | 290 | // concatenate the strings and do a standard open |
| 291 | 291 | astring name(name1, name2, name3); |
| 292 | return open(name); | |
| 292 | return open(name.c_str()); | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4) |
| 296 | 296 | { |
| 297 | 297 | // concatenate the strings and do a standard open |
| 298 | 298 | astring name(name1, name2, name3, name4); |
| 299 | return open(name); | |
| 299 | return open(name.c_str()); | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | file_error emu_file::open(const char *name, UINT32 crc) |
| r245640 | r245641 | |
| 315 | 315 | { |
| 316 | 316 | // concatenate the strings and do a standard open |
| 317 | 317 | astring name(name1, name2); |
| 318 | return open(name, crc); | |
| 318 | return open(name.c_str(), crc); | |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc) |
| 322 | 322 | { |
| 323 | 323 | // concatenate the strings and do a standard open |
| 324 | 324 | astring name(name1, name2, name3); |
| 325 | return open(name, crc); | |
| 325 | return open(name.c_str(), crc); | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc) |
| 329 | 329 | { |
| 330 | 330 | // concatenate the strings and do a standard open |
| 331 | 331 | astring name(name1, name2, name3, name4); |
| 332 | return open(name, crc); | |
| 332 | return open(name.c_str(), crc); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
| r245640 | r245641 | |
| 346 | 346 | |
| 347 | 347 | // loop over paths |
| 348 | 348 | file_error filerr = FILERR_NOT_FOUND; |
| 349 | while (m_iterator.next(m_fullpath, m_filename)) | |
| 349 | while (m_iterator.next(m_fullpath, m_filename.c_str())) | |
| 350 | 350 | { |
| 351 | 351 | // attempt to open the file directly |
| 352 | filerr = core_fopen(m_fullpath, m_openflags, &m_file); | |
| 352 | filerr = core_fopen(m_fullpath.c_str(), m_openflags, &m_file); | |
| 353 | 353 | if (filerr == FILERR_NONE) |
| 354 | 354 | break; |
| 355 | 355 | |
| r245640 | r245641 | |
| 413 | 413 | m_zipdata.reset(); |
| 414 | 414 | |
| 415 | 415 | if (m_remove_on_close) |
| 416 | osd_rmfile(m_fullpath); | |
| 416 | osd_rmfile(m_fullpath.c_str()); | |
| 417 | 417 | m_remove_on_close = false; |
| 418 | 418 | |
| 419 | 419 | // reset our hashes and path as well |
| r245640 | r245641 | |
| 698 | 698 | |
| 699 | 699 | // attempt to open the ZIP file |
| 700 | 700 | zip_file *zip; |
| 701 | zip_error ziperr = zip_file_open(m_fullpath, &zip); | |
| 701 | zip_error ziperr = zip_file_open(m_fullpath.c_str(), &zip); | |
| 702 | 702 | |
| 703 | 703 | // chop the .zip back off the filename before continuing |
| 704 | 704 | m_fullpath.substr(0, dirsep); |
| r245640 | r245641 | |
| 833 | 833 | |
| 834 | 834 | // attempt to open the _7Z file |
| 835 | 835 | _7z_file *_7z; |
| 836 | _7z_error _7zerr = _7z_file_open(m_fullpath, &_7z); | |
| 836 | _7z_error _7zerr = _7z_file_open(m_fullpath.c_str(), &_7z); | |
| 837 | 837 | |
| 838 | 838 | // chop the ._7z back off the filename before continuing |
| 839 | 839 | m_fullpath.substr(0, dirsep); |
| r245640 | r245641 | |
|---|---|---|
| 93 | 93 | operator core_file *(); |
| 94 | 94 | operator core_file &(); |
| 95 | 95 | bool is_open() const { return (m_file != NULL); } |
| 96 | const char *filename() const { return m_filename; } | |
| 97 | const char *fullpath() const { return m_fullpath; } | |
| 96 | const char *filename() const { return m_filename.c_str(); } | |
| 97 | const char *fullpath() const { return m_fullpath.c_str(); } | |
| 98 | 98 | UINT32 openflags() const { return m_openflags; } |
| 99 | 99 | hash_collection &hashes(const char *types); |
| 100 | 100 | bool restrict_to_mediapath() { return m_restrict_to_mediapath; } |
| r245640 | r245641 | |
|---|---|---|
| 122 | 122 | buffer.cat(HASH_CRC); |
| 123 | 123 | if (m_has_sha1) |
| 124 | 124 | buffer.cat(HASH_SHA1); |
| 125 | return buffer; | |
| 125 | return buffer.c_str(); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| r245640 | r245641 | |
| 204 | 204 | buffer.cat(HASH_SHA1).cat(m_sha1.as_string(temp)); |
| 205 | 205 | |
| 206 | 206 | // append flags |
| 207 | return buffer.cat(m_flags); | |
| 207 | return buffer.cat(m_flags).c_str(); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
| r245640 | r245641 | |
| 231 | 231 | buffer.cat("NO_DUMP "); |
| 232 | 232 | if (flag(FLAG_BAD_DUMP)) |
| 233 | 233 | buffer.cat("BAD_DUMP "); |
| 234 | return buffer.trimspace(); | |
| 234 | return buffer.trimspace().c_str(); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
| r245640 | r245641 | |
| 258 | 258 | buffer.cat("status=\"nodump\"" ); |
| 259 | 259 | if (flag(FLAG_BAD_DUMP)) |
| 260 | 260 | buffer.cat("status=\"baddump\"" ); |
| 261 | return buffer.trimspace(); | |
| 261 | return buffer.trimspace().c_str(); | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 |
| r245640 | r245641 | |
|---|---|---|
| 143 | 143 | { |
| 144 | 144 | astring inistring; |
| 145 | 145 | options.output_ini(inistring); |
| 146 | file.puts(inistring); | |
| 146 | file.puts(inistring.c_str()); | |
| 147 | 147 | retval = 0; |
| 148 | 148 | } |
| 149 | 149 | return retval; |
| r245640 | r245641 | |
|---|---|---|
| 103 | 103 | |
| 104 | 104 | if (software_entry() == NULL) |
| 105 | 105 | { |
| 106 | if (strstr(m_image_name,".chd") && is_loaded()) { | |
| 106 | if (strstr(m_image_name.c_str(), ".chd") && is_loaded()) { | |
| 107 | 107 | err = m_self_chd.open( *image_core_file() ); /* CDs are never writeable */ |
| 108 | 108 | if ( err ) |
| 109 | 109 | goto error; |
| 110 | 110 | chd = &m_self_chd; |
| 111 | 111 | } |
| 112 | 112 | } else { |
| 113 | chd | |
| 113 | chd = get_disk_handle(device().machine(), device().subtag(tempstring, "cdrom").c_str()); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /* open the CHD file */ |
| 117 | 117 | if (chd) { |
| 118 | 118 | m_cdrom_handle = cdrom_open( chd ); |
| 119 | 119 | } else { |
| 120 | m_cdrom_handle = cdrom_open( | |
| 120 | m_cdrom_handle = cdrom_open(m_image_name.c_str()); | |
| 121 | 121 | } |
| 122 | 122 | if ( ! m_cdrom_handle ) |
| 123 | 123 | goto error; |
| r245640 | r245641 | |
|---|---|---|
| 175 | 175 | /* try to open the diff */ |
| 176 | 176 | //printf("Opening differencing image file: %s\n", fname.c_str()); |
| 177 | 177 | emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE); |
| 178 | file_error filerr = diff_file.open(fname); | |
| 178 | file_error filerr = diff_file.open(fname.c_str()); | |
| 179 | 179 | if (filerr == FILERR_NONE) |
| 180 | 180 | { |
| 181 | 181 | astring fullpath(diff_file.fullpath()); |
| 182 | 182 | diff_file.close(); |
| 183 | 183 | |
| 184 | 184 | //printf("Opening differencing image file: %s\n", fullpath.c_str()); |
| 185 | return diff_chd.open(fullpath, true, &source); | |
| 185 | return diff_chd.open(fullpath.c_str(), true, &source); | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /* didn't work; try creating it instead */ |
| 189 | 189 | //printf("Creating differencing image: %s\n", fname.c_str()); |
| 190 | 190 | diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 191 | filerr = diff_file.open(fname); | |
| 191 | filerr = diff_file.open(fname.c_str()); | |
| 192 | 192 | if (filerr == FILERR_NONE) |
| 193 | 193 | { |
| 194 | 194 | astring fullpath(diff_file.fullpath()); |
| r245640 | r245641 | |
| 197 | 197 | /* create the CHD */ |
| 198 | 198 | //printf("Creating differencing image file: %s\n", fullpath.c_str()); |
| 199 | 199 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 200 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 200 | chd_error err = diff_chd.create(fullpath.c_str(), source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 201 | 201 | if (err != CHDERR_NONE) |
| 202 | 202 | return err; |
| 203 | 203 | |
| r245640 | r245641 | |
| 220 | 220 | /* open the CHD file */ |
| 221 | 221 | if (software_entry() != NULL) |
| 222 | 222 | { |
| 223 | m_chd | |
| 223 | m_chd = get_disk_handle(device().machine(), device().subtag(tempstring, "harddriv").c_str()); | |
| 224 | 224 | } |
| 225 | 225 | else |
| 226 | 226 | { |
| r245640 | r245641 | |
|---|---|---|
| 325 | 325 | core_file *fd; |
| 326 | 326 | astring revised_path; |
| 327 | 327 | |
| 328 | file_error err = zippath_fopen(filename, OPEN_FLAG_READ, fd, revised_path); | |
| 328 | file_error err = zippath_fopen(filename.c_str(), OPEN_FLAG_READ, fd, revised_path); | |
| 329 | 329 | if(err) { |
| 330 | 330 | seterror(IMAGE_ERROR_INVALIDIMAGE, "Unable to open the image file"); |
| 331 | 331 | return 0; |
| r245640 | r245641 | |
| 867 | 867 | { |
| 868 | 868 | floppy_image_device *fd = static_cast<floppy_image_device *>(image); |
| 869 | 869 | if(input_filename == "") { |
| 870 | int err = fd->create(output_filename, 0, NULL); | |
| 870 | int err = fd->create(output_filename.c_str(), 0, NULL); | |
| 871 | 871 | if (err != 0) { |
| 872 | 872 | popmessage("Error: %s", fd->error()); |
| 873 | 873 | return; |
| 874 | 874 | } |
| 875 | 875 | fd->setup_write(output_format); |
| 876 | 876 | } else { |
| 877 | int err = fd->load(input_filename); | |
| 877 | int err = fd->load(input_filename.c_str()); | |
| 878 | 878 | if(!err && output_filename != "") |
| 879 | err = fd->reopen_for_write(output_filename); | |
| 879 | err = fd->reopen_for_write(output_filename.c_str()); | |
| 880 | 880 | if(err != 0) { |
| 881 | 881 | popmessage("Error: %s", fd->error()); |
| 882 | 882 | return; |
| r245640 | r245641 | |
| 891 | 891 | if (softlist) |
| 892 | 892 | { |
| 893 | 893 | popmessage("When loaded from software list, the disk is Read-only.\n"); |
| 894 | image->load(filename); | |
| 894 | image->load(filename.c_str()); | |
| 895 | 895 | ui_menu::stack_pop(machine()); |
| 896 | 896 | return; |
| 897 | 897 | } |
| r245640 | r245641 | |
| 912 | 912 | astring tmp_path; |
| 913 | 913 | core_file *tmp_file; |
| 914 | 914 | /* attempt to open the file for writing but *without* create */ |
| 915 | filerr = zippath_fopen(filename, OPEN_FLAG_READ|OPEN_FLAG_WRITE, tmp_file, tmp_path); | |
| 915 | filerr = zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path); | |
| 916 | 916 | if(!filerr) |
| 917 | 917 | core_fclose(tmp_file); |
| 918 | 918 | else |
| r245640 | r245641 | |
| 933 | 933 | for(floppy_image_format_t *i = fif_list; i; i = i->next) { |
| 934 | 934 | if(!i->supports_save()) |
| 935 | 935 | continue; |
| 936 | if(i->extension_matches(current_file)) | |
| 936 | if (i->extension_matches(current_file.c_str())) | |
| 937 | 937 | format_array[total_usable++] = i; |
| 938 | 938 | } |
| 939 | 939 | ext_match = total_usable; |
| 940 | 940 | for(floppy_image_format_t *i = fif_list; i; i = i->next) { |
| 941 | 941 | if(!i->supports_save()) |
| 942 | 942 | continue; |
| 943 | if(!i->extension_matches(current_file)) | |
| 943 | if (!i->extension_matches(current_file.c_str())) | |
| 944 | 944 | format_array[total_usable++] = i; |
| 945 | 945 | } |
| 946 | 946 | submenu_result = -1; |
| r245640 | r245641 | |
| 955 | 955 | state = START_FILE; |
| 956 | 956 | handle(); |
| 957 | 957 | } else { |
| 958 | zippath_combine(output_filename, current_directory, current_file); | |
| 958 | zippath_combine(output_filename, current_directory.c_str(), current_file.c_str()); | |
| 959 | 959 | output_format = format_array[submenu_result]; |
| 960 | 960 | do_load_create(); |
| 961 | 961 | ui_menu::stack_pop(machine()); |
| r245640 | r245641 | |
|---|---|---|
| 181 | 181 | /* try to open the diff */ |
| 182 | 182 | //printf("Opening differencing image file: %s\n", fname.c_str()); |
| 183 | 183 | emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE); |
| 184 | file_error filerr = diff_file.open(fname); | |
| 184 | file_error filerr = diff_file.open(fname.c_str()); | |
| 185 | 185 | if (filerr == FILERR_NONE) |
| 186 | 186 | { |
| 187 | 187 | astring fullpath(diff_file.fullpath()); |
| 188 | 188 | diff_file.close(); |
| 189 | 189 | |
| 190 | 190 | //printf("Opening differencing image file: %s\n", fullpath.c_str()); |
| 191 | return diff_chd.open(fullpath, true, &source); | |
| 191 | return diff_chd.open(fullpath.c_str(), true, &source); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /* didn't work; try creating it instead */ |
| 195 | 195 | //printf("Creating differencing image: %s\n", fname.c_str()); |
| 196 | 196 | diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 197 | filerr = diff_file.open(fname); | |
| 197 | filerr = diff_file.open(fname.c_str()); | |
| 198 | 198 | if (filerr == FILERR_NONE) |
| 199 | 199 | { |
| 200 | 200 | astring fullpath(diff_file.fullpath()); |
| r245640 | r245641 | |
| 203 | 203 | /* create the CHD */ |
| 204 | 204 | //printf("Creating differencing image file: %s\n", fullpath.c_str()); |
| 205 | 205 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 206 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 206 | chd_error err = diff_chd.create(fullpath.c_str(), source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 207 | 207 | if (err != CHDERR_NONE) |
| 208 | 208 | return err; |
| 209 | 209 | |
| r245640 | r245641 | |
| 226 | 226 | /* open the CHD file */ |
| 227 | 227 | if (software_entry() != NULL) |
| 228 | 228 | { |
| 229 | m_chd | |
| 229 | m_chd = get_disk_handle(device().machine(), device().subtag(tempstring, "harddriv").c_str()); | |
| 230 | 230 | } |
| 231 | 231 | else |
| 232 | 232 | { |
| r245640 | r245641 | |
|---|---|---|
| 628 | 628 | if (strcmp(exec->device().tag(), device.tag())) |
| 629 | 629 | { |
| 630 | 630 | astring newtag(exec->device().tag()), oldtag(":"); |
| 631 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 631 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 632 | 632 | |
| 633 | 633 | fprintf(m_output, "\t\t<chip"); |
| 634 | 634 | fprintf(m_output, " type=\"cpu\""); |
| 635 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag)); | |
| 635 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str())); | |
| 636 | 636 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(exec->device().name())); |
| 637 | 637 | fprintf(m_output, " clock=\"%d\"", exec->device().clock()); |
| 638 | 638 | fprintf(m_output, "/>\n"); |
| r245640 | r245641 | |
| 646 | 646 | if (strcmp(sound->device().tag(), device.tag())) |
| 647 | 647 | { |
| 648 | 648 | astring newtag(sound->device().tag()), oldtag(":"); |
| 649 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 649 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 650 | 650 | |
| 651 | 651 | fprintf(m_output, "\t\t<chip"); |
| 652 | 652 | fprintf(m_output, " type=\"audio\""); |
| 653 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag)); | |
| 653 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str())); | |
| 654 | 654 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(sound->device().name())); |
| 655 | 655 | if (sound->device().clock() != 0) |
| 656 | 656 | fprintf(m_output, " clock=\"%d\"", sound->device().clock()); |
| r245640 | r245641 | |
| 674 | 674 | if (strcmp(screendev->tag(), device.tag())) |
| 675 | 675 | { |
| 676 | 676 | astring newtag(screendev->tag()), oldtag(":"); |
| 677 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 677 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 678 | 678 | |
| 679 | 679 | fprintf(m_output, "\t\t<display"); |
| 680 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag)); | |
| 680 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str())); | |
| 681 | 681 | |
| 682 | 682 | switch (screendev->screen_type()) |
| 683 | 683 | { |
| r245640 | r245641 | |
| 1080 | 1080 | astring output; |
| 1081 | 1081 | |
| 1082 | 1082 | astring newtag(port->tag()), oldtag(":"); |
| 1083 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 1083 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 1084 | 1084 | |
| 1085 | 1085 | // output the switch name information |
| 1086 | 1086 | astring normalized_field_name(xml_normalize_string(field->name())); |
| 1087 | astring normalized_newtag(xml_normalize_string(newtag)); | |
| 1087 | astring normalized_newtag(xml_normalize_string(newtag.c_str())); | |
| 1088 | 1088 | output.catprintf("\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.c_str(), normalized_newtag.c_str(), field->mask()); |
| 1089 | 1089 | |
| 1090 | 1090 | // loop over settings |
| r245640 | r245641 | |
| 1211 | 1211 | if (strcmp(imagedev->device().tag(), device.tag())) |
| 1212 | 1212 | { |
| 1213 | 1213 | astring newtag(imagedev->device().tag()), oldtag(":"); |
| 1214 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 1214 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 1215 | 1215 | |
| 1216 | 1216 | // print m_output device type |
| 1217 | 1217 | fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev->image_type_name())); |
| 1218 | 1218 | |
| 1219 | 1219 | // does this device have a tag? |
| 1220 | 1220 | if (imagedev->device().tag()) |
| 1221 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag)); | |
| 1221 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str())); | |
| 1222 | 1222 | |
| 1223 | 1223 | // is this device mandatory? |
| 1224 | 1224 | if (imagedev->must_be_loaded()) |
| r245640 | r245641 | |
| 1269 | 1269 | if (strcmp(slot->device().tag(), device.tag())) |
| 1270 | 1270 | { |
| 1271 | 1271 | astring newtag(slot->device().tag()), oldtag(":"); |
| 1272 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 1272 | newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); | |
| 1273 | 1273 | |
| 1274 | 1274 | // print m_output device type |
| 1275 | fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag)); | |
| 1275 | fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag.c_str())); | |
| 1276 | 1276 | |
| 1277 | 1277 | /* |
| 1278 | 1278 | if (slot->slot_interface()[0]) |
| r245640 | r245641 | |
| 1346 | 1346 | { |
| 1347 | 1347 | astring option; |
| 1348 | 1348 | option.cpysubstr(options, start, (end == -1) ? -1 : end - start); |
| 1349 | fprintf(m_output, "\t\t<ramoption>%u</ramoption>\n", ram_device::parse_string(option)); | |
| 1349 | fprintf(m_output, "\t\t<ramoption>%u</ramoption>\n", ram_device::parse_string(option.c_str())); | |
| 1350 | 1350 | if (end == -1) |
| 1351 | 1351 | break; |
| 1352 | 1352 | } |
| r245640 | r245641 | |
|---|---|---|
| 553 | 553 | |
| 554 | 554 | string.catprintf("\n"); |
| 555 | 555 | } |
| 556 | return string; | |
| 556 | return string.c_str(); | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | |
| r245640 | r245641 | |
| 1468 | 1468 | // if nothing there, return an empty string |
| 1469 | 1469 | input_device_item *item = item_from_code(code); |
| 1470 | 1470 | if (item == NULL) |
| 1471 | return string; | |
| 1471 | return string.c_str(); | |
| 1472 | 1472 | |
| 1473 | 1473 | // determine the devclass part |
| 1474 | 1474 | const char *devclass = (*devclass_string_table)[code.device_class()]; |
| r245640 | r245641 | |
| 1510 | 1510 | string.cat(" ").cat(modifier); |
| 1511 | 1511 | |
| 1512 | 1512 | // delete any leading spaces |
| 1513 | return string.trimspace(); | |
| 1513 | return string.trimspace().c_str(); | |
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | |
| r245640 | r245641 | |
| 1551 | 1551 | string.cat("_").cat(modifier); |
| 1552 | 1552 | if (itemclass[0] != 0) |
| 1553 | 1553 | string.cat("_").cat(itemclass); |
| 1554 | return string; | |
| 1554 | return string.c_str(); | |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | 1557 | |
| r245640 | r245641 | |
| 1585 | 1585 | |
| 1586 | 1586 | // second token might be index; look for number |
| 1587 | 1587 | int devindex = 0; |
| 1588 | if (numtokens > 2 && sscanf(token[curtok], "%d", &devindex) == 1) | |
| 1588 | if (numtokens > 2 && sscanf(token[curtok].c_str(), "%d", &devindex) == 1) | |
| 1589 | 1589 | { |
| 1590 | 1590 | curtok++; |
| 1591 | 1591 | devindex--; |
| r245640 | r245641 | |
| 1946 | 1946 | |
| 1947 | 1947 | // special case: empty |
| 1948 | 1948 | if (clean_index == 0) |
| 1949 | return string.cpy((seq.length() == 0) ? "None" : "n/a"); | |
| 1949 | return string.cpy((seq.length() == 0) ? "None" : "n/a").c_str(); | |
| 1950 | 1950 | |
| 1951 | 1951 | // start with an empty buffer |
| 1952 | 1952 | string.reset(); |
| r245640 | r245641 | |
| 1969 | 1969 | else |
| 1970 | 1970 | string.cat(code_name(codestr, code)); |
| 1971 | 1971 | } |
| 1972 | return string; | |
| 1972 | return string.c_str(); | |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | |
| r245640 | r245641 | |
| 2004 | 2004 | else |
| 2005 | 2005 | string.cat(code_to_token(codestr, code)); |
| 2006 | 2006 | } |
| 2007 | return string; | |
| 2007 | return string.c_str(); | |
| 2008 | 2008 | } |
| 2009 | 2009 | |
| 2010 | 2010 |
| r245640 | r245641 | |
|---|---|---|
| 500 | 500 | input_device &device() const { return m_device; } |
| 501 | 501 | input_manager &manager() const; |
| 502 | 502 | running_machine &machine() const; |
| 503 | const char *name() const { return m_name; } | |
| 503 | const char *name() const { return m_name.c_str(); } | |
| 504 | 504 | void *internal() const { return m_internal; } |
| 505 | 505 | input_item_id itemid() const { return m_itemid; } |
| 506 | 506 | input_item_class itemclass() const { return m_itemclass; } |
| 507 | const char *token() const { return m_token; } | |
| 507 | const char *token() const { return m_token.c_str(); } | |
| 508 | 508 | INT32 current() const { return m_current; } |
| 509 | 509 | INT32 memory() const { return m_memory; } |
| 510 | 510 | |
| r245640 | r245641 | |
| 549 | 549 | input_manager &manager() const; |
| 550 | 550 | running_machine &machine() const; |
| 551 | 551 | input_device_class devclass() const; |
| 552 | const char *name() const { return m_name; } | |
| 552 | const char *name() const { return m_name.c_str(); } | |
| 553 | 553 | int devindex() const { return m_devindex; } |
| 554 | 554 | input_device_item *item(input_item_id index) const { return m_item[index]; } |
| 555 | 555 | input_item_id maxitem() const { return m_maxitem; } |
| r245640 | r245641 | |
|---|---|---|
| 1264 | 1264 | buffer.format("U+%04X", unsigned(ch)); |
| 1265 | 1265 | break; |
| 1266 | 1266 | } |
| 1267 | return buffer; | |
| 1267 | return buffer.c_str(); | |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | |
| r245640 | r245641 | |
| 1327 | 1327 | // otherwise, opt for question marks |
| 1328 | 1328 | else |
| 1329 | 1329 | string.cpy("???"); |
| 1330 | return string; | |
| 1330 | return string.c_str(); | |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | |
| r245640 | r245641 | |
| 1520 | 1520 | { |
| 1521 | 1521 | // if we have a non-default name, use that |
| 1522 | 1522 | if (m_live != NULL && m_live->name) |
| 1523 | return m_live->name; | |
| 1523 | return m_live->name.c_str(); | |
| 1524 | 1524 | if (m_name != NULL) |
| 1525 | 1525 | return m_name; |
| 1526 | 1526 | |
| r245640 | r245641 | |
| 2066 | 2066 | tempstr.cpy(curentry, comma - curentry); |
| 2067 | 2067 | |
| 2068 | 2068 | // first extract the switch name if present |
| 2069 | const char *number = tempstr; | |
| 2070 | const char *colon = strchr(tempstr, ':'); | |
| 2069 | const char *number = tempstr.c_str(); | |
| 2070 | const char *colon = strchr(tempstr.c_str(), ':'); | |
| 2071 | 2071 | |
| 2072 | 2072 | // allocate and copy the name if it is present |
| 2073 | 2073 | if (colon != NULL) |
| 2074 | 2074 | { |
| 2075 | lastname = name.cpy(number, colon - number); | |
| 2075 | lastname = name.cpy(number, colon - number).c_str(); | |
| 2076 | 2076 | number = colon + 1; |
| 2077 | 2077 | } |
| 2078 | 2078 | |
| r245640 | r245641 | |
| 2101 | 2101 | errorbuf.catprintf("Switch location '%s' has invalid format!\n", location); |
| 2102 | 2102 | |
| 2103 | 2103 | // allocate a new entry |
| 2104 | m_diploclist.append(*global_alloc(ioport_diplocation(name, swnum, invert))); | |
| 2104 | m_diploclist.append(*global_alloc(ioport_diplocation(name.c_str(), swnum, invert))); | |
| 2105 | 2105 | entries++; |
| 2106 | 2106 | |
| 2107 | 2107 | // advance to the next item |
| r245640 | r245641 | |
| 3176 | 3176 | machine().input().seq_to_tokens(seqstring, seq); |
| 3177 | 3177 | |
| 3178 | 3178 | // add the new node |
| 3179 | xml_data_node *seqnode = xml_add_child(parentnode, "newseq", seqstring); | |
| 3179 | xml_data_node *seqnode = xml_add_child(parentnode, "newseq", seqstring.c_str()); | |
| 3180 | 3180 | if (seqnode != NULL) |
| 3181 | 3181 | xml_set_attribute(seqnode, "type", seqtypestrings[type]); |
| 3182 | 3182 | } |
| r245640 | r245641 | |
| 3685 | 3685 | m_owner.subtag(fulltag, tag); |
| 3686 | 3686 | |
| 3687 | 3687 | // add it to the list, and reset current field/setting |
| 3688 | m_curport = &m_portlist.append(fulltag, *global_alloc(ioport_port(m_owner, fulltag))); | |
| 3688 | m_curport = &m_portlist.append(fulltag.c_str(), *global_alloc(ioport_port(m_owner, fulltag.c_str()))); | |
| 3689 | 3689 | m_curfield = NULL; |
| 3690 | 3690 | m_cursetting = NULL; |
| 3691 | 3691 | } |
| r245640 | r245641 | |
| 4402 | 4402 | // look up the port and return the token |
| 4403 | 4403 | input_type_entry *entry = m_type_to_entry[type][player]; |
| 4404 | 4404 | if (entry != NULL) |
| 4405 | return string.cpy(entry->token()); | |
| 4405 | return string.cpy(entry->token()).c_str(); | |
| 4406 | 4406 | |
| 4407 | 4407 | // if that fails, carry on |
| 4408 | return string.format("TYPE_OTHER(%d,%d)", type, player); | |
| 4408 | return string.format("TYPE_OTHER(%d,%d)", type, player).c_str(); | |
| 4409 | 4409 | } |
| 4410 | 4410 | |
| 4411 | 4411 |
| r245640 | r245641 | |
|---|---|---|
| 969 | 969 | |
| 970 | 970 | // getters |
| 971 | 971 | ioport_diplocation *next() const { return m_next; } |
| 972 | const char *name() const { return m_name; } | |
| 972 | const char *name() const { return m_name.c_str(); } | |
| 973 | 973 | UINT8 number() const { return m_number; } |
| 974 | 974 | bool inverted() const { return m_invert; } |
| 975 | 975 | |
| r245640 | r245641 | |
| 1197 | 1197 | device_t &device() const { return m_device; } |
| 1198 | 1198 | running_machine &machine() const; |
| 1199 | 1199 | ioport_field *first_field() const { return m_fieldlist.first(); } |
| 1200 | const char *tag() const { return m_tag; } | |
| 1200 | const char *tag() const { return m_tag.c_str(); } | |
| 1201 | 1201 | int modcount() const { return m_modcount; } |
| 1202 | 1202 | ioport_value active() const { return m_active; } |
| 1203 | 1203 | ioport_value active_safe(ioport_value defval) const { return (this == NULL) ? defval : active(); } |
| r245640 | r245641 | |
|---|---|---|
| 195 | 195 | else |
| 196 | 196 | m_context.cpy("(no context)"); |
| 197 | 197 | |
| 198 | return m_context; | |
| 198 | return m_context.c_str(); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback) |
| r245640 | r245641 | |
| 206 | 206 | else if (strlen(options().autoboot_command())!=0) { |
| 207 | 207 | astring cmd = astring(options().autoboot_command()); |
| 208 | 208 | cmd.replace("'","\\'"); |
| 209 | astring val = astring("emu.keypost('",cmd,"')"); | |
| 210 | manager().lua()->load_string(val); | |
| 209 | astring val = astring("emu.keypost('", cmd.c_str(), "')").c_str(); | |
| 210 | manager().lua()->load_string(val.c_str()); | |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| r245640 | r245641 | |
| 560 | 560 | |
| 561 | 561 | // handle %d in the template (for image devices) |
| 562 | 562 | astring statename_dev("%d_"); |
| 563 | int pos = statename_str.find(0, statename_dev); | |
| 563 | int pos = statename_str.find(0, statename_dev.c_str()); | |
| 564 | 564 | |
| 565 | 565 | if (pos != -1) |
| 566 | 566 | { |
| 567 | 567 | // if more %d are found, revert to default and ignore them all |
| 568 | if (statename_str.find(pos + 3, statename_dev) != -1) | |
| 568 | if (statename_str.find(pos + 3, statename_dev.c_str()) != -1) | |
| 569 | 569 | statename_str.cpy("%g"); |
| 570 | 570 | // else if there is a single %d, try to create the correct snapname |
| 571 | 571 | else |
| r245640 | r245641 | |
| 610 | 610 | astring filename(image->basename_noext()); |
| 611 | 611 | |
| 612 | 612 | // setup snapname and remove the %d_ |
| 613 | statename_str.replace(0, devname_str, filename); | |
| 613 | statename_str.replace(0, devname_str.c_str(), filename.c_str()); | |
| 614 | 614 | statename_str.del(pos, 3); |
| 615 | 615 | //printf("check image: %s\n", filename.c_str()); |
| 616 | 616 | |
| r245640 | r245641 | |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | // open the file |
| 912 | filerr = file.open(m_saveload_pending_file); | |
| 912 | filerr = file.open(m_saveload_pending_file.c_str()); | |
| 913 | 913 | if (filerr == FILERR_NONE) |
| 914 | 914 | { |
| 915 | 915 | // read/write the save state |
| r245640 | r245641 | |
| 1237 | 1237 | { |
| 1238 | 1238 | astring filename; |
| 1239 | 1239 | emu_file file(options().nvram_directory(), OPEN_FLAG_READ); |
| 1240 | if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) | |
| 1240 | if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) | |
| 1241 | 1241 | { |
| 1242 | 1242 | nvram->nvram_load(file); |
| 1243 | 1243 | file.close(); |
| r245640 | r245641 | |
| 1259 | 1259 | { |
| 1260 | 1260 | astring filename; |
| 1261 | 1261 | emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1262 | if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) | |
| 1262 | if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) | |
| 1263 | 1263 | { |
| 1264 | 1264 | nvram->nvram_save(file); |
| 1265 | 1265 | file.close(); |
| r245640 | r245641 | |
|---|---|---|
| 180 | 180 | bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); } |
| 181 | 181 | bool exit_pending() const { return m_exit_pending; } |
| 182 | 182 | bool ui_active() const { return m_ui_active; } |
| 183 | const char *basename() const { return m_basename; } | |
| 183 | const char *basename() const { return m_basename.c_str(); } | |
| 184 | 184 | int sample_rate() const { return m_sample_rate; } |
| 185 | 185 | bool save_or_load_pending() const { return m_saveload_pending_file; } |
| 186 | 186 | screen_device *first_screen() const { return primary_screen; } |
| r245640 | r245641 | |
|---|---|---|
| 762 | 762 | |
| 763 | 763 | // extract the metadata |
| 764 | 764 | int fps, fpsfrac, interlaced, channels; |
| 765 | if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &m_width, &m_height, &interlaced, &channels, &m_samplerate) != 7) | |
| 765 | if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &m_width, &m_height, &interlaced, &channels, &m_samplerate) != 7) | |
| 766 | 766 | throw emu_fatalerror("Invalid metadata in CHD file"); |
| 767 | 767 | else |
| 768 | 768 | m_fps_times_1million = fps * 1000000 + fpsfrac; |
| r245640 | r245641 | |
|---|---|---|
| 64 | 64 | void wozfdc_device::device_start() |
| 65 | 65 | { |
| 66 | 66 | astring tempstring; |
| 67 | m_rom_p6 = machine().root_device().memregion(this->subtag(tempstring, DISKII_P6_REGION))->base(); | |
| 67 | m_rom_p6 = machine().root_device().memregion(this->subtag(tempstring, DISKII_P6_REGION).c_str())->base(); | |
| 68 | 68 | |
| 69 | 69 | timer = timer_alloc(0); |
| 70 | 70 | delay_timer = timer_alloc(1); |
| r245640 | r245641 | |
|---|---|---|
| 1840 | 1840 | { |
| 1841 | 1841 | VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.c_str(), entry->m_byteend + 1 - entry->m_bytestart)); |
| 1842 | 1842 | memory_share *share = global_alloc(memory_share(m_map->m_databits, entry->m_byteend + 1 - entry->m_bytestart, endianness())); |
| 1843 | manager().m_sharelist.append(fulltag, *share); | |
| 1843 | manager().m_sharelist.append(fulltag.c_str(), *share); | |
| 1844 | 1844 | } |
| 1845 | 1845 | } |
| 1846 | 1846 | |
| r245640 | r245641 | |
| 1863 | 1863 | entry->m_devbase.subtag(fulltag, entry->m_region); |
| 1864 | 1864 | |
| 1865 | 1865 | // find the region |
| 1866 | memory_region *region = machine().root_device().memregion(fulltag); | |
| 1866 | memory_region *region = machine().root_device().memregion(fulltag.c_str()); | |
| 1867 | 1867 | if (region == NULL) |
| 1868 | 1868 | fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"\n", m_device.tag(), m_name, entry->m_addrstart, entry->m_addrend, entry->m_region); |
| 1869 | 1869 | |
| r245640 | r245641 | |
| 2293 | 2293 | { |
| 2294 | 2294 | // find the port |
| 2295 | 2295 | astring fulltag; |
| 2296 | ioport_port *port = machine().root_device().ioport(device().siblingtag(fulltag, rtag)); | |
| 2296 | ioport_port *port = machine().root_device().ioport(device().siblingtag(fulltag, rtag).c_str()); | |
| 2297 | 2297 | if (port == NULL) |
| 2298 | 2298 | throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_name, m_device.tag()); |
| 2299 | 2299 | |
| r245640 | r245641 | |
| 2305 | 2305 | { |
| 2306 | 2306 | // find the port |
| 2307 | 2307 | astring fulltag; |
| 2308 | ioport_port *port = machine().root_device().ioport(device().siblingtag(fulltag, wtag)); | |
| 2308 | ioport_port *port = machine().root_device().ioport(device().siblingtag(fulltag, wtag).c_str()); | |
| 2309 | 2309 | if (port == NULL) |
| 2310 | 2310 | fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_name, m_device.tag()); |
| 2311 | 2311 | |
| r245640 | r245641 | |
| 2335 | 2335 | { |
| 2336 | 2336 | astring fulltag; |
| 2337 | 2337 | device().siblingtag(fulltag, rtag); |
| 2338 | memory_bank &bank = bank_find_or_allocate(fulltag, addrstart, addrend, addrmask, addrmirror, ROW_READ); | |
| 2338 | memory_bank &bank = bank_find_or_allocate(fulltag.c_str(), addrstart, addrend, addrmask, addrmirror, ROW_READ); | |
| 2339 | 2339 | read().map_range(addrstart, addrend, addrmask, addrmirror, bank.index()); |
| 2340 | 2340 | } |
| 2341 | 2341 | |
| r245640 | r245641 | |
| 2344 | 2344 | { |
| 2345 | 2345 | astring fulltag; |
| 2346 | 2346 | device().siblingtag(fulltag, wtag); |
| 2347 | memory_bank &bank = bank_find_or_allocate(fulltag, addrstart, addrend, addrmask, addrmirror, ROW_WRITE); | |
| 2347 | memory_bank &bank = bank_find_or_allocate(fulltag.c_str(), addrstart, addrend, addrmask, addrmirror, ROW_WRITE); | |
| 2348 | 2348 | write().map_range(addrstart, addrend, addrmask, addrmirror, bank.index()); |
| 2349 | 2349 | } |
| 2350 | 2350 | |
| r245640 | r245641 | |
| 2681 | 2681 | membank = global_alloc(memory_bank(*this, banknum, bytestart, byteend, tag)); |
| 2682 | 2682 | astring temptag; |
| 2683 | 2683 | if (tag == NULL) |
| 2684 | tag = temptag.format("anon_%p", membank); | |
| 2684 | tag = temptag.format("anon_%p", membank).c_str(); | |
| 2685 | 2685 | manager().m_banklist.append(tag, *membank); |
| 2686 | 2686 | } |
| 2687 | 2687 | |
| r245640 | r245641 | |
| 3874 | 3874 | int bytes_per_element = space.data_width() / 8; |
| 3875 | 3875 | astring name; |
| 3876 | 3876 | name.printf("%08x-%08x", bytestart, byteend); |
| 3877 | space.machine().save().save_memory(NULL, "memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); | |
| 3877 | space.machine().save().save_memory(NULL, "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); | |
| 3878 | 3878 | } |
| 3879 | 3879 | } |
| 3880 | 3880 | |
| r245640 | r245641 | |
| 3921 | 3921 | } |
| 3922 | 3922 | |
| 3923 | 3923 | if (!m_anonymous && space.machine().save().registration_allowed()) |
| 3924 | space.machine().save().save_item(NULL, "memory", m_tag, 0, NAME(m_curentry)); | |
| 3924 | space.machine().save().save_item(NULL, "memory", m_tag.c_str(), 0, NAME(m_curentry)); | |
| 3925 | 3925 | } |
| 3926 | 3926 | |
| 3927 | 3927 |
| r245640 | r245641 | |
|---|---|---|
| 587 | 587 | offs_t bytestart() const { return m_bytestart; } |
| 588 | 588 | void *base() const { return *m_baseptr; } |
| 589 | 589 | void *base_decrypted() const { return *m_basedptr; } |
| 590 | const char *tag() const { return m_tag; } | |
| 591 | const char *name() const { return m_name; } | |
| 590 | const char *tag() const { return m_tag.c_str(); } | |
| 591 | const char *name() const { return m_name.c_str(); } | |
| 592 | 592 | |
| 593 | 593 | // compare a range against our range |
| 594 | 594 | bool matches_exactly(offs_t bytestart, offs_t byteend) const { return (m_bytestart == bytestart && m_byteend == byteend); } |
| r245640 | r245641 | |
| 695 | 695 | UINT8 *base() { return (this != NULL) ? &m_buffer[0] : NULL; } |
| 696 | 696 | UINT8 *end() { return (this != NULL) ? base() + m_buffer.count() : NULL; } |
| 697 | 697 | UINT32 bytes() const { return (this != NULL) ? m_buffer.count() : 0; } |
| 698 | const char *name() const { return m_name; } | |
| 698 | const char *name() const { return m_name.c_str(); } | |
| 699 | 699 | |
| 700 | 700 | // flag expansion |
| 701 | 701 | endianness_t endianness() const { return m_endianness; } |
| r245640 | r245641 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | /* use the hash as a starting point and find an entry */ |
| 101 | 101 | for (item = itemtable[hash % HASH_SIZE]; item != NULL; item = item->next) |
| 102 | if (item->hash == hash && strcmp(string, item->name) == 0) | |
| 102 | if (item->hash == hash && strcmp(string, item->name.c_str()) == 0) | |
| 103 | 103 | return item; |
| 104 | 104 | |
| 105 | 105 | return NULL; |
| r245640 | r245641 | |
| 333 | 333 | /* remove all items */ |
| 334 | 334 | for (hash = 0; hash < HASH_SIZE; hash++) |
| 335 | 335 | for (item = itemtable[hash]; item != NULL; item = item->next) |
| 336 | (*callback)(item->name, item->value, param); | |
| 336 | (*callback)(item->name.c_str(), item->value, param); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | |
| r245640 | r245641 | |
| 367 | 367 | for (hash = 0; hash < HASH_SIZE; hash++) |
| 368 | 368 | for (item = itemtable[hash]; item != NULL; item = item->next) |
| 369 | 369 | if (item->id == id) |
| 370 | return item->name; | |
| 370 | return item->name.c_str(); | |
| 371 | 371 | |
| 372 | 372 | /* nothing found, return NULL */ |
| 373 | 373 | return NULL; |
| r245640 | r245641 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | astring parameters_manager::lookup(astring tag) const |
| 19 | 19 | { |
| 20 | return m_parameters.find(tag); | |
| 20 | return m_parameters.find(tag.c_str()); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | void parameters_manager::add(astring tag, astring value) |
| 24 | 24 | { |
| 25 | m_parameters.add(tag, value); | |
| 25 | m_parameters.add(tag.c_str(), value); | |
| 26 | 26 | } |
| r245640 | r245641 | |
|---|---|---|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | stop(); |
| 133 | return m_text; | |
| 133 | return m_text.c_str(); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 |
| r245640 | r245641 | |
|---|---|---|
| 1577 | 1577 | |
| 1578 | 1578 | // attempt to open the file; bail if we can't |
| 1579 | 1579 | emu_file layoutfile(manager().machine().options().art_path(), OPEN_FLAG_READ); |
| 1580 | file_error filerr = layoutfile.open(fname); | |
| 1580 | file_error filerr = layoutfile.open(fname.c_str()); | |
| 1581 | 1581 | if (filerr != FILERR_NONE) |
| 1582 | 1582 | return false; |
| 1583 | 1583 |
| r245640 | r245641 | |
|---|---|---|
| 392 | 392 | // attempt to open the cached version of the font |
| 393 | 393 | { |
| 394 | 394 | emu_file cachefile(manager().machine().options().font_path(), OPEN_FLAG_READ); |
| 395 | filerr = cachefile.open(cachedname); | |
| 395 | filerr = cachefile.open(cachedname.c_str()); | |
| 396 | 396 | if (filerr == FILERR_NONE) |
| 397 | 397 | { |
| 398 | 398 | // if we have a cached version, load it |
| r245640 | r245641 | |
| 427 | 427 | |
| 428 | 428 | // if we loaded okay, create a cached one |
| 429 | 429 | if (result) |
| 430 | save_cached(cachedname, hash); | |
| 430 | save_cached(cachedname.c_str(), hash); | |
| 431 | 431 | |
| 432 | 432 | // close the file |
| 433 | 433 | return result; |
| r245640 | r245641 | |
|---|---|---|
| 910 | 910 | |
| 911 | 911 | while (1) |
| 912 | 912 | { |
| 913 | width = font->string_width(bounds.height(), aspect, m_string); | |
| 913 | width = font->string_width(bounds.height(), aspect, m_string.c_str()); | |
| 914 | 914 | if (width < bounds.width()) |
| 915 | 915 | break; |
| 916 | 916 | aspect *= 0.9f; |
| r245640 | r245641 | |
| 941 | 941 | bitmap_argb32 tempbitmap(dest.width(), dest.height()); |
| 942 | 942 | |
| 943 | 943 | // loop over characters |
| 944 | for (const char *s = m_string; *s != 0; s++) | |
| 944 | for (const char *s = m_string.c_str(); *s != 0; s++) | |
| 945 | 945 | { |
| 946 | 946 | // get the font bitmap |
| 947 | 947 | rectangle chbounds; |
| r245640 | r245641 | |
| 1048 | 1048 | { |
| 1049 | 1049 | while (1) |
| 1050 | 1050 | { |
| 1051 | width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]); | |
| 1051 | width = font->string_width(ourheight / num_shown, aspect, m_stopnames[fruit].c_str()); | |
| 1052 | 1052 | if (width < bounds.width()) |
| 1053 | 1053 | break; |
| 1054 | 1054 | aspect *= 0.9f; |
| r245640 | r245641 | |
| 1100 | 1100 | bitmap_argb32 tempbitmap(dest.width(), dest.height()); |
| 1101 | 1101 | |
| 1102 | 1102 | // loop over characters |
| 1103 | for (const char *s = m_stopnames[fruit]; *s != 0; s++) | |
| 1103 | for (const char *s = m_stopnames[fruit].c_str(); *s != 0; s++) | |
| 1104 | 1104 | { |
| 1105 | 1105 | // get the font bitmap |
| 1106 | 1106 | rectangle chbounds; |
| r245640 | r245641 | |
| 1198 | 1198 | { |
| 1199 | 1199 | while (1) |
| 1200 | 1200 | { |
| 1201 | width = font->string_width(dest.height(), aspect, m_stopnames[fruit]); | |
| 1201 | width = font->string_width(dest.height(), aspect, m_stopnames[fruit].c_str()); | |
| 1202 | 1202 | if (width < bounds.width()) |
| 1203 | 1203 | break; |
| 1204 | 1204 | aspect *= 0.9f; |
| r245640 | r245641 | |
| 1250 | 1250 | bitmap_argb32 tempbitmap(dest.width(), dest.height()); |
| 1251 | 1251 | |
| 1252 | 1252 | // loop over characters |
| 1253 | for (const char *s = m_stopnames[fruit]; *s != 0; s++) | |
| 1253 | for (const char *s = m_stopnames[fruit].c_str(); *s != 0; s++) | |
| 1254 | 1254 | { |
| 1255 | 1255 | // get the font bitmap |
| 1256 | 1256 | rectangle chbounds; |
| r245640 | r245641 | |
| 1310 | 1310 | { |
| 1311 | 1311 | // load the basic bitmap |
| 1312 | 1312 | assert(m_file[0] != NULL); |
| 1313 | m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]); | |
| 1313 | m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname.c_str(), m_imagefile[0].c_str()); | |
| 1314 | 1314 | |
| 1315 | 1315 | // load the alpha bitmap if specified |
| 1316 | 1316 | if (m_bitmap[0].valid() && m_alphafile[0]) |
| 1317 | render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true); | |
| 1317 | render_load_png(m_bitmap[0], *m_file[0], m_dirname.c_str(), m_alphafile[0].c_str(), true); | |
| 1318 | 1318 | |
| 1319 | 1319 | // if we can't load the bitmap, allocate a dummy one and report an error |
| 1320 | 1320 | if (!m_bitmap[0].valid()) |
| r245640 | r245641 | |
| 1339 | 1339 | { |
| 1340 | 1340 | // load the basic bitmap |
| 1341 | 1341 | assert(m_file != NULL); |
| 1342 | /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]); | |
| 1342 | /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname.c_str(), m_imagefile[number].c_str()); | |
| 1343 | 1343 | |
| 1344 | 1344 | // load the alpha bitmap if specified |
| 1345 | 1345 | //if (m_bitmap[number].valid() && m_alphafile[number]) |
| r245640 | r245641 | |
| 2346 | 2346 | } |
| 2347 | 2347 | m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0); |
| 2348 | 2348 | if (m_output_name[0] != 0 && m_element != NULL) |
| 2349 | output_set_value(m_output_name, m_element->default_state()); | |
| 2349 | output_set_value(m_output_name.c_str(), m_element->default_state()); | |
| 2350 | 2350 | parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds); |
| 2351 | 2351 | parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color); |
| 2352 | 2352 | parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation); |
| r245640 | r245641 | |
| 2396 | 2396 | |
| 2397 | 2397 | // if configured to an output, fetch the output value |
| 2398 | 2398 | if (m_output_name[0] != 0) |
| 2399 | state = output_get_value(m_output_name); | |
| 2399 | state = output_get_value(m_output_name.c_str()); | |
| 2400 | 2400 | |
| 2401 | 2401 | // if configured to an input, fetch the input value |
| 2402 | 2402 | else if (m_input_tag[0] != 0) |
| 2403 | 2403 | { |
| 2404 | ioport_port *port = m_element->machine().root_device().ioport(m_input_tag); | |
| 2404 | ioport_port *port = m_element->machine().root_device().ioport(m_input_tag.c_str()); | |
| 2405 | 2405 | if (port != NULL) |
| 2406 | 2406 | { |
| 2407 | 2407 | ioport_field *field = port->field(m_input_mask); |
| r245640 | r245641 | |
|---|---|---|
| 52 | 52 | |
| 53 | 53 | // getters |
| 54 | 54 | layout_element *next() const { return m_next; } |
| 55 | const char *name() const { return m_name; } | |
| 55 | const char *name() const { return m_name.c_str(); } | |
| 56 | 56 | running_machine &machine() const { return m_machine; } |
| 57 | 57 | int default_state() const { return m_defstate; } |
| 58 | 58 | int maxstate() const { return m_maxstate; } |
| r245640 | r245641 | |
| 208 | 208 | int orientation() const { return m_orientation; } |
| 209 | 209 | render_container *screen_container(running_machine &machine) const; |
| 210 | 210 | bool has_input() const { return bool(m_input_tag); } |
| 211 | const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; } | |
| 211 | const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag.c_str(); } | |
| 212 | 212 | |
| 213 | 213 | // fetch state based on configured source |
| 214 | 214 | int state() const; |
| r245640 | r245641 | |
| 234 | 234 | // getters |
| 235 | 235 | layout_view *next() const { return m_next; } |
| 236 | 236 | item *first_item(item_layer layer) const; |
| 237 | const char *name() const { return m_name; } | |
| 237 | const char *name() const { return m_name.c_str(); } | |
| 238 | 238 | const render_screen_list &screens() const { return m_screens; } |
| 239 | 239 | bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; } |
| 240 | 240 |
| r245640 | r245641 | |
|---|---|---|
| 542 | 542 | fname.cpy(filename); |
| 543 | 543 | else |
| 544 | 544 | fname.cpy(dirname).cat(PATH_SEPARATOR).cat(filename); |
| 545 | file_error filerr = file.open(fname); | |
| 545 | file_error filerr = file.open(fname.c_str()); | |
| 546 | 546 | if (filerr != FILERR_NONE) |
| 547 | 547 | return false; |
| 548 | 548 |
| r245640 | r245641 | |
|---|---|---|
| 44 | 44 | m_region(region) { } |
| 45 | 45 | |
| 46 | 46 | open_chd *next() const { return m_next; } |
| 47 | const char *region() const { return m_region; } | |
| 47 | const char *region() const { return m_region.c_str(); } | |
| 48 | 48 | chd_file &chd() { return m_diffchd.opened() ? m_diffchd : m_origchd; } |
| 49 | 49 | chd_file &orig_chd() { return m_origchd; } |
| 50 | 50 | chd_file &diff_chd() { return m_diffchd; } |
| r245640 | r245641 | |
| 1125 | 1125 | image_file.close(); |
| 1126 | 1126 | |
| 1127 | 1127 | /* try to open the CHD */ |
| 1128 | err = image_chd.open(fullpath); | |
| 1128 | err = image_chd.open(fullpath.c_str()); | |
| 1129 | 1129 | if (err == CHDERR_NONE) |
| 1130 | 1130 | return err; |
| 1131 | 1131 | } |
| r245640 | r245641 | |
| 1163 | 1163 | image_file.close(); |
| 1164 | 1164 | |
| 1165 | 1165 | /* try to open the CHD */ |
| 1166 | err = image_chd.open(fullpath); | |
| 1166 | err = image_chd.open(fullpath.c_str()); | |
| 1167 | 1167 | if (err == CHDERR_NONE) |
| 1168 | 1168 | return err; |
| 1169 | 1169 | } |
| r245640 | r245641 | |
| 1184 | 1184 | /* try to open the diff */ |
| 1185 | 1185 | LOG(("Opening differencing image file: %s\n", fname.c_str())); |
| 1186 | 1186 | emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE); |
| 1187 | file_error filerr = diff_file.open(fname); | |
| 1187 | file_error filerr = diff_file.open(fname.c_str()); | |
| 1188 | 1188 | if (filerr == FILERR_NONE) |
| 1189 | 1189 | { |
| 1190 | 1190 | astring fullpath(diff_file.fullpath()); |
| 1191 | 1191 | diff_file.close(); |
| 1192 | 1192 | |
| 1193 | 1193 | LOG(("Opening differencing image file: %s\n", fullpath.c_str())); |
| 1194 | return diff_chd.open(fullpath, true, &source); | |
| 1194 | return diff_chd.open(fullpath.c_str(), true, &source); | |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | /* didn't work; try creating it instead */ |
| 1198 | 1198 | LOG(("Creating differencing image: %s\n", fname.c_str())); |
| 1199 | 1199 | diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1200 | filerr = diff_file.open(fname); | |
| 1200 | filerr = diff_file.open(fname.c_str()); | |
| 1201 | 1201 | if (filerr == FILERR_NONE) |
| 1202 | 1202 | { |
| 1203 | 1203 | astring fullpath(diff_file.fullpath()); |
| r245640 | r245641 | |
| 1206 | 1206 | /* create the CHD */ |
| 1207 | 1207 | LOG(("Creating differencing image file: %s\n", fullpath.c_str())); |
| 1208 | 1208 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 1209 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 1209 | chd_error err = diff_chd.create(fullpath.c_str(), source.logical_bytes(), source.hunk_bytes(), compression, source); | |
| 1210 | 1210 | if (err != CHDERR_NONE) |
| 1211 | 1211 | return err; |
| 1212 | 1212 | |
| r245640 | r245641 | |
| 1393 | 1393 | /* if this is a device region, override with the device width and endianness */ |
| 1394 | 1394 | endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; |
| 1395 | 1395 | UINT8 width = ROMREGION_GETWIDTH(region) / 8; |
| 1396 | memory_region *memregion = romdata->machine().root_device().memregion(regiontag); | |
| 1396 | memory_region *memregion = romdata->machine().root_device().memregion(regiontag.c_str()); | |
| 1397 | 1397 | if (memregion != NULL) |
| 1398 | 1398 | { |
| 1399 | if (romdata->machine().device(regiontag) != NULL) | |
| 1400 | normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); | |
| 1399 | if (romdata->machine().device(regiontag.c_str()) != NULL) | |
| 1400 | normalize_flags_for_device(romdata->machine(), regiontag.c_str(), width, endianness); | |
| 1401 | 1401 | |
| 1402 | 1402 | /* clear old region (todo: should be moved to an image unload function) */ |
| 1403 | 1403 | romdata->machine().memory().region_free(memregion->name()); |
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | /* remember the base and length */ |
| 1407 | romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness); | |
| 1407 | romdata->region = romdata->machine().memory().region_alloc(regiontag.c_str(), regionlength, width, endianness); | |
| 1408 | 1408 | LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); |
| 1409 | 1409 | |
| 1410 | 1410 | /* clear the region if it's requested */ |
| r245640 | r245641 | |
| 1430 | 1430 | |
| 1431 | 1431 | /* now process the entries in the region */ |
| 1432 | 1432 | if (ROMREGION_ISROMDATA(region)) |
| 1433 | process_rom_entries(romdata, locationtag, region, region + 1, &device, TRUE); | |
| 1433 | process_rom_entries(romdata, locationtag.c_str(), region, region + 1, &device, TRUE); | |
| 1434 | 1434 | else if (ROMREGION_ISDISKDATA(region)) |
| 1435 | process_disk_entries(romdata, regiontag, region, region + 1, locationtag); | |
| 1435 | process_disk_entries(romdata, regiontag.c_str(), region, region + 1, locationtag.c_str()); | |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | /* now go back and post-process all the regions */ |
| r245640 | r245641 | |
| 1473 | 1473 | /* if this is a device region, override with the device width and endianness */ |
| 1474 | 1474 | UINT8 width = ROMREGION_GETWIDTH(region) / 8; |
| 1475 | 1475 | endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; |
| 1476 | if (romdata->machine().device(regiontag) != NULL) | |
| 1477 | normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); | |
| 1476 | if (romdata->machine().device(regiontag.c_str()) != NULL) | |
| 1477 | normalize_flags_for_device(romdata->machine(), regiontag.c_str(), width, endianness); | |
| 1478 | 1478 | |
| 1479 | 1479 | /* remember the base and length */ |
| 1480 | romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness); | |
| 1480 | romdata->region = romdata->machine().memory().region_alloc(regiontag.c_str(), regionlength, width, endianness); | |
| 1481 | 1481 | LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); |
| 1482 | 1482 | |
| 1483 | 1483 | /* clear the region if it's requested */ |
| r245640 | r245641 | |
| 1498 | 1498 | process_rom_entries(romdata, device->shortname(), region, region + 1, device, FALSE); |
| 1499 | 1499 | } |
| 1500 | 1500 | else if (ROMREGION_ISDISKDATA(region)) |
| 1501 | process_disk_entries(romdata, regiontag, region, region + 1, NULL); | |
| 1501 | process_disk_entries(romdata, regiontag.c_str(), region, region + 1, NULL); | |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | /* now go back and post-process all the regions */ |
| r245640 | r245641 | |
| 1506 | 1506 | for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region)) |
| 1507 | 1507 | { |
| 1508 | 1508 | rom_region_name(regiontag, *device, region); |
| 1509 | region_post_process(romdata, regiontag, ROMREGION_ISINVERTED(region)); | |
| 1509 | region_post_process(romdata, regiontag.c_str(), ROMREGION_ISINVERTED(region)); | |
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | /* and finally register all per-game parameters */ |
| r245640 | r245641 | |
|---|---|---|
| 96 | 96 | valsize = entry->m_typesize; |
| 97 | 97 | valcount = entry->m_typecount; |
| 98 | 98 | |
| 99 | return entry->m_name; | |
| 99 | return entry->m_name.c_str(); | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| r245640 | r245641 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // insert us into the list |
| 186 | m_entry_list.insert_after(*global_alloc(state_entry(val, totalname, device, module, tag ? tag : "", index, valsize, valcount)), insert_after); | |
| 186 | m_entry_list.insert_after(*global_alloc(state_entry(val, totalname.c_str(), device, module, tag ? tag : "", index, valsize, valcount)), insert_after); | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 |
| r245640 | r245641 | |
|---|---|---|
| 268 | 268 | inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name) |
| 269 | 269 | { |
| 270 | 270 | astring tempstr(name, ".attoseconds"); |
| 271 | save_memory(device, module, tag, index, tempstr, &value.attoseconds, sizeof(value.attoseconds)); | |
| 271 | save_memory(device, module, tag, index, tempstr.c_str(), &value.attoseconds, sizeof(value.attoseconds)); | |
| 272 | 272 | tempstr.cpy(name).cat(".seconds"); |
| 273 | save_memory(device, module, tag, index, tempstr, &value.seconds, sizeof(value.seconds)); | |
| 273 | save_memory(device, module, tag, index, tempstr.c_str(), &value.seconds, sizeof(value.seconds)); | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 |
| r245640 | r245641 | |
|---|---|---|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // save the bits |
| 263 | machine().save().save_item(m_device, "timer", name, index, NAME(m_param)); | |
| 264 | machine().save().save_item(m_device, "timer", name, index, NAME(m_enabled)); | |
| 265 | machine().save().save_item(m_device, "timer", name, index, NAME(m_period)); | |
| 266 | machine().save().save_item(m_device, "timer", name, index, NAME(m_start)); | |
| 267 | machine().save().save_item(m_device, "timer", name, index, NAME(m_expire)); | |
| 263 | machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_param)); | |
| 264 | machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_enabled)); | |
| 265 | machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_period)); | |
| 266 | machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_start)); | |
| 267 | machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_expire)); | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
| r245640 | r245641 | |
| 755 | 755 | // if the configuration specifies a device to make perfect, pick that as the minimum |
| 756 | 756 | if (machine().config().m_perfect_cpu_quantum) |
| 757 | 757 | { |
| 758 | device_t *device = machine().device(machine().config().m_perfect_cpu_quantum); | |
| 758 | device_t *device = machine().device(machine().config().m_perfect_cpu_quantum.c_str()); | |
| 759 | 759 | if (device == NULL) |
| 760 | 760 | fatalerror("Device '%s' specified for perfect interleave is not present!\n", machine().config().m_perfect_cpu_quantum.c_str()); |
| 761 | 761 |
| r245640 | r245641 | |
|---|---|---|
| 1054 | 1054 | |
| 1055 | 1055 | // load the file |
| 1056 | 1056 | emu_file file(machine().options().art_path(), OPEN_FLAG_READ); |
| 1057 | render_load_png(m_screen_overlay_bitmap, file, NULL, fullname); | |
| 1057 | render_load_png(m_screen_overlay_bitmap, file, NULL, fullname.c_str()); | |
| 1058 | 1058 | if (m_screen_overlay_bitmap.valid()) |
| 1059 | 1059 | m_container->set_overlay(&m_screen_overlay_bitmap); |
| 1060 | 1060 | else |
| r245640 | r245641 | |
|---|---|---|
| 156 | 156 | for (int start = 0, end = filt.chr(start, ','); end != -1; start = end + 1, end = filt.chr(start, ',')) |
| 157 | 157 | { |
| 158 | 158 | astring token(filt, start, end - start + 1); |
| 159 | if (comp.find(0, token) != -1) | |
| 159 | if (comp.find(0, token.c_str()) != -1) | |
| 160 | 160 | return true; |
| 161 | 161 | } |
| 162 | 162 | return false; |
| r245640 | r245641 | |
| 179 | 179 | |
| 180 | 180 | // then add a comma to the end of our interface and return true if we find it in the list string |
| 181 | 181 | astring our_interface(m_interface, ","); |
| 182 | return (interfaces.find(0, our_interface) != -1); | |
| 182 | return (interfaces.find(0, our_interface.c_str()) != -1); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
| r245640 | r245641 | |
| 476 | 476 | m_errors.reset(); |
| 477 | 477 | |
| 478 | 478 | // attempt to open the file |
| 479 | file_error filerr = m_file.open(m_list_name, ".xml"); | |
| 479 | file_error filerr = m_file.open(m_list_name.c_str(), ".xml"); | |
| 480 | 480 | if (filerr == FILERR_NONE) |
| 481 | 481 | { |
| 482 | 482 | // parse if no error |
| r245640 | r245641 | |
| 500 | 500 | { |
| 501 | 501 | // add to the global map whenever we check a list so we don't re-check |
| 502 | 502 | // it in the future |
| 503 | if (valid.already_checked(astring("softlist/", m_list_name.c_str()))) | |
| 503 | if (valid.already_checked(astring("softlist/", m_list_name.c_str()).c_str())) | |
| 504 | 504 | return; |
| 505 | 505 | |
| 506 | 506 | // do device validation only in case of validate command |
| r245640 | r245641 | |
| 1172 | 1172 | else if (loadflag != NULL && strcmp(loadflag, "load32_byte") == 0) |
| 1173 | 1173 | romflags = ROM_SKIP(3); |
| 1174 | 1174 | |
| 1175 | add_rom_entry(name, hashdata, offset, length, ROMENTRYTYPE_ROM | romflags); | |
| 1175 | add_rom_entry(name, hashdata.c_str(), offset, length, ROMENTRYTYPE_ROM | romflags); | |
| 1176 | 1176 | } |
| 1177 | 1177 | else |
| 1178 | 1178 | parse_error("Rom name missing"); |
| r245640 | r245641 | |
| 1200 | 1200 | astring hashdata; |
| 1201 | 1201 | hashdata.printf( "%c%s%s", hash_collection::HASH_SHA1, sha1, (nodump ? NO_DUMP : (baddump ? BAD_DUMP : ""))); |
| 1202 | 1202 | |
| 1203 | add_rom_entry(name, hashdata, 0, 0, ROMENTRYTYPE_ROM | (writeable ? DISK_READWRITE : DISK_READONLY)); | |
| 1203 | add_rom_entry(name, hashdata.c_str(), 0, 0, ROMENTRYTYPE_ROM | (writeable ? DISK_READWRITE : DISK_READONLY)); | |
| 1204 | 1204 | } |
| 1205 | 1205 | else if (status == NULL || !strcmp(status, "nodump")) // a no_dump chd is not an incomplete entry |
| 1206 | 1206 | parse_error("Incomplete disk definition"); |
| r245640 | r245641 | |
| 1225 | 1225 | |
| 1226 | 1226 | // <description> |
| 1227 | 1227 | if (strcmp(tagname, "description") == 0) |
| 1228 | m_current_info->m_longname = m_list.add_string(m_data_accum); | |
| 1228 | m_current_info->m_longname = m_list.add_string(m_data_accum.c_str()); | |
| 1229 | 1229 | |
| 1230 | 1230 | // <year> |
| 1231 | 1231 | else if (strcmp(tagname, "year") == 0) |
| 1232 | m_current_info->m_year = m_list.add_string(m_data_accum); | |
| 1232 | m_current_info->m_year = m_list.add_string(m_data_accum.c_str()); | |
| 1233 | 1233 | |
| 1234 | 1234 | // <publisher> |
| 1235 | 1235 | else if (strcmp(tagname, "publisher") == 0) |
| 1236 | m_current_info->m_publisher = m_list.add_string(m_data_accum); | |
| 1236 | m_current_info->m_publisher = m_list.add_string(m_data_accum.c_str()); | |
| 1237 | 1237 | |
| 1238 | 1238 | // </part> |
| 1239 | 1239 | else if (strcmp(tagname, "part") == 0) |
| r245640 | r245641 | |
|---|---|---|
| 193 | 193 | static void static_set_filter(device_t &device, const char *filter); |
| 194 | 194 | |
| 195 | 195 | // getters |
| 196 | const char *list_name() const { return m_list_name; } | |
| 196 | const char *list_name() const { return m_list_name.c_str(); } | |
| 197 | 197 | softlist_type list_type() const { return m_list_type; } |
| 198 | 198 | const char *filter() const { return m_filter; } |
| 199 | 199 | const char *filename() { return m_file.filename(); } |
| r245640 | r245641 | |
| 201 | 201 | // getters that may trigger a parse |
| 202 | 202 | const char *description() { if (!m_parsed) parse(); return m_description; } |
| 203 | 203 | bool valid() { if (!m_parsed) parse(); return m_infolist.count() > 0; } |
| 204 | const char *errors_string() { if (!m_parsed) parse(); return m_errors; } | |
| 204 | const char *errors_string() { if (!m_parsed) parse(); return m_errors.c_str(); } | |
| 205 | 205 | |
| 206 | 206 | // operations |
| 207 | 207 | software_info *find(const char *look_for, software_info *prev = NULL); |
| r245640 | r245641 | |
|---|---|---|
| 77 | 77 | // create a unique tag for saving |
| 78 | 78 | astring state_tag; |
| 79 | 79 | state_tag.printf("%d", m_device.machine().sound().m_stream_list.count()); |
| 80 | m_device.machine().save().save_item(&m_device, "stream", state_tag, 0, NAME(m_sample_rate)); | |
| 80 | m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), 0, NAME(m_sample_rate)); | |
| 81 | 81 | m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this)); |
| 82 | 82 | |
| 83 | 83 | // save the gain of each input and output |
| 84 | 84 | for (int inputnum = 0; inputnum < m_input.count(); inputnum++) |
| 85 | 85 | { |
| 86 | m_device.machine().save().save_item(&m_device, "stream", state_tag, inputnum, NAME(m_input[inputnum].m_gain)); | |
| 87 | m_device.machine().save().save_item(&m_device, "stream", state_tag, inputnum, NAME(m_input[inputnum].m_user_gain)); | |
| 86 | m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_gain)); | |
| 87 | m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_user_gain)); | |
| 88 | 88 | } |
| 89 | 89 | for (int outputnum = 0; outputnum < m_output.count(); outputnum++) |
| 90 | 90 | { |
| 91 | 91 | m_output[outputnum].m_stream = this; |
| 92 | m_device.machine().save().save_item(&m_device, "stream", state_tag, outputnum, NAME(m_output[outputnum].m_gain)); | |
| 92 | m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), outputnum, NAME(m_output[outputnum].m_gain)); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Mark synchronous streams as such |
| r245640 | r245641 | |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | return string; | |
| 194 | return string.c_str(); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 |
| r245640 | r245641 | |
|---|---|---|
| 157 | 157 | pcmbufa = region()->base(); |
| 158 | 158 | pcmsizea = region()->bytes(); |
| 159 | 159 | name.printf("%s.deltat", tag()); |
| 160 | pcmbufb = (void *)(machine().root_device().memregion(name)->base()); | |
| 161 | pcmsizeb = machine().root_device().memregion(name)->bytes(); | |
| 160 | pcmbufb = (void *)(machine().root_device().memregion(name.c_str())->base()); | |
| 161 | pcmsizeb = machine().root_device().memregion(name.c_str())->bytes(); | |
| 162 | 162 | if (pcmbufb == NULL || pcmsizeb == 0) |
| 163 | 163 | { |
| 164 | 164 | pcmbufb = pcmbufa; |
| r245640 | r245641 | |
|---|---|---|
| 3678 | 3678 | |
| 3679 | 3679 | /* setup PCM buffers again */ |
| 3680 | 3680 | name.printf("%s",dev->tag()); |
| 3681 | F2610->pcmbuf = (const UINT8 *)dev->machine().root_device().memregion(name)->base(); | |
| 3682 | F2610->pcm_size = dev->machine().root_device().memregion(name)->bytes(); | |
| 3681 | F2610->pcmbuf = (const UINT8 *)dev->machine().root_device().memregion(name.c_str())->base(); | |
| 3682 | F2610->pcm_size = dev->machine().root_device().memregion(name.c_str())->bytes(); | |
| 3683 | 3683 | name.printf("%s.deltat",dev->tag()); |
| 3684 | F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name)->base(); | |
| 3684 | F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name.c_str())->base(); | |
| 3685 | 3685 | if(F2610->deltaT.memory == NULL) |
| 3686 | 3686 | { |
| 3687 | 3687 | F2610->deltaT.memory = (UINT8*)F2610->pcmbuf; |
| 3688 | 3688 | F2610->deltaT.memory_size = F2610->pcm_size; |
| 3689 | 3689 | } |
| 3690 | 3690 | else |
| 3691 | F2610->deltaT.memory_size = dev->machine().root_device().memregion(name)->bytes(); | |
| 3691 | F2610->deltaT.memory_size = dev->machine().root_device().memregion(name.c_str())->bytes(); | |
| 3692 | 3692 | |
| 3693 | 3693 | /* Reset Prescaler */ |
| 3694 | 3694 | OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */ |
| r245640 | r245641 | |
|---|---|---|
| 56 | 56 | const char *new_barcode; |
| 57 | 57 | |
| 58 | 58 | // selected device |
| 59 | item_append(current_display_name(), "", current_display_flags(), ITEMREF_SELECT_READER); | |
| 59 | item_append(current_display_name().c_str(), "", current_display_flags(), ITEMREF_SELECT_READER); | |
| 60 | 60 | |
| 61 | 61 | // append the "New Barcode" item |
| 62 | 62 | if (get_selection() == ITEMREF_NEW_BARCODE) |
| 63 | 63 | { |
| 64 | 64 | buffer.cat(m_barcode_buffer); |
| 65 | new_barcode = buffer; | |
| 65 | new_barcode = buffer.c_str(); | |
| 66 | 66 | } |
| 67 | 67 | else |
| 68 | 68 | { |
| r245640 | r245641 | |
|---|---|---|
| 115 | 115 | { |
| 116 | 116 | UINT32 flags; |
| 117 | 117 | curcheat->menu_text(text, subtext, flags); |
| 118 | item_append(text, subtext, flags, curcheat); | |
| 118 | item_append(text.c_str(), subtext.c_str(), flags, curcheat); | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /* add a separator */ |
| r245640 | r245641 | |
|---|---|---|
| 279 | 279 | string.cat("[None]\n"); |
| 280 | 280 | |
| 281 | 281 | const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name()); |
| 282 | item_append(string, NULL, MENU_FLAG_MULTILINE, NULL); | |
| 282 | item_append(string.c_str(), NULL, MENU_FLAG_MULTILINE, NULL); | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | void ui_menu_device_config::handle() |
| r245640 | r245641 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | if (m_warnings) |
| 108 | 108 | { |
| 109 | item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL); | |
| 109 | item_append(m_warnings.c_str(), NULL, MENU_FLAG_DISABLE, NULL); | |
| 110 | 110 | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 111 | 111 | } |
| 112 | 112 | |
| r245640 | r245641 | |
| 139 | 139 | else |
| 140 | 140 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 141 | 141 | buffer.printf("[root%s]", dev->tag()); |
| 142 | item_append(buffer, NULL, 0, NULL); | |
| 142 | item_append(buffer.c_str(), NULL, 0, NULL); | |
| 143 | 143 | tag_appended = true; |
| 144 | 144 | } |
| 145 | 145 | // finally, append the image interface to the menu |
| 146 | 146 | fill_image_line(scan, tmp_inst, tmp_name); |
| 147 | item_append(tmp_inst, tmp_name, 0, (void *) | |
| 147 | item_append(tmp_inst.c_str(), tmp_name.c_str(), 0, (void *)scan); | |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } |
| r245640 | r245641 | |
|---|---|---|
| 246 | 246 | void ui_menu_file_create::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 247 | 247 | { |
| 248 | 248 | extra_text_render(container, top, bottom, origx1, origy1, origx2, origy2, |
| 249 | m_current_directory, | |
| 249 | m_current_directory.c_str(), | |
| 250 | 250 | NULL); |
| 251 | 251 | } |
| 252 | 252 | |
| r245640 | r245641 | |
| 265 | 265 | if (get_selection() == ITEMREF_NEW_IMAGE_NAME) |
| 266 | 266 | { |
| 267 | 267 | buffer.cat(m_filename_buffer).cat("_"); |
| 268 | new_image_name = buffer; | |
| 268 | new_image_name = buffer.c_str(); | |
| 269 | 269 | } |
| 270 | 270 | else |
| 271 | 271 | { |
| r245640 | r245641 | |
| 374 | 374 | { |
| 375 | 375 | extra_text_render(container, top, bottom, |
| 376 | 376 | origx1, origy1, origx2, origy2, |
| 377 | m_current_directory, | |
| 377 | m_current_directory.c_str(), | |
| 378 | 378 | NULL); |
| 379 | 379 | } |
| 380 | 380 | |
| r245640 | r245641 | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // determine the full path |
| 479 | zippath_combine(buffer, m_current_directory, dirent->name); | |
| 479 | zippath_combine(buffer, m_current_directory.c_str(), dirent->name); | |
| 480 | 480 | |
| 481 | 481 | // create the file selector entry |
| 482 | 482 | entry = append_entry( |
| 483 | 483 | entry_type, |
| 484 | 484 | dirent->name, |
| 485 | buffer); | |
| 485 | buffer.c_str()); | |
| 486 | 486 | |
| 487 | 487 | return entry; |
| 488 | 488 | } |
| r245640 | r245641 | |
| 544 | 544 | const file_selector_entry *selected_entry = NULL; |
| 545 | 545 | int i; |
| 546 | 546 | const char *volume_name; |
| 547 | const char *path = m_current_directory; | |
| 547 | const char *path = m_current_directory.c_str(); | |
| 548 | 548 | |
| 549 | 549 | // open the directory |
| 550 | 550 | err = zippath_opendir(path, &directory); |
| r245640 | r245641 | |
| 594 | 594 | selected_entry = entry; |
| 595 | 595 | |
| 596 | 596 | // do we have to select this file? |
| 597 | if (!core_stricmp(m_current_file, dirent->name)) | |
| 597 | if (!core_stricmp(m_current_file.c_str(), dirent->name)) | |
| 598 | 598 | selected_entry = entry; |
| 599 | 599 | } |
| 600 | 600 | } |
| r245640 | r245641 | |
|---|---|---|
| 56 | 56 | if (image->exists()) |
| 57 | 57 | { |
| 58 | 58 | current_file.cpy(image->filename()); |
| 59 | zippath_parent(current_directory, current_file); | |
| 59 | zippath_parent(current_directory, current_file.c_str()); | |
| 60 | 60 | } else |
| 61 | 61 | current_directory.cpy(image->working_directory()); |
| 62 | 62 | |
| 63 | 63 | /* check to see if the path exists; if not clear it */ |
| 64 | if (zippath_opendir(current_directory, NULL) != FILERR_NONE) | |
| 64 | if (zippath_opendir(current_directory.c_str(), NULL) != FILERR_NONE) | |
| 65 | 65 | current_directory.reset(); |
| 66 | 66 | } |
| 67 | 67 | } |
| r245640 | r245641 | |
| 87 | 87 | osd_dir_entry_type file_type; |
| 88 | 88 | |
| 89 | 89 | /* assemble the full path */ |
| 90 | zippath_combine(path, current_directory, current_file); | |
| 90 | zippath_combine(path, current_directory.c_str(), current_file.c_str()); | |
| 91 | 91 | |
| 92 | 92 | /* does a file or a directory exist at the path */ |
| 93 | entry = osd_stat(path); | |
| 93 | entry = osd_stat(path.c_str()); | |
| 94 | 94 | file_type = (entry != NULL) ? entry->type : ENTTYPE_NONE; |
| 95 | 95 | |
| 96 | 96 | switch(file_type) |
| r245640 | r245641 | |
| 155 | 155 | void ui_menu_control_device_image::hook_load(astring name, bool softlist) |
| 156 | 156 | { |
| 157 | 157 | if (image->is_reset_on_load()) image->set_init_phase(); |
| 158 | image->load(name); | |
| 158 | image->load(name.c_str()); | |
| 159 | 159 | ui_menu::stack_pop(machine()); |
| 160 | 160 | } |
| 161 | 161 | |
| r245640 | r245641 | |
| 180 | 180 | bool can_create = false; |
| 181 | 181 | if(image->is_creatable()) { |
| 182 | 182 | zippath_directory *directory = NULL; |
| 183 | file_error err = zippath_opendir(current_directory, &directory); | |
| 183 | file_error err = zippath_opendir(current_directory.c_str(), &directory); | |
| 184 | 184 | can_create = err == FILERR_NONE && !zippath_is_zip(directory); |
| 185 | 185 | if(directory) |
| 186 | 186 | zippath_closedir(directory); |
| r245640 | r245641 | |
| 215 | 215 | break; |
| 216 | 216 | |
| 217 | 217 | case SELECT_PARTLIST: |
| 218 | swi = sld->find(software_info_name); | |
| 218 | swi = sld->find(software_info_name.c_str()); | |
| 219 | 219 | if (!swi) |
| 220 | 220 | state = START_SOFTLIST; |
| 221 | 221 | else if(swi->has_multiple_parts(image->image_interface())) |
| r245640 | r245641 | |
| 331 | 331 | |
| 332 | 332 | case DO_CREATE: { |
| 333 | 333 | astring path; |
| 334 | zippath_combine(path, current_directory, current_file); | |
| 335 | int err = image->create(path, 0, NULL); | |
| 334 | zippath_combine(path, current_directory.c_str(), current_file.c_str()); | |
| 335 | int err = image->create(path.c_str(), 0, NULL); | |
| 336 | 336 | if (err != 0) |
| 337 | 337 | popmessage("Error: %s", image->error()); |
| 338 | 338 | ui_menu::stack_pop(machine()); |
| r245640 | r245641 | |
|---|---|---|
| 30 | 30 | void ui_menu_game_info::populate() |
| 31 | 31 | { |
| 32 | 32 | astring tempstring; |
| 33 | item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL); | |
| 33 | item_append(machine().ui().game_info_astring(tempstring).c_str(), NULL, MENU_FLAG_MULTILINE, NULL); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | void ui_menu_game_info::handle() |
| r245640 | r245641 | |
| 92 | 92 | |
| 93 | 93 | // display manufacturer and year |
| 94 | 94 | string.catprintf("%s, %s", image->manufacturer(), image->year()); |
| 95 | item_append(string, "", MENU_FLAG_DISABLE, NULL); | |
| 95 | item_append(string.c_str(), "", MENU_FLAG_DISABLE, NULL); | |
| 96 | 96 | |
| 97 | 97 | // display supported information, if available |
| 98 | 98 | switch (image->supported()) |
| r245640 | r245641 | |
|---|---|---|
| 421 | 421 | else |
| 422 | 422 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 423 | 423 | text.printf("[root%s]", item->owner_name); |
| 424 | item_append(text, NULL, 0, NULL); | |
| 424 | item_append(text.c_str(), NULL, 0, NULL); | |
| 425 | 425 | prev_owner.cpy(item->owner_name); |
| 426 | 426 | } |
| 427 | 427 | |
| r245640 | r245641 | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /* add the item */ |
| 445 | item_append(text, subtext, flags, item); | |
| 445 | item_append(text.c_str(), subtext.c_str(), flags, item); | |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | |
| r245640 | r245641 | |
| 575 | 575 | else |
| 576 | 576 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 577 | 577 | name.printf("[root%s]", field->device().tag()); |
| 578 | item_append(name, NULL, 0, NULL); | |
| 578 | item_append(name.c_str(), NULL, 0, NULL); | |
| 579 | 579 | prev_owner.cpy(field->device().tag()); |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | name.cpy(field->name()); |
| 583 | 583 | |
| 584 | item_append(name, field->setting_name(), flags, (void *)field); | |
| 584 | item_append(name.c_str(), field->setting_name(), flags, (void *)field); | |
| 585 | 585 | |
| 586 | 586 | /* for DIP switches, build up the model */ |
| 587 | 587 | if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL) |
| r245640 | r245641 | |
| 879 | 879 | else |
| 880 | 880 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 881 | 881 | name.printf("[root%s]", field->device().tag()); |
| 882 | item_append(name, NULL, 0, NULL); | |
| 882 | item_append(name.c_str(), NULL, 0, NULL); | |
| 883 | 883 | prev_owner.cpy(field->device().tag()); |
| 884 | 884 | } |
| 885 | 885 | |
| r245640 | r245641 | |
| 938 | 938 | flags |= MENU_FLAG_RIGHT_ARROW; |
| 939 | 939 | |
| 940 | 940 | /* append a menu item */ |
| 941 | item_append(text, subtext, flags, data); | |
| 941 | item_append(text.c_str(), subtext.c_str(), flags, data); | |
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
| r245640 | r245641 | |
|---|---|---|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /* append the single item */ |
| 270 | item_append(tempstring, NULL, MENU_FLAG_MULTILINE, NULL); | |
| 270 | item_append(tempstring.c_str(), NULL, MENU_FLAG_MULTILINE, NULL); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /*------------------------------------------------- |
| r245640 | r245641 | |
|---|---|---|
| 239 | 239 | emulator_info::get_gamesnoun(), |
| 240 | 240 | emulator_info::get_configname(), |
| 241 | 241 | emulator_info::get_appname(),emulator_info::get_appname() ); |
| 242 | item_append(txt, NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); | |
| 242 | item_append(txt.c_str(), NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); | |
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | |
| r245640 | r245641 | |
| 293 | 293 | tempbuf[0].printf("Type name or select: (random)"); |
| 294 | 294 | |
| 295 | 295 | // get the size of the text |
| 296 | machine().ui().draw_text_full(container, tempbuf[0], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 296 | machine().ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 297 | 297 | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); |
| 298 | 298 | width += 2 * UI_BOX_LR_BORDER; |
| 299 | 299 | maxwidth = MAX(width, origx2 - origx1); |
| r245640 | r245641 | |
| 314 | 314 | y2 -= UI_BOX_TB_BORDER; |
| 315 | 315 | |
| 316 | 316 | // draw the text within it |
| 317 | machine().ui().draw_text_full(container, tempbuf[0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 317 | machine().ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 318 | 318 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 319 | 319 | |
| 320 | 320 | // determine the text to render below |
| r245640 | r245641 | |
| 384 | 384 | maxwidth = origx2 - origx1; |
| 385 | 385 | for (line = 0; line < 4; line++) |
| 386 | 386 | { |
| 387 | machine().ui().draw_text_full(container, tempbuf[line], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 387 | machine().ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 388 | 388 | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); |
| 389 | 389 | width += 2 * UI_BOX_LR_BORDER; |
| 390 | 390 | maxwidth = MAX(maxwidth, width); |
| r245640 | r245641 | |
| 415 | 415 | // draw all lines |
| 416 | 416 | for (line = 0; line < 4; line++) |
| 417 | 417 | { |
| 418 | machine().ui().draw_text_full(container, tempbuf[line], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 418 | machine().ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 419 | 419 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 420 | 420 | y1 += machine().ui().get_line_height(); |
| 421 | 421 | } |
| r245640 | r245641 | |
|---|---|---|
| 141 | 141 | flags |= MENU_FLAG_LEFT_ARROW; |
| 142 | 142 | if (curval < curslider->maxval) |
| 143 | 143 | flags |= MENU_FLAG_RIGHT_ARROW; |
| 144 | item_append(curslider->description, tempstring, flags, (void *)curslider); | |
| 144 | item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider); | |
| 145 | 145 | |
| 146 | 146 | if (menuless_mode) |
| 147 | 147 | break; |
| r245640 | r245641 | |
| 156 | 156 | flags |= MENU_FLAG_LEFT_ARROW; |
| 157 | 157 | if (curval < curslider->maxval) |
| 158 | 158 | flags |= MENU_FLAG_RIGHT_ARROW; |
| 159 | item_append(curslider->description, tempstring, flags, (void *)curslider); | |
| 159 | item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider); | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; |
| r245640 | r245641 | |
| 200 | 200 | y1 += UI_BOX_TB_BORDER; |
| 201 | 201 | |
| 202 | 202 | /* determine the text height */ |
| 203 | machine().ui().draw_text_full(container, tempstring, 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, | |
| 203 | machine().ui().draw_text_full(container, tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, | |
| 204 | 204 | JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, NULL, &text_height); |
| 205 | 205 | |
| 206 | 206 | /* draw the thermometer */ |
| r245640 | r245641 | |
| 227 | 227 | container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 228 | 228 | |
| 229 | 229 | /* draw the actual text */ |
| 230 | machine().ui().draw_text_full(container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, | |
| 230 | machine().ui().draw_text_full(container, tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, | |
| 231 | 231 | JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, &text_height); |
| 232 | 232 | } |
| 233 | 233 | } |
| r245640 | r245641 | |
|---|---|---|
| 166 | 166 | opt_name.cat(" [internal]"); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | item_append(slot->device().tag() + 1, opt_name, (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot); | |
| 169 | item_append(slot->device().tag() + 1, opt_name.c_str(), (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot); | |
| 170 | 170 | } |
| 171 | 171 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 172 | 172 | item_append("Reset", NULL, 0, (void *)1); |
| r245640 | r245641 | |
|---|---|---|
| 58 | 58 | if (current_device()) |
| 59 | 59 | { |
| 60 | 60 | // name of tape |
| 61 | item_append(current_display_name(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT); | |
| 61 | item_append(current_display_name().c_str(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT); | |
| 62 | 62 | |
| 63 | 63 | if (current_device()->exists()) |
| 64 | 64 | { |
| r245640 | r245641 | |
| 86 | 86 | ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)") |
| 87 | 87 | : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)") |
| 88 | 88 | ), |
| 89 | timepos, | |
| 89 | timepos.c_str(), | |
| 90 | 90 | tapeflags, |
| 91 | 91 | TAPECMD_SLIDER); |
| 92 | 92 |
| r245640 | r245641 | |
|---|---|---|
| 442 | 442 | |
| 443 | 443 | // display any popup messages |
| 444 | 444 | if (osd_ticks() < m_popup_text_end) |
| 445 | draw_text_box(container, messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor); | |
| 445 | draw_text_box(container, messagebox_text.c_str(), JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor); | |
| 446 | 446 | else |
| 447 | 447 | m_popup_text_end = 0; |
| 448 | 448 | |
| r245640 | r245641 | |
| 1253 | 1253 | |
| 1254 | 1254 | UINT32 ui_manager::handler_messagebox(running_machine &machine, render_container *container, UINT32 state) |
| 1255 | 1255 | { |
| 1256 | machine.ui().draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1256 | machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1257 | 1257 | return 0; |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| r245640 | r245641 | |
| 1266 | 1266 | UINT32 ui_manager::handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state) |
| 1267 | 1267 | { |
| 1268 | 1268 | // draw a standard message window |
| 1269 | machine.ui().draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1269 | machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1270 | 1270 | |
| 1271 | 1271 | // an 'O' or left joystick kicks us to the next state |
| 1272 | 1272 | if (state == 0 && (machine.input().code_pressed_once(KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT))) |
| r245640 | r245641 | |
| 1296 | 1296 | UINT32 ui_manager::handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state) |
| 1297 | 1297 | { |
| 1298 | 1298 | // draw a standard message window |
| 1299 | machine.ui().draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1299 | machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); | |
| 1300 | 1300 | |
| 1301 | 1301 | // if the user cancels, exit out completely |
| 1302 | 1302 | if (ui_input_pressed(machine, IPT_UI_CANCEL)) |
| r245640 | r245641 | |
| 1469 | 1469 | if (machine.ui().show_fps_counter()) |
| 1470 | 1470 | { |
| 1471 | 1471 | astring tempstring; |
| 1472 | machine.ui().draw_text_full(container, machine.video().speed_text(tempstring), 0.0f, 0.0f, 1.0f, | |
| 1472 | machine.ui().draw_text_full(container, machine.video().speed_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, | |
| 1473 | 1473 | JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); |
| 1474 | 1474 | } |
| 1475 | 1475 | |
| r245640 | r245641 | |
| 1764 | 1764 | ui_select_text.c_str(), |
| 1765 | 1765 | ui_cancel_text.c_str()); |
| 1766 | 1766 | |
| 1767 | machine.ui().draw_text_box(container, quit_message, JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); | |
| 1767 | machine.ui().draw_text_box(container, quit_message.c_str(), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); | |
| 1768 | 1768 | machine.pause(); |
| 1769 | 1769 | |
| 1770 | 1770 | // if the user press ENTER, quit the game |
| r245640 | r245641 | |
| 1844 | 1844 | |
| 1845 | 1845 | info.stream->input_name(info.inputnum, string); |
| 1846 | 1846 | string.cat(" Volume"); |
| 1847 | *tailptr = slider_alloc(machine, string, 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); | |
| 1847 | *tailptr = slider_alloc(machine, string.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); | |
| 1848 | 1848 | tailptr = &(*tailptr)->next; |
| 1849 | 1849 | } |
| 1850 | 1850 | |
| r245640 | r245641 | |
| 1866 | 1866 | { |
| 1867 | 1867 | void *param = (void *)&exec->device(); |
| 1868 | 1868 | string.printf("Overclock CPU %s", exec->device().tag()); |
| 1869 | *tailptr = slider_alloc(machine, string, 10, 1000, 2000, 1, slider_overclock, param); | |
| 1869 | *tailptr = slider_alloc(machine, string.c_str(), 10, 1000, 2000, 1, slider_overclock, param); | |
| 1870 | 1870 | tailptr = &(*tailptr)->next; |
| 1871 | 1871 | } |
| 1872 | 1872 | } |
| r245640 | r245641 | |
| 1885 | 1885 | if (machine.options().cheat()) |
| 1886 | 1886 | { |
| 1887 | 1887 | string.printf("%s Refresh Rate", slider_get_screen_desc(*screen)); |
| 1888 | *tailptr = slider_alloc(machine, string, -10000, 0, 10000, 1000, slider_refresh, param); | |
| 1888 | *tailptr = slider_alloc(machine, string.c_str(), -10000, 0, 10000, 1000, slider_refresh, param); | |
| 1889 | 1889 | tailptr = &(*tailptr)->next; |
| 1890 | 1890 | } |
| 1891 | 1891 | |
| 1892 | 1892 | // add standard brightness/contrast/gamma controls per-screen |
| 1893 | 1893 | string.printf("%s Brightness", slider_get_screen_desc(*screen)); |
| 1894 | *tailptr = slider_alloc(machine, string, 100, 1000, 2000, 10, slider_brightness, param); | |
| 1894 | *tailptr = slider_alloc(machine, string.c_str(), 100, 1000, 2000, 10, slider_brightness, param); | |
| 1895 | 1895 | tailptr = &(*tailptr)->next; |
| 1896 | 1896 | string.printf("%s Contrast", slider_get_screen_desc(*screen)); |
| 1897 | *tailptr = slider_alloc(machine, string, 100, 1000, 2000, 50, slider_contrast, param); | |
| 1897 | *tailptr = slider_alloc(machine, string.c_str(), 100, 1000, 2000, 50, slider_contrast, param); | |
| 1898 | 1898 | tailptr = &(*tailptr)->next; |
| 1899 | 1899 | string.printf("%s Gamma", slider_get_screen_desc(*screen)); |
| 1900 | *tailptr = slider_alloc(machine, string, 100, 1000, 3000, 50, slider_gamma, param); | |
| 1900 | *tailptr = slider_alloc(machine, string.c_str(), 100, 1000, 3000, 50, slider_gamma, param); | |
| 1901 | 1901 | tailptr = &(*tailptr)->next; |
| 1902 | 1902 | |
| 1903 | 1903 | // add scale and offset controls per-screen |
| 1904 | 1904 | string.printf("%s Horiz Stretch", slider_get_screen_desc(*screen)); |
| 1905 | *tailptr = slider_alloc(machine, string, 500, defxscale, 1500, 2, slider_xscale, param); | |
| 1905 | *tailptr = slider_alloc(machine, string.c_str(), 500, defxscale, 1500, 2, slider_xscale, param); | |
| 1906 | 1906 | tailptr = &(*tailptr)->next; |
| 1907 | 1907 | string.printf("%s Horiz Position", slider_get_screen_desc(*screen)); |
| 1908 | *tailptr = slider_alloc(machine, string, -500, defxoffset, 500, 2, slider_xoffset, param); | |
| 1908 | *tailptr = slider_alloc(machine, string.c_str(), -500, defxoffset, 500, 2, slider_xoffset, param); | |
| 1909 | 1909 | tailptr = &(*tailptr)->next; |
| 1910 | 1910 | string.printf("%s Vert Stretch", slider_get_screen_desc(*screen)); |
| 1911 | *tailptr = slider_alloc(machine, string, 500, defyscale, 1500, 2, slider_yscale, param); | |
| 1911 | *tailptr = slider_alloc(machine, string.c_str(), 500, defyscale, 1500, 2, slider_yscale, param); | |
| 1912 | 1912 | tailptr = &(*tailptr)->next; |
| 1913 | 1913 | string.printf("%s Vert Position", slider_get_screen_desc(*screen)); |
| 1914 | *tailptr = slider_alloc(machine, string, -500, defyoffset, 500, 2, slider_yoffset, param); | |
| 1914 | *tailptr = slider_alloc(machine, string.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param); | |
| 1915 | 1915 | tailptr = &(*tailptr)->next; |
| 1916 | 1916 | } |
| 1917 | 1917 | |
| r245640 | r245641 | |
| 1929 | 1929 | |
| 1930 | 1930 | // add scale and offset controls per-overlay |
| 1931 | 1931 | string.printf("Laserdisc '%s' Horiz Stretch", laserdisc->tag()); |
| 1932 | *tailptr = slider_alloc(machine, string, 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param); | |
| 1932 | *tailptr = slider_alloc(machine, string.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param); | |
| 1933 | 1933 | tailptr = &(*tailptr)->next; |
| 1934 | 1934 | string.printf("Laserdisc '%s' Horiz Position", laserdisc->tag()); |
| 1935 | *tailptr = slider_alloc(machine, string, -500, defxoffset, 500, 2, slider_overxoffset, param); | |
| 1935 | *tailptr = slider_alloc(machine, string.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param); | |
| 1936 | 1936 | tailptr = &(*tailptr)->next; |
| 1937 | 1937 | string.printf("Laserdisc '%s' Vert Stretch", laserdisc->tag()); |
| 1938 | *tailptr = slider_alloc(machine, string, 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param); | |
| 1938 | *tailptr = slider_alloc(machine, string.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param); | |
| 1939 | 1939 | tailptr = &(*tailptr)->next; |
| 1940 | 1940 | string.printf("Laserdisc '%s' Vert Position", laserdisc->tag()); |
| 1941 | *tailptr = slider_alloc(machine, string, -500, defyoffset, 500, 2, slider_overyoffset, param); | |
| 1941 | *tailptr = slider_alloc(machine, string.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param); | |
| 1942 | 1942 | tailptr = &(*tailptr)->next; |
| 1943 | 1943 | } |
| 1944 | 1944 | |
| r245640 | r245641 | |
| 1961 | 1961 | { |
| 1962 | 1962 | void *param = (void *)field; |
| 1963 | 1963 | string.printf("Crosshair Scale %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); |
| 1964 | *tailptr = slider_alloc(machine, string, -3000, 1000, 3000, 100, slider_crossscale, param); | |
| 1964 | *tailptr = slider_alloc(machine, string.c_str(), -3000, 1000, 3000, 100, slider_crossscale, param); | |
| 1965 | 1965 | tailptr = &(*tailptr)->next; |
| 1966 | 1966 | string.printf("Crosshair Offset %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); |
| 1967 | *tailptr = slider_alloc(machine, string, -3000, 0, 3000, 100, slider_crossoffset, param); | |
| 1967 | *tailptr = slider_alloc(machine, string.c_str(), -3000, 0, 3000, 100, slider_crossoffset, param); | |
| 1968 | 1968 | tailptr = &(*tailptr)->next; |
| 1969 | 1969 | } |
| 1970 | 1970 | #endif |
| r245640 | r245641 | |
|---|---|---|
| 187 | 187 | |
| 188 | 188 | /* create a string for the item, replacing underscores with spaces */ |
| 189 | 189 | tempstring.cpy(name).replace(0, "_", " "); |
| 190 | item_append(tempstring, NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum)); | |
| 190 | item_append(tempstring.c_str(), NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum)); | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /* add a separator */ |
| r245640 | r245641 | |
|---|---|---|
| 644 | 644 | |
| 645 | 645 | // attempt to add it to the map, reporting duplicates as errors |
| 646 | 646 | current_length = ROMREGION_GETLENGTH(romp); |
| 647 | if (m_region_map.add(fulltag, current_length, false) == TMERR_DUPLICATE) | |
| 647 | if (m_region_map.add(fulltag.c_str(), current_length, false) == TMERR_DUPLICATE) | |
| 648 | 648 | osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag.c_str()); |
| 649 | 649 | } |
| 650 | 650 | |
| r245640 | r245641 | |
| 852 | 852 | device.subtag(porttag, condition.tag()); |
| 853 | 853 | |
| 854 | 854 | // then find a matching port |
| 855 | if (port_map.find(porttag) == 0) | |
| 855 | if (port_map.find(porttag.c_str()) == 0) | |
| 856 | 856 | osd_printf_error("Condition referencing non-existent ioport tag '%s'\n", condition.tag()); |
| 857 | 857 | } |
| 858 | 858 |
| r245640 | r245641 | |
|---|---|---|
| 311 | 311 | astring text1(emulator_info::get_appname(), " ", build_version); |
| 312 | 312 | astring text2(machine().system().manufacturer, " ", machine().system().description); |
| 313 | 313 | png_info pnginfo = { 0 }; |
| 314 | png_add_text(&pnginfo, "Software", text1); | |
| 315 | png_add_text(&pnginfo, "System", text2); | |
| 314 | png_add_text(&pnginfo, "Software", text1.c_str()); | |
| 315 | png_add_text(&pnginfo, "System", text2.c_str()); | |
| 316 | 316 | |
| 317 | 317 | // now do the actual work |
| 318 | 318 | const rgb_t *palette = (screen !=NULL && screen->palette() != NULL) ? screen->palette()->palette()->entry_list_adjusted() : NULL; |
| r245640 | r245641 | |
| 417 | 417 | m_avi_frame_period = attotime::from_seconds(1000) / info.video_timescale; |
| 418 | 418 | |
| 419 | 419 | // create the file and free the string |
| 420 | avi_error avierr = avi_create(fullpath, &info, &m_avi_file); | |
| 420 | avi_error avierr = avi_create(fullpath.c_str(), &info, &m_avi_file); | |
| 421 | 421 | if (avierr != AVIERR_NONE) |
| 422 | 422 | { |
| 423 | 423 | osd_printf_error("Error creating AVI: %s\n", avi_error_string(avierr)); |
| r245640 | r245641 | |
| 1126 | 1126 | |
| 1127 | 1127 | // handle %d in the template (for image devices) |
| 1128 | 1128 | astring snapdev("%d_"); |
| 1129 | int pos = snapstr.find(0, snapdev); | |
| 1129 | int pos = snapstr.find(0, snapdev.c_str()); | |
| 1130 | 1130 | |
| 1131 | 1131 | if (pos != -1) |
| 1132 | 1132 | { |
| 1133 | 1133 | // if more %d are found, revert to default and ignore them all |
| 1134 | if (snapstr.find(pos + 3, snapdev) != -1) | |
| 1134 | if (snapstr.find(pos + 3, snapdev.c_str()) != -1) | |
| 1135 | 1135 | snapstr.cpy("%g/%i"); |
| 1136 | 1136 | // else if there is a single %d, try to create the correct snapname |
| 1137 | 1137 | else |
| r245640 | r245641 | |
| 1179 | 1179 | filename.substr(0, filename.rchr(0, '.')); |
| 1180 | 1180 | |
| 1181 | 1181 | // setup snapname and remove the %d_ |
| 1182 | snapstr.replace(0, snapdevname, filename); | |
| 1182 | snapstr.replace(0, snapdevname.c_str(), filename.c_str()); | |
| 1183 | 1183 | snapstr.del(pos, 3); |
| 1184 | 1184 | //printf("check image: %s\n", filename.c_str()); |
| 1185 | 1185 | |
| r245640 | r245641 | |
| 1218 | 1218 | fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d", seq).c_str()); |
| 1219 | 1219 | |
| 1220 | 1220 | // try to open the file; stop when we fail |
| 1221 | file_error filerr = file.open(fname); | |
| 1221 | file_error filerr = file.open(fname.c_str()); | |
| 1222 | 1222 | if (filerr != FILERR_NONE) |
| 1223 | 1223 | break; |
| 1224 | 1224 | } |
| r245640 | r245641 | |
| 1226 | 1226 | |
| 1227 | 1227 | // create the final file |
| 1228 | 1228 | file.set_openflags(origflags); |
| 1229 | return file.open(fname); | |
| 1229 | return file.open(fname.c_str()); | |
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | |
| r245640 | r245641 | |
| 1280 | 1280 | { |
| 1281 | 1281 | astring text1(emulator_info::get_appname(), " ", build_version); |
| 1282 | 1282 | astring text2(machine().system().manufacturer, " ", machine().system().description); |
| 1283 | png_add_text(&pnginfo, "Software", text1); | |
| 1284 | png_add_text(&pnginfo, "System", text2); | |
| 1283 | png_add_text(&pnginfo, "Software", text1.c_str()); | |
| 1284 | png_add_text(&pnginfo, "System", text2.c_str()); | |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | // write the next frame |
| r245640 | r245641 | |
|---|---|---|
| 331 | 331 | { |
| 332 | 332 | if(m_vga_tag.len() != 0) |
| 333 | 333 | { |
| 334 | m_vga = machine().device<vga_device>(m_vga_tag); | |
| 334 | m_vga = machine().device<vga_device>(m_vga_tag.c_str()); | |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 |
| r245640 | r245641 | |
|---|---|---|
| 261 | 261 | int web_engine::begin_request_handler(struct mg_connection *conn) |
| 262 | 262 | { |
| 263 | 263 | astring file_path(mg_get_option(m_server, "document_root"), PATH_SEPARATOR, conn->uri); |
| 264 | if (filename_endswith(file_path,".lp")) | |
| 264 | if (filename_endswith(file_path.c_str(), ".lp")) | |
| 265 | 265 | { |
| 266 | 266 | FILE *fp = NULL; |
| 267 | if ((fp = fopen(file_path, "rb")) != NULL) { | |
| 267 | if ((fp = fopen(file_path.c_str(), "rb")) != NULL) { | |
| 268 | 268 | fseek (fp, 0, SEEK_END); |
| 269 | 269 | size_t size = ftell(fp); |
| 270 | 270 | fseek (fp, 0, SEEK_SET); |
| r245640 | r245641 | |
| 442 | 442 | |
| 443 | 443 | astring fname("screenshot.png"); |
| 444 | 444 | emu_file file(m_machine->options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 445 | file_error filerr = file.open(fname); | |
| 445 | file_error filerr = file.open(fname.c_str()); | |
| 446 | 446 | |
| 447 | 447 | if (filerr != FILERR_NONE) |
| 448 | 448 | { |
| r245640 | r245641 | |
|---|---|---|
| 234 | 234 | |
| 235 | 235 | // try to open the CHD |
| 236 | 236 | |
| 237 | if (set_disk_handle(machine(), "laserdisc", fullpath) == CHDERR_NONE) | |
| 237 | if (set_disk_handle(machine(), "laserdisc", fullpath.c_str()) == CHDERR_NONE) | |
| 238 | 238 | { |
| 239 | 239 | m_filename.cpy(dir->name); |
| 240 | 240 | found = TRUE; |
| r245640 | r245641 | |
|---|---|---|
| 73 | 73 | operator bool() const { return m_text[0] != 0; } |
| 74 | 74 | |
| 75 | 75 | // C string conversion operators and helpers |
| 76 | operator const char *() const { return m_text; } | |
| 77 | 76 | const char *c_str() const { return m_text; } |
| 78 | 77 | |
| 79 | 78 | // buffer management |
| r245640 | r245641 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | for (i = 0; i < file->cdtoc.numtrks; i++) |
| 163 | 163 | { |
| 164 | file_error filerr = core_fopen(file->track_info.track[i].fname, OPEN_FLAG_READ, &file->fhandle[i]); | |
| 164 | file_error filerr = core_fopen(file->track_info.track[i].fname.c_str(), OPEN_FLAG_READ, &file->fhandle[i]); | |
| 165 | 165 | if (filerr != FILERR_NONE) |
| 166 | 166 | { |
| 167 | 167 | fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.c_str()); |
| r245640 | r245641 | |
| 833 | 833 | /* parse the metadata */ |
| 834 | 834 | type[0] = subtype[0] = 0; |
| 835 | 835 | pgtype[0] = pgsub[0] = 0; |
| 836 | if (sscanf(metadata, CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4) | |
| 836 | if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4) | |
| 837 | 837 | return CHDERR_INVALID_DATA; |
| 838 | 838 | if (tracknum == 0 || tracknum > CD_MAX_TRACKS) |
| 839 | 839 | return CHDERR_INVALID_DATA; |
| r245640 | r245641 | |
| 847 | 847 | /* parse the metadata */ |
| 848 | 848 | type[0] = subtype[0] = 0; |
| 849 | 849 | pregap = postgap = 0; |
| 850 | if (sscanf(metadata, CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8) | |
| 850 | if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8) | |
| 851 | 851 | return CHDERR_INVALID_DATA; |
| 852 | 852 | if (tracknum == 0 || tracknum > CD_MAX_TRACKS) |
| 853 | 853 | return CHDERR_INVALID_DATA; |
| r245640 | r245641 | |
| 867 | 867 | /* parse the metadata */ |
| 868 | 868 | type[0] = subtype[0] = 0; |
| 869 | 869 | pregap = postgap = 0; |
| 870 | if (sscanf(metadata, GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9) | |
| 870 | if (sscanf(metadata.c_str(), GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9) | |
| 871 | 871 | return CHDERR_INVALID_DATA; |
| 872 | 872 | if (tracknum == 0 || tracknum > CD_MAX_TRACKS) |
| 873 | 873 | return CHDERR_INVALID_DATA; |
| r245640 | r245641 | |
|---|---|---|
| 1411 | 1411 | // look for hard disk metadata; if found, then the unit size == sector size |
| 1412 | 1412 | astring metadata; |
| 1413 | 1413 | int i0, i1, i2, i3; |
| 1414 | if (read_metadata(HARD_DISK_METADATA_TAG, 0, metadata) == CHDERR_NONE && sscanf(metadata, HARD_DISK_METADATA_FORMAT, &i0, &i1, &i2, &i3) == 4) | |
| 1414 | if (read_metadata(HARD_DISK_METADATA_TAG, 0, metadata) == CHDERR_NONE && sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &i0, &i1, &i2, &i3) == 4) | |
| 1415 | 1415 | return i3; |
| 1416 | 1416 | |
| 1417 | 1417 | // look for CD-ROM metadata; if found, then the unit size == CD frame size |
| r245640 | r245641 | |
|---|---|---|
| 679 | 679 | } |
| 680 | 680 | outinfo.track[trknum].fname.cpy(path).cat(name); |
| 681 | 681 | |
| 682 | sz = get_file_size(outinfo.track[trknum].fname); | |
| 682 | sz = get_file_size(outinfo.track[trknum].fname.c_str()); | |
| 683 | 683 | |
| 684 | 684 | outtoc.tracks[trknum].frames = sz/trksize; |
| 685 | 685 | outtoc.tracks[trknum].padframes = 0; |
| r245640 | r245641 | |
| 768 | 768 | } |
| 769 | 769 | else if (!strcmp(token, "WAVE")) |
| 770 | 770 | { |
| 771 | wavlen = parse_wav_sample(lastfname, &wavoffs); | |
| 771 | wavlen = parse_wav_sample(lastfname.c_str(), &wavoffs); | |
| 772 | 772 | if (!wavlen) |
| 773 | 773 | { |
| 774 | 774 | printf("ERROR: couldn't read [%s] or not a valid .WAV\n", lastfname.c_str()); |
| r245640 | r245641 | |
| 938 | 938 | } |
| 939 | 939 | else /* data files are different */ |
| 940 | 940 | { |
| 941 | tlen = get_file_size(outinfo.track[trknum].fname); | |
| 941 | tlen = get_file_size(outinfo.track[trknum].fname.c_str()); | |
| 942 | 942 | if (tlen == 0) |
| 943 | 943 | { |
| 944 | 944 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); |
| r245640 | r245641 | |
| 973 | 973 | } |
| 974 | 974 | else /* data files are different */ |
| 975 | 975 | { |
| 976 | tlen = get_file_size(outinfo.track[trknum].fname); | |
| 976 | tlen = get_file_size(outinfo.track[trknum].fname.c_str()); | |
| 977 | 977 | if (tlen == 0) |
| 978 | 978 | { |
| 979 | 979 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.c_str()); |
| r245640 | r245641 | |
|---|---|---|
| 1626 | 1626 | |
| 1627 | 1627 | // extract the info |
| 1628 | 1628 | int fps, fpsfrac, width, height, interlaced, channels, rate; |
| 1629 | if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 1629 | if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 1630 | 1630 | throw CHDERR_INVALID_METADATA; |
| 1631 | 1631 | |
| 1632 | 1632 | // compute the bytes per frame |
| r245640 | r245641 | |
|---|---|---|
| 53 | 53 | return NULL; |
| 54 | 54 | |
| 55 | 55 | /* parse the metadata */ |
| 56 | if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §orbytes) != 4) | |
| 56 | if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §orbytes) != 4) | |
| 57 | 57 | return NULL; |
| 58 | 58 | |
| 59 | 59 | /* allocate memory for the hard disk file */ |
| r245640 | r245641 | |
|---|---|---|
| 84 | 84 | buffer.reset(); |
| 85 | 85 | for (int i = 0; i < ARRAY_LENGTH(m_raw); i++) |
| 86 | 86 | buffer.catformat("%02x", m_raw[i]); |
| 87 | return buffer; | |
| 87 | return buffer.c_str(); | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| r245640 | r245641 | |
| 127 | 127 | buffer.reset(); |
| 128 | 128 | for (int i = 0; i < ARRAY_LENGTH(m_raw); i++) |
| 129 | 129 | buffer.catformat("%02x", m_raw[i]); |
| 130 | return buffer; | |
| 130 | return buffer.c_str(); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| r245640 | r245641 | |
| 168 | 168 | |
| 169 | 169 | const char *crc32_t::as_string(astring &buffer) const |
| 170 | 170 | { |
| 171 | return buffer.format("%08x", m_raw); | |
| 171 | return buffer.format("%08x", m_raw).c_str(); | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| r245640 | r245641 | |
| 220 | 220 | |
| 221 | 221 | const char *crc16_t::as_string(astring &buffer) const |
| 222 | 222 | { |
| 223 | return buffer.format("%04x", m_raw); | |
| 223 | return buffer.format("%04x", m_raw).c_str(); | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 |
| r245640 | r245641 | |
|---|---|---|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | return buffer; | |
| 535 | return buffer.c_str(); | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | |
| r245640 | r245641 | |
| 556 | 556 | else if (curentry->description() != NULL) |
| 557 | 557 | buffer.catprintf("-%-20s%s\n", curentry->name(), curentry->description()); |
| 558 | 558 | } |
| 559 | return buffer; | |
| 559 | return buffer.c_str(); | |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | |
| r245640 | r245641 | |
| 687 | 687 | |
| 688 | 688 | // for boolean options add a "no" variant as well |
| 689 | 689 | if (newentry.type() == OPTION_BOOLEAN) |
| 690 | m_entrymap.add(astring("no", newentry.name(name)), &newentry); | |
| 690 | m_entrymap.add(astring("no", newentry.name(name)).c_str(), &newentry); | |
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
| r245640 | r245641 | |
| 702 | 702 | // remove all names from the map |
| 703 | 703 | for (int name = 0; name < ARRAY_LENGTH(delentry.m_name); name++) |
| 704 | 704 | if (delentry.m_name[name]) |
| 705 | m_entrymap.remove(delentry.m_name[name]); | |
| 705 | m_entrymap.remove(delentry.m_name[name].c_str()); | |
| 706 | 706 | |
| 707 | 707 | // remove the entry from the list |
| 708 | 708 | m_entrylist.remove(delentry); |
| r245640 | r245641 | |
| 750 | 750 | { |
| 751 | 751 | // booleans must be 0 or 1 |
| 752 | 752 | case OPTION_BOOLEAN: |
| 753 | if (sscanf(data, "%d", &ival) != 1 || ival < 0 || ival > 1) | |
| 753 | if (sscanf(data.c_str(), "%d", &ival) != 1 || ival < 0 || ival > 1) | |
| 754 | 754 | { |
| 755 | 755 | error_string.catprintf("Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); |
| 756 | 756 | return false; |
| r245640 | r245641 | |
| 759 | 759 | |
| 760 | 760 | // integers must be integral |
| 761 | 761 | case OPTION_INTEGER: |
| 762 | if (sscanf(data, "%d", &ival) != 1) | |
| 762 | if (sscanf(data.c_str(), "%d", &ival) != 1) | |
| 763 | 763 | { |
| 764 | 764 | error_string.catprintf("Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); |
| 765 | 765 | return false; |
| r245640 | r245641 | |
| 773 | 773 | |
| 774 | 774 | // floating-point values must be numeric |
| 775 | 775 | case OPTION_FLOAT: |
| 776 | if (sscanf(data, "%f", &fval) != 1) | |
| 776 | if (sscanf(data.c_str(), "%f", &fval) != 1) | |
| 777 | 777 | { |
| 778 | 778 | error_string.catprintf("Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); |
| 779 | 779 | return false; |
| r245640 | r245641 | |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | // set the data |
| 801 | curentry.set_value(data, priority); | |
| 801 | curentry.set_value(data.c_str(), priority); | |
| 802 | 802 | return true; |
| 803 | 803 | } |
| r245640 | r245641 | |
|---|---|---|
| 77 | 77 | entry *next() const { return m_next; } |
| 78 | 78 | const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && m_name[index]) ? m_name[index].c_str() : NULL; } |
| 79 | 79 | const char *description() const { return m_description; } |
| 80 | const char *value() const { return m_data; } | |
| 81 | const char *default_value() const { return m_defdata; } | |
| 82 | const char *minimum() const { return m_minimum; } | |
| 83 | const char *maximum() const { return m_maximum; } | |
| 80 | const char *value() const { return m_data.c_str(); } | |
| 81 | const char *default_value() const { return m_defdata.c_str(); } | |
| 82 | const char *minimum() const { return m_minimum.c_str(); } | |
| 83 | const char *maximum() const { return m_maximum.c_str(); } | |
| 84 | 84 | UINT32 seqid() const { return m_seqid; } |
| 85 | 85 | int type() const { return (m_flags & OPTION_TYPE_MASK); } |
| 86 | 86 | UINT32 flags() const { return m_flags; } |
| r245640 | r245641 | |
| 127 | 127 | |
| 128 | 128 | // getters |
| 129 | 129 | entry *first() const { return m_entrylist.first(); } |
| 130 | const char *command() const { return m_command; } | |
| 130 | const char *command() const { return m_command.c_str(); } | |
| 131 | 131 | |
| 132 | 132 | // configuration |
| 133 | 133 | void add_entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = NULL, bool override_existing = false); |
| r245640 | r245641 | |
|---|---|---|
| 263 | 263 | && ((openflags == OPEN_FLAG_READ) || (subpath.len() == 0))) |
| 264 | 264 | { |
| 265 | 265 | /* is the mainpath a ZIP path? */ |
| 266 | if (is_zip_file(mainpath)) | |
| 266 | if (is_zip_file(mainpath.c_str())) | |
| 267 | 267 | { |
| 268 | 268 | /* this file might be a zip file - lets take a look */ |
| 269 | ziperr = zip_file_open(mainpath, &zip); | |
| 269 | ziperr = zip_file_open(mainpath.c_str(), &zip); | |
| 270 | 270 | if (ziperr == ZIPERR_NONE) |
| 271 | 271 | { |
| 272 | 272 | /* it is a zip file - error if we're not opening for reading */ |
| r245640 | r245641 | |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | if (subpath.len() > 0) |
| 280 | header = zippath_find_sub_path(zip, subpath, &entry_type); | |
| 280 | header = zippath_find_sub_path(zip, subpath.c_str(), &entry_type); | |
| 281 | 281 | else |
| 282 | 282 | header = zip_file_first_file(zip); |
| 283 | 283 | |
| r245640 | r245641 | |
| 300 | 300 | goto done; |
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | else if (is_7z_file(mainpath)) | |
| 303 | else if (is_7z_file(mainpath.c_str())) | |
| 304 | 304 | { |
| 305 | 305 | filerr = FILERR_INVALID_DATA; |
| 306 | 306 | goto done; |
| r245640 | r245641 | |
| 316 | 316 | { |
| 317 | 317 | /* go up a directory */ |
| 318 | 318 | astring temp; |
| 319 | zippath_parent(temp, mainpath); | |
| 319 | zippath_parent(temp, mainpath.c_str()); | |
| 320 | 320 | |
| 321 | 321 | /* append to the sub path */ |
| 322 | 322 | if (subpath.len() > 0) |
| r245640 | r245641 | |
| 342 | 342 | if (filerr == FILERR_NONE) |
| 343 | 343 | { |
| 344 | 344 | /* cannonicalize mainpath */ |
| 345 | filerr = osd_get_full_path(&alloc_fullpath, mainpath); | |
| 345 | filerr = osd_get_full_path(&alloc_fullpath, mainpath.c_str()); | |
| 346 | 346 | if (filerr == FILERR_NONE) |
| 347 | 347 | { |
| 348 | 348 | if (subpath.len() > 0) |
| r245640 | r245641 | |
| 559 | 559 | apath_trimmed.cpysubstr(apath, 0, i); |
| 560 | 560 | |
| 561 | 561 | /* stat the path */ |
| 562 | current_entry = osd_stat(apath_trimmed); | |
| 562 | current_entry = osd_stat(apath_trimmed.c_str()); | |
| 563 | 563 | |
| 564 | 564 | /* did we find anything? */ |
| 565 | 565 | if (current_entry != NULL) |
| r245640 | r245641 | |
| 575 | 575 | current_entry_type = ENTTYPE_NONE; |
| 576 | 576 | went_up = TRUE; |
| 577 | 577 | astring parent; |
| 578 | apath.cpy(zippath_parent(parent, apath)); | |
| 578 | apath.cpy(zippath_parent(parent, apath.c_str())); | |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | while (current_entry_type == ENTTYPE_NONE && !is_root(apath)); | |
| 581 | while (current_entry_type == ENTTYPE_NONE && !is_root(apath.c_str())); | |
| 582 | 582 | |
| 583 | 583 | /* if we did not find anything, then error out */ |
| 584 | 584 | if (current_entry_type == ENTTYPE_NONE) |
| r245640 | r245641 | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /* is this file a ZIP file? */ |
| 591 | if ((current_entry_type == ENTTYPE_FILE) && is_zip_file(apath_trimmed) | |
| 592 | && (zip_file_open(apath_trimmed, &zipfile) == ZIPERR_NONE)) | |
| 591 | if ((current_entry_type == ENTTYPE_FILE) && is_zip_file(apath_trimmed.c_str()) | |
| 592 | && (zip_file_open(apath_trimmed.c_str(), &zipfile) == ZIPERR_NONE)) | |
| 593 | 593 | { |
| 594 | 594 | i = strlen(path + apath.len()); |
| 595 | 595 | while (i > 0 && is_zip_path_separator(path[apath.len() + i - 1])) |
| r245640 | r245641 | |
| 597 | 597 | newpath.cpy(path + apath.len(), i); |
| 598 | 598 | |
| 599 | 599 | /* this was a true ZIP path - attempt to identify the type of path */ |
| 600 | zippath_find_sub_path(zipfile, newpath, ¤t_entry_type); | |
| 600 | zippath_find_sub_path(zipfile, newpath.c_str(), ¤t_entry_type); | |
| 601 | 601 | if (current_entry_type == ENTTYPE_NONE) |
| 602 | 602 | { |
| 603 | 603 | err = FILERR_NOT_FOUND; |
| r245640 | r245641 | |
| 719 | 719 | int len = directory->zipprefix.len(); |
| 720 | 720 | |
| 721 | 721 | if ((len <= strlen(header->filename)) |
| 722 | && !strncmp(directory->zipprefix, header->filename, len)) | |
| 722 | && !strncmp(directory->zipprefix.c_str(), header->filename, len)) | |
| 723 | 723 | { |
| 724 | 724 | result = &header->filename[len]; |
| 725 | 725 | while(is_zip_file_separator(*result)) |
| r245640 | r245641 | |
| 798 | 798 | /* a nested entry; loop through returned_dirlist to see if we've returned the parent directory */ |
| 799 | 799 | for (rdent = directory->returned_dirlist; rdent != NULL; rdent = rdent->next) |
| 800 | 800 | { |
| 801 | if (!core_strnicmp(rdent->name, relpath, separator - relpath)) | |
| 801 | if (!core_strnicmp(rdent->name.c_str(), relpath, separator - relpath)) | |
| 802 | 802 | break; |
| 803 | 803 | } |
| 804 | 804 | |
| r245640 | r245641 | |
| 812 | 812 | |
| 813 | 813 | /* ...and return it */ |
| 814 | 814 | memset(&directory->returned_entry, 0, sizeof(directory->returned_entry)); |
| 815 | directory->returned_entry.name = rdent->name; | |
| 815 | directory->returned_entry.name = rdent->name.c_str(); | |
| 816 | 816 | directory->returned_entry.type = ENTTYPE_DIR; |
| 817 | 817 | result = &directory->returned_entry; |
| 818 | 818 | } |
| r245640 | r245641 | |
|---|---|---|
| 780 | 780 | astring tempstr; |
| 781 | 781 | for (int simmnum = 0; simmnum < 7; simmnum++) |
| 782 | 782 | for (int chipnum = 0; chipnum < 8; chipnum++) |
| 783 | m_simm[simmnum][chipnum] = machine().device<fujitsu_29f016a_device>(tempstr.format("simm%d.%d", simmnum + 1, chipnum)); | |
| 783 | m_simm[simmnum][chipnum] = machine().device<fujitsu_29f016a_device>(tempstr.format("simm%d.%d", simmnum + 1, chipnum).c_str()); | |
| 784 | 784 | |
| 785 | 785 | m_eeprom = auto_alloc_array(machine(), UINT32, 0x400/4); |
| 786 | 786 | machine().device<nvram_device>("eeprom")->set_base(m_eeprom, 0x400); |
| r245640 | r245641 | |
|---|---|---|
| 644 | 644 | |
| 645 | 645 | astring region_tag; |
| 646 | 646 | if (m_cart1) |
| 647 | m_cart_reg[0] = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 647 | m_cart_reg[0] = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 648 | 648 | else |
| 649 | 649 | m_cart_reg[0] = memregion("cart"); |
| 650 | 650 | if (m_cart2) |
| 651 | m_cart_reg[1] = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 651 | m_cart_reg[1] = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 652 | 652 | if (m_cart3) |
| 653 | m_cart_reg[2] = memregion(region_tag.cpy(m_cart3->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 653 | m_cart_reg[2] = memregion(region_tag.cpy(m_cart3->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 654 | 654 | if (m_cart4) |
| 655 | m_cart_reg[3] = memregion(region_tag.cpy(m_cart4->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 655 | m_cart_reg[3] = memregion(region_tag.cpy(m_cart4->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 656 | 656 | if (m_cart5) |
| 657 | m_cart_reg[4] = memregion(region_tag.cpy(m_cart5->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 657 | m_cart_reg[4] = memregion(region_tag.cpy(m_cart5->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 658 | 658 | if (m_cart6) |
| 659 | m_cart_reg[5] = memregion(region_tag.cpy(m_cart6->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 659 | m_cart_reg[5] = memregion(region_tag.cpy(m_cart6->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 660 | 660 | if (m_cart7) |
| 661 | m_cart_reg[6] = memregion(region_tag.cpy(m_cart7->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 661 | m_cart_reg[6] = memregion(region_tag.cpy(m_cart7->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 662 | 662 | if (m_cart8) |
| 663 | m_cart_reg[7] = memregion(region_tag.cpy(m_cart8->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 663 | m_cart_reg[7] = memregion(region_tag.cpy(m_cart8->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 664 | 664 | |
| 665 | 665 | switch_cart(0); |
| 666 | 666 | } |
| r245640 | r245641 | |
|---|---|---|
| 1239 | 1239 | |
| 1240 | 1240 | astring region_tag; |
| 1241 | 1241 | if (m_cart1) |
| 1242 | m_cart_reg[0] = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1242 | m_cart_reg[0] = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1243 | 1243 | else |
| 1244 | 1244 | m_cart_reg[0] = memregion("cart"); |
| 1245 | 1245 | if (m_cart2) |
| 1246 | m_cart_reg[1] = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1246 | m_cart_reg[1] = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1247 | 1247 | if (m_cart3) |
| 1248 | m_cart_reg[2] = memregion(region_tag.cpy(m_cart3->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1248 | m_cart_reg[2] = memregion(region_tag.cpy(m_cart3->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1249 | 1249 | if (m_cart4) |
| 1250 | m_cart_reg[3] = memregion(region_tag.cpy(m_cart4->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1250 | m_cart_reg[3] = memregion(region_tag.cpy(m_cart4->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1251 | 1251 | |
| 1252 | 1252 | m_en_68k = 0; |
| 1253 | 1253 | m_NMI_reset = 0; |
| r245640 | r245641 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | #define MCFG_ATARI_VAD_PLAYFIELD(_class, _gfxtag, _getinfo) \ |
| 51 | 51 | { astring fulltag(device->tag(), ":playfield"); device_t *device; \ |
| 52 | MCFG_TILEMAP_ADD(fulltag) \ | |
| 52 | MCFG_TILEMAP_ADD(fulltag.c_str()) \ | |
| 53 | 53 | MCFG_TILEMAP_GFXDECODE("^" _gfxtag) \ |
| 54 | 54 | MCFG_TILEMAP_BYTES_PER_ENTRY(2) \ |
| 55 | 55 | MCFG_TILEMAP_INFO_CB_DEVICE(DEVICE_SELF_OWNER, _class, _getinfo) \ |
| r245640 | r245641 | |
| 58 | 58 | |
| 59 | 59 | #define MCFG_ATARI_VAD_PLAYFIELD2(_class, _gfxtag, _getinfo) \ |
| 60 | 60 | { astring fulltag(device->tag(), ":playfield2"); device_t *device; \ |
| 61 | MCFG_TILEMAP_ADD(fulltag) \ | |
| 61 | MCFG_TILEMAP_ADD(fulltag.c_str()) \ | |
| 62 | 62 | MCFG_TILEMAP_GFXDECODE("^" _gfxtag) \ |
| 63 | 63 | MCFG_TILEMAP_BYTES_PER_ENTRY(2) \ |
| 64 | 64 | MCFG_TILEMAP_INFO_CB_DEVICE(DEVICE_SELF_OWNER, _class, _getinfo) \ |
| r245640 | r245641 | |
| 68 | 68 | |
| 69 | 69 | #define MCFG_ATARI_VAD_ALPHA(_class, _gfxtag, _getinfo) \ |
| 70 | 70 | { astring fulltag(device->tag(), ":alpha"); device_t *device; \ |
| 71 | MCFG_TILEMAP_ADD(fulltag) \ | |
| 71 | MCFG_TILEMAP_ADD(fulltag.c_str()) \ | |
| 72 | 72 | MCFG_TILEMAP_GFXDECODE("^" _gfxtag) \ |
| 73 | 73 | MCFG_TILEMAP_BYTES_PER_ENTRY(2) \ |
| 74 | 74 | MCFG_TILEMAP_INFO_CB_DEVICE(DEVICE_SELF_OWNER, _class, _getinfo) \ |
| r245640 | r245641 | |
| 78 | 78 | |
| 79 | 79 | #define MCFG_ATARI_VAD_MOB(_config, _gfxtag) \ |
| 80 | 80 | { astring fulltag(device->tag(), ":mob"); device_t *device; \ |
| 81 | MCFG_ATARI_MOTION_OBJECTS_ADD(fulltag, "^^screen", _config) \ | |
| 81 | MCFG_ATARI_MOTION_OBJECTS_ADD(fulltag.c_str(), "^^screen", _config) \ | |
| 82 | 82 | MCFG_ATARI_MOTION_OBJECTS_GFXDECODE("^" _gfxtag) } |
| 83 | 83 | |
| 84 | 84 |
| r245640 | r245641 | |
|---|---|---|
| 317 | 317 | else |
| 318 | 318 | { |
| 319 | 319 | astring region_tag; |
| 320 | memcpy(m_eprom_rom, memregion(region_tag.cpy(m_eprom->tag()).cat(GENERIC_ROM_REGION_TAG))->base(), 0x800); | |
| 320 | memcpy(m_eprom_rom, memregion(region_tag.cpy(m_eprom->tag()).cat(GENERIC_ROM_REGION_TAG).c_str())->base(), 0x800); | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | // state saving |
| r245640 | r245641 | |
|---|---|---|
| 546 | 546 | { |
| 547 | 547 | // init |
| 548 | 548 | astring region_tag; |
| 549 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 549 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 550 | 550 | |
| 551 | 551 | membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); |
| 552 | 552 | if (m_cart_rom) |
| r245640 | r245641 | |
|---|---|---|
| 119 | 119 | void gameking_state::machine_start() |
| 120 | 120 | { |
| 121 | 121 | astring region_tag; |
| 122 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 122 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 123 | 123 | |
| 124 | 124 | if (!m_cart_rom) |
| 125 | 125 | { |
| r245640 | r245641 | |
|---|---|---|
| 2118 | 2118 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x0c000000, 0x0cffffff, 0, 0, "rom3"); |
| 2119 | 2119 | |
| 2120 | 2120 | astring region_tag; |
| 2121 | memory_region *cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GBASLOT_ROM_REGION_TAG)); | |
| 2121 | memory_region *cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GBASLOT_ROM_REGION_TAG).c_str()); | |
| 2122 | 2122 | |
| 2123 | 2123 | // install ROM accesses |
| 2124 | 2124 | membank("rom1")->set_base(cart_rom->base()); |
| r245640 | r245641 | |
|---|---|---|
| 1169 | 1169 | address_space &program = m_maincpu->space(AS_PROGRAM); |
| 1170 | 1170 | |
| 1171 | 1171 | astring region_tag; |
| 1172 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1172 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1173 | 1173 | |
| 1174 | 1174 | /* initialize RTC */ |
| 1175 | 1175 | m_rtc->cs_w(1); |
| r245640 | r245641 | |
| 1212 | 1212 | UINT8 *ram = m_ram->pointer(); |
| 1213 | 1213 | |
| 1214 | 1214 | astring region_tag; |
| 1215 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1215 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1216 | 1216 | |
| 1217 | 1217 | /* initialize RTC */ |
| 1218 | 1218 | m_rtc->cs_w(1); |
| r245640 | r245641 | |
| 1246 | 1246 | address_space &program = m_maincpu->space(AS_PROGRAM); |
| 1247 | 1247 | |
| 1248 | 1248 | astring region_tag; |
| 1249 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1249 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1250 | 1250 | |
| 1251 | 1251 | /* initialize RTC */ |
| 1252 | 1252 | m_rtc->cs_w(1); |
| r245640 | r245641 | |
| 1297 | 1297 | void tandy200_state::machine_start() |
| 1298 | 1298 | { |
| 1299 | 1299 | astring region_tag; |
| 1300 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1300 | m_opt_region = memregion(region_tag.cpy(m_opt_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1301 | 1301 | |
| 1302 | 1302 | /* configure ROM banking */ |
| 1303 | 1303 | membank("bank1")->configure_entry(0, m_rom->base()); |
| r245640 | r245641 | |
|---|---|---|
| 270 | 270 | void leapster_state::machine_start() |
| 271 | 271 | { |
| 272 | 272 | astring region_tag; |
| 273 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 273 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 274 | 274 | |
| 275 | 275 | if (m_cart_rom) |
| 276 | 276 | { |
| r245640 | r245641 | |
|---|---|---|
| 796 | 796 | m_type = NC_TYPE_1xx; |
| 797 | 797 | |
| 798 | 798 | astring region_tag; |
| 799 | m_card_ram = memregion(region_tag.cpy(m_card->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 799 | m_card_ram = memregion(region_tag.cpy(m_card->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 800 | 800 | if (m_card_ram) |
| 801 | 801 | m_card_size = m_card_ram->bytes(); |
| 802 | 802 | else |
| r245640 | r245641 | |
| 1140 | 1140 | m_type = NC_TYPE_200; |
| 1141 | 1141 | |
| 1142 | 1142 | astring region_tag; |
| 1143 | m_card_ram = memregion(region_tag.cpy(m_card->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1143 | m_card_ram = memregion(region_tag.cpy(m_card->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1144 | 1144 | if (m_card_ram) |
| 1145 | 1145 | m_card_size = m_card_ram->bytes(); |
| 1146 | 1146 | else |
| r245640 | r245641 | |
|---|---|---|
| 645 | 645 | if (m_cart->exists()) |
| 646 | 646 | { |
| 647 | 647 | astring region_tag; |
| 648 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG))->base(); | |
| 648 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str())->base(); | |
| 649 | 649 | |
| 650 | 650 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x3fffff, "flash0"); |
| 651 | 651 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x800000, 0x9fffff, "flash1"); |
| r245640 | r245641 | |
|---|---|---|
| 518 | 518 | { |
| 519 | 519 | astring region_tag; |
| 520 | 520 | ioport_port *color = ioport("COLOR"); |
| 521 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 521 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 522 | 522 | if (!m_cart_rom) // this should never happen, since we make carts mandatory! |
| 523 | 523 | m_cart_rom = memregion("maincpu"); |
| 524 | 524 |
| r245640 | r245641 | |
|---|---|---|
| 461 | 461 | astring region_tag; |
| 462 | 462 | m_rom_reg = memregion("rom"); |
| 463 | 463 | if (m_card1) |
| 464 | m_card1_reg = memregion(region_tag.cpy(m_card1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 464 | m_card1_reg = memregion(region_tag.cpy(m_card1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 465 | 465 | if (m_card2) |
| 466 | m_card2_reg = memregion(region_tag.cpy(m_card2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 466 | m_card2_reg = memregion(region_tag.cpy(m_card2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 467 | 467 | |
| 468 | 468 | membank("bank1")->set_base(m_rom_reg->base()); |
| 469 | 469 |
| r245640 | r245641 | |
|---|---|---|
| 742 | 742 | { |
| 743 | 743 | astring region_tag; |
| 744 | 744 | UINT8 *bios = memregion("bios")->base(); |
| 745 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG))->base(); | |
| 745 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str())->base(); | |
| 746 | 746 | if (!cart) |
| 747 | 747 | cart = memregion("bios")->base(); |
| 748 | 748 | |
| r245640 | r245641 | |
| 756 | 756 | { |
| 757 | 757 | astring region_tag; |
| 758 | 758 | UINT8 *bios = memregion("bios")->base(); |
| 759 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG))->base(); | |
| 759 | UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str())->base(); | |
| 760 | 760 | if (!cart) |
| 761 | 761 | cart = memregion("bios")->base(); |
| 762 | 762 |
| r245640 | r245641 | |
|---|---|---|
| 2079 | 2079 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); |
| 2080 | 2080 | |
| 2081 | 2081 | astring region_tag; |
| 2082 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 2082 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 2083 | 2083 | |
| 2084 | 2084 | m_port_c_8255=0; |
| 2085 | 2085 | |
| r245640 | r245641 | |
| 2097 | 2097 | m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000; |
| 2098 | 2098 | |
| 2099 | 2099 | astring region_tag; |
| 2100 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 2100 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 2101 | 2101 | // hackish way to simplify bankswitch handling |
| 2102 | 2102 | if (m_cart_rom) |
| 2103 | 2103 | memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000); |
| r245640 | r245641 | |
| 2136 | 2136 | m_video_ram = m_region_maincpu->base() + 0x70000; |
| 2137 | 2137 | |
| 2138 | 2138 | astring region_tag; |
| 2139 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 2139 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 2140 | 2140 | // should this be mirrored into the EXROM regions? hard to tell without an actual cart dump... |
| 2141 | 2141 | |
| 2142 | 2142 | m_port_c_8255=0; |
| r245640 | r245641 | |
|---|---|---|
| 489 | 489 | void pc8401a_state::machine_start() |
| 490 | 490 | { |
| 491 | 491 | astring region_tag; |
| 492 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 492 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 493 | 493 | |
| 494 | 494 | /* initialize RTC */ |
| 495 | 495 | m_rtc->cs_w(1); |
| r245640 | r245641 | |
|---|---|---|
| 886 | 886 | m_rtc_regs.timer->adjust(attotime::from_hz(1), index); |
| 887 | 887 | |
| 888 | 888 | astring region_tag; |
| 889 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 889 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 890 | 890 | |
| 891 | 891 | save_item(NAME(m_ftlb_regs.control)); |
| 892 | 892 | save_item(NAME(m_ftlb_regs.stat)); |
| r245640 | r245641 | |
|---|---|---|
| 619 | 619 | void prestige_state::machine_start() |
| 620 | 620 | { |
| 621 | 621 | astring region_tag; |
| 622 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 622 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 623 | 623 | |
| 624 | 624 | UINT8 *rom = memregion("maincpu")->base(); |
| 625 | 625 | UINT8 *cart = m_cart_rom->base(); |
| r245640 | r245641 | |
|---|---|---|
| 406 | 406 | |
| 407 | 407 | // FIXME: this is needed for gfx decoding, but there is probably a cleaner solution! |
| 408 | 408 | astring region_tag; |
| 409 | memcpy(memregion("gfxrom")->base(), memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG))->base(), m_cart->get_rom_size()); | |
| 409 | memcpy(memregion("gfxrom")->base(), memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str())->base(), m_cart->get_rom_size()); | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | save_item(NAME(m_io_regs)); |
| r245640 | r245641 | |
|---|---|---|
| 1229 | 1229 | void px4_state::machine_start() |
| 1230 | 1230 | { |
| 1231 | 1231 | astring region_tag; |
| 1232 | m_caps1_rom = memregion(region_tag.cpy(m_caps1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1233 | m_caps2_rom = memregion(region_tag.cpy(m_caps2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1232 | m_caps1_rom = memregion(region_tag.cpy(m_caps1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1233 | m_caps2_rom = memregion(region_tag.cpy(m_caps2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1234 | 1234 | |
| 1235 | 1235 | m_nvram->set_base(m_ram->pointer(), 0x10000); |
| 1236 | 1236 |
| r245640 | r245641 | |
|---|---|---|
| 318 | 318 | void socrates_state::machine_reset() |
| 319 | 319 | { |
| 320 | 320 | astring region_tag; |
| 321 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 321 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 322 | 322 | |
| 323 | 323 | m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere... |
| 324 | 324 | socrates_set_rom_bank(); |
| r245640 | r245641 | |
| 897 | 897 | void iqunlim_state::machine_start() |
| 898 | 898 | { |
| 899 | 899 | astring region_tag; |
| 900 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 900 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 901 | 901 | |
| 902 | 902 | UINT8 *bios = m_bios_reg->base(); |
| 903 | 903 | UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base(); |
| r245640 | r245641 | |
|---|---|---|
| 469 | 469 | { |
| 470 | 470 | int num_banks; |
| 471 | 471 | astring region_tag; |
| 472 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 472 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 473 | 473 | num_banks = m_cart_rom->bytes() / 0x4000; |
| 474 | 474 | |
| 475 | 475 | m_bank1 = membank("bank1"); |
| r245640 | r245641 | |
|---|---|---|
| 545 | 545 | m_port_f4_data = 0; |
| 546 | 546 | |
| 547 | 547 | astring region_tag; |
| 548 | m_dock_crt = memregion(region_tag.cpy(m_dock->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 548 | m_dock_crt = memregion(region_tag.cpy(m_dock->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 549 | 549 | m_dock_cart_type = m_dock_crt ? TIMEX_CART_DOCK : TIMEX_CART_NONE; |
| 550 | 550 | |
| 551 | 551 | ts2068_update_memory(); |
| r245640 | r245641 | |
|---|---|---|
| 355 | 355 | if (m_cart != NULL && m_cart->exists()) |
| 356 | 356 | { |
| 357 | 357 | astring region_tag; |
| 358 | memory_region *src = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 358 | memory_region *src = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 359 | 359 | if (src) |
| 360 | 360 | memcpy(m_cart_base, src->base(), src->bytes()); |
| 361 | 361 | } |
| r245640 | r245641 | |
|---|---|---|
| 226 | 226 | void tutor_state::machine_start() |
| 227 | 227 | { |
| 228 | 228 | astring region_tag; |
| 229 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 229 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 230 | 230 | |
| 231 | 231 | m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); |
| 232 | 232 |
| r245640 | r245641 | |
|---|---|---|
| 608 | 608 | m_vram = memregion("vram"); |
| 609 | 609 | |
| 610 | 610 | astring region_tag; |
| 611 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 611 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | void tvc_state::machine_reset() |
| r245640 | r245641 | |
|---|---|---|
| 1174 | 1174 | if (m_cart->exists()) |
| 1175 | 1175 | { |
| 1176 | 1176 | astring region_tag; |
| 1177 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(VBOYSLOT_ROM_REGION_TAG)); | |
| 1177 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(VBOYSLOT_ROM_REGION_TAG).c_str()); | |
| 1178 | 1178 | |
| 1179 | 1179 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "prog_cart_bank"); |
| 1180 | 1180 | m_maincpu->space(AS_IO).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "io_cart_bank"); |
| r245640 | r245641 | |
|---|---|---|
| 1024 | 1024 | if (m_cart && m_cart->exists()) |
| 1025 | 1025 | { |
| 1026 | 1026 | astring region_tag; |
| 1027 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 1027 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 1028 | 1028 | memcpy(m_p_cart, m_cart_rom->base(), 0x400000 * 2); |
| 1029 | 1029 | } |
| 1030 | 1030 | else if (m_spg243_mode == SPG243_VII) // Vii bios is banked |
| r245640 | r245641 | |
|---|---|---|
| 28 | 28 | void advision_state::machine_start() |
| 29 | 29 | { |
| 30 | 30 | astring region_tag; |
| 31 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 31 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 32 | 32 | |
| 33 | 33 | /* configure EA banking */ |
| 34 | 34 | m_bank1->configure_entry(0, memregion(I8048_TAG)->base()); |
| r245640 | r245641 | |
|---|---|---|
| 3033 | 3033 | m_centronics->write_data7(0); |
| 3034 | 3034 | |
| 3035 | 3035 | astring region_tag; |
| 3036 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 3036 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 3037 | 3037 | if (!m_region_cart) // this should never happen, since we make carts mandatory! |
| 3038 | 3038 | m_region_cart = memregion("maincpu"); |
| 3039 | 3039 | } |
| r245640 | r245641 | |
| 3077 | 3077 | m_system_type = SYSTEM_GX4000; |
| 3078 | 3078 | |
| 3079 | 3079 | astring region_tag; |
| 3080 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 3080 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 3081 | 3081 | if (!m_region_cart) // this should never happen, since we make carts mandatory! |
| 3082 | 3082 | m_region_cart = memregion("maincpu"); |
| 3083 | 3083 | } |
| r245640 | r245641 | |
|---|---|---|
| 2036 | 2036 | astring region_tag; |
| 2037 | 2037 | memory_region *tmp_reg; |
| 2038 | 2038 | UINT8 *eprom[4]; |
| 2039 | if (m_exp1 && (tmp_reg = memregion(region_tag.cpy(m_exp1->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2039 | if (m_exp1 && (tmp_reg = memregion(region_tag.cpy(m_exp1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2040 | 2040 | eprom[0] = tmp_reg->base() + shift; |
| 2041 | 2041 | else |
| 2042 | 2042 | eprom[0] = m_region_opt->base() + 0x0000 + shift; |
| 2043 | if (m_exp2 && (tmp_reg = memregion(region_tag.cpy(m_exp2->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2043 | if (m_exp2 && (tmp_reg = memregion(region_tag.cpy(m_exp2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2044 | 2044 | eprom[1] = tmp_reg->base() + shift; |
| 2045 | 2045 | else |
| 2046 | 2046 | eprom[1] = m_region_opt->base() + 0x4000 + shift; |
| 2047 | if (m_exp3 && (tmp_reg = memregion(region_tag.cpy(m_exp3->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2047 | if (m_exp3 && (tmp_reg = memregion(region_tag.cpy(m_exp3->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2048 | 2048 | eprom[2] = tmp_reg->base() + shift; |
| 2049 | 2049 | else |
| 2050 | 2050 | eprom[2] = m_region_opt->base() + 0x8000 + shift; |
| 2051 | if (m_exp4 && (tmp_reg = memregion(region_tag.cpy(m_exp4->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2051 | if (m_exp4 && (tmp_reg = memregion(region_tag.cpy(m_exp4->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2052 | 2052 | eprom[3] = tmp_reg->base() + shift; |
| 2053 | 2053 | else |
| 2054 | 2054 | eprom[3] = m_region_opt->base() + 0xc000 + shift; |
| r245640 | r245641 | |
| 2070 | 2070 | astring region_tag; |
| 2071 | 2071 | memory_region *tmp_reg; |
| 2072 | 2072 | UINT8 *eprom[2]; |
| 2073 | if (m_exp1 && (tmp_reg = memregion(region_tag.cpy(m_exp1->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2073 | if (m_exp1 && (tmp_reg = memregion(region_tag.cpy(m_exp1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2074 | 2074 | eprom[0] = tmp_reg->base() + shift; |
| 2075 | 2075 | else |
| 2076 | 2076 | eprom[0] = m_region_opt->base() + 0x0000 + shift; |
| 2077 | if (m_exp2 && (tmp_reg = memregion(region_tag.cpy(m_exp2->tag()).cat(GENERIC_ROM_REGION_TAG)))) | |
| 2077 | if (m_exp2 && (tmp_reg = memregion(region_tag.cpy(m_exp2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()))) | |
| 2078 | 2078 | eprom[1] = tmp_reg->base() + shift; |
| 2079 | 2079 | else |
| 2080 | 2080 | eprom[1] = m_region_opt->base() + 0x8000 + shift; |
| r245640 | r245641 | |
|---|---|---|
| 439 | 439 | save_item(NAME(disk_pram)); |
| 440 | 440 | |
| 441 | 441 | astring tempstring; |
| 442 | UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, CUDA_CPU_TAG))->base(); | |
| 442 | UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, CUDA_CPU_TAG).c_str())->base(); | |
| 443 | 443 | |
| 444 | 444 | if (rom) |
| 445 | 445 | { |
| r245640 | r245641 | |
|---|---|---|
| 388 | 388 | save_item(NAME(disk_pram)); |
| 389 | 389 | |
| 390 | 390 | astring tempstring; |
| 391 | UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, EGRET_CPU_TAG))->base(); | |
| 391 | UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, EGRET_CPU_TAG).c_str())->base(); | |
| 392 | 392 | |
| 393 | 393 | if (rom) |
| 394 | 394 | { |
| r245640 | r245641 | |
|---|---|---|
| 347 | 347 | { |
| 348 | 348 | UINT8 *lo_rom, *up_rom; |
| 349 | 349 | astring region_tag; |
| 350 | memory_region *cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 350 | memory_region *cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 351 | 351 | |
| 352 | 352 | if (cart_rom) |
| 353 | 353 | up_rom = cart_rom->base(); |
| r245640 | r245641 | |
|---|---|---|
| 26 | 26 | m_lcdc_reg = 0xb0; |
| 27 | 27 | |
| 28 | 28 | astring region_tag; |
| 29 | m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 30 | m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 29 | m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 30 | m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data) |
| r245640 | r245641 | |
|---|---|---|
| 243 | 243 | void primo_state::machine_start() |
| 244 | 244 | { |
| 245 | 245 | astring region_tag; |
| 246 | m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 247 | m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 246 | m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 247 | m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | void primo_state::machine_reset() |
| r245640 | r245641 | |
|---|---|---|
| 422 | 422 | void svi318_state::machine_start() |
| 423 | 423 | { |
| 424 | 424 | astring region_tag; |
| 425 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 425 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 426 | 426 | m_bios_rom = memregion("maincpu"); |
| 427 | 427 | |
| 428 | 428 | // 80 column card start |
| r245640 | r245641 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | // check ROM expansion |
| 76 | 76 | astring region_tag; |
| 77 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); | |
| 77 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG).c_str()); | |
| 78 | 78 | |
| 79 | 79 | for (i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) |
| 80 | 80 | m_laser_bank[i] = -1; |
| r245640 | r245641 | |
|---|---|---|
| 484 | 484 | if (!dv->title) |
| 485 | 485 | return; |
| 486 | 486 | |
| 487 | for (i=0; i<strlen(dv->title); i++) | |
| 487 | for (i = 0; i<strlen(dv->title.c_str()); i++) | |
| 488 | 488 | { |
| 489 | 489 | dview_draw_char(dv, RECT_DVIEW_TITLE, i * debug_font_width + BORDER_XTHICKNESS, |
| 490 | 490 | BORDER_YTHICKNESS, debug_font_height, //r.max_y - 2 * BORDER_YTHICKNESS, |
| r245640 | r245641 | |
| 1113 | 1113 | |
| 1114 | 1114 | editor->container->empty(); |
| 1115 | 1115 | /* get the size of the text */ |
| 1116 | editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str, 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 1116 | editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 1117 | 1117 | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); |
| 1118 | 1118 | width += 2 * UI_BOX_LR_BORDER; |
| 1119 | 1119 | maxwidth = MAX(width, 0.5); |
| r245640 | r245641 | |
| 1134 | 1134 | y2 -= UI_BOX_TB_BORDER; |
| 1135 | 1135 | |
| 1136 | 1136 | /* draw the text within it */ |
| 1137 | editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str, x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 1137 | editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, | |
| 1138 | 1138 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 1139 | 1139 | |
| 1140 | 1140 | } |
| r245640 | r245641 | |
| 1180 | 1180 | break; |
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | menu->item_append(title.cat(focus_view->title), NULL, MENU_FLAG_DISABLE, NULL); | |
| 1183 | menu->item_append(title.cat(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL); | |
| 1184 | 1184 | menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 1185 | 1185 | |
| 1186 | 1186 | switch (focus_view->type) |
| r245640 | r245641 | |
| 1322 | 1322 | render_editor(cur_editor); |
| 1323 | 1323 | if (ui_input_pressed(machine, IPT_UI_SELECT)) |
| 1324 | 1324 | { |
| 1325 | process_string(focus_view, focus_view->editor.str); | |
| 1325 | process_string(focus_view, focus_view->editor.str.c_str()); | |
| 1326 | 1326 | focus_view->editor.str = ""; |
| 1327 | 1327 | cur_editor = NULL; |
| 1328 | 1328 | } |
| r245640 | r245641 | |
|---|---|---|
| 121 | 121 | void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 122 | 122 | { |
| 123 | 123 | WindowQtConfig::addToXmlDataNode(node); |
| 124 | xml_set_attribute(node, "device-tag", m_device_tag); | |
| 124 | xml_set_attribute(node, "device-tag", m_device_tag.c_str()); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 |
| r245640 | r245641 | |
|---|---|---|
| 234 | 234 | { |
| 235 | 235 | command.printf("bpclear 0x%X", bpindex); |
| 236 | 236 | } |
| 237 | debug_console_execute_command(*m_machine, command, 1); | |
| 237 | debug_console_execute_command(*m_machine, command.c_str(), 1); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | refreshAll(); |
| r245640 | r245641 | |
| 259 | 259 | INT32 const bpindex = bp->index(); |
| 260 | 260 | astring command; |
| 261 | 261 | command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex); |
| 262 | debug_console_execute_command(*m_machine, command, 1); | |
| 262 | debug_console_execute_command(*m_machine, command.c_str(), 1); | |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| r245640 | r245641 | |
| 275 | 275 | offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address(); |
| 276 | 276 | astring command; |
| 277 | 277 | command.printf("go 0x%X", address); |
| 278 | debug_console_execute_command(*m_machine, command, 1); | |
| 278 | debug_console_execute_command(*m_machine, command.c_str(), 1); | |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 |
| r245640 | r245641 | |
|---|---|---|
| 46 | 46 | { |
| 47 | 47 | astring temp; |
| 48 | 48 | temp.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[no image]"); |
| 49 | TCHAR *tc_buf = tstring_from_utf8(temp); | |
| 49 | TCHAR *tc_buf = tstring_from_utf8(temp.c_str()); | |
| 50 | 50 | if (tc_buf != NULL) |
| 51 | 51 | { |
| 52 | 52 | AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf); |
| r245640 | r245641 | |
| 112 | 112 | title.printf("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag()); |
| 113 | 113 | win_get_window_text_utf8(window(), curtitle, ARRAY_LENGTH(curtitle)); |
| 114 | 114 | if (title.cmp(curtitle) != 0) |
| 115 | win_set_window_text_utf8(window(), title); | |
| 115 | win_set_window_text_utf8(window(), title.c_str()); | |
| 116 | 116 | |
| 117 | 117 | // and recompute the children |
| 118 | 118 | recompute_children(); |
| r245640 | r245641 | |
| 203 | 203 | |
| 204 | 204 | astring temp; |
| 205 | 205 | temp.format("%s :%s", img->device().name(), img->exists() ? img->filename() : "[empty slot]"); |
| 206 | TCHAR *tc_buf = tstring_from_utf8(temp); | |
| 206 | TCHAR *tc_buf = tstring_from_utf8(temp.c_str()); | |
| 207 | 207 | if (tc_buf != NULL) |
| 208 | 208 | { |
| 209 | 209 | ModifyMenu(m_devices_menu, cnt, MF_BYPOSITION | MF_POPUP, (UINT_PTR)devicesubmenu, tc_buf); |
| r245640 | r245641 | |
| 229 | 229 | { |
| 230 | 230 | astring filter; |
| 231 | 231 | build_generic_filter(img, false, filter); |
| 232 | LPTSTR t_filter = tstring_from_utf8(filter); | |
| 232 | LPTSTR t_filter = tstring_from_utf8(filter.c_str()); | |
| 233 | 233 | if (t_filter) |
| 234 | 234 | { |
| 235 | 235 | // convert a pipe-char delimited string into a NUL delimited string |
| r245640 | r245641 | |
|---|---|---|
| 200 | 200 | command.printf("bpset 0x%X", address); |
| 201 | 201 | else |
| 202 | 202 | command.printf("bpclear 0x%X", bpindex); |
| 203 | debug_console_execute_command(machine(), command, 1); | |
| 203 | debug_console_execute_command(machine(), command.c_str(), 1); | |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | return true; |
| r245640 | r245641 | |
| 230 | 230 | { |
| 231 | 231 | astring command; |
| 232 | 232 | command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index()); |
| 233 | debug_console_execute_command(machine(), command, 1); | |
| 233 | debug_console_execute_command(machine(), command.c_str(), 1); | |
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
| r245640 | r245641 | |
| 244 | 244 | { |
| 245 | 245 | astring command; |
| 246 | 246 | command.printf("go 0x%X", address); |
| 247 | debug_console_execute_command(machine(), command, 1); | |
| 247 | debug_console_execute_command(machine(), command.c_str(), 1); | |
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| r245640 | r245641 | |
|---|---|---|
| 145 | 145 | |
| 146 | 146 | void disasmwin_info::update_caption() |
| 147 | 147 | { |
| 148 | win_set_window_text_utf8(window(), astring("Disassembly: ", m_views[0]->source_name())); | |
| 148 | win_set_window_text_utf8(window(), astring("Disassembly: ", m_views[0]->source_name()).c_str()); | |
| 149 | 149 | } |
| r245640 | r245641 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | if (wnd == m_editwnd) |
| 53 | 53 | { |
| 54 | set_editwnd_text(m_edit_defstr); | |
| 54 | set_editwnd_text(m_edit_defstr.c_str()); | |
| 55 | 55 | editwnd_select_all(); |
| 56 | 56 | return true; |
| 57 | 57 | } |
| r245640 | r245641 | |
| 206 | 206 | if (_tcslen(buffer) > 0) |
| 207 | 207 | { |
| 208 | 208 | set_ignore_char_lparam(lparam); |
| 209 | set_editwnd_text(m_edit_defstr); | |
| 209 | set_editwnd_text(m_edit_defstr.c_str()); | |
| 210 | 210 | editwnd_select_all(); |
| 211 | 211 | } |
| 212 | 212 | break; |
| r245640 | r245641 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | logwin_info::logwin_info(debugger_windows_interface &debugger) : |
| 15 | debugwin_info(debugger, false, astring("Errorlog: ", debugger.machine().system().description, " [", debugger.machine().system().name, "]"), NULL) | |
| 15 | debugwin_info(debugger, false, astring("Errorlog: ", debugger.machine().system().description, " [", debugger.machine().system().name, "]").c_str(), NULL) | |
| 16 | 16 | { |
| 17 | 17 | if (!window()) |
| 18 | 18 | return; |
| r245640 | r245641 | |
|---|---|---|
| 275 | 275 | |
| 276 | 276 | void memorywin_info::update_caption() |
| 277 | 277 | { |
| 278 | win_set_window_text_utf8(window(), astring("Memory: ", m_views[0]->source_name())); | |
| 278 | win_set_window_text_utf8(window(), astring("Memory: ", m_views[0]->source_name()).c_str()); | |
| 279 | 279 | } |
| r245640 | r245641 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | pointswin_info::pointswin_info(debugger_windows_interface &debugger) : |
| 17 | debugwin_info(debugger, false, astring("All Breakpoints"), NULL) | |
| 17 | debugwin_info(debugger, false, astring("All Breakpoints").c_str(), NULL) | |
| 18 | 18 | { |
| 19 | 19 | if (!window()) |
| 20 | 20 | return; |
| r245640 | r245641 | |
|---|---|---|
| 68 | 68 | logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; |
| 69 | 69 | |
| 70 | 70 | // copy in the face name |
| 71 | TCHAR *face = tstring_from_utf8(name); | |
| 71 | TCHAR *face = tstring_from_utf8(name.c_str()); | |
| 72 | 72 | _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR)); |
| 73 | 73 | logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0; |
| 74 | 74 | osd_free(face); |
| r245640 | r245641 | |
| 89 | 89 | |
| 90 | 90 | // if it doesn't match our request, fail |
| 91 | 91 | char *utf = utf8_from_tstring(realname); |
| 92 | int result = core_stricmp(utf, name); | |
| 92 | int result = core_stricmp(utf, name.c_str()); | |
| 93 | 93 | osd_free(utf); |
| 94 | 94 | |
| 95 | 95 | // if we didn't match, nuke our font and fall back |
| r245640 | r245641 | |
|---|---|---|
| 113 | 113 | const char *aspect() const { return value(OSDOPTION_ASPECT); } |
| 114 | 114 | const char *resolution() const { return value(OSDOPTION_RESOLUTION); } |
| 115 | 115 | const char *view() const { return value(OSDOPTION_VIEW); } |
| 116 | const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); } | |
| 117 | const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); } | |
| 118 | const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); } | |
| 119 | const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); } | |
| 116 | const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index).c_str()); } | |
| 117 | const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index).c_str()); } | |
| 118 | const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index).c_str()); } | |
| 119 | const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index).c_str()); } | |
| 120 | 120 | |
| 121 | 121 | // full screen options |
| 122 | 122 | bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); } |
| r245640 | r245641 | |
| 136 | 136 | bool gl_pbo() const { return bool_value(OSDOPTION_GL_PBO); } |
| 137 | 137 | bool gl_glsl() const { return bool_value(OSDOPTION_GL_GLSL); } |
| 138 | 138 | bool glsl_filter() const { return bool_value(OSDOPTION_GLSL_FILTER); } |
| 139 | const char *shader_mame(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_MAME, index)); } | |
| 140 | const char *shader_screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_SCREEN, index)); } | |
| 139 | const char *shader_mame(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_MAME, index).c_str()); } | |
| 140 | const char *shader_screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_SCREEN, index).c_str()); } | |
| 141 | 141 | |
| 142 | 142 | // CoreAudio specific options |
| 143 | 143 | const char *audio_output() const { return value(OSDOPTION_AUDIO_OUTPUT); } |
| 144 | const char *audio_effect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_AUDIO_EFFECT, index)); } | |
| 144 | const char *audio_effect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_AUDIO_EFFECT, index).c_str()); } | |
| 145 | 145 | |
| 146 | 146 | private: |
| 147 | 147 | static const options_entry s_option_entries[]; |
| r245640 | r245641 | |
| 240 | 240 | // FIXME: should be elsewhere |
| 241 | 241 | osd_module *select_module_options(const core_options &opts, const astring &opt_name) |
| 242 | 242 | { |
| 243 | astring opt_val = opts.value(opt_name); | |
| 243 | astring opt_val = opts.value(opt_name.c_str()); | |
| 244 | 244 | if (opt_val == "auto") |
| 245 | 245 | opt_val = ""; |
| 246 | else if (!m_mod_man.type_has_name(opt_name, opt_val)) | |
| 246 | else if (!m_mod_man.type_has_name(opt_name.c_str(), opt_val.c_str())) | |
| 247 | 247 | { |
| 248 | 248 | osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.c_str(), opt_name.c_str()); |
| 249 | 249 | opt_val = ""; |
| 250 | 250 | } |
| 251 | return m_mod_man.select_module(opt_name, opt_val); | |
| 251 | return m_mod_man.select_module(opt_name.c_str(), opt_val.c_str()); | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | template<class C> |
| r245640 | r245641 | |
|---|---|---|
| 32 | 32 | {} |
| 33 | 33 | virtual ~osd_module() { } |
| 34 | 34 | |
| 35 | const char * name() const { return m_name; } | |
| 36 | const char * type() const { return m_type; } | |
| 35 | const char * name() const { return m_name.c_str(); } | |
| 36 | const char * type() const { return m_type.c_str(); } | |
| 37 | 37 | |
| 38 | 38 | virtual bool probe() { return true; } |
| 39 | 39 |
| r245640 | r245641 | |
|---|---|---|
| 373 | 373 | astring text1(emulator_info::get_appname(), " ", build_version); |
| 374 | 374 | astring text2(machine->system().manufacturer, " ", machine->system().description); |
| 375 | 375 | png_info pnginfo = { 0 }; |
| 376 | png_add_text(&pnginfo, "Software", text1); | |
| 377 | png_add_text(&pnginfo, "System", text2); | |
| 376 | png_add_text(&pnginfo, "Software", text1.c_str()); | |
| 377 | png_add_text(&pnginfo, "System", text2.c_str()); | |
| 378 | 378 | |
| 379 | 379 | // now do the actual work |
| 380 | 380 | png_error error = png_write_bitmap(file, &pnginfo, avi_snap, 1 << 24, NULL); |
| r245640 | r245641 | |
| 567 | 567 | if (filerr == FILERR_NONE) |
| 568 | 568 | { |
| 569 | 569 | // create the file and free the string |
| 570 | avi_error avierr = avi_create(fullpath, &info, &avi_output_file); | |
| 570 | avi_error avierr = avi_create(fullpath.c_str(), &info, &avi_output_file); | |
| 571 | 571 | if (avierr != AVIERR_NONE) |
| 572 | 572 | { |
| 573 | 573 | osd_printf_error("Error creating AVI: %s\n", avi_error_string(avierr)); |
| r245640 | r245641 | |
| 3402 | 3402 | |
| 3403 | 3403 | // handle %d in the template (for image devices) |
| 3404 | 3404 | astring snapdev("%d_"); |
| 3405 | int pos = snapstr.find(0, snapdev); | |
| 3405 | int pos = snapstr.find(0, snapdev.c_str()); | |
| 3406 | 3406 | |
| 3407 | 3407 | if (pos != -1) |
| 3408 | 3408 | { |
| 3409 | 3409 | // if more %d are found, revert to default and ignore them all |
| 3410 | if (snapstr.find(pos + 3, snapdev) != -1) | |
| 3410 | if (snapstr.find(pos + 3, snapdev.c_str()) != -1) | |
| 3411 | 3411 | snapstr.cpy("%g/%i"); |
| 3412 | 3412 | // else if there is a single %d, try to create the correct snapname |
| 3413 | 3413 | else |
| r245640 | r245641 | |
| 3453 | 3453 | filename.substr(0, filename.rchr(0, '.')); |
| 3454 | 3454 | |
| 3455 | 3455 | // setup snapname and remove the %d_ |
| 3456 | snapstr.replace(0, snapdevname, filename); | |
| 3456 | snapstr.replace(0, snapdevname.c_str(), filename.c_str()); | |
| 3457 | 3457 | snapstr.del(pos, 3); |
| 3458 | 3458 | |
| 3459 | 3459 | name_found = 1; |
| r245640 | r245641 | |
| 3492 | 3492 | fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d_%d", seq, idx).c_str()); |
| 3493 | 3493 | |
| 3494 | 3494 | // try to open the file; stop when we fail |
| 3495 | file_error filerr = file.open(fname); | |
| 3495 | file_error filerr = file.open(fname.c_str()); | |
| 3496 | 3496 | if (filerr != FILERR_NONE) |
| 3497 | 3497 | break; |
| 3498 | 3498 | } |
| r245640 | r245641 | |
| 3500 | 3500 | |
| 3501 | 3501 | // create the final file |
| 3502 | 3502 | file.set_openflags(origflags); |
| 3503 | return file.open(fname); | |
| 3503 | return file.open(fname.c_str()); | |
| 3504 | 3504 | } |
| r245640 | r245641 | |
|---|---|---|
| 687 | 687 | { |
| 688 | 688 | sprintf(tempname, "NC%d", index); |
| 689 | 689 | devinfo = generic_device_alloc(devlist, tempname); |
| 690 | devinfo->device = machine.input().device_class(devclass).add_device(devinfo->name, devinfo); | |
| 690 | devinfo->device = machine.input().device_class(devclass).add_device(devinfo->name.c_str(), devinfo); | |
| 691 | 691 | } |
| 692 | 692 | return NULL; |
| 693 | 693 | } |
| 694 | 694 | else |
| 695 | 695 | { |
| 696 | 696 | devinfo = generic_device_alloc(devlist, devmap->map[index].name); |
| 697 | devinfo->device = machine.input().device_class(devclass).add_device(devinfo->name, devinfo); | |
| 697 | devinfo->device = machine.input().device_class(devclass).add_device(devinfo->name.c_str(), devinfo); | |
| 698 | 698 | } |
| 699 | 699 | return devinfo; |
| 700 | 700 | } |
| r245640 | r245641 | |
|---|---|---|
| 119 | 119 | const char *ui_mode_key() const { return value(SDLOPTION_UIMODEKEY); } |
| 120 | 120 | |
| 121 | 121 | // joystick mapping |
| 122 | const char *joy_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_JOYINDEX, index)); } | |
| 122 | const char *joy_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_JOYINDEX, index).c_str()); } | |
| 123 | 123 | bool sixaxis() const { return bool_value(SDLOPTION_SIXAXIS); } |
| 124 | 124 | |
| 125 | 125 | #if (SDLMAME_SDL2) |
| 126 | const char *mouse_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_MOUSEINDEX, index)); } | |
| 127 | const char *keyboard_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_KEYBINDEX, index)); } | |
| 126 | const char *mouse_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } | |
| 127 | const char *keyboard_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } | |
| 128 | 128 | #endif |
| 129 | 129 | |
| 130 | 130 | const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } |
| r245640 | r245641 | |
|---|---|---|
| 591 | 591 | for (win_window_info *info = win_window_list; info != NULL; info = info->m_next) |
| 592 | 592 | { |
| 593 | 593 | tempstring.printf("Orientation(%s)", info->m_monitor->devicename()); |
| 594 | output_set_value(tempstring, info->m_targetorient); | |
| 594 | output_set_value(tempstring.c_str(), info->m_targetorient); | |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | // hook up the debugger log |
| r245640 | r245641 | |
| 1062 | 1062 | else |
| 1063 | 1063 | scan_file_for_address(address, false); |
| 1064 | 1064 | } |
| 1065 | return m_buffer; | |
| 1065 | return m_buffer.c_str(); | |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | |
| r245640 | r245641 | |
| 1116 | 1116 | |
| 1117 | 1117 | #ifdef __GNUC__ |
| 1118 | 1118 | // see if we have a symbol file (gcc only) |
| 1119 | srcfile = fopen(m_symfile, "r"); | |
| 1119 | srcfile = fopen(m_symfile.c_str(), "r"); | |
| 1120 | 1120 | is_symfile = (srcfile != NULL); |
| 1121 | 1121 | #endif |
| 1122 | 1122 | |
| 1123 | 1123 | // if not, see if we have a map file |
| 1124 | 1124 | if (srcfile == NULL) |
| 1125 | srcfile = fopen(m_mapfile, "r"); | |
| 1125 | srcfile = fopen(m_mapfile.c_str(), "r"); | |
| 1126 | 1126 | |
| 1127 | 1127 | // if not, fail |
| 1128 | 1128 | if (srcfile == NULL) |
| r245640 | r245641 | |
| 1153 | 1153 | |
| 1154 | 1154 | // also create a cache entry if we can |
| 1155 | 1155 | if (create_cache) |
| 1156 | m_cache.append(*global_alloc(cache_entry(addr, symbol))); | |
| 1156 | m_cache.append(*global_alloc(cache_entry(addr, symbol.c_str()))); | |
| 1157 | 1157 | } |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| r245640 | r245641 | |
| 1161 | 1161 | fclose(srcfile); |
| 1162 | 1162 | |
| 1163 | 1163 | // format the symbol and remember the last base |
| 1164 | format_symbol(best_symbol, address - best_addr); | |
| 1164 | format_symbol(best_symbol.c_str(), address - best_addr); | |
| 1165 | 1165 | m_last_base = best_addr; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| r245640 | r245641 | |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | // format the symbol and remember the last base |
| 1191 | format_symbol(best_symbol, address - best_addr); | |
| 1191 | format_symbol(best_symbol.c_str(), address - best_addr); | |
| 1192 | 1192 | m_last_base = best_addr; |
| 1193 | 1193 | } |
| 1194 | 1194 |
| r245640 | r245641 | |
|---|---|---|
| 325 | 325 | if (m_file != NULL) |
| 326 | 326 | core_fclose(m_file); |
| 327 | 327 | m_lastfile = m_info.track[tracknum].fname; |
| 328 | file_error filerr = core_fopen(m_lastfile, OPEN_FLAG_READ, &m_file); | |
| 328 | file_error filerr = core_fopen(m_lastfile.c_str(), OPEN_FLAG_READ, &m_file); | |
| 329 | 329 | if (filerr != FILERR_NONE) |
| 330 | 330 | report_error(1, "Error opening input file (%s)'", m_lastfile.c_str()); |
| 331 | 331 | } |
| r245640 | r245641 | |
| 826 | 826 | { |
| 827 | 827 | // 0 is a special case |
| 828 | 828 | if (intvalue == 0) |
| 829 | return string.cpy("0"); | |
| 829 | return string.cpy("0").c_str(); | |
| 830 | 830 | |
| 831 | 831 | // loop until all chunks are done |
| 832 | 832 | string.reset(); |
| r245640 | r245641 | |
| 840 | 840 | insert.format((intvalue != 0) ? "%03d" : "%d", chunk); |
| 841 | 841 | |
| 842 | 842 | if (!first) |
| 843 | string.ins(0, ","); | |
| 843 | string.ins(0, ",").c_str(); | |
| 844 | 844 | first = false; |
| 845 | 845 | string.ins(0, insert); |
| 846 | 846 | } |
| 847 | return string; | |
| 847 | return string.c_str(); | |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | |
| r245640 | r245641 | |
| 855 | 855 | |
| 856 | 856 | const char *msf_string_from_frames(astring &string, UINT32 frames) |
| 857 | 857 | { |
| 858 | return string.format("%02d:%02d:%02d", frames / (75 * 60), (frames / 75) % 60, frames % 75); | |
| 858 | return string.format("%02d:%02d:%02d", frames / (75 * 60), (frames / 75) % 60, frames % 75).c_str(); | |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | |
| r245640 | r245641 | |
| 899 | 899 | static void guess_chs(astring *filename, UINT64 filesize, int sectorsize, UINT32 &cylinders, UINT32 &heads, UINT32 §ors, UINT32 &bps) |
| 900 | 900 | { |
| 901 | 901 | // if this is a direct physical drive read, handle it specially |
| 902 | if (filename != NULL && osd_get_physical_drive_geometry( | |
| 902 | if (filename != NULL && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, §ors, &bps)) | |
| 903 | 903 | return; |
| 904 | 904 | |
| 905 | 905 | // if we have no length to work with, we can't guess |
| r245640 | r245641 | |
| 938 | 938 | astring *input_chd_parent_str = params.find(OPTION_INPUT_PARENT); |
| 939 | 939 | if (input_chd_parent_str != NULL) |
| 940 | 940 | { |
| 941 | chd_error err = input_parent_chd.open( | |
| 941 | chd_error err = input_parent_chd.open(input_chd_parent_str->c_str()); | |
| 942 | 942 | if (err != CHDERR_NONE) |
| 943 | 943 | report_error(1, "Error opening parent CHD file (%s): %s", input_chd_parent_str->c_str(), chd_file::error_string(err)); |
| 944 | 944 | } |
| r245640 | r245641 | |
| 947 | 947 | astring *input_chd_str = params.find(OPTION_INPUT); |
| 948 | 948 | if (input_chd_str != NULL) |
| 949 | 949 | { |
| 950 | chd_error err = input_chd.open( | |
| 950 | chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : NULL); | |
| 951 | 951 | if (err != CHDERR_NONE) |
| 952 | 952 | report_error(1, "Error opening CHD file (%s): %s", input_chd_str->c_str(), chd_file::error_string(err)); |
| 953 | 953 | } |
| r245640 | r245641 | |
| 970 | 970 | astring *input_start_hunk_str = params.find(OPTION_INPUT_START_HUNK); |
| 971 | 971 | astring *input_start_frame_str = params.find(OPTION_INPUT_START_FRAME); |
| 972 | 972 | if (input_start_byte_str != NULL) |
| 973 | input_start = parse_number( | |
| 973 | input_start = parse_number(input_start_byte_str->c_str()); | |
| 974 | 974 | if (input_start_hunk_str != NULL) |
| 975 | input_start = parse_number( | |
| 975 | input_start = parse_number(input_start_hunk_str->c_str()) * hunkbytes; | |
| 976 | 976 | if (input_start_frame_str != NULL) |
| 977 | input_start = parse_number( | |
| 977 | input_start = parse_number(input_start_frame_str->c_str()) * framebytes; | |
| 978 | 978 | if (input_start >= input_end) |
| 979 | 979 | report_error(1, "Input start offset greater than input file size"); |
| 980 | 980 | |
| r245640 | r245641 | |
| 984 | 984 | astring *input_length_frames_str = params.find(OPTION_INPUT_LENGTH_FRAMES); |
| 985 | 985 | UINT64 input_length = input_end; |
| 986 | 986 | if (input_length_bytes_str != NULL) |
| 987 | input_length = parse_number( | |
| 987 | input_length = parse_number(input_length_bytes_str->c_str()); | |
| 988 | 988 | if (input_length_hunks_str != NULL) |
| 989 | input_length = parse_number( | |
| 989 | input_length = parse_number(input_length_hunks_str->c_str()) * hunkbytes; | |
| 990 | 990 | if (input_length_frames_str != NULL) |
| 991 | input_length = parse_number( | |
| 991 | input_length = parse_number(input_length_frames_str->c_str()) * framebytes; | |
| 992 | 992 | if (input_start + input_length < input_end) |
| 993 | 993 | input_end = input_start + input_length; |
| 994 | 994 | } |
| r245640 | r245641 | |
| 1026 | 1026 | astring *output_chd_parent_str = params.find(OPTION_OUTPUT_PARENT); |
| 1027 | 1027 | if (output_chd_parent_str != NULL) |
| 1028 | 1028 | { |
| 1029 | chd_error err = output_parent_chd.open( | |
| 1029 | chd_error err = output_parent_chd.open(output_chd_parent_str->c_str()); | |
| 1030 | 1030 | if (err != CHDERR_NONE) |
| 1031 | 1031 | report_error(1, "Error opening parent CHD file (%s): %s", output_chd_parent_str->c_str(), chd_file::error_string(err)); |
| 1032 | 1032 | } |
| r245640 | r245641 | |
| 1034 | 1034 | // process output file |
| 1035 | 1035 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 1036 | 1036 | if (output_chd_str != NULL) |
| 1037 | check_existing_output_file(params, | |
| 1037 | check_existing_output_file(params, output_chd_str->c_str()); | |
| 1038 | 1038 | return output_chd_str; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| r245640 | r245641 | |
| 1049 | 1049 | astring *hunk_size_str = params.find(OPTION_HUNK_SIZE); |
| 1050 | 1050 | if (hunk_size_str != NULL) |
| 1051 | 1051 | { |
| 1052 | hunk_size = parse_number( | |
| 1052 | hunk_size = parse_number(hunk_size_str->c_str()); | |
| 1053 | 1053 | if (hunk_size < 16 || hunk_size > 1024 * 1024) |
| 1054 | 1054 | report_error(1, "Invalid hunk size"); |
| 1055 | 1055 | if (hunk_size % required_granularity != 0) |
| r245640 | r245641 | |
| 1110 | 1110 | if (numprocessors_str == NULL) |
| 1111 | 1111 | return; |
| 1112 | 1112 | |
| 1113 | int count = atoi( | |
| 1113 | int count = atoi(numprocessors_str->c_str()); | |
| 1114 | 1114 | if (count > 0) |
| 1115 | 1115 | { |
| 1116 | 1116 | extern int osd_num_processors; |
| r245640 | r245641 | |
| 1129 | 1129 | // output compression types |
| 1130 | 1130 | string.reset(); |
| 1131 | 1131 | if (compression[0] == CHD_CODEC_NONE) |
| 1132 | return string.cpy("none"); | |
| 1132 | return string.cpy("none").c_str(); | |
| 1133 | 1133 | |
| 1134 | 1134 | // iterate over types |
| 1135 | 1135 | for (int index = 0; index < 4; index++) |
| r245640 | r245641 | |
| 1142 | 1142 | string.cat((type >> 24) & 0xff).cat((type >> 16) & 0xff).cat((type >> 8) & 0xff).cat(type & 0xff); |
| 1143 | 1143 | string.cat(" (").cat(chd_codec_list::codec_name(type)).cat(")"); |
| 1144 | 1144 | } |
| 1145 | return string; | |
| 1145 | return string.c_str(); | |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | |
| r245640 | r245641 | |
| 1566 | 1566 | astring *input_file_str = params.find(OPTION_INPUT); |
| 1567 | 1567 | if (input_file_str != NULL) |
| 1568 | 1568 | { |
| 1569 | file_error filerr = core_fopen( | |
| 1569 | file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); | |
| 1570 | 1570 | if (filerr != FILERR_NONE) |
| 1571 | 1571 | report_error(1, "Unable to open file (%s)", input_file_str->c_str()); |
| 1572 | 1572 | } |
| r245640 | r245641 | |
| 1584 | 1584 | astring *unit_size_str = params.find(OPTION_UNIT_SIZE); |
| 1585 | 1585 | if (unit_size_str != NULL) |
| 1586 | 1586 | { |
| 1587 | unit_size = parse_number( | |
| 1587 | unit_size = parse_number(unit_size_str->c_str()); | |
| 1588 | 1588 | if (hunk_size % unit_size != 0) |
| 1589 | 1589 | report_error(1, "Unit size is not an even divisor of the hunk size"); |
| 1590 | 1590 | } |
| r245640 | r245641 | |
| 1625 | 1625 | chd = new chd_rawfile_compressor(input_file, input_start, input_end); |
| 1626 | 1626 | chd_error err; |
| 1627 | 1627 | if (output_parent.opened()) |
| 1628 | err = chd->create( | |
| 1628 | err = chd->create(output_chd_str->c_str(), input_end - input_start, hunk_size, compression, output_parent); | |
| 1629 | 1629 | else |
| 1630 | err = chd->create( | |
| 1630 | err = chd->create(output_chd_str->c_str(), input_end - input_start, hunk_size, unit_size, compression); | |
| 1631 | 1631 | if (err != CHDERR_NONE) |
| 1632 | 1632 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); |
| 1633 | 1633 | |
| r245640 | r245641 | |
| 1645 | 1645 | // delete the output file |
| 1646 | 1646 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 1647 | 1647 | if (output_chd_str != NULL) |
| 1648 | osd_rmfile( | |
| 1648 | osd_rmfile(output_chd_str->c_str()); | |
| 1649 | 1649 | throw; |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
| r245640 | r245641 | |
| 1663 | 1663 | astring *input_file_str = params.find(OPTION_INPUT); |
| 1664 | 1664 | if (input_file_str != NULL) |
| 1665 | 1665 | { |
| 1666 | file_error filerr = core_fopen( | |
| 1666 | file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); | |
| 1667 | 1667 | if (filerr != FILERR_NONE) |
| 1668 | 1668 | report_error(1, "Unable to open file (%s)", input_file_str->c_str()); |
| 1669 | 1669 | } |
| r245640 | r245641 | |
| 1679 | 1679 | { |
| 1680 | 1680 | if (output_parent.opened()) |
| 1681 | 1681 | report_error(1, "Sector size does not apply when creating a diff from the parent"); |
| 1682 | sector_size = parse_number( | |
| 1682 | sector_size = parse_number(sectorsize_str->c_str()); | |
| 1683 | 1683 | } |
| 1684 | 1684 | |
| 1685 | 1685 | // process hunk size (needs to know sector_size) |
| r245640 | r245641 | |
| 1700 | 1700 | astring *size_str = params.find(OPTION_SIZE); |
| 1701 | 1701 | if (size_str != NULL) |
| 1702 | 1702 | { |
| 1703 | if (sscanf( | |
| 1703 | if (sscanf(size_str->c_str(), "%" I64FMT"d", &filesize) != 1) | |
| 1704 | 1704 | report_error(1, "Invalid size string"); |
| 1705 | 1705 | } |
| 1706 | 1706 | } |
| r245640 | r245641 | |
| 1726 | 1726 | { |
| 1727 | 1727 | if (output_parent.opened()) |
| 1728 | 1728 | report_error(1, "CHS does not apply when creating a diff from the parent"); |
| 1729 | if (sscanf( | |
| 1729 | if (sscanf(chs_str->c_str(), "%d,%d,%d", &cylinders, &heads, §ors) != 3) | |
| 1730 | 1730 | report_error(1, "Invalid CHS string; must be of the form <cylinders>,<heads>,<sectors>"); |
| 1731 | 1731 | } |
| 1732 | 1732 | |
| r245640 | r245641 | |
| 1738 | 1738 | if (ident_str != NULL) |
| 1739 | 1739 | { |
| 1740 | 1740 | // load the file |
| 1741 | file_error filerr = core_fload( | |
| 1741 | file_error filerr = core_fload(ident_str->c_str(), identdata); | |
| 1742 | 1742 | if (filerr != FILERR_NONE) |
| 1743 | 1743 | report_error(1, "Error reading ident file (%s)", ident_str->c_str()); |
| 1744 | 1744 | |
| r245640 | r245641 | |
| 1756 | 1756 | astring metadata; |
| 1757 | 1757 | if (output_parent.read_metadata(HARD_DISK_METADATA_TAG, 0, metadata) != CHDERR_NONE) |
| 1758 | 1758 | report_error(1, "Unable to find hard disk metadata in parent CHD"); |
| 1759 | if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §or_size) != 4) | |
| 1759 | if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §or_size) != 4) | |
| 1760 | 1760 | report_error(1, "Error parsing hard disk metadata in parent CHD"); |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| r245640 | r245641 | |
| 1803 | 1803 | chd = new chd_rawfile_compressor(input_file, input_start, input_end); |
| 1804 | 1804 | chd_error err; |
| 1805 | 1805 | if (output_parent.opened()) |
| 1806 | err = chd->create( | |
| 1806 | err = chd->create(output_chd_str->c_str(), UINT64(totalsectors) * UINT64(sector_size), hunk_size, compression, output_parent); | |
| 1807 | 1807 | else |
| 1808 | err = chd->create( | |
| 1808 | err = chd->create(output_chd_str->c_str(), UINT64(totalsectors) * UINT64(sector_size), hunk_size, sector_size, compression); | |
| 1809 | 1809 | if (err != CHDERR_NONE) |
| 1810 | 1810 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); |
| 1811 | 1811 | |
| r245640 | r245641 | |
| 1835 | 1835 | // delete the output file |
| 1836 | 1836 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 1837 | 1837 | if (output_chd_str != NULL) |
| 1838 | osd_rmfile( | |
| 1838 | osd_rmfile(output_chd_str->c_str()); | |
| 1839 | 1839 | throw; |
| 1840 | 1840 | } |
| 1841 | 1841 | } |
| r245640 | r245641 | |
| 1854 | 1854 | astring *input_file_str = params.find(OPTION_INPUT); |
| 1855 | 1855 | if (input_file_str != NULL) |
| 1856 | 1856 | { |
| 1857 | chd_error err = chdcd_parse_toc( | |
| 1857 | chd_error err = chdcd_parse_toc(input_file_str->c_str(), toc, track_info); | |
| 1858 | 1858 | if (err != CHDERR_NONE) |
| 1859 | 1859 | report_error(1, "Error parsing input file (%s: %s)\n", input_file_str->c_str(), chd_file::error_string(err)); |
| 1860 | 1860 | } |
| r245640 | r245641 | |
| 1906 | 1906 | chd = new chd_cd_compressor(toc, track_info); |
| 1907 | 1907 | chd_error err; |
| 1908 | 1908 | if (output_parent.opened()) |
| 1909 | err = chd->create( | |
| 1909 | err = chd->create(output_chd_str->c_str(), UINT64(totalsectors) * UINT64(CD_FRAME_SIZE), hunk_size, compression, output_parent); | |
| 1910 | 1910 | else |
| 1911 | err = chd->create( | |
| 1911 | err = chd->create(output_chd_str->c_str(), UINT64(totalsectors) * UINT64(CD_FRAME_SIZE), hunk_size, CD_FRAME_SIZE, compression); | |
| 1912 | 1912 | if (err != CHDERR_NONE) |
| 1913 | 1913 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); |
| 1914 | 1914 | |
| r245640 | r245641 | |
| 1927 | 1927 | // delete the output file |
| 1928 | 1928 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 1929 | 1929 | if (output_chd_str != NULL) |
| 1930 | osd_rmfile( | |
| 1930 | osd_rmfile(output_chd_str->c_str()); | |
| 1931 | 1931 | throw; |
| 1932 | 1932 | } |
| 1933 | 1933 | } |
| r245640 | r245641 | |
| 1945 | 1945 | astring *input_file_str = params.find(OPTION_INPUT); |
| 1946 | 1946 | if (input_file_str != NULL) |
| 1947 | 1947 | { |
| 1948 | avi_error avierr = avi_open( | |
| 1948 | avi_error avierr = avi_open(input_file_str->c_str(), &input_file); | |
| 1949 | 1949 | if (avierr != AVIERR_NONE) |
| 1950 | 1950 | report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->c_str(), avi_error_string(avierr)); |
| 1951 | 1951 | } |
| r245640 | r245641 | |
| 2024 | 2024 | chd = new chd_avi_compressor(*input_file, info, input_start, input_end); |
| 2025 | 2025 | chd_error err; |
| 2026 | 2026 | if (output_parent.opened()) |
| 2027 | err = chd->create( | |
| 2027 | err = chd->create(output_chd_str->c_str(), UINT64(input_end - input_start) * hunk_size, hunk_size, compression, output_parent); | |
| 2028 | 2028 | else |
| 2029 | err = chd->create( | |
| 2029 | err = chd->create(output_chd_str->c_str(), UINT64(input_end - input_start) * hunk_size, hunk_size, info.bytes_per_frame, compression); | |
| 2030 | 2030 | if (err != CHDERR_NONE) |
| 2031 | 2031 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); |
| 2032 | 2032 | |
| r245640 | r245641 | |
| 2055 | 2055 | // delete the output file |
| 2056 | 2056 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 2057 | 2057 | if (output_chd_str != NULL) |
| 2058 | osd_rmfile( | |
| 2058 | osd_rmfile(output_chd_str->c_str()); | |
| 2059 | 2059 | throw; |
| 2060 | 2060 | } |
| 2061 | 2061 | } |
| r245640 | r245641 | |
| 2133 | 2133 | chd = new chd_chdfile_compressor(input_chd, input_start, input_end); |
| 2134 | 2134 | chd_error err; |
| 2135 | 2135 | if (output_parent.opened()) |
| 2136 | err = chd->create( | |
| 2136 | err = chd->create(output_chd_str->c_str(), input_end - input_start, hunk_size, compression, output_parent); | |
| 2137 | 2137 | else |
| 2138 | err = chd->create( | |
| 2138 | err = chd->create(output_chd_str->c_str(), input_end - input_start, hunk_size, input_chd.unit_bytes(), compression); | |
| 2139 | 2139 | if (err != CHDERR_NONE) |
| 2140 | 2140 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); |
| 2141 | 2141 | |
| r245640 | r245641 | |
| 2191 | 2191 | // delete the output file |
| 2192 | 2192 | astring *output_chd_str = params.find(OPTION_OUTPUT); |
| 2193 | 2193 | if (output_chd_str != NULL) |
| 2194 | osd_rmfile( | |
| 2194 | osd_rmfile(output_chd_str->c_str()); | |
| 2195 | 2195 | throw; |
| 2196 | 2196 | } |
| 2197 | 2197 | } |
| r245640 | r245641 | |
| 2217 | 2217 | // verify output file doesn't exist |
| 2218 | 2218 | astring *output_file_str = params.find(OPTION_OUTPUT); |
| 2219 | 2219 | if (output_file_str != NULL) |
| 2220 | check_existing_output_file(params, | |
| 2220 | check_existing_output_file(params, output_file_str->c_str()); | |
| 2221 | 2221 | |
| 2222 | 2222 | // print some info |
| 2223 | 2223 | astring tempstr; |
| r245640 | r245641 | |
| 2234 | 2234 | try |
| 2235 | 2235 | { |
| 2236 | 2236 | // process output file |
| 2237 | file_error filerr = core_fopen( | |
| 2237 | file_error filerr = core_fopen(output_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file); | |
| 2238 | 2238 | if (filerr != FILERR_NONE) |
| 2239 | 2239 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); |
| 2240 | 2240 | |
| r245640 | r245641 | |
| 2269 | 2269 | if (output_file != NULL) |
| 2270 | 2270 | { |
| 2271 | 2271 | core_fclose(output_file); |
| 2272 | osd_rmfile( | |
| 2272 | osd_rmfile(output_file_str->c_str()); | |
| 2273 | 2273 | } |
| 2274 | 2274 | throw; |
| 2275 | 2275 | } |
| r245640 | r245641 | |
| 2297 | 2297 | // verify output file doesn't exist |
| 2298 | 2298 | astring *output_file_str = params.find(OPTION_OUTPUT); |
| 2299 | 2299 | if (output_file_str != NULL) |
| 2300 | check_existing_output_file(params, | |
| 2300 | check_existing_output_file(params, output_file_str->c_str()); | |
| 2301 | 2301 | |
| 2302 | 2302 | // verify output BIN file doesn't exist |
| 2303 | 2303 | astring *output_bin_file_str = params.find(OPTION_OUTPUT_BIN); |
| r245640 | r245641 | |
| 2310 | 2310 | default_name.cat(".bin"); |
| 2311 | 2311 | if (output_bin_file_str == NULL) |
| 2312 | 2312 | output_bin_file_str = &default_name; |
| 2313 | check_existing_output_file(params, | |
| 2313 | check_existing_output_file(params, output_bin_file_str->c_str()); | |
| 2314 | 2314 | |
| 2315 | 2315 | // print some info |
| 2316 | 2316 | astring tempstr; |
| r245640 | r245641 | |
| 2335 | 2335 | } |
| 2336 | 2336 | |
| 2337 | 2337 | // process output file |
| 2338 | file_error filerr = core_fopen( | |
| 2338 | file_error filerr = core_fopen(output_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &output_toc_file); | |
| 2339 | 2339 | if (filerr != FILERR_NONE) |
| 2340 | 2340 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); |
| 2341 | 2341 | |
| 2342 | 2342 | // process output BIN file |
| 2343 | 2343 | if (mode != MODE_GDI) |
| 2344 | 2344 | { |
| 2345 | filerr = core_fopen( | |
| 2345 | filerr = core_fopen(output_bin_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); | |
| 2346 | 2346 | if (filerr != FILERR_NONE) |
| 2347 | 2347 | report_error(1, "Unable to open file (%s)", output_bin_file_str->c_str()); |
| 2348 | 2348 | } |
| r245640 | r245641 | |
| 2382 | 2382 | output_bin_file = NULL; |
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | filerr = core_fopen(trackbin_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); | |
| 2385 | filerr = core_fopen(trackbin_name.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); | |
| 2386 | 2386 | if (filerr != FILERR_NONE) |
| 2387 | 2387 | report_error(1, "Unable to open file (%s)", trackbin_name.c_str()); |
| 2388 | 2388 | |
| r245640 | r245641 | |
| 2394 | 2394 | astring temp; |
| 2395 | 2395 | if (mode == MODE_GDI) |
| 2396 | 2396 | { |
| 2397 | output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp,trackbin_name), discoffs, outputoffs); | |
| 2397 | output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, trackbin_name.c_str()).c_str(), discoffs, outputoffs); | |
| 2398 | 2398 | } |
| 2399 | 2399 | else |
| 2400 | 2400 | { |
| 2401 | output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, | |
| 2401 | output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, output_bin_file_str->c_str()).c_str(), discoffs, outputoffs); | |
| 2402 | 2402 | } |
| 2403 | 2403 | |
| 2404 | 2404 | // If this is bin/cue output and the CHD contains subdata, warn the user and don't include |
| r245640 | r245641 | |
| 2470 | 2470 | core_fclose(output_bin_file); |
| 2471 | 2471 | if (output_toc_file != NULL) |
| 2472 | 2472 | core_fclose(output_toc_file); |
| 2473 | osd_rmfile(*output_bin_file_str); | |
| 2474 | osd_rmfile(*output_file_str); | |
| 2473 | osd_rmfile(output_bin_file_str->c_str()); | |
| 2474 | osd_rmfile(output_file_str->c_str()); | |
| 2475 | 2475 | throw; |
| 2476 | 2476 | } |
| 2477 | 2477 | } |
| r245640 | r245641 | |
| 2507 | 2507 | { |
| 2508 | 2508 | int fps; |
| 2509 | 2509 | int fpsfrac; |
| 2510 | if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 2510 | if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 2511 | 2511 | report_error(1, "Improperly formatted A/V metadata found"); |
| 2512 | 2512 | fps_times_1million = fps * 1000000 + fpsfrac; |
| 2513 | 2513 | } |
| r245640 | r245641 | |
| 2544 | 2544 | // verify output file doesn't exist |
| 2545 | 2545 | astring *output_file_str = params.find(OPTION_OUTPUT); |
| 2546 | 2546 | if (output_file_str != NULL) |
| 2547 | check_existing_output_file(params, | |
| 2547 | check_existing_output_file(params, output_file_str->c_str()); | |
| 2548 | 2548 | |
| 2549 | 2549 | // print some info |
| 2550 | 2550 | astring tempstr; |
| r245640 | r245641 | |
| 2561 | 2561 | try |
| 2562 | 2562 | { |
| 2563 | 2563 | // process output file |
| 2564 | avi_error avierr = avi_create( | |
| 2564 | avi_error avierr = avi_create(output_file_str->c_str(), &info, &output_file); | |
| 2565 | 2565 | if (avierr != AVIERR_NONE) |
| 2566 | 2566 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); |
| 2567 | 2567 | |
| r245640 | r245641 | |
| 2621 | 2621 | // delete the output file |
| 2622 | 2622 | if (output_file != NULL) |
| 2623 | 2623 | avi_close(output_file); |
| 2624 | osd_rmfile( | |
| 2624 | osd_rmfile(output_file_str->c_str()); | |
| 2625 | 2625 | throw; |
| 2626 | 2626 | } |
| 2627 | 2627 | } |
| r245640 | r245641 | |
| 2652 | 2652 | UINT32 index = 0; |
| 2653 | 2653 | astring *index_str = params.find(OPTION_INDEX); |
| 2654 | 2654 | if (index_str != NULL) |
| 2655 | index = atoi( | |
| 2655 | index = atoi(index_str->c_str()); | |
| 2656 | 2656 | |
| 2657 | 2657 | // process text input |
| 2658 | 2658 | astring *text_str = params.find(OPTION_VALUE_TEXT); |
| r245640 | r245641 | |
| 2669 | 2669 | dynamic_buffer file; |
| 2670 | 2670 | if (file_str != NULL) |
| 2671 | 2671 | { |
| 2672 | file_error filerr = core_fload( | |
| 2672 | file_error filerr = core_fload(file_str->c_str(), file); | |
| 2673 | 2673 | if (filerr != FILERR_NONE) |
| 2674 | 2674 | report_error(1, "Error reading metadata file (%s)", file_str->c_str()); |
| 2675 | 2675 | } |
| r245640 | r245641 | |
| 2732 | 2732 | UINT32 index = 0; |
| 2733 | 2733 | astring *index_str = params.find(OPTION_INDEX); |
| 2734 | 2734 | if (index_str != NULL) |
| 2735 | index = atoi( | |
| 2735 | index = atoi(index_str->c_str()); | |
| 2736 | 2736 | |
| 2737 | 2737 | // print some info |
| 2738 | 2738 | astring tempstr; |
| r245640 | r245641 | |
| 2763 | 2763 | // verify output file doesn't exist |
| 2764 | 2764 | astring *output_file_str = params.find(OPTION_OUTPUT); |
| 2765 | 2765 | if (output_file_str != NULL) |
| 2766 | check_existing_output_file(params, | |
| 2766 | check_existing_output_file(params, output_file_str->c_str()); | |
| 2767 | 2767 | |
| 2768 | 2768 | // process tag |
| 2769 | 2769 | chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); |
| r245640 | r245641 | |
| 2778 | 2778 | UINT32 index = 0; |
| 2779 | 2779 | astring *index_str = params.find(OPTION_INDEX); |
| 2780 | 2780 | if (index_str != NULL) |
| 2781 | index = atoi( | |
| 2781 | index = atoi(index_str->c_str()); | |
| 2782 | 2782 | |
| 2783 | 2783 | // write the metadata |
| 2784 | 2784 | dynamic_buffer buffer; |
| r245640 | r245641 | |
| 2793 | 2793 | // create the file |
| 2794 | 2794 | if (output_file_str != NULL) |
| 2795 | 2795 | { |
| 2796 | file_error filerr = core_fopen( | |
| 2796 | file_error filerr = core_fopen(output_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file); | |
| 2797 | 2797 | if (filerr != FILERR_NONE) |
| 2798 | 2798 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); |
| 2799 | 2799 | |
| r245640 | r245641 | |
| 2820 | 2820 | // delete the output file |
| 2821 | 2821 | if (output_file != NULL) |
| 2822 | 2822 | core_fclose(output_file); |
| 2823 | osd_rmfile( | |
| 2823 | osd_rmfile(output_file_str->c_str()); | |
| 2824 | 2824 | throw; |
| 2825 | 2825 | } |
| 2826 | 2826 | } |
| r245640 | r245641 | |
|---|---|---|
| 177 | 177 | |
| 178 | 178 | // extract the info |
| 179 | 179 | int fps, fpsfrac, width, height, interlaced, channels, rate; |
| 180 | if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 180 | if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 181 | 181 | { |
| 182 | 182 | fprintf(stderr, "Improperly formatted metadata\n"); |
| 183 | 183 | return CHDERR_INVALID_DATA; |
| r245640 | r245641 | |
|---|---|---|
| 194 | 194 | |
| 195 | 195 | // extract the info |
| 196 | 196 | int fps, fpsfrac, width, height, interlaced, channels, rate; |
| 197 | if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 197 | if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7) | |
| 198 | 198 | { |
| 199 | 199 | fprintf(stderr, "Improperly formatted metadata\n"); |
| 200 | 200 | delete chd; |
| r245640 | r245641 | |
|---|---|---|
| 80 | 80 | int x, y; |
| 81 | 81 | |
| 82 | 82 | /* open the source image */ |
| 83 | filerr = core_fopen(imgfile1, OPEN_FLAG_READ, &file); | |
| 83 | filerr = core_fopen(imgfile1.c_str(), OPEN_FLAG_READ, &file); | |
| 84 | 84 | if (filerr != FILERR_NONE) |
| 85 | 85 | { |
| 86 | 86 | printf("Could not open %s (%d)\n", imgfile1.c_str(), filerr); |
| r245640 | r245641 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /* open the source image */ |
| 100 | filerr = core_fopen(imgfile2, OPEN_FLAG_READ, &file); | |
| 100 | filerr = core_fopen(imgfile2.c_str(), OPEN_FLAG_READ, &file); | |
| 101 | 101 | if (filerr != FILERR_NONE) |
| 102 | 102 | { |
| 103 | 103 | printf("Could not open %s (%d)\n", imgfile2.c_str(), filerr); |
| r245640 | r245641 | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /* write the final PNG */ |
| 173 | filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 173 | filerr = core_fopen(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 174 | 174 | if (filerr != FILERR_NONE) |
| 175 | 175 | { |
| 176 | 176 | printf("Could not open %s (%d)\n", outfilename.c_str(), filerr); |
| r245640 | r245641 | |
| 193 | 193 | |
| 194 | 194 | error: |
| 195 | 195 | if (error == -1) |
| 196 | osd_rmfile(outfilename); | |
| 196 | osd_rmfile(outfilename.c_str()); | |
| 197 | 197 | return error; |
| 198 | 198 | } |
| r245640 | r245641 | |
|---|---|---|
| 235 | 235 | |
| 236 | 236 | /* read the template file into an astring */ |
| 237 | 237 | astring tempheader; |
| 238 | if (core_fload(tempfilename, &buffer, &bufsize) == FILERR_NONE) | |
| 238 | if (core_fload(tempfilename.c_str(), &buffer, &bufsize) == FILERR_NONE) | |
| 239 | 239 | { |
| 240 | 240 | tempheader.cpy((const char *)buffer, bufsize); |
| 241 | 241 | osd_free(buffer); |
| r245640 | r245641 | |
| 565 | 565 | core_file *file; |
| 566 | 566 | |
| 567 | 567 | /* create the indexfile */ |
| 568 | if (core_fopen(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) | |
| 568 | if (core_fopen(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) | |
| 569 | 569 | return NULL; |
| 570 | 570 | |
| 571 | 571 | /* print a header */ |
| 572 | 572 | astring modified(templatefile); |
| 573 | modified.replace("<!--TITLE-->", title); | |
| 573 | modified.replace("<!--TITLE-->", title.c_str()); | |
| 574 | 574 | core_fwrite(file, modified.c_str(), modified.len()); |
| 575 | 575 | |
| 576 | 576 | /* return the file */ |
| r245640 | r245641 | |
| 586 | 586 | static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &title) |
| 587 | 587 | { |
| 588 | 588 | astring modified(templatefile); |
| 589 | modified.replace(0, "<!--TITLE-->", title); | |
| 589 | modified.replace(0, "<!--TITLE-->", title.c_str()); | |
| 590 | 590 | core_fwrite(file, modified.c_str(), modified.len()); |
| 591 | 591 | core_fclose(file); |
| 592 | 592 | } |
| r245640 | r245641 | |
| 735 | 735 | fullname.printf("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", lists[listnum].dir, curfile->name); |
| 736 | 736 | |
| 737 | 737 | /* open the file */ |
| 738 | filerr = core_fopen(fullname, OPEN_FLAG_READ, &file); | |
| 738 | filerr = core_fopen(fullname.c_str(), OPEN_FLAG_READ, &file); | |
| 739 | 739 | |
| 740 | 740 | /* if that failed, look in the old location */ |
| 741 | 741 | if (filerr != FILERR_NONE) |
| r245640 | r245641 | |
| 744 | 744 | fullname.printf("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "_%s.png", lists[listnum].dir, curfile->name); |
| 745 | 745 | |
| 746 | 746 | /* open the file */ |
| 747 | filerr = core_fopen(fullname, OPEN_FLAG_READ, &file); | |
| 747 | filerr = core_fopen(fullname.c_str(), OPEN_FLAG_READ, &file); | |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /* if that worked, load the file */ |
| r245640 | r245641 | |
| 853 | 853 | tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); |
| 854 | 854 | |
| 855 | 855 | /* open the source image */ |
| 856 | filerr = core_fopen(tempname, OPEN_FLAG_READ, &file); | |
| 856 | filerr = core_fopen(tempname.c_str(), OPEN_FLAG_READ, &file); | |
| 857 | 857 | if (filerr != FILERR_NONE) |
| 858 | 858 | goto error; |
| 859 | 859 | |
| r245640 | r245641 | |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | /* write the final PNG */ |
| 928 | filerr = core_fopen(dstfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 928 | filerr = core_fopen(dstfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 929 | 929 | if (filerr != FILERR_NONE) |
| 930 | 930 | goto error; |
| 931 | 931 | pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL); |
| r245640 | r245641 | |
| 938 | 938 | |
| 939 | 939 | error: |
| 940 | 940 | if (error) |
| 941 | osd_rmfile(dstfilename); | |
| 941 | osd_rmfile(dstfilename.c_str()); | |
| 942 | 942 | return error; |
| 943 | 943 | } |
| 944 | 944 |
| r245640 | r245641 | |
|---|---|---|
| 120 | 120 | splitfilename.cpy(basename).cat(".split"); |
| 121 | 121 | |
| 122 | 122 | // create the split file |
| 123 | filerr = core_fopen(splitfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &splitfile); | |
| 123 | filerr = core_fopen(splitfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &splitfile); | |
| 124 | 124 | if (filerr != FILERR_NONE) |
| 125 | 125 | { |
| 126 | 126 | fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.c_str()); |
| r245640 | r245641 | |
| 156 | 156 | outfilename.printf("%s.%03d", basename, partnum); |
| 157 | 157 | |
| 158 | 158 | // create it |
| 159 | filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); | |
| 159 | filerr = core_fopen(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); | |
| 160 | 160 | if (filerr != FILERR_NONE) |
| 161 | 161 | { |
| 162 | 162 | printf("\n"); |
| r245640 | r245641 | |
| 193 | 193 | { |
| 194 | 194 | core_fclose(splitfile); |
| 195 | 195 | if (error != 0) |
| 196 | remove(splitfilename); | |
| 196 | remove(splitfilename.c_str()); | |
| 197 | 197 | } |
| 198 | 198 | if (infile != NULL) |
| 199 | 199 | core_fclose(infile); |
| r245640 | r245641 | |
| 201 | 201 | { |
| 202 | 202 | core_fclose(outfile); |
| 203 | 203 | if (error != 0) |
| 204 | remove(outfilename); | |
| 204 | remove(outfilename.c_str()); | |
| 205 | 205 | } |
| 206 | 206 | if (splitbuffer != NULL) |
| 207 | 207 | free(splitbuffer); |
| r245640 | r245641 | |
| 268 | 268 | if (write_output) |
| 269 | 269 | { |
| 270 | 270 | // don't overwrite the original! |
| 271 | filerr = core_fopen(outfilename, OPEN_FLAG_READ, &outfile); | |
| 271 | filerr = core_fopen(outfilename.c_str(), OPEN_FLAG_READ, &outfile); | |
| 272 | 272 | if (filerr == FILERR_NONE) |
| 273 | 273 | { |
| 274 | 274 | core_fclose(outfile); |
| r245640 | r245641 | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // open the output for write |
| 281 | filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); | |
| 281 | filerr = core_fopen(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); | |
| 282 | 282 | if (filerr != FILERR_NONE) |
| 283 | 283 | { |
| 284 | 284 | fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.c_str()); |
| r245640 | r245641 | |
| 306 | 306 | |
| 307 | 307 | // read the file's contents |
| 308 | 308 | infilename.ins(0, basepath); |
| 309 | filerr = core_fload(infilename, &splitbuffer, &length); | |
| 309 | filerr = core_fload(infilename.c_str(), &splitbuffer, &length); | |
| 310 | 310 | if (filerr != FILERR_NONE) |
| 311 | 311 | { |
| 312 | 312 | printf("\n"); |
| r245640 | r245641 | |
| 364 | 364 | { |
| 365 | 365 | core_fclose(outfile); |
| 366 | 366 | if (error != 0) |
| 367 | remove(outfilename); | |
| 367 | remove(outfilename.c_str()); | |
| 368 | 368 | } |
| 369 | 369 | if (splitbuffer != NULL) |
| 370 | 370 | osd_free(splitbuffer); |
| r245640 | r245641 | |
|---|---|---|
| 279 | 279 | // read the template file into an astring |
| 280 | 280 | UINT32 bufsize; |
| 281 | 281 | void *buffer; |
| 282 | if (core_fload(tempfilename, &buffer, &bufsize) == FILERR_NONE) | |
| 282 | if (core_fload(tempfilename.c_str(), &buffer, &bufsize) == FILERR_NONE) | |
| 283 | 283 | { |
| 284 | 284 | tempheader.cpy((const char *)buffer, bufsize); |
| 285 | 285 | osd_free(buffer); |
| r245640 | r245641 | |
| 347 | 347 | osd_dir_entry_type entry_type = typelist[entindex]; |
| 348 | 348 | |
| 349 | 349 | // open the directory and iterate through it |
| 350 | osd_directory *dir = osd_opendir(srcdir); | |
| 350 | osd_directory *dir = osd_opendir(srcdir.c_str()); | |
| 351 | 351 | if (dir == NULL) |
| 352 | 352 | { |
| 353 | 353 | result = 1; |
| r245640 | r245641 | |
| 411 | 411 | // make sure we care, first |
| 412 | 412 | file_type type = FILE_TYPE_INVALID; |
| 413 | 413 | for (int extnum = 0; extnum < ARRAY_LENGTH(extension_lookup); extnum++) |
| 414 | if (core_filename_ends_with(curlist->name, extension_lookup[extnum].extension)) | |
| 414 | if (core_filename_ends_with(curlist->name.c_str(), extension_lookup[extnum].extension)) | |
| 415 | 415 | { |
| 416 | 416 | type = extension_lookup[extnum].type; |
| 417 | 417 | break; |
| r245640 | r245641 | |
| 517 | 517 | |
| 518 | 518 | // open the source file |
| 519 | 519 | core_file *src; |
| 520 | if (core_fopen(srcfile, OPEN_FLAG_READ, &src) != FILERR_NONE) | |
| 520 | if (core_fopen(srcfile.c_str(), OPEN_FLAG_READ, &src) != FILERR_NONE) | |
| 521 | 521 | { |
| 522 | 522 | fprintf(stderr, "Unable to read file '%s'\n", srcfile.c_str()); |
| 523 | 523 | return 1; |
| r245640 | r245641 | |
| 706 | 706 | |
| 707 | 707 | // append a break and move on |
| 708 | 708 | dstline.catprintf("\n"); |
| 709 | core_fputs(dst, dstline); | |
| 709 | core_fputs(dst, dstline.c_str()); | |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | // close tags |
| r245640 | r245641 | |
| 733 | 733 | { |
| 734 | 734 | // create the indexfile |
| 735 | 735 | core_file *file; |
| 736 | if (core_fopen(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) | |
| 736 | if (core_fopen(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) | |
| 737 | 737 | return NULL; |
| 738 | 738 | |
| 739 | 739 | // print a header |
| r245640 | r245641 | |
| 865 | 865 | |
| 866 | 866 | // see if we can open it |
| 867 | 867 | core_file *testfile; |
| 868 | if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE) | |
| 868 | if (core_fopen(srcincpath.c_str(), OPEN_FLAG_READ, &testfile) == FILERR_NONE) | |
| 869 | 869 | { |
| 870 | 870 | // close the file |
| 871 | 871 | core_fclose(testfile); |
| https://github.com/mamedev/mame/commit/7faba31b1b8dcd6caa5f1b651d2693106de08d35 |
| Previous | 199869 Revisions | Next |