| Previous | 199869 Revisions | Next |
| r37111 Saturday 11th April, 2015 at 14:16:55 UTC by Vasantha Crabb |
|---|
| Merge branch 'master' of https://github.com/mamedev/mame |
| [src/emu] | addrmap.c cheat.c clifront.c digfx.c diimage.c disound.c emuopts.c emupal.c fileio.c image.c info.c input.c ioport.c luaengine.c machine.c mame.c mconfig.c memory.c rendlay.c romload.c save.c schedule.c screen.c softlist.c tilemap.c validity.c video.c webengine.c |
| [src/emu/bus/a7800] | a78_slot.c |
| [src/emu/bus/gba] | gba_slot.c |
| [src/emu/bus/intv] | slot.c |
| [src/emu/bus/megadrive] | md_slot.c |
| [src/emu/bus/msx_slot] | cartridge.c |
| [src/emu/bus/nes] | nes_ines.inc |
| [src/emu/cpu] | drcbex64.c drcbex86.c drcuml.c uml.c |
| [src/emu/cpu/dsp16] | dsp16.c dsp16dis.c |
| [src/emu/cpu/dsp56k] | dsp56dsm.c inst.h pmove.h tables.c |
| [src/emu/cpu/mcs96] | mcs96.c |
| [src/emu/cpu/score] | score.c |
| [src/emu/debug] | debugcmd.c debugcpu.c dvbpoints.c dvstate.c dvwpoints.c express.c |
| [src/emu/imagedev] | cassette.c diablo.c harddriv.c |
| [src/emu/machine] | fdc_pll.c hdc9234.c ram.c upd765.c wd_fdc.c |
| [src/emu/sound] | disc_inp.inc |
| [src/emu/ui] | barcode.c devopt.c inputmap.c mainmenu.c menu.c miscmenu.c selgame.c swlist.c ui.c |
| [src/ldplayer] | ldplayer.c |
| [src/lib/util] | astring.h cdrom.c chd.h chdcd.c options.c options.h |
| [src/mame/drivers] | bfm_sc45_helper.c sfbonus.c |
| [src/mame/machine] | 315-5881_crypt.c naomim1.c |
| [src/mess/drivers] | aim65.c hh_hmcs40.c hh_tms1k.c hh_ucom4.c pegasus.c |
| [src/mess/machine] | spec_snqk.c thomson.c |
| [src/mess/machine/ti99] | gromport.c gromport.h |
| [src/osd/modules/debugger/qt] | deviceinformationwindow.c mainwindow.c |
| [src/osd/modules/font] | font_osx.c font_sdl.c |
| [src/osd/modules/lib] | osdobj_common.c osdobj_common.h |
| [src/osd/modules/render/d3d] | d3dhlsl.c |
| [src/osd/sdl] | input.c sdlmain.c |
| [src/tools] | chdman.c nltool.c pngcmp.c regrep.c split.c src2html.c |
| r245622 | r245623 | |
|---|---|---|
| 494 | 494 | owner.subtag(tag, entry->m_read.m_tag); |
| 495 | 495 | device_t *mapdevice = machine.device(tag); |
| 496 | 496 | if (mapdevice == NULL) { |
| 497 | throw emu_fatalerror("Attempted to submap a non-existent device '%s' in space %d of device '%s'\n", tag.cstr(), m_spacenum, device.basetag()); | |
| 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 | } |
| 499 | 499 | // Grab the submap |
| 500 | 500 | address_map submap(*mapdevice, entry); |
| r245622 | r245623 | |
|---|---|---|
| 812 | 812 | logerror( "==============\n\n" ); |
| 813 | 813 | logerror( "\tTitle: %.32s\n", head_title); |
| 814 | 814 | logerror( "\tLength: 0x%X [real 0x%X]\n", head_length, len); |
| 815 | logerror( "\tMapper: %s [0x%X]\n", cart_mapper.cstr(), head_mapper); | |
| 815 | logerror( "\tMapper: %s [0x%X]\n", cart_mapper.c_str(), head_mapper); | |
| 816 | 816 | logerror( "\t\tPOKEY: %s\n", BIT(head_mapper, 0) ? "Yes" : "No"); |
| 817 | 817 | logerror( "\t\tSC Bankswitch: %s\n", BIT(head_mapper, 1) ? "Yes" : "No"); |
| 818 | 818 | logerror( "\t\tRAM at $4000: %s\n", BIT(head_mapper, 2) ? "Yes" : "No"); |
| r245622 | r245623 | |
| 827 | 827 | } |
| 828 | 828 | else |
| 829 | 829 | logerror( "\n"); |
| 830 | logerror( "\tController 1: 0x%.2X [%s]\n", head_ctrl1, ctrl1.cstr()); | |
| 831 | logerror( "\tController 2: 0x%.2X [%s]\n", head_ctrl2, ctrl2.cstr()); | |
| 830 | logerror( "\tController 1: 0x%.2X [%s]\n", head_ctrl1, ctrl1.c_str()); | |
| 831 | logerror( "\tController 2: 0x%.2X [%s]\n", head_ctrl2, ctrl2.c_str()); | |
| 832 | 832 | logerror( "\tVideo: %s\n", (head_ispal) ? "PAL" : "NTSC"); |
| 833 | 833 | } |
| r245622 | r245623 | |
|---|---|---|
| 307 | 307 | else if (!memcmp(&ROM[i], "SIIRTC_V", 8)) |
| 308 | 308 | chip |= GBA_CHIP_RTC; |
| 309 | 309 | } |
| 310 | osd_printf_info("GBA: Detected (ROM) %s\n", gba_chip_string(chip).cstr()); | |
| 310 | osd_printf_info("GBA: Detected (ROM) %s\n", gba_chip_string(chip).c_str()); | |
| 311 | 311 | |
| 312 | 312 | // fix for games which return more than one kind of chip: either it is one of the known titles, or we default to no battery |
| 313 | 313 | if (gba_chip_has_conflict(chip)) |
| r245622 | r245623 | |
| 364 | 364 | chip &= ~GBA_CHIP_RTC; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | osd_printf_info("GBA: Emulate %s\n", gba_chip_string(chip).cstr()); | |
| 367 | osd_printf_info("GBA: Emulate %s\n", gba_chip_string(chip).c_str()); | |
| 368 | 368 | |
| 369 | 369 | switch (chip) |
| 370 | 370 | { |
| r245622 | r245623 | |
|---|---|---|
| 328 | 328 | } |
| 329 | 329 | else |
| 330 | 330 | { |
| 331 | sscanf(extrainfo.cstr() ,"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2], | |
| 331 | sscanf(extrainfo.c_str() ,"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2], | |
| 332 | 332 | &rom[3], &ram, &extra); |
| 333 | 333 | //printf("extrainfo: %d %d %d %d %d %d %d \n", mapper, rom[0], rom[1], rom[2], rom[3], ram, extra); |
| 334 | 334 | |
| r245622 | r245623 | |
| 483 | 483 | |
| 484 | 484 | if (hashfile_extrainfo(*this, extrainfo)) |
| 485 | 485 | { |
| 486 | sscanf(extrainfo.cstr() ,"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2], | |
| 486 | sscanf(extrainfo.c_str() ,"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2], | |
| 487 | 487 | &rom[3], &ram, &extra); |
| 488 | 488 | |
| 489 | 489 | if (ram) |
| r245622 | r245623 | |
|---|---|---|
| 1082 | 1082 | } |
| 1083 | 1083 | logerror("Checksum: %X\n", checksum); |
| 1084 | 1084 | logerror(" - Calculated Checksum: %X\n", csum); |
| 1085 | logerror("Supported I/O Devices: %.16s\n%s", io, ctrl.cstr()); | |
| 1085 | logerror("Supported I/O Devices: %.16s\n%s", io, ctrl.c_str()); | |
| 1086 | 1086 | logerror("Modem: %.12s\n", modem); |
| 1087 | 1087 | logerror("Memo: %.40s\n", memo); |
| 1088 | logerror("Country: %.16s\n%s", country, reg.cstr()); | |
| 1088 | logerror("Country: %.16s\n%s", country, reg.c_str()); | |
| 1089 | 1089 | logerror("ROM Start: 0x%.8X\n", rom_start); |
| 1090 | 1090 | logerror("ROM End: 0x%.8X\n", rom_end); |
| 1091 | 1091 | logerror("RAM Start: 0x%.8X\n", ram_start); |
| r245622 | r245623 | |
|---|---|---|
| 290 | 290 | if (hashfile_extrainfo(*this, extrainfo)) |
| 291 | 291 | { |
| 292 | 292 | int extrainfo_type = -1; |
| 293 | if (1 == sscanf(extrainfo.cstr(), "%d", &extrainfo_type)) | |
| 293 | if (1 == sscanf(extrainfo.c_str(), "%d", &extrainfo_type)) | |
| 294 | 294 | { |
| 295 | 295 | static const struct { int extrainfo; int mapper; } extrainfo_map[] = { |
| 296 | 296 | //{ 0, NOMAPPER }, |
| r245622 | r245623 | |
|---|---|---|
| 392 | 392 | } |
| 393 | 393 | else |
| 394 | 394 | { |
| 395 | logerror("NES: [%s], Invalid mapinfo found\n", mapinfo.cstr()); | |
| 395 | logerror("NES: [%s], Invalid mapinfo found\n", mapinfo.c_str()); | |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | else |
| r245622 | r245623 | |
|---|---|---|
| 540 | 540 | // output an output |
| 541 | 541 | else |
| 542 | 542 | { |
| 543 | cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.cstr()); | |
| 543 | cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.c_str()); | |
| 544 | 544 | if (!m_condition.is_empty()) |
| 545 | 545 | cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition)); |
| 546 | 546 | if (m_line != 0) |
| r245622 | r245623 | |
| 588 | 588 | |
| 589 | 589 | // look for a valid type |
| 590 | 590 | if (strchr("cdiouxX", *p) == NULL) |
| 591 | throw emu_fatalerror("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, m_format.cstr()); | |
| 591 | throw emu_fatalerror("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, m_format.c_str()); | |
| 592 | 592 | argscounted++; |
| 593 | 593 | |
| 594 | 594 | // look for the next one |
| r245622 | r245623 | |
| 597 | 597 | |
| 598 | 598 | // did we match? |
| 599 | 599 | if (argscounted < argsprovided) |
| 600 | throw emu_fatalerror("%s.xml(%d): too many arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, m_format.cstr()); | |
| 600 | throw emu_fatalerror("%s.xml(%d): too many arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, m_format.c_str()); | |
| 601 | 601 | if (argscounted > argsprovided) |
| 602 | throw emu_fatalerror("%s.xml(%d): not enough arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, m_format.cstr()); | |
| 602 | throw emu_fatalerror("%s.xml(%d): not enough arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, m_format.c_str()); | |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | |
| r245622 | r245623 | |
| 782 | 782 | bool has_scripts = (m_off_script != NULL || m_on_script != NULL || m_run_script != NULL || m_change_script != NULL); |
| 783 | 783 | |
| 784 | 784 | // output the cheat tag |
| 785 | cheatfile.printf("\t<cheat desc=\"%s\"", m_description.cstr()); | |
| 785 | cheatfile.printf("\t<cheat desc=\"%s\"", m_description.c_str()); | |
| 786 | 786 | if (m_numtemp != DEFAULT_TEMP_VARIABLES) |
| 787 | 787 | cheatfile.printf(" tempvariables=\"%d\"", m_numtemp); |
| 788 | 788 | if (!m_comment && m_parameter == NULL && !has_scripts) |
| r245622 | r245623 | |
| 793 | 793 | |
| 794 | 794 | // save the comment |
| 795 | 795 | if (m_comment) |
| 796 | cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.cstr()); | |
| 796 | cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.c_str()); | |
| 797 | 797 | |
| 798 | 798 | // output the parameter, if present |
| 799 | 799 | if (m_parameter != NULL) |
| r245622 | r245623 | |
| 832 | 832 | { |
| 833 | 833 | execute_on_script(); |
| 834 | 834 | changed = true; |
| 835 | popmessage("Activated %s", m_description.cstr()); | |
| 835 | popmessage("Activated %s", m_description.c_str()); | |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | // if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change |
| r245622 | r245623 | |
| 840 | 840 | { |
| 841 | 841 | execute_change_script(); |
| 842 | 842 | changed = true; |
| 843 | popmessage("Activated\n %s = %s", m_description.cstr(), m_parameter->text()); | |
| 843 | popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text()); | |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | return changed; |
| r245622 | r245623 | |
|---|---|---|
| 153 | 153 | val.printf("%s:%s:%s", swlistdev->list_name(), m_options.software_name(), swpart->name()); |
| 154 | 154 | |
| 155 | 155 | // call this in order to set slot devices according to mounting |
| 156 | m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.cstr()); | |
| 156 | m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.c_str()); | |
| 157 | 157 | break; |
| 158 | 158 | } |
| 159 | 159 | } |
| r245622 | r245623 | |
| 184 | 184 | throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); |
| 185 | 185 | |
| 186 | 186 | // otherwise, error on the options |
| 187 | throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", option_errors.trimspace().cstr()); | |
| 187 | throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", option_errors.trimspace().c_str()); | |
| 188 | 188 | } |
| 189 | 189 | if (option_errors) |
| 190 | osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().cstr()); | |
| 190 | osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str()); | |
| 191 | 191 | |
| 192 | 192 | // determine the base name of the EXE |
| 193 | 193 | astring exename; |
| r245622 | r245623 | |
| 208 | 208 | m_options.parse_standard_inis(option_errors); |
| 209 | 209 | } |
| 210 | 210 | if (option_errors) |
| 211 | osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().cstr()); | |
| 211 | osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str()); | |
| 212 | 212 | |
| 213 | 213 | // if we can't find it, give an appropriate error |
| 214 | 214 | const game_driver *system = m_options.system(); |
| r245622 | r245623 | |
| 226 | 226 | catch (emu_fatalerror &fatal) |
| 227 | 227 | { |
| 228 | 228 | astring string(fatal.string()); |
| 229 | osd_printf_error("%s\n", string.trimspace().cstr()); | |
| 229 | osd_printf_error("%s\n", string.trimspace().c_str()); | |
| 230 | 230 | m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : MAMERR_FATALERROR; |
| 231 | 231 | |
| 232 | 232 | // if a game was specified, wasn't a wildcard, and our error indicates this was the |
| r245622 | r245623 | |
| 328 | 328 | // iterate through drivers and output the info |
| 329 | 329 | astring filename; |
| 330 | 330 | while (drivlist.next()) |
| 331 | osd_printf_info("%-16s %s\n", drivlist.driver().name, core_filename_extract_base(filename, drivlist.driver().source_file).cstr()); | |
| 331 | osd_printf_info("%-16s %s\n", drivlist.driver().name, core_filename_extract_base(filename, drivlist.driver().source_file).c_str()); | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
| r245622 | r245623 | |
| 418 | 418 | while (drivlist.next()) |
| 419 | 419 | { |
| 420 | 420 | int clone_of = drivlist.clone(); |
| 421 | osd_printf_info("%-16s %-16s %-16s\n", core_filename_extract_base(filename, drivlist.driver().source_file).cstr(), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name)); | |
| 421 | osd_printf_info("%-16s %-16s %-16s\n", core_filename_extract_base(filename, drivlist.driver().source_file).c_str(), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name)); | |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| r245622 | r245623 | |
| 726 | 726 | paren_shortname.format("(%s)", imagedev->brief_instance_name()); |
| 727 | 727 | |
| 728 | 728 | // output the line, up to the list of extensions |
| 729 | printf("%-13s%-12s%-8s ", first ? drivlist.driver().name : "", imagedev->instance_name(), paren_shortname.cstr()); | |
| 729 | printf("%-13s%-12s%-8s ", first ? drivlist.driver().name : "", imagedev->instance_name(), paren_shortname.c_str()); | |
| 730 | 730 | |
| 731 | 731 | // get the extensions and print them |
| 732 | 732 | astring extensions(imagedev->file_extensions()); |
| 733 | 733 | for (int start = 0, end = extensions.chr(0, ','); ; start = end + 1, end = extensions.chr(start, ',')) |
| 734 | 734 | { |
| 735 | 735 | astring curext(extensions, start, (end == -1) ? extensions.len() - start : end - start); |
| 736 | printf(".%-5s", curext.cstr()); | |
| 736 | printf(".%-5s", curext.c_str()); | |
| 737 | 737 | if (end == -1) |
| 738 | 738 | break; |
| 739 | 739 | } |
| r245622 | r245623 | |
| 782 | 782 | // output the summary of the audit |
| 783 | 783 | astring summary_string; |
| 784 | 784 | auditor.summarize(drivlist.driver().name,&summary_string); |
| 785 | osd_printf_info("%s", summary_string.cstr()); | |
| 785 | osd_printf_info("%s", summary_string.c_str()); | |
| 786 | 786 | |
| 787 | 787 | // output the name of the driver and its clone |
| 788 | 788 | osd_printf_info("romset %s ", drivlist.driver().name); |
| r245622 | r245623 | |
| 842 | 842 | // output the summary of the audit |
| 843 | 843 | astring summary_string; |
| 844 | 844 | auditor.summarize(dev->shortname(),&summary_string); |
| 845 | osd_printf_info("%s", summary_string.cstr()); | |
| 845 | osd_printf_info("%s", summary_string.c_str()); | |
| 846 | 846 | |
| 847 | 847 | // display information about what we discovered |
| 848 | 848 | osd_printf_info("romset %s ", dev->shortname()); |
| r245622 | r245623 | |
| 880 | 880 | { |
| 881 | 881 | astring temptag("_"); |
| 882 | 882 | temptag.cat(option->name()); |
| 883 | device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.cstr(), option->devtype(), 0); | |
| 883 | device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.c_str(), option->devtype(), 0); | |
| 884 | 884 | |
| 885 | 885 | // notify this device and all its subdevices that they are now configured |
| 886 | 886 | device_iterator subiter(*dev); |
| r245622 | r245623 | |
| 907 | 907 | // output the summary of the audit |
| 908 | 908 | astring summary_string; |
| 909 | 909 | auditor.summarize(dev->shortname(),&summary_string); |
| 910 | osd_printf_info("%s", summary_string.cstr()); | |
| 910 | osd_printf_info("%s", summary_string.c_str()); | |
| 911 | 911 | |
| 912 | 912 | // display information about what we discovered |
| 913 | 913 | osd_printf_info("romset %s ", dev->shortname()); |
| r245622 | r245623 | |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | const_cast<machine_config &>(config).device_remove(&config.root_device(), temptag.cstr()); | |
| 941 | const_cast<machine_config &>(config).device_remove(&config.root_device(), temptag.c_str()); | |
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
| r245622 | r245623 | |
| 1004 | 1004 | // output the summary of the audit |
| 1005 | 1005 | astring summary_string; |
| 1006 | 1006 | auditor.summarize(drivlist.driver().name,&summary_string); |
| 1007 | osd_printf_info("%s", summary_string.cstr()); | |
| 1007 | osd_printf_info("%s", summary_string.c_str()); | |
| 1008 | 1008 | |
| 1009 | 1009 | // output the name of the driver and its clone |
| 1010 | 1010 | osd_printf_info("sampleset %s ", drivlist.driver().name); |
| r245622 | r245623 | |
| 1322 | 1322 | // output the summary of the audit |
| 1323 | 1323 | astring summary_string; |
| 1324 | 1324 | auditor.summarize(swinfo->shortname(), &summary_string); |
| 1325 | osd_printf_info("%s", summary_string.cstr()); | |
| 1325 | osd_printf_info("%s", summary_string.c_str()); | |
| 1326 | 1326 | |
| 1327 | 1327 | // display information about what we discovered |
| 1328 | 1328 | osd_printf_info("romset %s:%s ", swlistdev->list_name(), swinfo->shortname()); |
| r245622 | r245623 | |
| 1444 | 1444 | // output the summary of the audit |
| 1445 | 1445 | astring summary_string; |
| 1446 | 1446 | auditor.summarize(swinfo->shortname(), &summary_string); |
| 1447 | osd_printf_info("%s", summary_string.cstr()); | |
| 1447 | osd_printf_info("%s", summary_string.c_str()); | |
| 1448 | 1448 | |
| 1449 | 1449 | // display information about what we discovered |
| 1450 | 1450 | osd_printf_info("romset %s:%s ", swlistdev->list_name(), swinfo->shortname()); |
| r245622 | r245623 | |
| 1556 | 1556 | astring option_errors; |
| 1557 | 1557 | m_options.parse_standard_inis(option_errors); |
| 1558 | 1558 | if (option_errors) |
| 1559 | osd_printf_error("%s\n", option_errors.cstr()); | |
| 1559 | osd_printf_error("%s\n", option_errors.c_str()); | |
| 1560 | 1560 | |
| 1561 | 1561 | // createconfig? |
| 1562 | 1562 | if (strcmp(m_options.command(), CLICOMMAND_CREATECONFIG) == 0) |
| r245622 | r245623 | |
| 1779 | 1779 | { |
| 1780 | 1780 | // output the name |
| 1781 | 1781 | astring basename; |
| 1782 | osd_printf_info("%-20s", core_filename_extract_base(basename, name).cstr()); | |
| 1782 | osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str()); | |
| 1783 | 1783 | m_total++; |
| 1784 | 1784 | |
| 1785 | 1785 | // attempt to open as a CHD; fail if not |
| r245622 | r245623 | |
| 1855 | 1855 | // output the name |
| 1856 | 1856 | m_total++; |
| 1857 | 1857 | astring basename; |
| 1858 | osd_printf_info("%-20s", core_filename_extract_base(basename, name).cstr()); | |
| 1858 | osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str()); | |
| 1859 | 1859 | |
| 1860 | 1860 | // see if we can find a match in the ROMs |
| 1861 | 1861 | int found = find_by_hash(hashes, length); |
| r245622 | r245623 | |
|---|---|---|
| 655 | 655 | if (device.machine().options().drc_log_native()) |
| 656 | 656 | { |
| 657 | 657 | astring filename("drcbex64_", device.shortname(), ".asm"); |
| 658 | m_log = x86log_create_context(filename.cstr()); | |
| 658 | m_log = x86log_create_context(filename.c_str()); | |
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | 661 | |
| r245622 | r245623 | |
| 799 | 799 | { |
| 800 | 800 | astring dasm; |
| 801 | 801 | inst.disasm(dasm, &m_drcuml); |
| 802 | x86log_add_comment(m_log, dst, "%s", dasm.cstr()); | |
| 802 | x86log_add_comment(m_log, dst, "%s", dasm.c_str()); | |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | // extract a blockname |
| r245622 | r245623 | |
|---|---|---|
| 569 | 569 | if (device.machine().options().drc_log_native()) |
| 570 | 570 | { |
| 571 | 571 | astring filename("drcbex86_", device.shortname(), ".asm"); |
| 572 | m_log = x86log_create_context(filename.cstr()); | |
| 572 | m_log = x86log_create_context(filename.c_str()); | |
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | |
| r245622 | r245623 | |
| 782 | 782 | { |
| 783 | 783 | astring dasm; |
| 784 | 784 | inst.disasm(dasm, &m_drcuml); |
| 785 | x86log_add_comment(m_log, dst, "%s", dasm.cstr()); | |
| 785 | x86log_add_comment(m_log, dst, "%s", dasm.c_str()); | |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | // extract a blockname |
| r245622 | r245623 | |
|---|---|---|
| 130 | 130 | if (device.machine().options().drc_log_uml()) |
| 131 | 131 | { |
| 132 | 132 | astring filename("drcuml_", m_device.shortname(), ".asm"); |
| 133 | m_umllog = fopen(filename.cstr(), "w"); | |
| 133 | m_umllog = fopen(filename.c_str(), "w"); | |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| r245622 | r245623 | |
| 490 | 490 | // include the first accumulated comment with this line |
| 491 | 491 | if (firstcomment != -1) |
| 492 | 492 | { |
| 493 | m_drcuml.log_printf("\t%-50.50s; %s\n", dasm.cstr(), get_comment_text(m_inst[firstcomment], comment)); | |
| 493 | m_drcuml.log_printf("\t%-50.50s; %s\n", dasm.c_str(), get_comment_text(m_inst[firstcomment], comment)); | |
| 494 | 494 | firstcomment++; |
| 495 | 495 | flushcomments = TRUE; |
| 496 | 496 | } |
| 497 | 497 | else |
| 498 | m_drcuml.log_printf("\t%s\n", dasm.cstr()); | |
| 498 | m_drcuml.log_printf("\t%s\n", dasm.c_str()); | |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | // flush any comments pending |
| r245622 | r245623 | |
|---|---|---|
| 237 | 237 | m_auc & 0x10 ? '0':'.', |
| 238 | 238 | m_auc & 0x08 ? '1':'.', |
| 239 | 239 | m_auc & 0x04 ? '0':'.', |
| 240 | alignString.cstr()); | |
| 240 | alignString.c_str()); | |
| 241 | 241 | break; |
| 242 | 242 | } |
| 243 | 243 | |
| r245622 | r245623 | |
| 274 | 274 | } |
| 275 | 275 | string.printf("%c%s%c%c%c%c%c%c%c%c%c%c%c%c%c", |
| 276 | 276 | m_pioc & 0x8000 ? 'I':'.', |
| 277 | strobeString.cstr(), | |
| 277 | strobeString.c_str(), | |
| 278 | 278 | m_pioc & 0x1000 ? 'O':'I', |
| 279 | 279 | m_pioc & 0x0800 ? 'O':'I', |
| 280 | 280 | m_pioc & 0x0400 ? 'S':'.', |
| r245622 | r245623 | |
| 305 | 305 | } |
| 306 | 306 | string.printf("%c%s%c%c%c%c%c%c%c", |
| 307 | 307 | m_sioc & 0x0200 ? 'I':'O', |
| 308 | clkString.cstr(), | |
| 308 | clkString.c_str(), | |
| 309 | 309 | m_sioc & 0x0040 ? 'L':'M', |
| 310 | 310 | m_sioc & 0x0020 ? 'I':'O', |
| 311 | 311 | m_sioc & 0x0010 ? 'I':'O', |
| r245622 | r245623 | |
|---|---|---|
| 270 | 270 | const UINT8 F1 = (op & 0x01e0) >> 5; |
| 271 | 271 | astring yString = disasmYField(Y); |
| 272 | 272 | astring fString = disasmF1Field(F1, D, S); |
| 273 | sprintf(buffer, "%s, %s", fString.cstr(), yString.cstr()); | |
| 273 | sprintf(buffer, "%s, %s", fString.c_str(), yString.c_str()); | |
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | case 0x04: case 0x1c: |
| r245622 | r245623 | |
| 285 | 285 | astring fString = disasmF1Field(F1, D, S); |
| 286 | 286 | astring aString = (opcode == 0x1c) ? "a0" : "a1"; |
| 287 | 287 | astring xString = (X) ? "" : "l"; |
| 288 | sprintf(buffer, "%s = %s%s, %s", yString.cstr(), aString.cstr(), xString.cstr(), fString.cstr()); | |
| 288 | sprintf(buffer, "%s = %s%s, %s", yString.c_str(), aString.c_str(), xString.c_str(), fString.c_str()); | |
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | 291 | case 0x16: |
| r245622 | r245623 | |
| 297 | 297 | const UINT8 F1 = (op & 0x01e0) >> 5; |
| 298 | 298 | astring yString = disasmYField(Y); |
| 299 | 299 | astring fString = disasmF1Field(F1, D, S); |
| 300 | sprintf(buffer, "%s, x = %s", fString.cstr(), yString.cstr()); | |
| 300 | sprintf(buffer, "%s, x = %s", fString.c_str(), yString.c_str()); | |
| 301 | 301 | break; |
| 302 | 302 | } |
| 303 | 303 | case 0x17: |
| r245622 | r245623 | |
| 311 | 311 | astring yString = disasmYField(Y); |
| 312 | 312 | astring fString = disasmF1Field(F1, D, S); |
| 313 | 313 | astring xString = (X ? "y" : "y1"); |
| 314 | sprintf(buffer, "%s, %s = %s", fString.cstr(), xString.cstr(), yString.cstr()); | |
| 314 | sprintf(buffer, "%s, %s = %s", fString.c_str(), xString.c_str(), yString.c_str()); | |
| 315 | 315 | break; |
| 316 | 316 | } |
| 317 | 317 | case 0x1f: |
| r245622 | r245623 | |
| 325 | 325 | astring yString = disasmYField(Y); |
| 326 | 326 | astring fString = disasmF1Field(F1, D, S); |
| 327 | 327 | astring xString = (X ? "*pt++i" : "*pt++"); |
| 328 | sprintf(buffer, "%s, y = %s, x = %s", fString.cstr(), yString.cstr(), xString.cstr()); | |
| 328 | sprintf(buffer, "%s, y = %s, x = %s", fString.c_str(), yString.c_str(), xString.c_str()); | |
| 329 | 329 | break; |
| 330 | 330 | } |
| 331 | 331 | case 0x19: case 0x1b: |
| r245622 | r245623 | |
| 339 | 339 | astring fString = disasmF1Field(F1, D, S); |
| 340 | 340 | astring xString = (X ? "*pt++i" : "*pt++"); |
| 341 | 341 | astring aString = (opcode == 0x19) ? "a0" : "a1"; |
| 342 | sprintf(buffer, "%s, y = %s, x = %s", fString.cstr(), aString.cstr(), xString.cstr()); | |
| 342 | sprintf(buffer, "%s, y = %s, x = %s", fString.c_str(), aString.c_str(), xString.c_str()); | |
| 343 | 343 | if (Y != 0x00) sprintf(buffer, "UNKNOWN"); |
| 344 | 344 | break; |
| 345 | 345 | } |
| r245622 | r245623 | |
| 354 | 354 | astring yString = disasmYField(Y); |
| 355 | 355 | astring xString = (X ? "y" : "y1"); |
| 356 | 356 | astring fString = disasmF1Field(F1, D, S); |
| 357 | sprintf(buffer, "%s, %s = %s", fString.cstr(), yString.cstr(), xString.cstr()); | |
| 357 | sprintf(buffer, "%s, %s = %s", fString.c_str(), yString.c_str(), xString.c_str()); | |
| 358 | 358 | break; |
| 359 | 359 | } |
| 360 | 360 | |
| r245622 | r245623 | |
| 369 | 369 | astring yString = disasmYField(Y); |
| 370 | 370 | astring atString = (aT ? "a0" : "a1"); |
| 371 | 371 | astring fString = disasmF1Field(F1, aT, S); |
| 372 | sprintf(buffer, "%s, %s = %s", fString.cstr(), atString.cstr(), yString.cstr()); | |
| 372 | sprintf(buffer, "%s, %s = %s", fString.c_str(), atString.c_str(), yString.c_str()); | |
| 373 | 373 | break; |
| 374 | 374 | } |
| 375 | 375 | |
| r245622 | r245623 | |
| 385 | 385 | astring zString = disasmZField(Z); |
| 386 | 386 | astring xString = (X ? "y" : "y1"); |
| 387 | 387 | astring fString = disasmF1Field(F1, D, S); |
| 388 | sprintf(buffer, "%s, %s <=> %s", fString.cstr(), xString.cstr(), zString.cstr()); | |
| 388 | sprintf(buffer, "%s, %s <=> %s", fString.c_str(), xString.c_str(), zString.c_str()); | |
| 389 | 389 | break; |
| 390 | 390 | } |
| 391 | 391 | case 0x1d: |
| r245622 | r245623 | |
| 399 | 399 | astring zString = disasmZField(Z); |
| 400 | 400 | astring xString = (X ? "*pt++i" : "*pt++"); |
| 401 | 401 | astring fString = disasmF1Field(F1, D, S); |
| 402 | sprintf(buffer, "%s, %s <=> y, x = %s", fString.cstr(), zString.cstr(), xString.cstr()); | |
| 402 | sprintf(buffer, "%s, %s <=> y, x = %s", fString.c_str(), zString.c_str(), xString.c_str()); | |
| 403 | 403 | break; |
| 404 | 404 | } |
| 405 | 405 | |
| r245622 | r245623 | |
| 416 | 416 | astring atString = (aT ? "a0" : "a1"); |
| 417 | 417 | atString += X ? "" : "1"; // TODO: Figure out unclear wording. |
| 418 | 418 | astring fString = disasmF1Field(F1, aT, S); |
| 419 | sprintf(buffer, "%s, %s <=> %s", fString.cstr(), zString.cstr(), atString.cstr()); | |
| 419 | sprintf(buffer, "%s, %s <=> %s", fString.c_str(), zString.c_str(), atString.c_str()); | |
| 420 | 420 | break; |
| 421 | 421 | } |
| 422 | 422 | |
| r245622 | r245623 | |
| 431 | 431 | const UINT8 F2 = (op & 0x01e0) >> 5; |
| 432 | 432 | astring fString = disasmF2Field(F2, D, S); |
| 433 | 433 | astring conString = disasmCONField(CON); |
| 434 | if (op & 0x0800) sprintf(buffer, "if %s : %s", conString.cstr(), fString.cstr()); | |
| 435 | else sprintf(buffer, "ifc %s : %s", conString.cstr(), fString.cstr()); | |
| 434 | if (op & 0x0800) sprintf(buffer, "if %s : %s", conString.c_str(), fString.c_str()); | |
| 435 | else sprintf(buffer, "ifc %s : %s", conString.c_str(), fString.c_str()); | |
| 436 | 436 | break; |
| 437 | 437 | } |
| 438 | 438 | |
| r245622 | r245623 | |
| 458 | 458 | // goto B |
| 459 | 459 | const UINT8 B = (op & 0x0700) >> 8; |
| 460 | 460 | astring bString = disasmBField(B); |
| 461 | sprintf(buffer, "%s", bString.cstr()); | |
| 461 | sprintf(buffer, "%s", bString.c_str()); | |
| 462 | 462 | break; |
| 463 | 463 | } |
| 464 | 464 | |
| r245622 | r245623 | |
| 468 | 468 | // if CON [goto/call/return] |
| 469 | 469 | const UINT8 CON = (op & 0x001f); |
| 470 | 470 | astring conString = disasmCONField(CON); |
| 471 | sprintf(buffer, "if %s:", conString.cstr()); | |
| 471 | sprintf(buffer, "if %s:", conString.c_str()); | |
| 472 | 472 | // TODO: Test for invalid ops |
| 473 | 473 | // icall |
| 474 | 474 | if (op == 0xd40e) sprintf(buffer, "icall"); |
| r245622 | r245623 | |
| 482 | 482 | const UINT8 R = (op & 0x03f0) >> 4; |
| 483 | 483 | const UINT8 S = (op & 0x1000) >> 12; |
| 484 | 484 | astring rString = disasmRField(R); |
| 485 | sprintf(buffer, "%s = %s", rString.cstr(), (S ? "a1" : "a0")); | |
| 485 | sprintf(buffer, "%s = %s", rString.c_str(), (S ? "a1" : "a0")); | |
| 486 | 486 | break; |
| 487 | 487 | } |
| 488 | 488 | case 0x08: |
| r245622 | r245623 | |
| 491 | 491 | const UINT8 R = (op & 0x03f0) >> 4; |
| 492 | 492 | const UINT8 aT = (op & 0x0400) >> 10; |
| 493 | 493 | astring rString = disasmRField(R); |
| 494 | sprintf(buffer, "%s = %s", (aT ? "a0" : "a1"), rString.cstr()); | |
| 494 | sprintf(buffer, "%s = %s", (aT ? "a0" : "a1"), rString.c_str()); | |
| 495 | 495 | break; |
| 496 | 496 | } |
| 497 | 497 | case 0x0f: |
| r245622 | r245623 | |
| 501 | 501 | const UINT8 R = (op & 0x03f0) >> 4; |
| 502 | 502 | astring yString = disasmYField(Y); |
| 503 | 503 | astring rString = disasmRField(R); |
| 504 | sprintf(buffer, "%s = %s", rString.cstr(), yString.cstr()); | |
| 504 | sprintf(buffer, "%s = %s", rString.c_str(), yString.c_str()); | |
| 505 | 505 | // TODO: Special case the R == [y, y1, or x] case |
| 506 | 506 | break; |
| 507 | 507 | } |
| r245622 | r245623 | |
| 513 | 513 | astring yString = disasmYField(Y); |
| 514 | 514 | astring rString = disasmRField(R); |
| 515 | 515 | // TODO: page 3-31 "special function encoding" |
| 516 | sprintf(buffer, "%s = %s", yString.cstr(), rString.cstr()); | |
| 516 | sprintf(buffer, "%s = %s", yString.c_str(), rString.c_str()); | |
| 517 | 517 | break; |
| 518 | 518 | } |
| 519 | 519 | case 0x0d: |
| r245622 | r245623 | |
| 523 | 523 | const UINT8 R = (op & 0x03f0) >> 4; |
| 524 | 524 | astring zString = disasmZField(Z); |
| 525 | 525 | astring rString = disasmRField(R); |
| 526 | sprintf(buffer, "%s <=> %s", zString.cstr(), rString.cstr()); | |
| 526 | sprintf(buffer, "%s <=> %s", zString.c_str(), rString.c_str()); | |
| 527 | 527 | break; |
| 528 | 528 | } |
| 529 | 529 | |
| r245622 | r245623 | |
| 533 | 533 | // R = N |
| 534 | 534 | const UINT8 R = (op & 0x03f0) >> 4; |
| 535 | 535 | astring rString = disasmRField(R); |
| 536 | sprintf(buffer, "%s = 0x%04x", rString.cstr(), op2); | |
| 536 | sprintf(buffer, "%s = 0x%04x", rString.c_str(), op2); | |
| 537 | 537 | opSize = 2; |
| 538 | 538 | break; |
| 539 | 539 | } |
| r245622 | r245623 | |
| 545 | 545 | const UINT16 M = (op & 0x01ff); |
| 546 | 546 | const UINT8 R = (op & 0x0e00) >> 9; |
| 547 | 547 | astring rString = disasmRImmediateField(R); |
| 548 | sprintf(buffer, "%s = 0x%04x", rString.cstr(), M); | |
| 548 | sprintf(buffer, "%s = 0x%04x", rString.c_str(), M); | |
| 549 | 549 | break; |
| 550 | 550 | } |
| 551 | 551 |
| r245622 | r245623 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | // Decode and disassemble. |
| 23 | 23 | DSP56K::Opcode op(w0, w1); |
| 24 | sprintf(buffer, "%s", op.disassemble().cstr()); | |
| 24 | sprintf(buffer, "%s", op.disassemble().c_str()); | |
| 25 | 25 | |
| 26 | 26 | const unsigned size = op.size(); |
| 27 | 27 | return (size | DASMFLAG_SUPPORTED); |
| r245622 | r245623 | |
|---|---|---|
| 204 | 204 | void disassemble(astring& retString) const |
| 205 | 205 | { |
| 206 | 206 | char temp[32]; |
| 207 | sprintf(temp, "#$%x,%s", m_immediate, regIdAsString(m_destination).cstr()); | |
| 207 | sprintf(temp, "#$%x,%s", m_immediate, regIdAsString(m_destination).c_str()); | |
| 208 | 208 | retString = "andi " + astring(temp); |
| 209 | 209 | // NEW // sprintf(opcode_str, "and(i)"); |
| 210 | 210 | } |
| r245622 | r245623 | |
| 438 | 438 | sprintf(temp, "#$%x", m_iVal); |
| 439 | 439 | astring source = temp; |
| 440 | 440 | |
| 441 | sprintf(temp, "X:(%s)", regIdAsString(m_r).cstr()); | |
| 441 | sprintf(temp, "X:(%s)", regIdAsString(m_r).c_str()); | |
| 442 | 442 | astring destination = temp; |
| 443 | 443 | |
| 444 | 444 | retString = m_opcode + " " + source + "," + destination; |
| r245622 | r245623 | |
| 1138 | 1138 | astring destination = temp; |
| 1139 | 1139 | // NEW // sprintf(temp, "X:(R%d),$%02x", Rnum, pc + 2 + word1); |
| 1140 | 1140 | |
| 1141 | sprintf(temp, "X:(%s)", regIdAsString(m_source).cstr()); | |
| 1141 | sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); | |
| 1142 | 1142 | astring source = temp; |
| 1143 | 1143 | |
| 1144 | 1144 | retString = "do " + source + "," + destination; |
| r245622 | r245623 | |
| 3042 | 3042 | void disassemble(astring& retString) const |
| 3043 | 3043 | { |
| 3044 | 3044 | char temp[32]; |
| 3045 | sprintf(temp, "X:(%s)", regIdAsString(m_source).cstr()); | |
| 3045 | sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); | |
| 3046 | 3046 | retString = "rep " + astring(temp); |
| 3047 | 3047 | } |
| 3048 | 3048 | void evaluate(dsp56k_core* cpustate) {} |
| r245622 | r245623 | |
|---|---|---|
| 158 | 158 | if (r == iR3) return false; |
| 159 | 159 | |
| 160 | 160 | char temp[32]; |
| 161 | sprintf(temp, "X:%s,%s", ea1.cstr(), regIdAsString(D1).cstr()); | |
| 161 | sprintf(temp, "X:%s,%s", ea1.c_str(), regIdAsString(D1).c_str()); | |
| 162 | 162 | parallelMove = temp; |
| 163 | sprintf(temp, "X:%s,%s", ea2.cstr(), regIdAsString(D2).cstr()); | |
| 163 | sprintf(temp, "X:%s,%s", ea2.c_str(), regIdAsString(D2).c_str()); | |
| 164 | 164 | parallelMove2 = temp; |
| 165 | 165 | |
| 166 | 166 | return true; |
| r245622 | r245623 | |
| 253 | 253 | decode_RR_table(BITSn(word0,0x00c0), r); |
| 254 | 254 | decode_DD_table(BITSn(word0,0x0030), S); |
| 255 | 255 | |
| 256 | sprintf(parallel_move_str, "%s,X:(R%d)+N%d", regIdAsString(Dnot).cstr(), regIDAsNum(r), regIDAsNum(r)); | |
| 257 | sprintf(parallel_move_str2, "%s,%s", regIdAsString(S).cstr(), regIdAsString(Dnot).cstr()); | |
| 256 | sprintf(parallel_move_str, "%s,X:(R%d)+N%d", regIdAsString(Dnot).c_str(), regIDAsNum(r), regIDAsNum(r)); | |
| 257 | sprintf(parallel_move_str2, "%s,%s", regIdAsString(S).c_str(), regIdAsString(Dnot).c_str()); | |
| 258 | 258 | pms = parallel_move_str; |
| 259 | 259 | pms2 = parallel_move_str2; |
| 260 | 260 | return true; |
| r245622 | r245623 | |
|---|---|---|
| 574 | 574 | break; |
| 575 | 575 | case 0x1: |
| 576 | 576 | assemble_address_from_IO_short_address(ppppp, fullAddy); |
| 577 | sprintf(temp, "X:<<$%s", fullAddy.cstr()); | |
| 578 | // NEW // sprintf(temp, "X:$%s", fullAddy.cstr()); | |
| 577 | sprintf(temp, "X:<<$%s", fullAddy.c_str()); | |
| 578 | // NEW // sprintf(temp, "X:$%s", fullAddy.c_str()); | |
| 579 | 579 | break; |
| 580 | 580 | } |
| 581 | 581 | D = temp; |
| r245622 | r245623 | |
| 585 | 585 | astring& source, astring& destination) |
| 586 | 586 | { |
| 587 | 587 | char temp[32]; |
| 588 | sprintf(temp, "%c:%s", ma, ea.cstr()); | |
| 588 | sprintf(temp, "%c:%s", ma, ea.c_str()); | |
| 589 | 589 | switch(W) |
| 590 | 590 | { |
| 591 | 591 | case 0x0: source = regIdAsString(SD); destination = temp; break; |
| r245622 | r245623 | |
| 597 | 597 | astring& source, astring& destination) |
| 598 | 598 | { |
| 599 | 599 | char temp[32]; |
| 600 | sprintf(temp, "%c:%s", ma, ea.cstr()); | |
| 600 | sprintf(temp, "%c:%s", ma, ea.c_str()); | |
| 601 | 601 | switch(W) |
| 602 | 602 | { |
| 603 | 603 | case 0x0: source = SD; destination = temp; break; |
| r245622 | r245623 | |
|---|---|---|
| 253 | 253 | int delta = oprom[2]; |
| 254 | 254 | if(delta & 0x80) |
| 255 | 255 | delta -= 0x100; |
| 256 | sprintf(buffer, " %s, %04x", regname(oprom[1]).cstr(), (pc+3+delta) & 0xffff); | |
| 256 | sprintf(buffer, " %s, %04x", regname(oprom[1]).c_str(), (pc+3+delta) & 0xffff); | |
| 257 | 257 | flags |= 3; |
| 258 | 258 | break; |
| 259 | 259 | } |
| r245622 | r245623 | |
| 262 | 262 | int delta = oprom[2]; |
| 263 | 263 | if(delta & 0x80) |
| 264 | 264 | delta -= 0x100; |
| 265 | sprintf(buffer, " %d, %s, %04x", oprom[0] & 7, regname(oprom[1]).cstr(), (pc+3+delta) & 0xffff); | |
| 265 | sprintf(buffer, " %d, %s, %04x", oprom[0] & 7, regname(oprom[1]).c_str(), (pc+3+delta) & 0xffff); | |
| 266 | 266 | flags |= 3; |
| 267 | 267 | break; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | case DASM_direct_1: |
| 271 | sprintf(buffer, " %s", regname(oprom[1]).cstr()); | |
| 271 | sprintf(buffer, " %s", regname(oprom[1]).c_str()); | |
| 272 | 272 | flags |= 2; |
| 273 | 273 | break; |
| 274 | 274 | |
| 275 | 275 | case DASM_direct_2: |
| 276 | sprintf(buffer, " %s, %s", regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); | |
| 276 | sprintf(buffer, " %s, %s", regname(oprom[2]).c_str(), regname(oprom[1]).c_str()); | |
| 277 | 277 | flags |= 3; |
| 278 | 278 | break; |
| 279 | 279 | |
| 280 | 280 | case DASM_direct_3: |
| 281 | sprintf(buffer, " %s, %s, %s", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); | |
| 281 | sprintf(buffer, " %s, %s, %s", regname(oprom[3]).c_str(), regname(oprom[2]).c_str(), regname(oprom[1]).c_str()); | |
| 282 | 282 | flags |= 4; |
| 283 | 283 | break; |
| 284 | 284 | |
| r245622 | r245623 | |
| 288 | 288 | break; |
| 289 | 289 | |
| 290 | 290 | case DASM_immed_2b: |
| 291 | sprintf(buffer, " %s, #%02x", regname(oprom[2]).cstr(), oprom[1]); | |
| 291 | sprintf(buffer, " %s, #%02x", regname(oprom[2]).c_str(), oprom[1]); | |
| 292 | 292 | flags |= 3; |
| 293 | 293 | break; |
| 294 | 294 | |
| 295 | 295 | case DASM_immed_or_reg_2b: |
| 296 | 296 | if(oprom[1] >= 0x10) |
| 297 | sprintf(buffer, " %s, %s", regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); | |
| 297 | sprintf(buffer, " %s, %s", regname(oprom[2]).c_str(), regname(oprom[1]).c_str()); | |
| 298 | 298 | else |
| 299 | sprintf(buffer, " %s, #%02x", regname(oprom[2]).cstr(), oprom[1]); | |
| 299 | sprintf(buffer, " %s, #%02x", regname(oprom[2]).c_str(), oprom[1]); | |
| 300 | 300 | flags |= 3; |
| 301 | 301 | break; |
| 302 | 302 | |
| 303 | 303 | case DASM_immed_3b: |
| 304 | sprintf(buffer, " %s, %s, #%02x", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), oprom[1]); | |
| 304 | sprintf(buffer, " %s, %s, #%02x", regname(oprom[3]).c_str(), regname(oprom[2]).c_str(), oprom[1]); | |
| 305 | 305 | flags |= 4; |
| 306 | 306 | break; |
| 307 | 307 | |
| r245622 | r245623 | |
| 311 | 311 | break; |
| 312 | 312 | |
| 313 | 313 | case DASM_immed_2w: |
| 314 | sprintf(buffer, " %s, #%02x%02x", regname(oprom[3]).cstr(), oprom[2], oprom[1]); | |
| 314 | sprintf(buffer, " %s, #%02x%02x", regname(oprom[3]).c_str(), oprom[2], oprom[1]); | |
| 315 | 315 | flags |= 4; |
| 316 | 316 | break; |
| 317 | 317 | |
| 318 | 318 | case DASM_immed_3w: |
| 319 | sprintf(buffer, " %s, %s, #%02x%02x", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), oprom[2], oprom[1]); | |
| 319 | sprintf(buffer, " %s, %s, #%02x%02x", regname(oprom[4]).c_str(), regname(oprom[3]).c_str(), oprom[2], oprom[1]); | |
| 320 | 320 | flags |= 5; |
| 321 | 321 | break; |
| 322 | 322 | |
| 323 | 323 | case DASM_indirect_1n: |
| 324 | sprintf(buffer, " [%s]", regname(oprom[1]).cstr()); | |
| 324 | sprintf(buffer, " [%s]", regname(oprom[1]).c_str()); | |
| 325 | 325 | flags |= 2; |
| 326 | 326 | break; |
| 327 | 327 | |
| 328 | 328 | case DASM_indirect_1: |
| 329 | 329 | if(oprom[1] & 0x01) { |
| 330 | sprintf(buffer, " [%s]+", regname(oprom[1]-1).cstr()); | |
| 330 | sprintf(buffer, " [%s]+", regname(oprom[1]-1).c_str()); | |
| 331 | 331 | flags |= 2; |
| 332 | 332 | } else { |
| 333 | sprintf(buffer, " [%s]", regname(oprom[1]).cstr()); | |
| 333 | sprintf(buffer, " [%s]", regname(oprom[1]).c_str()); | |
| 334 | 334 | flags |= 2; |
| 335 | 335 | } |
| 336 | 336 | break; |
| 337 | 337 | |
| 338 | 338 | case DASM_indirect_2: |
| 339 | 339 | if(oprom[1] & 0x01) { |
| 340 | sprintf(buffer, " %s, [%s]+", regname(oprom[2]).cstr(), regname(oprom[1]-1).cstr()); | |
| 340 | sprintf(buffer, " %s, [%s]+", regname(oprom[2]).c_str(), regname(oprom[1]-1).c_str()); | |
| 341 | 341 | flags |= 3; |
| 342 | 342 | } else { |
| 343 | sprintf(buffer, " %s, [%s]", regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); | |
| 343 | sprintf(buffer, " %s, [%s]", regname(oprom[2]).c_str(), regname(oprom[1]).c_str()); | |
| 344 | 344 | flags |= 3; |
| 345 | 345 | } |
| 346 | 346 | break; |
| 347 | 347 | |
| 348 | 348 | case DASM_indirect_3: |
| 349 | 349 | if(oprom[1] & 0x01) { |
| 350 | sprintf(buffer, " %s, %s, [%s]+", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), regname(oprom[1]-1).cstr()); | |
| 350 | sprintf(buffer, " %s, %s, [%s]+", regname(oprom[3]).c_str(), regname(oprom[2]).c_str(), regname(oprom[1]-1).c_str()); | |
| 351 | 351 | flags |= 4; |
| 352 | 352 | } else { |
| 353 | sprintf(buffer, " %s, %s, [%s]", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); | |
| 353 | sprintf(buffer, " %s, %s, [%s]", regname(oprom[3]).c_str(), regname(oprom[2]).c_str(), regname(oprom[1]).c_str()); | |
| 354 | 354 | flags |= 4; |
| 355 | 355 | } |
| 356 | 356 | break; |
| r245622 | r245623 | |
| 360 | 360 | if(oprom[1] == 0x01) |
| 361 | 361 | sprintf(buffer, " %02x%02x", oprom[3], oprom[2]); |
| 362 | 362 | else |
| 363 | sprintf(buffer, " %02x%02x[%s]", oprom[3], oprom[2], regname(oprom[1]-1).cstr()); | |
| 363 | sprintf(buffer, " %02x%02x[%s]", oprom[3], oprom[2], regname(oprom[1]-1).c_str()); | |
| 364 | 364 | flags |= 4; |
| 365 | 365 | } else { |
| 366 | 366 | int delta = oprom[2]; |
| r245622 | r245623 | |
| 373 | 373 | sprintf(buffer, " %02x", delta); |
| 374 | 374 | } else { |
| 375 | 375 | if(delta < 0) |
| 376 | sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]).cstr()); | |
| 376 | sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]).c_str()); | |
| 377 | 377 | else |
| 378 | sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]).cstr()); | |
| 378 | sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]).c_str()); | |
| 379 | 379 | } |
| 380 | 380 | flags |= 3; |
| 381 | 381 | } |
| r245622 | r245623 | |
| 384 | 384 | case DASM_indexed_2: |
| 385 | 385 | if(oprom[1] & 0x01) { |
| 386 | 386 | if(oprom[1] == 0x01) |
| 387 | sprintf(buffer, " %s, %02x%02x", regname(oprom[4]).cstr(), oprom[3], oprom[2]); | |
| 387 | sprintf(buffer, " %s, %02x%02x", regname(oprom[4]).c_str(), oprom[3], oprom[2]); | |
| 388 | 388 | else |
| 389 | sprintf(buffer, " %s, %02x%02x[%s]", regname(oprom[4]).cstr(), oprom[3], oprom[2], regname(oprom[1]-1).cstr()); | |
| 389 | sprintf(buffer, " %s, %02x%02x[%s]", regname(oprom[4]).c_str(), oprom[3], oprom[2], regname(oprom[1]-1).c_str()); | |
| 390 | 390 | flags |= 5; |
| 391 | 391 | } else { |
| 392 | 392 | int delta = oprom[2]; |
| r245622 | r245623 | |
| 394 | 394 | delta -= 0x100; |
| 395 | 395 | if(oprom[1] == 0x00) { |
| 396 | 396 | if(delta < 0) |
| 397 | sprintf(buffer, " %s, %04x", regname(oprom[3]).cstr(), delta & 0xffff); | |
| 397 | sprintf(buffer, " %s, %04x", regname(oprom[3]).c_str(), delta & 0xffff); | |
| 398 | 398 | else |
| 399 | sprintf(buffer, " %s, %02x", regname(oprom[3]).cstr(), delta); | |
| 399 | sprintf(buffer, " %s, %02x", regname(oprom[3]).c_str(), delta); | |
| 400 | 400 | } else { |
| 401 | 401 | if(delta < 0) |
| 402 | sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr()); | |
| 402 | sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).c_str(), -delta, regname(oprom[1]).c_str()); | |
| 403 | 403 | else |
| 404 | sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr()); | |
| 404 | sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).c_str(), delta, regname(oprom[1]).c_str()); | |
| 405 | 405 | } |
| 406 | 406 | flags |= 4; |
| 407 | 407 | } |
| r245622 | r245623 | |
| 410 | 410 | case DASM_indexed_3: |
| 411 | 411 | if(oprom[1] & 0x01) { |
| 412 | 412 | if(oprom[1] == 0x01) |
| 413 | sprintf(buffer, " %s, %s, %02x%02x", regname(oprom[5]).cstr(), regname(oprom[4]).cstr(), oprom[3], oprom[2]); | |
| 413 | sprintf(buffer, " %s, %s, %02x%02x", regname(oprom[5]).c_str(), regname(oprom[4]).c_str(), oprom[3], oprom[2]); | |
| 414 | 414 | else |
| 415 | sprintf(buffer, " %s, %s, %02x%02x[%s]", regname(oprom[5]).cstr(), regname(oprom[4]).cstr(), oprom[3], oprom[2], regname(oprom[1]-1).cstr()); | |
| 415 | sprintf(buffer, " %s, %s, %02x%02x[%s]", regname(oprom[5]).c_str(), regname(oprom[4]).c_str(), oprom[3], oprom[2], regname(oprom[1]-1).c_str()); | |
| 416 | 416 | flags |= 6; |
| 417 | 417 | } else { |
| 418 | 418 | int delta = oprom[2]; |
| r245622 | r245623 | |
| 420 | 420 | delta -= 0x100; |
| 421 | 421 | if(oprom[1] == 0x00) { |
| 422 | 422 | if(delta < 0) |
| 423 | sprintf(buffer, " %s, %s, %04x", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta & 0xffff); | |
| 423 | sprintf(buffer, " %s, %s, %04x", regname(oprom[4]).c_str(), regname(oprom[3]).c_str(), delta & 0xffff); | |
| 424 | 424 | else |
| 425 | sprintf(buffer, " %s, %s, %02x", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta); | |
| 425 | sprintf(buffer, " %s, %s, %02x", regname(oprom[4]).c_str(), regname(oprom[3]).c_str(), delta); | |
| 426 | 426 | } else { |
| 427 | 427 | if(delta < 0) |
| 428 | sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr()); | |
| 428 | sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).c_str(), regname(oprom[3]).c_str(), -delta, regname(oprom[1]).c_str()); | |
| 429 | 429 | else |
| 430 | sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr()); | |
| 430 | sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).c_str(), regname(oprom[3]).c_str(), delta, regname(oprom[1]).c_str()); | |
| 431 | 431 | } |
| 432 | 432 | flags |= 5; |
| 433 | 433 | } |
| r245622 | r245623 | |
|---|---|---|
| 83 | 83 | astring tmp_string; |
| 84 | 84 | |
| 85 | 85 | for(int i=0; i<0x20; i++) |
| 86 | state_add(SCORE_GPR + i, tmp_string.format("r%d", i).cstr(), m_gpr[i]).callimport().callexport().formatstr("%08X"); | |
| 86 | state_add(SCORE_GPR + i, tmp_string.format("r%d", i).c_str(), m_gpr[i]).callimport().callexport().formatstr("%08X"); | |
| 87 | 87 | |
| 88 | 88 | for(int i=0; i<0x20; i++) |
| 89 | state_add(SCORE_CR + i, tmp_string.format("cr%d", i).cstr(), m_cr[i]).callimport().callexport().formatstr("%08X"); | |
| 89 | state_add(SCORE_CR + i, tmp_string.format("cr%d", i).c_str(), m_cr[i]).callimport().callexport().formatstr("%08X"); | |
| 90 | 90 | |
| 91 | 91 | for(int i=0; i<3; i++) |
| 92 | state_add(SCORE_SR + i, tmp_string.format("sr%d", i).cstr(), m_sr[i]).callimport().callexport().formatstr("%08X"); | |
| 92 | state_add(SCORE_SR + i, tmp_string.format("sr%d", i).c_str(), m_sr[i]).callimport().callexport().formatstr("%08X"); | |
| 93 | 93 | |
| 94 | 94 | state_add(SCORE_CEH, "ceh", REG_CEH).callimport().callexport().formatstr("%08X"); |
| 95 | 95 | state_add(SCORE_CEL, "cel", REG_CEL).callimport().callexport().formatstr("%08X"); |
| r245622 | r245623 | |
|---|---|---|
| 743 | 743 | astring disasm1, disasm2; |
| 744 | 744 | orig.disasm(disasm1, block->drcuml); |
| 745 | 745 | inst->disasm(disasm2, block->drcuml); |
| 746 | osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.cstr(), disasm2.cstr()); | |
| 746 | osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.c_str(), disasm2.c_str()); | |
| 747 | 747 | } |
| 748 | 748 | */ |
| 749 | 749 |
| r245622 | r245623 | |
|---|---|---|
| 1044 | 1044 | /* special message for none */ |
| 1045 | 1045 | if (!buffer) |
| 1046 | 1046 | buffer.printf("Not currently ignoring any devices"); |
| 1047 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 1047 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | /* otherwise clear the ignore flag on all requested CPUs */ |
| r245622 | r245623 | |
| 1109 | 1109 | /* special message for none */ |
| 1110 | 1110 | if (!buffer) |
| 1111 | 1111 | buffer.printf("Not currently observing any devices"); |
| 1112 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 1112 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | /* otherwise set the ignore flag on all requested CPUs */ |
| r245622 | r245623 | |
| 1332 | 1332 | buffer.catprintf(" if %s", bp->condition()); |
| 1333 | 1333 | if (astring(bp->action()) != astring("")) |
| 1334 | 1334 | buffer.catprintf(" do %s", bp->action()); |
| 1335 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 1335 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 1336 | 1336 | printed++; |
| 1337 | 1337 | } |
| 1338 | 1338 | } |
| r245622 | r245623 | |
| 1502 | 1502 | buffer.catprintf(" if %s", wp->condition()); |
| 1503 | 1503 | if (astring(wp->action()) != astring("")) |
| 1504 | 1504 | buffer.catprintf(" do %s", wp->action()); |
| 1505 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 1505 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 1506 | 1506 | printed++; |
| 1507 | 1507 | } |
| 1508 | 1508 | } |
| r245622 | r245623 | |
| 1641 | 1641 | buffer.catprintf("if %s", rp->condition()); |
| 1642 | 1642 | if (rp->action() != NULL) |
| 1643 | 1643 | buffer.catprintf(" do %s", rp->action()); |
| 1644 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 1644 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 1645 | 1645 | printed++; |
| 1646 | 1646 | } |
| 1647 | 1647 | } |
| r245622 | r245623 | |
| 2605 | 2605 | /* do it */ |
| 2606 | 2606 | cpu->debug()->trace(f, trace_over, action); |
| 2607 | 2607 | if (f) |
| 2608 | debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag(), filename.cstr()); | |
| 2608 | debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag(), filename.c_str()); | |
| 2609 | 2609 | else |
| 2610 | 2610 | debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag()); |
| 2611 | 2611 | } |
| r245622 | r245623 | |
| 3100 | 3100 | |
| 3101 | 3101 | // and output it as appropriate |
| 3102 | 3102 | if (file != NULL) |
| 3103 | fprintf(file, "%s\n", buffer.cstr()); | |
| 3103 | fprintf(file, "%s\n", buffer.c_str()); | |
| 3104 | 3104 | else |
| 3105 | debug_console_printf(machine, "%s\n", buffer.cstr()); | |
| 3105 | debug_console_printf(machine, "%s\n", buffer.c_str()); | |
| 3106 | 3106 | |
| 3107 | 3107 | // cleanup |
| 3108 | 3108 | if (file != NULL) |
| r245622 | r245623 | |
|---|---|---|
| 3059 | 3059 | } |
| 3060 | 3060 | else |
| 3061 | 3061 | buffer.printf("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); |
| 3062 | debug_console_printf(space.machine(), "%s\n", buffer.cstr()); | |
| 3062 | debug_console_printf(space.machine(), "%s\n", buffer.c_str()); | |
| 3063 | 3063 | space.device().debug()->compute_debug_flags(); |
| 3064 | 3064 | } |
| 3065 | 3065 | break; |
| r245622 | r245623 | |
| 3493 | 3493 | buffer.cat(dasm); |
| 3494 | 3494 | |
| 3495 | 3495 | // output the result |
| 3496 | fprintf(&m_file, "%s\n", buffer.cstr()); | |
| 3496 | fprintf(&m_file, "%s\n", buffer.c_str()); | |
| 3497 | 3497 | |
| 3498 | 3498 | // do we need to step the trace over this instruction? |
| 3499 | 3499 | if (m_trace_over && (dasmresult & DASMFLAG_SUPPORTED) != 0 && (dasmresult & DASMFLAG_STEP_OVER) != 0) |
| r245622 | r245623 | |
|---|---|---|
| 134 | 134 | { |
| 135 | 135 | astring name; |
| 136 | 136 | name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); |
| 137 | m_source_list.append(*global_alloc(debug_view_source(name.cstr(), &dasm->device()))); | |
| 137 | m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device()))); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // reset the source to a known good entry |
| r245622 | r245623 | |
| 196 | 196 | buffer.expand(diff); |
| 197 | 197 | for (int i = 0; i < diff; i++) |
| 198 | 198 | buffer.catprintf(" "); |
| 199 | str.catprintf("%s", buffer.cstr()); | |
| 199 | str.catprintf("%s", buffer.c_str()); | |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 |
| r245622 | r245623 | |
|---|---|---|
| 291 | 291 | len += m_divider - 1 - curitem->m_symbol.len(); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | memcpy(&temp[len], curitem->m_symbol.cstr(), curitem->m_symbol.len()); | |
| 294 | memcpy(&temp[len], curitem->m_symbol.c_str(), curitem->m_symbol.len()); | |
| 295 | 295 | len += curitem->m_symbol.len(); |
| 296 | 296 | |
| 297 | 297 | temp[len++] = ' '; |
| 298 | 298 | temp[len++] = ' '; |
| 299 | 299 | |
| 300 | memcpy(&temp[len], valstr.cstr(), curitem->m_vallen); | |
| 300 | memcpy(&temp[len], valstr.c_str(), curitem->m_vallen); | |
| 301 | 301 | len += curitem->m_vallen; |
| 302 | 302 | |
| 303 | 303 | temp[len++] = ' '; |
| r245622 | r245623 | |
|---|---|---|
| 156 | 156 | { |
| 157 | 157 | astring name; |
| 158 | 158 | name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); |
| 159 | m_source_list.append(*global_alloc(debug_view_source(name.cstr(), &dasm->device()))); | |
| 159 | m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device()))); | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // reset the source to a known good entry |
| r245622 | r245623 | |
| 220 | 220 | buffer.expand(diff); |
| 221 | 221 | for (int i = 0; i < diff; i++) |
| 222 | 222 | buffer.catprintf(" "); |
| 223 | str.catprintf("%s", buffer.cstr()); | |
| 223 | str.catprintf("%s", buffer.c_str()); | |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 |
| r245622 | r245623 | |
|---|---|---|
| 287 | 287 | if (m_setter != NULL) |
| 288 | 288 | (*m_setter)(m_table, m_ref, newvalue); |
| 289 | 289 | else |
| 290 | throw emu_fatalerror("Symbol '%s' is read-only", m_name.cstr()); | |
| 290 | throw emu_fatalerror("Symbol '%s' is read-only", m_name.c_str()); | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| r245622 | r245623 | |
| 347 | 347 | |
| 348 | 348 | UINT64 function_symbol_entry::value() const |
| 349 | 349 | { |
| 350 | throw emu_fatalerror("Symbol '%s' is a function and cannot be used in this context", m_name.cstr()); | |
| 350 | throw emu_fatalerror("Symbol '%s' is a function and cannot be used in this context", m_name.c_str()); | |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
| r245622 | r245623 | |
| 357 | 357 | |
| 358 | 358 | void function_symbol_entry::set_value(UINT64 newvalue) |
| 359 | 359 | { |
| 360 | throw emu_fatalerror("Symbol '%s' is a function and cannot be written", m_name.cstr()); | |
| 360 | throw emu_fatalerror("Symbol '%s' is a function and cannot be written", m_name.c_str()); | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | |
| r245622 | r245623 | |
| 368 | 368 | UINT64 function_symbol_entry::execute(int numparams, const UINT64 *paramlist) |
| 369 | 369 | { |
| 370 | 370 | if (numparams < m_minparams) |
| 371 | throw emu_fatalerror("Function '%s' requires at least %d parameters", m_name.cstr(), m_minparams); | |
| 371 | throw emu_fatalerror("Function '%s' requires at least %d parameters", m_name.c_str(), m_minparams); | |
| 372 | 372 | if (numparams > m_maxparams) |
| 373 | throw emu_fatalerror("Function '%s' accepts no more than %d parameters", m_name.cstr(), m_maxparams); | |
| 373 | throw emu_fatalerror("Function '%s' accepts no more than %d parameters", m_name.c_str(), m_maxparams); | |
| 374 | 374 | return (*m_execute)(m_table, m_ref, numparams, paramlist); |
| 375 | 375 | } |
| 376 | 376 | |
| r245622 | r245623 | |
| 927 | 927 | |
| 928 | 928 | // if we have an 0x prefix, we must be a hex value |
| 929 | 929 | if (buffer[0] == '0' && buffer[1] == 'x') |
| 930 | return parse_number(token, buffer.cstr() + 2, 16, expression_error::INVALID_NUMBER); | |
| 930 | return parse_number(token, buffer.c_str() + 2, 16, expression_error::INVALID_NUMBER); | |
| 931 | 931 | |
| 932 | 932 | // if we have a # prefix, we must be a decimal value |
| 933 | 933 | if (buffer[0] == '#') |
| 934 | return parse_number(token, buffer.cstr() + 1, 10, expression_error::INVALID_NUMBER); | |
| 934 | return parse_number(token, buffer.c_str() + 1, 10, expression_error::INVALID_NUMBER); | |
| 935 | 935 | |
| 936 | 936 | // if we have a $ prefix, we are a hex value |
| 937 | 937 | if (buffer[0] == '$') |
| 938 | return parse_number(token, buffer.cstr() + 1, 16, expression_error::INVALID_NUMBER); | |
| 938 | return parse_number(token, buffer.c_str() + 1, 16, expression_error::INVALID_NUMBER); | |
| 939 | 939 | |
| 940 | 940 | // check for a symbol match |
| 941 | 941 | symbol_entry *symbol = m_symtable->find_deep(buffer); |
| r245622 | r245623 | |
|---|---|---|
| 327 | 327 | |
| 328 | 328 | UINT32 region_length = valid.region_length(gfxregion); |
| 329 | 329 | if (region_length == 0) |
| 330 | osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.cstr()); | |
| 330 | osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.c_str()); | |
| 331 | 331 | |
| 332 | 332 | // if we have a valid region, and we're not using auto-sizing, check the decode against the region length |
| 333 | 333 | else if (!IS_FRAC(layout.total)) |
| r245622 | r245623 | |
|---|---|---|
| 236 | 236 | |
| 237 | 237 | const char *device_image_interface::error() |
| 238 | 238 | { |
| 239 | return (m_err_message) ? m_err_message.cstr() : messages[m_err]; | |
| 239 | return (m_err_message) ? m_err_message.c_str() : messages[m_err]; | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
| r245622 | r245623 | |
| 295 | 295 | bool success = FALSE; |
| 296 | 296 | bool done = FALSE; |
| 297 | 297 | |
| 298 | directory = osd_opendir(m_working_directory.cstr()); | |
| 298 | directory = osd_opendir(m_working_directory.c_str()); | |
| 299 | 299 | if (directory != NULL) |
| 300 | 300 | { |
| 301 | 301 | while(!done && (entry = osd_readdir(directory)) != NULL) |
| r245622 | r245623 | |
| 536 | 536 | |
| 537 | 537 | /* find the extensions */ |
| 538 | 538 | astring extensions(file_extensions()); |
| 539 | char *ext = strtok((char*)extensions.cstr(),","); | |
| 539 | char *ext = strtok((char*)extensions.c_str(),","); | |
| 540 | 540 | while (ext != NULL) |
| 541 | 541 | { |
| 542 | 542 | if (!core_stricmp(ext, file_extension)) |
| r245622 | r245623 | |
| 823 | 823 | // - if we are not using lists, we have regiontag only; |
| 824 | 824 | // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname |
| 825 | 825 | // try to load from list/setname |
| 826 | if ((m_mame_file == NULL) && (tag2.cstr() != NULL)) | |
| 827 | filerr = common_process_file(device().machine().options(), tag2.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 826 | if ((m_mame_file == NULL) && (tag2.c_str() != NULL)) | |
| 827 | filerr = common_process_file(device().machine().options(), tag2.c_str(), has_crc, crc, romp, &m_mame_file); | |
| 828 | 828 | // try to load from list/parentname |
| 829 | if ((m_mame_file == NULL) && (tag3.cstr() != NULL)) | |
| 830 | filerr = common_process_file(device().machine().options(), tag3.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 829 | if ((m_mame_file == NULL) && (tag3.c_str() != NULL)) | |
| 830 | filerr = common_process_file(device().machine().options(), tag3.c_str(), has_crc, crc, romp, &m_mame_file); | |
| 831 | 831 | // try to load from setname |
| 832 | if ((m_mame_file == NULL) && (tag4.cstr() != NULL)) | |
| 833 | filerr = common_process_file(device().machine().options(), tag4.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 832 | if ((m_mame_file == NULL) && (tag4.c_str() != NULL)) | |
| 833 | filerr = common_process_file(device().machine().options(), tag4.c_str(), has_crc, crc, romp, &m_mame_file); | |
| 834 | 834 | // try to load from parentname |
| 835 | if ((m_mame_file == NULL) && (tag5.cstr() != NULL)) | |
| 836 | filerr = common_process_file(device().machine().options(), tag5.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 835 | if ((m_mame_file == NULL) && (tag5.c_str() != NULL)) | |
| 836 | filerr = common_process_file(device().machine().options(), tag5.c_str(), has_crc, crc, romp, &m_mame_file); | |
| 837 | 837 | |
| 838 | 838 | warningcount += verify_length_and_hash(m_mame_file,ROM_GETNAME(romp),ROM_GETLENGTH(romp),hash_collection(ROM_GETHASHDATA(romp))); |
| 839 | 839 |
| r245622 | r245623 | |
|---|---|---|
| 238 | 238 | for (const sound_route *route = first_route(); route != NULL; route = route->next()) |
| 239 | 239 | { |
| 240 | 240 | // find a device with the requested tag |
| 241 | const device_t *target = device().siblingdevice(route->m_target.cstr()); | |
| 241 | const device_t *target = device().siblingdevice(route->m_target.c_str()); | |
| 242 | 242 | if (target == NULL) |
| 243 | osd_printf_error("Attempting to route sound to non-existant device '%s'\n", route->m_target.cstr()); | |
| 243 | osd_printf_error("Attempting to route sound to non-existant device '%s'\n", route->m_target.c_str()); | |
| 244 | 244 | |
| 245 | 245 | // if it's not a speaker or a sound device, error |
| 246 | 246 | const device_sound_interface *sound; |
| 247 | 247 | if (target != NULL && target->type() != SPEAKER && !target->interface(sound)) |
| 248 | osd_printf_error("Attempting to route sound to a non-sound device '%s' (%s)\n", route->m_target.cstr(), target->name()); | |
| 248 | osd_printf_error("Attempting to route sound to a non-sound device '%s' (%s)\n", route->m_target.c_str(), target->name()); | |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| r245622 | r245623 | |
| 318 | 318 | int streamoutputnum; |
| 319 | 319 | sound_stream *outputstream = sound->output_to_stream_output(outputnum, streamoutputnum); |
| 320 | 320 | if (outputstream == NULL) |
| 321 | fatalerror("Sound device '%s' specifies route for non-existant output #%d\n", route->m_target.cstr(), outputnum); | |
| 321 | fatalerror("Sound device '%s' specifies route for non-existant output #%d\n", route->m_target.c_str(), outputnum); | |
| 322 | 322 | |
| 323 | 323 | // find the input stream to connect to |
| 324 | 324 | int streaminputnum; |
| 325 | 325 | sound_stream *inputstream = input_to_stream_input(inputnum++, streaminputnum); |
| 326 | 326 | if (inputstream == NULL) |
| 327 | fatalerror("Sound device '%s' targeted output #%d to non-existant device '%s' input %d\n", route->m_target.cstr(), outputnum, m_device.tag(), inputnum - 1); | |
| 327 | fatalerror("Sound device '%s' targeted output #%d to non-existant device '%s' input %d\n", route->m_target.c_str(), outputnum, m_device.tag(), inputnum - 1); | |
| 328 | 328 | |
| 329 | 329 | // set the input |
| 330 | 330 | inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route->m_gain); |
| r245622 | r245623 | |
|---|---|---|
| 532 | 532 | |
| 533 | 533 | // append errors if requested |
| 534 | 534 | if (error && error_string != NULL) |
| 535 | error_string->catprintf("While parsing %s:\n%s\n", file.fullpath(), error.cstr()); | |
| 535 | error_string->catprintf("While parsing %s:\n%s\n", file.fullpath(), error.c_str()); | |
| 536 | 536 | |
| 537 | 537 | return result; |
| 538 | 538 | } |
| r245622 | r245623 | |
| 544 | 544 | int pos = buffer.chr(0, ','); |
| 545 | 545 | if (pos != -1) |
| 546 | 546 | buffer = buffer.substr(0, pos); |
| 547 | return buffer.cstr(); | |
| 547 | return buffer.c_str(); | |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | const char *emu_options::sub_value(astring &buffer, const char *name, const char *subname) const |
| r245622 | r245623 | |
| 561 | 561 | } |
| 562 | 562 | else |
| 563 | 563 | buffer.reset(); |
| 564 | return buffer.cstr(); | |
| 564 | return buffer.c_str(); | |
| 565 | 565 | } |
| r245622 | r245623 | |
|---|---|---|
| 409 | 409 | { |
| 410 | 410 | // find the extended (split) memory, if present |
| 411 | 411 | astring tag_ext(tag(), "_ext"); |
| 412 | const memory_share *share_ext = memshare(tag_ext.cstr()); | |
| 412 | const memory_share *share_ext = memshare(tag_ext.c_str()); | |
| 413 | 413 | |
| 414 | 414 | // make sure we have specified a format |
| 415 | 415 | assert_always(m_raw_to_rgb.bytes_per_entry() > 0, "Palette has memory share but no format specified"); |
| r245622 | r245623 | |
|---|---|---|
| 845 | 845 | int fileno = -1; |
| 846 | 846 | |
| 847 | 847 | // see if we can find a file with the right name and (if available) crc |
| 848 | if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.cstr(), filename.len(), true, true); | |
| 848 | if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), true, true); | |
| 849 | 849 | |
| 850 | 850 | // if that failed, look for a file with the right crc, but the wrong filename |
| 851 | 851 | if (fileno==-1) |
| 852 | if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.cstr(), filename.len(), true, false); | |
| 852 | if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), true, false); | |
| 853 | 853 | |
| 854 | 854 | // if that failed, look for a file with the right name; reporting a bad checksum |
| 855 | 855 | // is more helpful and less confusing than reporting "rom not found" |
| 856 | 856 | if (fileno==-1) |
| 857 | fileno = _7z_search_crc_match(_7z, m_crc, filename.cstr(), filename.len(), false, true); | |
| 857 | fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), false, true); | |
| 858 | 858 | |
| 859 | 859 | if (fileno != -1) |
| 860 | 860 | { |
| r245622 | r245623 | |
|---|---|---|
| 232 | 232 | |
| 233 | 233 | fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s", |
| 234 | 234 | image->device().name(), |
| 235 | image_basename.cstr(), | |
| 236 | image_err.cstr()); | |
| 235 | image_basename.c_str(), | |
| 236 | image_err.c_str()); | |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | } |
| r245622 | r245623 | |
| 280 | 280 | |
| 281 | 281 | fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load failed: %s", |
| 282 | 282 | image->device().name(), |
| 283 | image_err.cstr()); | |
| 283 | image_err.c_str()); | |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 |
| r245622 | r245623 | |
|---|---|---|
| 280 | 280 | fname = m_mame_file->filename(); |
| 281 | 281 | int loc = fname.rchr(0,'.'); |
| 282 | 282 | if (loc!=-1) { |
| 283 | extension = fname.substr(loc + 1,fname.len()-loc).cstr(); | |
| 283 | extension = fname.substr(loc + 1,fname.len()-loc).c_str(); | |
| 284 | 284 | } else { |
| 285 | 285 | extension = ""; |
| 286 | 286 | } |
| r245622 | r245623 | |
|---|---|---|
| 173 | 173 | astring fname(name, ".dif"); |
| 174 | 174 | |
| 175 | 175 | /* try to open the diff */ |
| 176 | //printf("Opening differencing image file: %s\n", fname.cstr()); | |
| 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 | 178 | file_error filerr = diff_file.open(fname); |
| 179 | 179 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 181 | 181 | astring fullpath(diff_file.fullpath()); |
| 182 | 182 | diff_file.close(); |
| 183 | 183 | |
| 184 | //printf("Opening differencing image file: %s\n", fullpath.cstr()); | |
| 184 | //printf("Opening differencing image file: %s\n", fullpath.c_str()); | |
| 185 | 185 | return diff_chd.open(fullpath, true, &source); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /* didn't work; try creating it instead */ |
| 189 | //printf("Creating differencing image: %s\n", fname.cstr()); | |
| 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 | 191 | filerr = diff_file.open(fname); |
| 192 | 192 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 195 | 195 | diff_file.close(); |
| 196 | 196 | |
| 197 | 197 | /* create the CHD */ |
| 198 | //printf("Creating differencing image file: %s\n", fullpath.cstr()); | |
| 198 | //printf("Creating differencing image file: %s\n", fullpath.c_str()); | |
| 199 | 199 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 200 | 200 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); |
| 201 | 201 | if (err != CHDERR_NONE) |
| r245622 | r245623 | |
|---|---|---|
| 179 | 179 | astring fname(name, ".dif"); |
| 180 | 180 | |
| 181 | 181 | /* try to open the diff */ |
| 182 | //printf("Opening differencing image file: %s\n", fname.cstr()); | |
| 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 | 184 | file_error filerr = diff_file.open(fname); |
| 185 | 185 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 187 | 187 | astring fullpath(diff_file.fullpath()); |
| 188 | 188 | diff_file.close(); |
| 189 | 189 | |
| 190 | //printf("Opening differencing image file: %s\n", fullpath.cstr()); | |
| 190 | //printf("Opening differencing image file: %s\n", fullpath.c_str()); | |
| 191 | 191 | return diff_chd.open(fullpath, true, &source); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /* didn't work; try creating it instead */ |
| 195 | //printf("Creating differencing image: %s\n", fname.cstr()); | |
| 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 | 197 | filerr = diff_file.open(fname); |
| 198 | 198 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 201 | 201 | diff_file.close(); |
| 202 | 202 | |
| 203 | 203 | /* create the CHD */ |
| 204 | //printf("Creating differencing image file: %s\n", fullpath.cstr()); | |
| 204 | //printf("Creating differencing image file: %s\n", fullpath.c_str()); | |
| 205 | 205 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 206 | 206 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); |
| 207 | 207 | if (err != CHDERR_NONE) |
| r245622 | r245623 | |
|---|---|---|
| 197 | 197 | dtd.replace(0,"__XML_ROOT__", emulator_info::get_xml_root()); |
| 198 | 198 | dtd.replace(0,"__XML_TOP__", emulator_info::get_xml_top()); |
| 199 | 199 | |
| 200 | fprintf(m_output, "%s\n\n", dtd.cstr()); | |
| 200 | fprintf(m_output, "%s\n\n", dtd.c_str()); | |
| 201 | 201 | |
| 202 | 202 | // top-level tag |
| 203 | 203 | fprintf(m_output, "<%s build=\"%s\" debug=\"" |
| r245622 | r245623 | |
| 343 | 343 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); |
| 344 | 344 | astring src(device.source()); |
| 345 | 345 | src.replace("../",""); |
| 346 | fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.cstr())); | |
| 346 | fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.c_str())); | |
| 347 | 347 | fprintf(m_output, " isdevice=\"yes\""); |
| 348 | 348 | fprintf(m_output, " runnable=\"no\""); |
| 349 | 349 | output_sampleof(); |
| r245622 | r245623 | |
| 404 | 404 | { |
| 405 | 405 | astring temptag("_"); |
| 406 | 406 | temptag.cat(option->name()); |
| 407 | device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.cstr(), option->devtype(), 0); | |
| 407 | device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.c_str(), option->devtype(), 0); | |
| 408 | 408 | |
| 409 | 409 | // notify this device and all its subdevices that they are now configured |
| 410 | 410 | device_iterator subiter(*dev); |
| r245622 | r245623 | |
| 413 | 413 | device->config_complete(); |
| 414 | 414 | |
| 415 | 415 | if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE) |
| 416 | output_one_device(*dev, temptag.cstr()); | |
| 416 | output_one_device(*dev, temptag.c_str()); | |
| 417 | 417 | |
| 418 | const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.cstr()); | |
| 418 | const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.c_str()); | |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } |
| r245622 | r245623 | |
| 582 | 582 | |
| 583 | 583 | output.cat("/>\n"); |
| 584 | 584 | |
| 585 | fprintf(m_output, "%s", output.cstr()); | |
| 585 | fprintf(m_output, "%s", output.c_str()); | |
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | } |
| r245622 | r245623 | |
| 1085 | 1085 | // output the switch name information |
| 1086 | 1086 | astring normalized_field_name(xml_normalize_string(field->name())); |
| 1087 | 1087 | astring normalized_newtag(xml_normalize_string(newtag)); |
| 1088 | output.catprintf("\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.cstr(), normalized_newtag.cstr(), field->mask()); | |
| 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 |
| 1091 | 1091 | for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) |
| r245622 | r245623 | |
| 1096 | 1096 | // terminate the switch entry |
| 1097 | 1097 | output.catprintf("\t\t</%s>\n", outertag); |
| 1098 | 1098 | |
| 1099 | fprintf(m_output, "%s", output.cstr()); | |
| 1099 | fprintf(m_output, "%s", output.c_str()); | |
| 1100 | 1100 | } |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| r245622 | r245623 | |
| 1240 | 1240 | |
| 1241 | 1241 | astring extensions(imagedev->file_extensions()); |
| 1242 | 1242 | |
| 1243 | char *ext = strtok((char *)extensions.cstr(), ","); | |
| 1243 | char *ext = strtok((char *)extensions.c_str(), ","); | |
| 1244 | 1244 | while (ext != NULL) |
| 1245 | 1245 | { |
| 1246 | 1246 | fprintf(m_output, "\t\t\t<extension"); |
| r245622 | r245623 | |
|---|---|---|
| 531 | 531 | |
| 532 | 532 | const char *joystick_map::to_string(astring &string) const |
| 533 | 533 | { |
| 534 | string.printf("%s\n", m_origstring.cstr()); | |
| 534 | string.printf("%s\n", m_origstring.c_str()); | |
| 535 | 535 | for (int rownum = 0; rownum < 9; rownum++) |
| 536 | 536 | { |
| 537 | 537 | string.catprintf(" "); |
| r245622 | r245623 | |
| 1579 | 1579 | |
| 1580 | 1580 | // first token should be the devclass |
| 1581 | 1581 | int curtok = 0; |
| 1582 | input_device_class devclass = input_device_class((*devclass_token_table)[token[curtok++].cstr()]); | |
| 1582 | input_device_class devclass = input_device_class((*devclass_token_table)[token[curtok++].c_str()]); | |
| 1583 | 1583 | if (devclass == ~0) |
| 1584 | 1584 | return INPUT_CODE_INVALID; |
| 1585 | 1585 | |
| r245622 | r245623 | |
| 1594 | 1594 | return INPUT_CODE_INVALID; |
| 1595 | 1595 | |
| 1596 | 1596 | // next token is the item ID |
| 1597 | input_item_id itemid = input_item_id((*itemid_token_table)[token[curtok].cstr()]); | |
| 1597 | input_item_id itemid = input_item_id((*itemid_token_table)[token[curtok].c_str()]); | |
| 1598 | 1598 | bool standard = (itemid != ~0); |
| 1599 | 1599 | |
| 1600 | 1600 | // if we're a standard code, default the itemclass based on it |
| r245622 | r245623 | |
| 1632 | 1632 | input_item_modifier modifier = ITEM_MODIFIER_NONE; |
| 1633 | 1633 | if (curtok < numtokens) |
| 1634 | 1634 | { |
| 1635 | modifier = input_item_modifier((*modifier_token_table)[token[curtok].cstr()]); | |
| 1635 | modifier = input_item_modifier((*modifier_token_table)[token[curtok].c_str()]); | |
| 1636 | 1636 | if (modifier != ~0) |
| 1637 | 1637 | curtok++; |
| 1638 | 1638 | else |
| r245622 | r245623 | |
| 1642 | 1642 | // if we have another token, it is the item class |
| 1643 | 1643 | if (curtok < numtokens) |
| 1644 | 1644 | { |
| 1645 | UINT32 temp = (*itemclass_token_table)[token[curtok].cstr()]; | |
| 1645 | UINT32 temp = (*itemclass_token_table)[token[curtok].c_str()]; | |
| 1646 | 1646 | if (temp != ~0) |
| 1647 | 1647 | { |
| 1648 | 1648 | curtok++; |
| r245622 | r245623 | |
| 2020 | 2020 | |
| 2021 | 2021 | // loop until we're done |
| 2022 | 2022 | astring strcopy = string; |
| 2023 | char *str = const_cast<char *>(strcopy.cstr()); | |
| 2023 | char *str = const_cast<char *>(strcopy.c_str()); | |
| 2024 | 2024 | while (1) |
| 2025 | 2025 | { |
| 2026 | 2026 | // trim any leading spaces |
| r245622 | r245623 | |
|---|---|---|
| 2482 | 2482 | astring errors; |
| 2483 | 2483 | m_portlist.append(*device, errors); |
| 2484 | 2484 | if (errors) |
| 2485 | osd_printf_error("Input port errors:\n%s", errors.cstr()); | |
| 2485 | osd_printf_error("Input port errors:\n%s", errors.c_str()); | |
| 2486 | 2486 | } |
| 2487 | 2487 | |
| 2488 | 2488 | // renumber player numbers for controller ports |
| r245622 | r245623 | |
| 3703 | 3703 | m_owner.subtag(fulltag, tag); |
| 3704 | 3704 | |
| 3705 | 3705 | // find the existing port |
| 3706 | m_curport = m_portlist.find(fulltag.cstr()); | |
| 3706 | m_curport = m_portlist.find(fulltag.c_str()); | |
| 3707 | 3707 | if (m_curport == NULL) |
| 3708 | throw emu_fatalerror("Requested to modify nonexistent port '%s'", fulltag.cstr()); | |
| 3708 | throw emu_fatalerror("Requested to modify nonexistent port '%s'", fulltag.c_str()); | |
| 3709 | 3709 | |
| 3710 | 3710 | // bump the modification count, and reset current field/setting |
| 3711 | 3711 | m_curport->m_modcount++; |
| r245622 | r245623 | |
|---|---|---|
| 1044 | 1044 | osd_lock_acquire(lock); |
| 1045 | 1045 | if (msg.ready == 1) { |
| 1046 | 1046 | lua_settop(m_lua_state, 0); |
| 1047 | int status = luaL_loadbuffer(m_lua_state, msg.text.cstr(), strlen(msg.text.cstr()), "=stdin"); | |
| 1047 | int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), strlen(msg.text.c_str()), "=stdin"); | |
| 1048 | 1048 | if (incomplete(status)==0) /* cannot try to add lines? */ |
| 1049 | 1049 | { |
| 1050 | 1050 | if (status == LUA_OK) status = docall(0, LUA_MULTRET); |
| r245622 | r245623 | |
|---|---|---|
| 592 | 592 | // copy the device name to an astring |
| 593 | 593 | astring devname_str; |
| 594 | 594 | devname_str.cpysubstr(statename_str, pos + 3, end - pos - 3); |
| 595 | //printf("check template: %s\n", devname_str.cstr()); | |
| 595 | //printf("check template: %s\n", devname_str.c_str()); | |
| 596 | 596 | |
| 597 | 597 | // verify that there is such a device for this system |
| 598 | 598 | image_interface_iterator iter(root_device()); |
| r245622 | r245623 | |
| 600 | 600 | { |
| 601 | 601 | // get the device name |
| 602 | 602 | astring tempdevname(image->brief_instance_name()); |
| 603 | //printf("check device: %s\n", tempdevname.cstr()); | |
| 603 | //printf("check device: %s\n", tempdevname.c_str()); | |
| 604 | 604 | |
| 605 | 605 | if (devname_str.cmp(tempdevname) == 0) |
| 606 | 606 | { |
| r245622 | r245623 | |
| 612 | 612 | // setup snapname and remove the %d_ |
| 613 | 613 | statename_str.replace(0, devname_str, filename); |
| 614 | 614 | statename_str.del(pos, 3); |
| 615 | //printf("check image: %s\n", filename.cstr()); | |
| 615 | //printf("check image: %s\n", filename.c_str()); | |
| 616 | 616 | |
| 617 | 617 | name_found = 1; |
| 618 | 618 | } |
| r245622 | r245623 | |
| 651 | 651 | // take into account the statename option |
| 652 | 652 | const char *stateopt = options().state_name(); |
| 653 | 653 | astring statename = get_statename(stateopt); |
| 654 | m_saveload_pending_file.cpy(statename.cstr()).cat(PATH_SEPARATOR).cat(filename).cat(".sta"); | |
| 654 | m_saveload_pending_file.cpy(statename.c_str()).cat(PATH_SEPARATOR).cat(filename).cat(".sta"); | |
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 |
| r245622 | r245623 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | #if 0 |
| 62 | 62 | if(!edge.is_never()) |
| 63 | fprintf(stderr, "ctime=%s, transition_time=%s, next=%s, pha=%s\n", tts(ctime).cstr(), tts(edge).cstr(), tts(next).cstr(), tts(phase_adjust).cstr()); | |
| 63 | fprintf(stderr, "ctime=%s, transition_time=%s, next=%s, pha=%s\n", tts(ctime).c_str(), tts(edge).c_str(), tts(next).c_str(), tts(phase_adjust).c_str()); | |
| 64 | 64 | #endif |
| 65 | 65 | |
| 66 | 66 | if(next > limit) |
| r245622 | r245623 | |
|---|---|---|
| 572 | 572 | |
| 573 | 573 | void hdc9234_device::wait_time(emu_timer *tm, const attotime &delay, int param) |
| 574 | 574 | { |
| 575 | if (TRACE_DELAY) logerror("%s: [%s] Delaying by %4.2f microsecs\n", tag(), ttsn().cstr(), delay.as_double()*1000000); | |
| 575 | if (TRACE_DELAY) logerror("%s: [%s] Delaying by %4.2f microsecs\n", tag(), ttsn().c_str(), delay.as_double()*1000000); | |
| 576 | 576 | tm->adjust(delay); |
| 577 | 577 | m_substate = param; |
| 578 | 578 | } |
| r245622 | r245623 | |
| 1784 | 1784 | */ |
| 1785 | 1785 | void hdc9234_device::live_start(int state) |
| 1786 | 1786 | { |
| 1787 | if (TRACE_LIVE) logerror("%s: [%s] Live start substate=%d\n", tag(), ttsn().cstr(), state); | |
| 1787 | if (TRACE_LIVE) logerror("%s: [%s] Live start substate=%d\n", tag(), ttsn().c_str(), state); | |
| 1788 | 1788 | m_live_state.time = machine().time(); |
| 1789 | 1789 | m_live_state.state = state; |
| 1790 | 1790 | m_live_state.next_state = -1; |
| r245622 | r245623 | |
| 1828 | 1828 | if (TRACE_LIVE) |
| 1829 | 1829 | { |
| 1830 | 1830 | if (limit == attotime::never) |
| 1831 | logerror("%s: [%s] live_run, live_state=%d, mode=%s\n", tag(), tts(m_live_state.time).cstr(), m_live_state.state, fm_mode()? "FM":"MFM"); | |
| 1831 | logerror("%s: [%s] live_run, live_state=%d, mode=%s\n", tag(), tts(m_live_state.time).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); | |
| 1832 | 1832 | else |
| 1833 | logerror("%s: [%s] live_run until %s, live_state=%d, mode=%s\n", tag(), tts(m_live_state.time).cstr(), tts(limit).cstr(), m_live_state.state, fm_mode()? "FM":"MFM"); | |
| 1833 | logerror("%s: [%s] live_run until %s, live_state=%d, mode=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); | |
| 1834 | 1834 | } |
| 1835 | 1835 | |
| 1836 | 1836 | if (limit == attotime::never) |
| r245622 | r245623 | |
| 1862 | 1862 | |
| 1863 | 1863 | if (TRACE_LIVE && m_last_live_state != SEARCH_IDAM) |
| 1864 | 1864 | { |
| 1865 | logerror("%s: [%s] SEARCH_IDAM [limit %s]\n", tag(),tts(m_live_state.time).cstr(), tts(limit).cstr()); | |
| 1865 | logerror("%s: [%s] SEARCH_IDAM [limit %s]\n", tag(),tts(m_live_state.time).c_str(), tts(limit).c_str()); | |
| 1866 | 1866 | m_last_live_state = m_live_state.state; |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| r245622 | r245623 | |
| 1871 | 1871 | |
| 1872 | 1872 | if (read_one_bit(limit)) |
| 1873 | 1873 | { |
| 1874 | if (TRACE_LIVE) logerror("%s: [%s] SEARCH_IDAM limit reached\n", tag(), tts(m_live_state.time).cstr()); | |
| 1874 | if (TRACE_LIVE) logerror("%s: [%s] SEARCH_IDAM limit reached\n", tag(), tts(m_live_state.time).c_str()); | |
| 1875 | 1875 | return; |
| 1876 | 1876 | } |
| 1877 | // logerror("%s: SEARCH_IDAM\n", tts(m_live_state.time).cstr()); | |
| 1878 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).cstr(), m_live_state.shift_reg, | |
| 1877 | // logerror("%s: SEARCH_IDAM\n", tts(m_live_state.time).c_str()); | |
| 1878 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).c_str(), m_live_state.shift_reg, | |
| 1879 | 1879 | get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); |
| 1880 | 1880 | |
| 1881 | 1881 | // [1] p. 9: The ID field sync mark must be found within 33,792 byte times |
| r245622 | r245623 | |
| 1890 | 1890 | // MFM case |
| 1891 | 1891 | if (m_live_state.shift_reg == 0x4489) |
| 1892 | 1892 | { |
| 1893 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).cstr()); | |
| 1893 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); | |
| 1894 | 1894 | m_live_state.crc = 0x443b; |
| 1895 | 1895 | m_live_state.data_separator_phase = false; |
| 1896 | 1896 | m_live_state.bit_counter = 0; |
| r245622 | r245623 | |
| 1921 | 1921 | |
| 1922 | 1922 | if (TRACE_LIVE && m_last_live_state != READ_TWO_MORE_A1_IDAM) |
| 1923 | 1923 | { |
| 1924 | logerror("%s: [%s] READ_TWO_MORE_A1\n", tag(),tts(m_live_state.time).cstr()); | |
| 1924 | logerror("%s: [%s] READ_TWO_MORE_A1\n", tag(),tts(m_live_state.time).c_str()); | |
| 1925 | 1925 | m_last_live_state = m_live_state.state; |
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | // Beyond time limit? |
| 1929 | 1929 | if (read_one_bit(limit)) return; |
| 1930 | 1930 | |
| 1931 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).cstr(), m_live_state.shift_reg, | |
| 1931 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).c_str(), m_live_state.shift_reg, | |
| 1932 | 1932 | get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); |
| 1933 | 1933 | |
| 1934 | 1934 | if (m_live_state.bit_count_total > 33792*16) |
| r245622 | r245623 | |
| 1950 | 1950 | m_live_state.state = SEARCH_IDAM; |
| 1951 | 1951 | } |
| 1952 | 1952 | else |
| 1953 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).cstr()); | |
| 1953 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); | |
| 1954 | 1954 | // Continue |
| 1955 | 1955 | break; |
| 1956 | 1956 | } |
| 1957 | 1957 | |
| 1958 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X\n", tag(),tts(m_live_state.time).cstr(), m_live_state.data_reg); | |
| 1958 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg); | |
| 1959 | 1959 | |
| 1960 | 1960 | // Check for ident field (fe, ff, fd, fc) |
| 1961 | 1961 | if ((m_live_state.data_reg & 0xfc) != 0xfc) |
| r245622 | r245623 | |
| 1976 | 1976 | case READ_ID_FIELDS_INTO_REGS: |
| 1977 | 1977 | if (TRACE_LIVE && m_last_live_state != READ_ID_FIELDS_INTO_REGS) |
| 1978 | 1978 | { |
| 1979 | logerror("%s: [%s] READ_ID_FIELDS_INTO_REGS\n", tag(),tts(m_live_state.time).cstr()); | |
| 1979 | logerror("%s: [%s] READ_ID_FIELDS_INTO_REGS\n", tag(),tts(m_live_state.time).c_str()); | |
| 1980 | 1980 | m_last_live_state = m_live_state.state; |
| 1981 | 1981 | } |
| 1982 | 1982 | |
| r245622 | r245623 | |
| 2017 | 2017 | case SEARCH_DAM: |
| 2018 | 2018 | if (TRACE_LIVE && m_last_live_state != SEARCH_DAM) |
| 2019 | 2019 | { |
| 2020 | logerror("%s: [%s] SEARCH_DAM\n", tag(),tts(m_live_state.time).cstr()); | |
| 2020 | logerror("%s: [%s] SEARCH_DAM\n", tag(),tts(m_live_state.time).c_str()); | |
| 2021 | 2021 | m_last_live_state = m_live_state.state; |
| 2022 | 2022 | } |
| 2023 | 2023 | |
| r245622 | r245623 | |
| 2026 | 2026 | if(read_one_bit(limit)) |
| 2027 | 2027 | return; |
| 2028 | 2028 | |
| 2029 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).cstr(), m_live_state.shift_reg, | |
| 2029 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).c_str(), m_live_state.shift_reg, | |
| 2030 | 2030 | get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); |
| 2031 | 2031 | |
| 2032 | 2032 | if (!fm_mode()) |
| r245622 | r245623 | |
| 2040 | 2040 | |
| 2041 | 2041 | if (m_live_state.bit_counter >= 28*16 && m_live_state.shift_reg == 0x4489) |
| 2042 | 2042 | { |
| 2043 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).cstr()); | |
| 2043 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); | |
| 2044 | 2044 | m_live_state.crc = 0x443b; |
| 2045 | 2045 | m_live_state.data_separator_phase = false; |
| 2046 | 2046 | m_live_state.bit_counter = 0; |
| r245622 | r245623 | |
| 2074 | 2074 | case READ_TWO_MORE_A1_DAM: { |
| 2075 | 2075 | if (TRACE_LIVE && m_last_live_state != READ_TWO_MORE_A1_DAM) |
| 2076 | 2076 | { |
| 2077 | logerror("%s: [%s] READ_TWO_MORE_A1_DAM\n", tag(),tts(m_live_state.time).cstr()); | |
| 2077 | logerror("%s: [%s] READ_TWO_MORE_A1_DAM\n", tag(),tts(m_live_state.time).c_str()); | |
| 2078 | 2078 | m_last_live_state = m_live_state.state; |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | if(read_one_bit(limit)) |
| 2082 | 2082 | return; |
| 2083 | 2083 | |
| 2084 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).cstr(), m_live_state.shift_reg, | |
| 2084 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(m_live_state.time).c_str(), m_live_state.shift_reg, | |
| 2085 | 2085 | get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); |
| 2086 | 2086 | |
| 2087 | 2087 | // Repeat until we have collected 16 bits |
| r245622 | r245623 | |
| 2098 | 2098 | return; |
| 2099 | 2099 | } |
| 2100 | 2100 | else |
| 2101 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).cstr()); | |
| 2101 | if (TRACE_LIVE) logerror("%s: [%s] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); | |
| 2102 | 2102 | // Continue |
| 2103 | 2103 | break; |
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X\n", tag(),tts(m_live_state.time).cstr(), m_live_state.data_reg); | |
| 2106 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg); | |
| 2107 | 2107 | |
| 2108 | 2108 | if ((m_live_state.data_reg & 0xff) == 0xf8) |
| 2109 | 2109 | { |
| r245622 | r245623 | |
| 2133 | 2133 | { |
| 2134 | 2134 | if (TRACE_LIVE && m_last_live_state != READ_SECTOR_DATA) |
| 2135 | 2135 | { |
| 2136 | logerror("%s: [%s] READ_SECTOR_DATA\n", tag(),tts(m_live_state.time).cstr()); | |
| 2136 | logerror("%s: [%s] READ_SECTOR_DATA\n", tag(),tts(m_live_state.time).c_str()); | |
| 2137 | 2137 | m_last_live_state = m_live_state.state; |
| 2138 | 2138 | } |
| 2139 | 2139 | |
| r245622 | r245623 | |
| 2158 | 2158 | // Repeat until we have collected 16 bits |
| 2159 | 2159 | if (m_live_state.bit_counter & 15) break; |
| 2160 | 2160 | |
| 2161 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X, CRC=%04x\n", tag(),tts(m_live_state.time).cstr(), m_live_state.data_reg, m_live_state.crc); | |
| 2161 | if (TRACE_LIVE) logerror("%s: [%s] Found data value %02X, CRC=%04x\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.crc); | |
| 2162 | 2162 | int slot = (m_live_state.bit_counter >> 4)-1; |
| 2163 | 2163 | |
| 2164 | 2164 | if (slot < calc_sector_size()) |
| r245622 | r245623 | |
| 2179 | 2179 | } |
| 2180 | 2180 | else |
| 2181 | 2181 | { |
| 2182 | if (TRACE_LIVE) logerror("%s: [%s] Sector read completed\n", tag(),tts(m_live_state.time).cstr()); | |
| 2182 | if (TRACE_LIVE) logerror("%s: [%s] Sector read completed\n", tag(),tts(m_live_state.time).c_str()); | |
| 2183 | 2183 | wait_for_realtime(IDLE); |
| 2184 | 2184 | } |
| 2185 | 2185 | return; |
| r245622 | r245623 | |
| 2191 | 2191 | case READ_SECTOR_DATA1: |
| 2192 | 2192 | if (TRACE_LIVE && m_last_live_state != READ_SECTOR_DATA1) |
| 2193 | 2193 | { |
| 2194 | logerror("%s: [%s] READ_SECTOR_DATA1\n", tag(),tts(m_live_state.time).cstr()); | |
| 2194 | logerror("%s: [%s] READ_SECTOR_DATA1\n", tag(),tts(m_live_state.time).c_str()); | |
| 2195 | 2195 | m_last_live_state = m_live_state.state; |
| 2196 | 2196 | } |
| 2197 | 2197 | |
| r245622 | r245623 | |
| 2237 | 2237 | // 5. Write the CRC bytes |
| 2238 | 2238 | |
| 2239 | 2239 | if (TRACE_LIVE) |
| 2240 | logerror("%s: [%s] WRITE_DAM_AND_SECTOR\n", tag(), tts(m_live_state.time).cstr()); | |
| 2240 | logerror("%s: [%s] WRITE_DAM_AND_SECTOR\n", tag(), tts(m_live_state.time).c_str()); | |
| 2241 | 2241 | |
| 2242 | 2242 | skip_on_track(m_gap2_size, WRITE_DAM_SYNC); |
| 2243 | 2243 | break; |
| r245622 | r245623 | |
| 2554 | 2554 | // The pause is implemented by doing dummy reads on the floppy |
| 2555 | 2555 | if (read_one_bit(limit)) |
| 2556 | 2556 | { |
| 2557 | if (TRACE_LIVE) logerror("%s: [%s] return; limit=%s\n", tag(), tts(m_live_state.time).cstr(), tts(limit).cstr()); | |
| 2557 | if (TRACE_LIVE) logerror("%s: [%s] return; limit=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str()); | |
| 2558 | 2558 | return; |
| 2559 | 2559 | } |
| 2560 | 2560 | |
| 2561 | 2561 | // Repeat until we have collected 16 bits |
| 2562 | 2562 | if ((m_live_state.bit_counter & 15)==0) |
| 2563 | 2563 | { |
| 2564 | if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s] Read byte %02x, repeat = %d\n", tag(), tts(m_live_state.time).cstr(), m_live_state.data_reg, m_live_state.repeat); | |
| 2564 | if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s] Read byte %02x, repeat = %d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.repeat); | |
| 2565 | 2565 | wait_for_realtime(READ_TRACK_NEXT_BYTE); |
| 2566 | 2566 | return; |
| 2567 | 2567 | } |
| r245622 | r245623 | |
| 2636 | 2636 | if(m_live_state.time > machine().time()) |
| 2637 | 2637 | { |
| 2638 | 2638 | // If so, we must roll back to the last checkpoint |
| 2639 | if (TRACE_SYNC) logerror("%s: [%s] Rolling back and replaying (%s)\n", tag(), ttsn().cstr(), tts(m_live_state.time).cstr()); | |
| 2639 | if (TRACE_SYNC) logerror("%s: [%s] Rolling back and replaying (%s)\n", tag(), ttsn().c_str(), tts(m_live_state.time).c_str()); | |
| 2640 | 2640 | rollback(); |
| 2641 | 2641 | // and replay until we reach the machine time |
| 2642 | 2642 | live_run_until(machine().time()); |
| r245622 | r245623 | |
| 2647 | 2647 | { |
| 2648 | 2648 | // We are behind machine time, so we will never get back to that |
| 2649 | 2649 | // time, thus we can commit that position |
| 2650 | if (TRACE_SYNC) logerror("%s: [%s] Committing (%s)\n", tag(), ttsn().cstr(), tts(m_live_state.time).cstr()); | |
| 2650 | if (TRACE_SYNC) logerror("%s: [%s] Committing (%s)\n", tag(), ttsn().c_str(), tts(m_live_state.time).c_str()); | |
| 2651 | 2651 | // Write on floppy image |
| 2652 | 2652 | m_pll.commit(m_floppy, m_live_state.time); |
| 2653 | 2653 | |
| r245622 | r245623 | |
| 2672 | 2672 | { |
| 2673 | 2673 | if (!m_live_state.time.is_never() && m_live_state.time > machine().time()) |
| 2674 | 2674 | { |
| 2675 | if (TRACE_LIVE) logerror("%s: Abort; rolling back and replaying (%s)\n", ttsn().cstr(), tts(m_live_state.time).cstr()); | |
| 2675 | if (TRACE_LIVE) logerror("%s: Abort; rolling back and replaying (%s)\n", ttsn().c_str(), tts(m_live_state.time).c_str()); | |
| 2676 | 2676 | rollback(); |
| 2677 | 2677 | live_run_until(machine().time()); |
| 2678 | 2678 | } |
| r245622 | r245623 | |
| 2735 | 2735 | { |
| 2736 | 2736 | m_live_state.next_state = state; |
| 2737 | 2737 | m_timer->adjust(m_live_state.time - machine().time()); |
| 2738 | if (TRACE_LIVE) logerror("%s: [%s] Waiting for real time [%s] to catch up\n", tag(), tts(m_live_state.time).cstr(), tts(machine().time()).cstr()); | |
| 2738 | if (TRACE_LIVE) logerror("%s: [%s] Waiting for real time [%s] to catch up\n", tag(), tts(m_live_state.time).c_str(), tts(machine().time()).c_str()); | |
| 2739 | 2739 | } |
| 2740 | 2740 | |
| 2741 | 2741 | /* |
| r245622 | r245623 | |
| 2858 | 2858 | m_live_state.bit_counter = 16; |
| 2859 | 2859 | m_live_state.last_data_bit = raw & 1; |
| 2860 | 2860 | m_live_state.shift_reg = m_live_state.shift_reg_save = raw; |
| 2861 | if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s] Write %02x (%04x)\n", tag(), tts(m_live_state.time).cstr(), byte, raw); | |
| 2861 | if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s] Write %02x (%04x)\n", tag(), tts(m_live_state.time).c_str(), byte, raw); | |
| 2862 | 2862 | checkpoint(); |
| 2863 | 2863 | } |
| 2864 | 2864 | |
| r245622 | r245623 | |
| 2872 | 2872 | m_live_state.bit_counter = 16; |
| 2873 | 2873 | m_live_state.shift_reg = m_live_state.shift_reg_save = raw; |
| 2874 | 2874 | m_live_state.last_data_bit = raw & 1; |
| 2875 | if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s] Write %02x (%04x)\n", tag(), tts(m_live_state.time).cstr(), get_data_from_encoding(raw), raw); | |
| 2875 | if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s] Write %02x (%04x)\n", tag(), tts(m_live_state.time).c_str(), get_data_from_encoding(raw), raw); | |
| 2876 | 2876 | checkpoint(); |
| 2877 | 2877 | } |
| 2878 | 2878 | |
| r245622 | r245623 | |
| 2960 | 2960 | { |
| 2961 | 2961 | if (m_executing) |
| 2962 | 2962 | { |
| 2963 | logerror("%s: [%s] Error - previous command %02x not completed; new command %02x ignored\n", tag(), ttsn().cstr(), current_command(), data); | |
| 2963 | logerror("%s: [%s] Error - previous command %02x not completed; new command %02x ignored\n", tag(), ttsn().c_str(), current_command(), data); | |
| 2964 | 2964 | } |
| 2965 | 2965 | else |
| 2966 | 2966 | { |
| r245622 | r245623 | |
| 3169 | 3169 | |
| 3170 | 3170 | void hdc9234_device::index_callback(int level) |
| 3171 | 3171 | { |
| 3172 | if (TRACE_LINES) logerror("%s: [%s] Index callback level=%d\n", tag(), ttsn().cstr(), level); | |
| 3172 | if (TRACE_LINES) logerror("%s: [%s] Index callback level=%d\n", tag(), ttsn().c_str(), level); | |
| 3173 | 3173 | |
| 3174 | 3174 | // Synchronize our position on the track |
| 3175 | 3175 | live_sync(); |
| r245622 | r245623 | |
| 3182 | 3182 | |
| 3183 | 3183 | if (m_event_line == INDEX_LINE && level == m_line_level && m_state_after_line != UNDEF) |
| 3184 | 3184 | { |
| 3185 | if (TRACE_LINES) logerror("%s: [%s] Index pulse level=%d triggers event\n", tag(), ttsn().cstr(), level); | |
| 3185 | if (TRACE_LINES) logerror("%s: [%s] Index pulse level=%d triggers event\n", tag(), ttsn().c_str(), level); | |
| 3186 | 3186 | m_substate = m_state_after_line; |
| 3187 | 3187 | m_state_after_line = UNDEF; |
| 3188 | 3188 | if (m_stopwrite) |
| r245622 | r245623 | |
| 3197 | 3197 | |
| 3198 | 3198 | void hdc9234_device::ready_callback(int level) |
| 3199 | 3199 | { |
| 3200 | if (TRACE_LINES) logerror("%s: [%s] Ready callback level=%d\n", tag(), ttsn().cstr(), level); | |
| 3200 | if (TRACE_LINES) logerror("%s: [%s] Ready callback level=%d\n", tag(), ttsn().c_str(), level); | |
| 3201 | 3201 | |
| 3202 | 3202 | // Set the interrupt status flag |
| 3203 | 3203 | set_bits(m_register_r[INT_STATUS], ST_RDYCHNG, true); |
| r245622 | r245623 | |
| 3222 | 3222 | |
| 3223 | 3223 | void hdc9234_device::seek_complete_callback(int level) |
| 3224 | 3224 | { |
| 3225 | if (TRACE_LINES) logerror("%s: [%s] Seek complete callback level=%d\n", tag(), ttsn().cstr(), level); | |
| 3225 | if (TRACE_LINES) logerror("%s: [%s] Seek complete callback level=%d\n", tag(), ttsn().c_str(), level); | |
| 3226 | 3226 | |
| 3227 | 3227 | // Synchronize our position on the track |
| 3228 | 3228 | live_sync(); |
| r245622 | r245623 | |
| 3323 | 3323 | { |
| 3324 | 3324 | if (state==ASSERT_LINE) |
| 3325 | 3325 | { |
| 3326 | if (TRACE_DMA) logerror("%s: [%s] DMA acknowledged\n", tag(), ttsn().cstr()); | |
| 3326 | if (TRACE_DMA) logerror("%s: [%s] DMA acknowledged\n", tag(), ttsn().c_str()); | |
| 3327 | 3327 | set_bits(m_register_r[INT_STATUS], ST_OVRUN, false); |
| 3328 | 3328 | } |
| 3329 | 3329 | } |
| r245622 | r245623 | |
|---|---|---|
| 162 | 162 | else |
| 163 | 163 | output.catprintf(").\n"); |
| 164 | 164 | |
| 165 | osd_printf_error("%s", output.cstr()); | |
| 165 | osd_printf_error("%s", output.c_str()); | |
| 166 | 166 | |
| 167 | 167 | osd_printf_warning("Setting value to default %s\n",m_default_size); |
| 168 | 168 | astring error; |
| r245622 | r245623 | |
|---|---|---|
| 676 | 676 | if(read_one_bit(limit)) |
| 677 | 677 | return; |
| 678 | 678 | #if 0 |
| 679 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 679 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 680 | 680 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 681 | 681 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 682 | 682 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 707 | 707 | if(read_one_bit(limit)) |
| 708 | 708 | return; |
| 709 | 709 | #if 0 |
| 710 | fprintf(stderr, "%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 710 | fprintf(stderr, "%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 711 | 711 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 712 | 712 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 713 | 713 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 747 | 747 | int slot = (cur_live.bit_counter >> 4)-1; |
| 748 | 748 | |
| 749 | 749 | if(0) |
| 750 | fprintf(stderr, "%s: slot=%d data=%02x crc=%04x\n", tts(cur_live.tm).cstr(), slot, cur_live.data_reg, cur_live.crc); | |
| 750 | fprintf(stderr, "%s: slot=%d data=%02x crc=%04x\n", tts(cur_live.tm).c_str(), slot, cur_live.data_reg, cur_live.crc); | |
| 751 | 751 | cur_live.idbuf[slot] = cur_live.data_reg; |
| 752 | 752 | if(slot == 5) { |
| 753 | 753 | live_delay(IDLE); |
| r245622 | r245623 | |
| 760 | 760 | if(read_one_bit(limit)) |
| 761 | 761 | return; |
| 762 | 762 | #if 0 |
| 763 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 763 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 764 | 764 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 765 | 765 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 766 | 766 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 806 | 806 | if(read_one_bit(limit)) |
| 807 | 807 | return; |
| 808 | 808 | #if 0 |
| 809 | fprintf(stderr, "%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 809 | fprintf(stderr, "%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 810 | 810 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 811 | 811 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 812 | 812 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 1117 | 1117 | break; |
| 1118 | 1118 | |
| 1119 | 1119 | default: |
| 1120 | logerror("%s: Unknown live state %d\n", tts(cur_live.tm).cstr(), cur_live.state); | |
| 1120 | logerror("%s: Unknown live state %d\n", tts(cur_live.tm).c_str(), cur_live.state); | |
| 1121 | 1121 | return; |
| 1122 | 1122 | } |
| 1123 | 1123 | } |
| r245622 | r245623 | |
| 1711 | 1711 | return; |
| 1712 | 1712 | |
| 1713 | 1713 | default: |
| 1714 | logerror("%s: read sector unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 1714 | logerror("%s: read sector unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 1715 | 1715 | return; |
| 1716 | 1716 | } |
| 1717 | 1717 | } |
| r245622 | r245623 | |
| 1837 | 1837 | return; |
| 1838 | 1838 | |
| 1839 | 1839 | default: |
| 1840 | logerror("%s: write sector unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 1840 | logerror("%s: write sector unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 1841 | 1841 | return; |
| 1842 | 1842 | } |
| 1843 | 1843 | } |
| r245622 | r245623 | |
| 2007 | 2007 | return; |
| 2008 | 2008 | |
| 2009 | 2009 | default: |
| 2010 | logerror("%s: read track unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 2010 | logerror("%s: read track unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 2011 | 2011 | return; |
| 2012 | 2012 | } |
| 2013 | 2013 | } |
| r245622 | r245623 | |
| 2080 | 2080 | return; |
| 2081 | 2081 | |
| 2082 | 2082 | default: |
| 2083 | logerror("%s: format track unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 2083 | logerror("%s: format track unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 2084 | 2084 | return; |
| 2085 | 2085 | } |
| 2086 | 2086 | } |
| r245622 | r245623 | |
| 2159 | 2159 | return; |
| 2160 | 2160 | |
| 2161 | 2161 | default: |
| 2162 | logerror("%s: read id unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 2162 | logerror("%s: read id unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 2163 | 2163 | return; |
| 2164 | 2164 | } |
| 2165 | 2165 | } |
| r245622 | r245623 | |
| 2287 | 2287 | break; |
| 2288 | 2288 | |
| 2289 | 2289 | default: |
| 2290 | logerror("%s: Index pulse on unknown sub-state %d\n", ttsn().cstr(), fi.sub_state); | |
| 2290 | logerror("%s: Index pulse on unknown sub-state %d\n", ttsn().c_str(), fi.sub_state); | |
| 2291 | 2291 | break; |
| 2292 | 2292 | } |
| 2293 | 2293 | |
| r245622 | r245623 | |
| 2335 | 2335 | break; |
| 2336 | 2336 | |
| 2337 | 2337 | default: |
| 2338 | logerror("%s: general_continue on unknown main-state %d\n", ttsn().cstr(), fi.main_state); | |
| 2338 | logerror("%s: general_continue on unknown main-state %d\n", ttsn().c_str(), fi.main_state); | |
| 2339 | 2339 | break; |
| 2340 | 2340 | } |
| 2341 | 2341 | } |
| r245622 | r245623 | |
|---|---|---|
| 383 | 383 | return; |
| 384 | 384 | |
| 385 | 385 | default: |
| 386 | logerror("%s: seek unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 386 | logerror("%s: seek unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 387 | 387 | return; |
| 388 | 388 | } |
| 389 | 389 | } |
| r245622 | r245623 | |
| 505 | 505 | break; |
| 506 | 506 | |
| 507 | 507 | default: |
| 508 | logerror("%s: read sector unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 508 | logerror("%s: read sector unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | 511 | } |
| r245622 | r245623 | |
| 584 | 584 | return; |
| 585 | 585 | |
| 586 | 586 | default: |
| 587 | logerror("%s: read track unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 587 | logerror("%s: read track unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 588 | 588 | return; |
| 589 | 589 | } |
| 590 | 590 | } |
| r245622 | r245623 | |
| 659 | 659 | return; |
| 660 | 660 | |
| 661 | 661 | default: |
| 662 | logerror("%s: read id unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 662 | logerror("%s: read id unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 663 | 663 | return; |
| 664 | 664 | } |
| 665 | 665 | } |
| r245622 | r245623 | |
| 763 | 763 | sprintf(buf, "%02x", format_last_byte); |
| 764 | 764 | format_description_string += buf; |
| 765 | 765 | } |
| 766 | if (TRACE_DESC) logerror("%s: track description %s\n", tag(), format_description_string.cstr()); | |
| 766 | if (TRACE_DESC) logerror("%s: track description %s\n", tag(), format_description_string.c_str()); | |
| 767 | 767 | command_end(); |
| 768 | 768 | return; |
| 769 | 769 | |
| 770 | 770 | default: |
| 771 | logerror("%s: write track unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 771 | logerror("%s: write track unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 772 | 772 | return; |
| 773 | 773 | } |
| 774 | 774 | } |
| r245622 | r245623 | |
| 867 | 867 | break; |
| 868 | 868 | |
| 869 | 869 | default: |
| 870 | logerror("%s: write sector unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 870 | logerror("%s: write sector unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 871 | 871 | return; |
| 872 | 872 | } |
| 873 | 873 | } |
| r245622 | r245623 | |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | if(command & 0x03) { |
| 901 | logerror("%s: unhandled interrupt generation (%02x)\n", ttsn().cstr(), command); | |
| 901 | logerror("%s: unhandled interrupt generation (%02x)\n", ttsn().c_str(), command); | |
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | |
| r245622 | r245623 | |
| 932 | 932 | write_sector_continue(); |
| 933 | 933 | break; |
| 934 | 934 | default: |
| 935 | logerror("%s: general_continue on unknown main-state %d\n", ttsn().cstr(), main_state); | |
| 935 | logerror("%s: general_continue on unknown main-state %d\n", ttsn().c_str(), main_state); | |
| 936 | 936 | break; |
| 937 | 937 | } |
| 938 | 938 | } |
| r245622 | r245623 | |
| 963 | 963 | |
| 964 | 964 | default: |
| 965 | 965 | if(cur_live.tm.is_never()) |
| 966 | logerror("%s: do_generic on unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 966 | logerror("%s: do_generic on unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 967 | 967 | break; |
| 968 | 968 | } |
| 969 | 969 | } |
| r245622 | r245623 | |
| 1285 | 1285 | break; |
| 1286 | 1286 | |
| 1287 | 1287 | default: |
| 1288 | logerror("%s: Index pulse on unknown sub-state %d\n", ttsn().cstr(), sub_state); | |
| 1288 | logerror("%s: Index pulse on unknown sub-state %d\n", ttsn().c_str(), sub_state); | |
| 1289 | 1289 | break; |
| 1290 | 1290 | } |
| 1291 | 1291 | |
| r245622 | r245623 | |
| 1360 | 1360 | { |
| 1361 | 1361 | if(!cur_live.tm.is_never()) { |
| 1362 | 1362 | if(cur_live.tm > machine().time()) { |
| 1363 | if (TRACE_SYNC) logerror("%s: Rolling back and replaying (%s)\n", ttsn().cstr(), tts(cur_live.tm).cstr()); | |
| 1363 | if (TRACE_SYNC) logerror("%s: Rolling back and replaying (%s)\n", ttsn().c_str(), tts(cur_live.tm).c_str()); | |
| 1364 | 1364 | rollback(); |
| 1365 | 1365 | live_run(machine().time()); |
| 1366 | 1366 | pll_commit(floppy, cur_live.tm); |
| 1367 | 1367 | } else { |
| 1368 | if (TRACE_SYNC) logerror("%s: Committing (%s)\n", ttsn().cstr(), tts(cur_live.tm).cstr()); | |
| 1368 | if (TRACE_SYNC) logerror("%s: Committing (%s)\n", ttsn().c_str(), tts(cur_live.tm).c_str()); | |
| 1369 | 1369 | pll_commit(floppy, cur_live.tm); |
| 1370 | 1370 | if(cur_live.next_state != -1) { |
| 1371 | 1371 | cur_live.state = cur_live.next_state; |
| r245622 | r245623 | |
| 1485 | 1485 | } |
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | // fprintf(stderr, "%s: live_run(%s)\n", ttsn().cstr(), tts(limit).cstr()); | |
| 1488 | // fprintf(stderr, "%s: live_run(%s)\n", ttsn().c_str(), tts(limit).c_str()); | |
| 1489 | 1489 | |
| 1490 | 1490 | for(;;) { |
| 1491 | 1491 | switch(cur_live.state) { |
| r245622 | r245623 | |
| 1493 | 1493 | if(read_one_bit(limit)) |
| 1494 | 1494 | return; |
| 1495 | 1495 | |
| 1496 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 1496 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 1497 | 1497 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 1498 | 1498 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 1499 | 1499 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 1526 | 1526 | if(read_one_bit(limit)) |
| 1527 | 1527 | return; |
| 1528 | 1528 | |
| 1529 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 1529 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 1530 | 1530 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 1531 | 1531 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 1532 | 1532 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 1568 | 1568 | if(cur_live.bit_counter & 15) |
| 1569 | 1569 | break; |
| 1570 | 1570 | int slot = (cur_live.bit_counter >> 4)-1; |
| 1571 | // fprintf(stderr, "%s: slot[%d] = %02x crc = %04x\n", tts(cur_live.tm).cstr(), slot, cur_live.data_reg, cur_live.crc); | |
| 1571 | // fprintf(stderr, "%s: slot[%d] = %02x crc = %04x\n", tts(cur_live.tm).c_str(), slot, cur_live.data_reg, cur_live.crc); | |
| 1572 | 1572 | cur_live.idbuf[slot] = cur_live.data_reg; |
| 1573 | 1573 | if(slot == 5) { |
| 1574 | 1574 | live_delay(IDLE); |
| r245622 | r245623 | |
| 1609 | 1609 | if(read_one_bit(limit)) |
| 1610 | 1610 | return; |
| 1611 | 1611 | |
| 1612 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 1612 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 1613 | 1613 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 1614 | 1614 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 1615 | 1615 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 1656 | 1656 | if(read_one_bit(limit)) |
| 1657 | 1657 | return; |
| 1658 | 1658 | |
| 1659 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, | |
| 1659 | if (TRACE_SHIFT) logerror("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm).c_str(), cur_live.shift_reg, | |
| 1660 | 1660 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 1661 | 1661 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 1662 | 1662 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| r245622 | r245623 | |
| 1954 | 1954 | break; |
| 1955 | 1955 | |
| 1956 | 1956 | default: |
| 1957 | logerror("%s: Unknown sub state %d in WRITE_BYTE_DONE\n", tts(cur_live.tm).cstr(), sub_state); | |
| 1957 | logerror("%s: Unknown sub state %d in WRITE_BYTE_DONE\n", tts(cur_live.tm).c_str(), sub_state); | |
| 1958 | 1958 | live_abort(); |
| 1959 | 1959 | return; |
| 1960 | 1960 | } |
| r245622 | r245623 | |
| 2017 | 2017 | break; |
| 2018 | 2018 | |
| 2019 | 2019 | default: |
| 2020 | logerror("%s: Unknown live state %d\n", tts(cur_live.tm).cstr(), cur_live.state); | |
| 2020 | logerror("%s: Unknown live state %d\n", tts(cur_live.tm).c_str(), cur_live.state); | |
| 2021 | 2021 | return; |
| 2022 | 2022 | } |
| 2023 | 2023 | } |
| r245622 | r245623 | |
| 2186 | 2186 | |
| 2187 | 2187 | /* if (TRACE_TRANSITION) |
| 2188 | 2188 | if(!when.is_never()) |
| 2189 | logerror("transition_time=%s\n", tts(when).cstr()); | |
| 2189 | logerror("transition_time=%s\n", tts(when).c_str()); | |
| 2190 | 2190 | */ |
| 2191 | 2191 | for(;;) { |
| 2192 | 2192 | // if (TRACE_TRANSITION) logerror("slot=%2d, counter=%03x\n", slot, counter); |
| 2193 | 2193 | attotime etime = ctime+delays[slot]; |
| 2194 | // if (TRACE_TRANSITION) logerror("etime=%s\n", tts(etime).cstr()); | |
| 2194 | // if (TRACE_TRANSITION) logerror("etime=%s\n", tts(etime).c_str()); | |
| 2195 | 2195 | if(etime > limit) |
| 2196 | 2196 | return -1; |
| 2197 | 2197 | if(transition_time == 0xffff && !when.is_never() && etime >= when) |
| r245622 | r245623 | |
|---|---|---|
| 285 | 285 | va_end(arg); |
| 286 | 286 | |
| 287 | 287 | // pop it in the UI |
| 288 | machine_manager::instance()->machine()->ui().popup_time(temp.len() / 40 + 2, "%s", temp.cstr()); | |
| 288 | machine_manager::instance()->machine()->ui().popup_time(temp.len() / 40 + 2, "%s", temp.c_str()); | |
| 289 | 289 | |
| 290 | 290 | /* |
| 291 | 291 | // also write to error.log |
| 292 | logerror("popmessage: %s\n", temp.cstr()); | |
| 292 | logerror("popmessage: %s\n", temp.c_str()); | |
| 293 | 293 | |
| 294 | 294 | #ifdef MAME_DEBUG |
| 295 | 295 | // and to command-line in a DEBUG build |
| 296 | osd_printf_info("popmessage: %s\n", temp.cstr()); | |
| 296 | osd_printf_info("popmessage: %s\n", temp.c_str()); | |
| 297 | 297 | #endif |
| 298 | 298 | */ |
| 299 | 299 | } |
| r245622 | r245623 | |
|---|---|---|
| 129 | 129 | break; |
| 130 | 130 | if (!curdevice) |
| 131 | 131 | throw emu_fatalerror("Could not find %s when looking up path for device %s\n", |
| 132 | part.cstr(), orig_tag); | |
| 132 | part.c_str(), orig_tag); | |
| 133 | 133 | owner = curdevice; |
| 134 | 134 | tag = next+1; |
| 135 | 135 | } |
| r245622 | r245623 | |
|---|---|---|
| 1836 | 1836 | { |
| 1837 | 1837 | // if we can't find it, add it to our map |
| 1838 | 1838 | astring fulltag; |
| 1839 | if (manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).cstr()) == NULL) | |
| 1839 | if (manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).c_str()) == NULL) | |
| 1840 | 1840 | { |
| 1841 | VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.cstr(), entry->m_byteend + 1 - entry->m_bytestart)); | |
| 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 | 1843 | manager().m_sharelist.append(fulltag, *share); |
| 1844 | 1844 | } |
| r245622 | r245623 | |
| 1880 | 1880 | entry->m_devbase.subtag(fulltag, entry->m_region); |
| 1881 | 1881 | |
| 1882 | 1882 | // set the memory address |
| 1883 | entry->m_memory = machine().root_device().memregion(fulltag.cstr())->base() + entry->m_rgnoffs; | |
| 1883 | entry->m_memory = machine().root_device().memregion(fulltag.c_str())->base() + entry->m_rgnoffs; | |
| 1884 | 1884 | } |
| 1885 | 1885 | } |
| 1886 | 1886 | |
| r245622 | r245623 | |
| 2154 | 2154 | if (entry->m_memory == NULL && entry->m_share != NULL) |
| 2155 | 2155 | { |
| 2156 | 2156 | astring fulltag; |
| 2157 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).cstr()); | |
| 2157 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).c_str()); | |
| 2158 | 2158 | if (share != NULL && share->ptr() != NULL) |
| 2159 | 2159 | { |
| 2160 | 2160 | entry->m_memory = share->ptr(); |
| r245622 | r245623 | |
| 2177 | 2177 | if (entry->m_memory != NULL && entry->m_share != NULL) |
| 2178 | 2178 | { |
| 2179 | 2179 | astring fulltag; |
| 2180 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).cstr()); | |
| 2180 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).c_str()); | |
| 2181 | 2181 | if (share != NULL && share->ptr() == NULL) |
| 2182 | 2182 | { |
| 2183 | 2183 | share->set_ptr(entry->m_memory); |
| r245622 | r245623 | |
| 2613 | 2613 | if (entry->m_share != NULL) |
| 2614 | 2614 | { |
| 2615 | 2615 | astring fulltag; |
| 2616 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).cstr()); | |
| 2616 | memory_share *share = manager().m_sharelist.find(entry->m_devbase.subtag(fulltag, entry->m_share).c_str()); | |
| 2617 | 2617 | if (share != NULL && share->ptr() == NULL) |
| 2618 | 2618 | return true; |
| 2619 | 2619 | } |
| r245622 | r245623 | |
| 4022 | 4022 | if (entrynum < 0 || entrynum >= m_entry.count()) |
| 4023 | 4023 | throw emu_fatalerror("memory_bank::set_entry called with out-of-range entry %d", entrynum); |
| 4024 | 4024 | if (m_entry[entrynum].m_raw == NULL) |
| 4025 | throw emu_fatalerror("memory_bank::set_entry called for bank '%s' with invalid bank entry %d", m_tag.cstr(), entrynum); | |
| 4025 | throw emu_fatalerror("memory_bank::set_entry called for bank '%s' with invalid bank entry %d", m_tag.c_str(), entrynum); | |
| 4026 | 4026 | |
| 4027 | 4027 | // set both raw and decrypted values |
| 4028 | 4028 | m_curentry = entrynum; |
| r245622 | r245623 | |
|---|---|---|
| 1328 | 1328 | |
| 1329 | 1329 | // log an error |
| 1330 | 1330 | if (!m_alphafile[0]) |
| 1331 | osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr()); | |
| 1331 | osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].c_str()); | |
| 1332 | 1332 | else |
| 1333 | osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr()); | |
| 1333 | osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].c_str(), m_alphafile[0].c_str()); | |
| 1334 | 1334 | } |
| 1335 | 1335 | } |
| 1336 | 1336 |
| r245622 | r245623 | |
|---|---|---|
| 441 | 441 | |
| 442 | 442 | bool is_chd_error = (is_chd && chderr != CHDERR_FILE_NOT_FOUND); |
| 443 | 443 | if (is_chd_error) |
| 444 | romdata->errorstring.catprintf("%s CHD ERROR: %s\n", name.cstr(), chd_file::error_string(chderr)); | |
| 444 | romdata->errorstring.catprintf("%s CHD ERROR: %s\n", name.c_str(), chd_file::error_string(chderr)); | |
| 445 | 445 | |
| 446 | 446 | /* optional files are okay */ |
| 447 | 447 | if (ROM_ISOPTIONAL(romp)) |
| 448 | 448 | { |
| 449 | 449 | if (!is_chd_error) |
| 450 | romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", name.cstr(), tried_file_names.cstr()); | |
| 450 | romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); | |
| 451 | 451 | romdata->warnings++; |
| 452 | 452 | } |
| 453 | 453 | |
| r245622 | r245623 | |
| 455 | 455 | else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP)) |
| 456 | 456 | { |
| 457 | 457 | if (!is_chd_error) |
| 458 | romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.cstr(), tried_file_names.cstr()); | |
| 458 | romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.c_str(), tried_file_names.c_str()); | |
| 459 | 459 | romdata->knownbad++; |
| 460 | 460 | } |
| 461 | 461 | |
| r245622 | r245623 | |
| 463 | 463 | else |
| 464 | 464 | { |
| 465 | 465 | if (!is_chd_error) |
| 466 | romdata->errorstring.catprintf("%s NOT FOUND%s\n", name.cstr(), tried_file_names.cstr()); | |
| 466 | romdata->errorstring.catprintf("%s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); | |
| 467 | 467 | romdata->errors++; |
| 468 | 468 | } |
| 469 | 469 | } |
| r245622 | r245623 | |
| 560 | 560 | if (romdata->errors != 0) |
| 561 | 561 | { |
| 562 | 562 | /* create the error message and exit fatally */ |
| 563 | osd_printf_error("%s", romdata->errorstring.cstr()); | |
| 563 | osd_printf_error("%s", romdata->errorstring.c_str()); | |
| 564 | 564 | fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "Required files are missing, the %s cannot be run.",emulator_info::get_gamenoun()); |
| 565 | 565 | } |
| 566 | 566 | |
| r245622 | r245623 | |
| 570 | 570 | romdata->errorstring.cat("WARNING: the "); |
| 571 | 571 | romdata->errorstring.cat(emulator_info::get_gamenoun()); |
| 572 | 572 | romdata->errorstring.cat(" might not run correctly."); |
| 573 | osd_printf_warning("%s\n", romdata->errorstring.cstr()); | |
| 573 | osd_printf_warning("%s\n", romdata->errorstring.c_str()); | |
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
| r245622 | r245623 | |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // prepare locations where we have to load from: list/parentname & list/clonename |
| 680 | astring swlist(tag1.cstr()); | |
| 680 | astring swlist(tag1.c_str()); | |
| 681 | 681 | tag2.cpy(swlist.cat(tag4)); |
| 682 | 682 | if (has_parent) |
| 683 | 683 | { |
| r245622 | r245623 | |
| 695 | 695 | if (!is_list) |
| 696 | 696 | { |
| 697 | 697 | tried_file_names += " " + tag1; |
| 698 | filerr = common_process_file(romdata->machine().options(), tag1.cstr(), has_crc, crc, romp, &romdata->file); | |
| 698 | filerr = common_process_file(romdata->machine().options(), tag1.c_str(), has_crc, crc, romp, &romdata->file); | |
| 699 | 699 | } |
| 700 | 700 | else |
| 701 | 701 | { |
| 702 | 702 | // try to load from list/setname |
| 703 | if ((romdata->file == NULL) && (tag2.cstr() != NULL)) | |
| 703 | if ((romdata->file == NULL) && (tag2.c_str() != NULL)) | |
| 704 | 704 | { |
| 705 | 705 | tried_file_names += " " + tag2; |
| 706 | filerr = common_process_file(romdata->machine().options(), tag2.cstr(), has_crc, crc, romp, &romdata->file); | |
| 706 | filerr = common_process_file(romdata->machine().options(), tag2.c_str(), has_crc, crc, romp, &romdata->file); | |
| 707 | 707 | } |
| 708 | 708 | // try to load from list/parentname |
| 709 | if ((romdata->file == NULL) && has_parent && (tag3.cstr() != NULL)) | |
| 709 | if ((romdata->file == NULL) && has_parent && (tag3.c_str() != NULL)) | |
| 710 | 710 | { |
| 711 | 711 | tried_file_names += " " + tag3; |
| 712 | filerr = common_process_file(romdata->machine().options(), tag3.cstr(), has_crc, crc, romp, &romdata->file); | |
| 712 | filerr = common_process_file(romdata->machine().options(), tag3.c_str(), has_crc, crc, romp, &romdata->file); | |
| 713 | 713 | } |
| 714 | 714 | // try to load from setname |
| 715 | if ((romdata->file == NULL) && (tag4.cstr() != NULL)) | |
| 715 | if ((romdata->file == NULL) && (tag4.c_str() != NULL)) | |
| 716 | 716 | { |
| 717 | 717 | tried_file_names += " " + tag4; |
| 718 | filerr = common_process_file(romdata->machine().options(), tag4.cstr(), has_crc, crc, romp, &romdata->file); | |
| 718 | filerr = common_process_file(romdata->machine().options(), tag4.c_str(), has_crc, crc, romp, &romdata->file); | |
| 719 | 719 | } |
| 720 | 720 | // try to load from parentname |
| 721 | if ((romdata->file == NULL) && has_parent && (tag5.cstr() != NULL)) | |
| 721 | if ((romdata->file == NULL) && has_parent && (tag5.c_str() != NULL)) | |
| 722 | 722 | { |
| 723 | 723 | tried_file_names += " " + tag5; |
| 724 | filerr = common_process_file(romdata->machine().options(), tag5.cstr(), has_crc, crc, romp, &romdata->file); | |
| 724 | filerr = common_process_file(romdata->machine().options(), tag5.c_str(), has_crc, crc, romp, &romdata->file); | |
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | } |
| r245622 | r245623 | |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | // prepare locations where we have to load from: list/parentname (if any) & list/clonename |
| 1081 | astring swlist(tag1.cstr()); | |
| 1081 | astring swlist(tag1.c_str()); | |
| 1082 | 1082 | tag2.cpy(swlist.cat(tag4)); |
| 1083 | 1083 | if (has_parent) |
| 1084 | 1084 | { |
| r245622 | r245623 | |
| 1098 | 1098 | else |
| 1099 | 1099 | { |
| 1100 | 1100 | // try to load from list/setname |
| 1101 | if ((filerr != FILERR_NONE) && (tag2.cstr() != NULL)) | |
| 1102 | filerr = common_process_file(options, tag2.cstr(), ".chd", romp, image_file); | |
| 1101 | if ((filerr != FILERR_NONE) && (tag2.c_str() != NULL)) | |
| 1102 | filerr = common_process_file(options, tag2.c_str(), ".chd", romp, image_file); | |
| 1103 | 1103 | // try to load from list/parentname (if any) |
| 1104 | if ((filerr != FILERR_NONE) && has_parent && (tag3.cstr() != NULL)) | |
| 1105 | filerr = common_process_file(options, tag3.cstr(), ".chd", romp, image_file); | |
| 1104 | if ((filerr != FILERR_NONE) && has_parent && (tag3.c_str() != NULL)) | |
| 1105 | filerr = common_process_file(options, tag3.c_str(), ".chd", romp, image_file); | |
| 1106 | 1106 | // try to load from setname |
| 1107 | if ((filerr != FILERR_NONE) && (tag4.cstr() != NULL)) | |
| 1108 | filerr = common_process_file(options, tag4.cstr(), ".chd", romp, image_file); | |
| 1107 | if ((filerr != FILERR_NONE) && (tag4.c_str() != NULL)) | |
| 1108 | filerr = common_process_file(options, tag4.c_str(), ".chd", romp, image_file); | |
| 1109 | 1109 | // try to load from parentname (if any) |
| 1110 | if ((filerr != FILERR_NONE) && has_parent && (tag5.cstr() != NULL)) | |
| 1111 | filerr = common_process_file(options, tag5.cstr(), ".chd", romp, image_file); | |
| 1110 | if ((filerr != FILERR_NONE) && has_parent && (tag5.c_str() != NULL)) | |
| 1111 | filerr = common_process_file(options, tag5.c_str(), ".chd", romp, image_file); | |
| 1112 | 1112 | // only for CHD we also try to load from list/ |
| 1113 | if ((filerr != FILERR_NONE) && (tag1.cstr() != NULL)) | |
| 1113 | if ((filerr != FILERR_NONE) && (tag1.c_str() != NULL)) | |
| 1114 | 1114 | { |
| 1115 | 1115 | tag1.del(tag1.len() - 1, 1); // remove the PATH_SEPARATOR |
| 1116 | filerr = common_process_file(options, tag1.cstr(), ".chd", romp, image_file); | |
| 1116 | filerr = common_process_file(options, tag1.c_str(), ".chd", romp, image_file); | |
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| 1119 | 1119 | } |
| r245622 | r245623 | |
| 1182 | 1182 | astring fname(ROM_GETNAME(romp), ".dif"); |
| 1183 | 1183 | |
| 1184 | 1184 | /* try to open the diff */ |
| 1185 | LOG(("Opening differencing image file: %s\n", fname.cstr())); | |
| 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 | 1187 | file_error filerr = diff_file.open(fname); |
| 1188 | 1188 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 1190 | 1190 | astring fullpath(diff_file.fullpath()); |
| 1191 | 1191 | diff_file.close(); |
| 1192 | 1192 | |
| 1193 | LOG(("Opening differencing image file: %s\n", fullpath.cstr())); | |
| 1193 | LOG(("Opening differencing image file: %s\n", fullpath.c_str())); | |
| 1194 | 1194 | return diff_chd.open(fullpath, true, &source); |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | /* didn't work; try creating it instead */ |
| 1198 | LOG(("Creating differencing image: %s\n", fname.cstr())); | |
| 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 | 1200 | filerr = diff_file.open(fname); |
| 1201 | 1201 | if (filerr == FILERR_NONE) |
| r245622 | r245623 | |
| 1204 | 1204 | diff_file.close(); |
| 1205 | 1205 | |
| 1206 | 1206 | /* create the CHD */ |
| 1207 | LOG(("Creating differencing image file: %s\n", fullpath.cstr())); | |
| 1207 | LOG(("Creating differencing image file: %s\n", fullpath.c_str())); | |
| 1208 | 1208 | chd_codec_type compression[4] = { CHD_CODEC_NONE }; |
| 1209 | 1209 | chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source); |
| 1210 | 1210 | if (err != CHDERR_NONE) |
| r245622 | r245623 | |
| 1239 | 1239 | astring filename(ROM_GETNAME(romp), ".chd"); |
| 1240 | 1240 | |
| 1241 | 1241 | /* first open the source drive */ |
| 1242 | LOG(("Opening disk image: %s\n", filename.cstr())); | |
| 1242 | LOG(("Opening disk image: %s\n", filename.c_str())); | |
| 1243 | 1243 | err = chd_error(open_disk_image(romdata->machine().options(), &romdata->machine().system(), romp, chd->orig_chd(), locationtag)); |
| 1244 | 1244 | if (err != CHDERR_NONE) |
| 1245 | 1245 | { |
| r245622 | r245623 | |
| 1255 | 1255 | /* verify the hash */ |
| 1256 | 1256 | if (hashes != acthashes) |
| 1257 | 1257 | { |
| 1258 | romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", filename.cstr()); | |
| 1258 | romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", filename.c_str()); | |
| 1259 | 1259 | dump_wrong_and_correct_checksums(romdata, hashes, acthashes); |
| 1260 | 1260 | romdata->warnings++; |
| 1261 | 1261 | } |
| 1262 | 1262 | else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) |
| 1263 | 1263 | { |
| 1264 | romdata->errorstring.catprintf("%s CHD NEEDS REDUMP\n", filename.cstr()); | |
| 1264 | romdata->errorstring.catprintf("%s CHD NEEDS REDUMP\n", filename.c_str()); | |
| 1265 | 1265 | romdata->knownbad++; |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| r245622 | r245623 | |
| 1272 | 1272 | err = open_disk_diff(romdata->machine().options(), romp, chd->orig_chd(), chd->diff_chd()); |
| 1273 | 1273 | if (err != CHDERR_NONE) |
| 1274 | 1274 | { |
| 1275 | romdata->errorstring.catprintf("%s DIFF CHD ERROR: %s\n", filename.cstr(), chd_file::error_string(err)); | |
| 1275 | romdata->errorstring.catprintf("%s DIFF CHD ERROR: %s\n", filename.c_str(), chd_file::error_string(err)); | |
| 1276 | 1276 | romdata->errors++; |
| 1277 | 1277 | global_free(chd); |
| 1278 | 1278 | continue; |
| r245622 | r245623 | |
| 1385 | 1385 | UINT32 regionlength = ROMREGION_GETLENGTH(region); |
| 1386 | 1386 | |
| 1387 | 1387 | device.subtag(regiontag, ROMREGION_GETTAG(region)); |
| 1388 | LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength)); | |
| 1388 | LOG(("Processing region \"%s\" (length=%X)\n", regiontag.c_str(), regionlength)); | |
| 1389 | 1389 | |
| 1390 | 1390 | /* the first entry must be a region */ |
| 1391 | 1391 | assert(ROMENTRY_ISREGION(region)); |
| r245622 | r245623 | |
| 1439 | 1439 | for (region = start_region; region != NULL; region = rom_next_region(region)) |
| 1440 | 1440 | { |
| 1441 | 1441 | device.subtag(regiontag, ROMREGION_GETTAG(region)); |
| 1442 | region_post_process(romdata, regiontag.cstr(), ROMREGION_ISINVERTED(region)); | |
| 1442 | region_post_process(romdata, regiontag.c_str(), ROMREGION_ISINVERTED(region)); | |
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | /* display the results and exit */ |
| r245622 | r245623 | |
| 1463 | 1463 | UINT32 regionlength = ROMREGION_GETLENGTH(region); |
| 1464 | 1464 | |
| 1465 | 1465 | rom_region_name(regiontag, *device, region); |
| 1466 | LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength)); | |
| 1466 | LOG(("Processing region \"%s\" (length=%X)\n", regiontag.c_str(), regionlength)); | |
| 1467 | 1467 | |
| 1468 | 1468 | /* the first entry must be a region */ |
| 1469 | 1469 | assert(ROMENTRY_ISREGION(region)); |
| r245622 | r245623 | |
| 1548 | 1548 | } else { |
| 1549 | 1549 | specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios"); |
| 1550 | 1550 | if (strlen(specbios) == 0) { |
| 1551 | specbios = device->default_bios_tag().cstr(); | |
| 1551 | specbios = device->default_bios_tag().c_str(); | |
| 1552 | 1552 | } |
| 1553 | 1553 | } |
| 1554 | 1554 | determine_bios_rom(romdata, device, specbios); |
| r245622 | r245623 | |
|---|---|---|
| 179 | 179 | |
| 180 | 180 | // error if we are equal |
| 181 | 181 | if (entry->m_name == totalname) |
| 182 | fatalerror("Duplicate save state registration entry (%s)\n", totalname.cstr()); | |
| 182 | fatalerror("Duplicate save state registration entry (%s)\n", totalname.c_str()); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // insert us into the list |
| r245622 | r245623 | |
| 333 | 333 | for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) |
| 334 | 334 | { |
| 335 | 335 | // add the entry name to the CRC |
| 336 | crc = crc32(crc, (UINT8 *)entry->m_name.cstr(), entry->m_name.len()); | |
| 336 | crc = crc32(crc, (UINT8 *)entry->m_name.c_str(), entry->m_name.len()); | |
| 337 | 337 | |
| 338 | 338 | // add the type and size to the CRC |
| 339 | 339 | UINT32 temp[2]; |
| r245622 | r245623 | |
| 353 | 353 | void save_manager::dump_registry() const |
| 354 | 354 | { |
| 355 | 355 | for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) |
| 356 | LOG(("%s: %d x %d\n", entry->m_name.cstr(), entry->m_typesize, entry->m_typecount)); | |
| 356 | LOG(("%s: %d x %d\n", entry->m_name.c_str(), entry->m_typesize, entry->m_typecount)); | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 |
| r245622 | r245623 | |
|---|---|---|
| 757 | 757 | { |
| 758 | 758 | device_t *device = machine().device(machine().config().m_perfect_cpu_quantum); |
| 759 | 759 | if (device == NULL) |
| 760 | fatalerror("Device '%s' specified for perfect interleave is not present!\n", machine().config().m_perfect_cpu_quantum.cstr()); | |
| 760 | fatalerror("Device '%s' specified for perfect interleave is not present!\n", machine().config().m_perfect_cpu_quantum.c_str()); | |
| 761 | 761 | |
| 762 | 762 | device_execute_interface *exec; |
| 763 | 763 | if (!device->interface(exec)) |
| 764 | fatalerror("Device '%s' specified for perfect interleave is not an executing device!\n", machine().config().m_perfect_cpu_quantum.cstr()); | |
| 764 | fatalerror("Device '%s' specified for perfect interleave is not an executing device!\n", machine().config().m_perfect_cpu_quantum.c_str()); | |
| 765 | 765 | |
| 766 | 766 | min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum); |
| 767 | 767 | } |
| r245622 | r245623 | |
|---|---|---|
| 1058 | 1058 | if (m_screen_overlay_bitmap.valid()) |
| 1059 | 1059 | m_container->set_overlay(&m_screen_overlay_bitmap); |
| 1060 | 1060 | else |
| 1061 | osd_printf_warning("Unable to load effect PNG file '%s'\n", fullname.cstr()); | |
| 1061 | osd_printf_warning("Unable to load effect PNG file '%s'\n", fullname.c_str()); | |
| 1062 | 1062 | } |
| r245622 | r245623 | |
|---|---|---|
| 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.cstr()))) | |
| 503 | if (valid.already_checked(astring("softlist/", m_list_name.c_str()))) | |
| 504 | 504 | return; |
| 505 | 505 | |
| 506 | 506 | // do device validation only in case of validate command |
| r245622 | r245623 | |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | // check for duplicate descriptions |
| 568 | if (descriptions.add(astring(swinfo->longname()).makelower().cstr(), swinfo, false) == TMERR_DUPLICATE) | |
| 568 | if (descriptions.add(astring(swinfo->longname()).makelower().c_str(), swinfo, false) == TMERR_DUPLICATE) | |
| 569 | 569 | osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo->longname(), swinfo->shortname()); |
| 570 | 570 | |
| 571 | 571 | bool is_clone = false; |
| r245622 | r245623 | |
|---|---|---|
| 63 | 63 | double min, max; |
| 64 | 64 | |
| 65 | 65 | astring fulltag; |
| 66 | m_port = m_device->machine().root_device().ioport(m_device->siblingtag(fulltag, (const char *)this->custom_data()).cstr()); | |
| 66 | m_port = m_device->machine().root_device().ioport(m_device->siblingtag(fulltag, (const char *)this->custom_data()).c_str()); | |
| 67 | 67 | if (m_port == NULL) |
| 68 | 68 | fatalerror("DISCRETE_ADJUSTMENT - NODE_%d has invalid tag\n", this->index()); |
| 69 | 69 |
| r245622 | r245623 | |
|---|---|---|
| 1786 | 1786 | |
| 1787 | 1787 | // look for an extension entry |
| 1788 | 1788 | astring tag_ext(tag(), "_ext"); |
| 1789 | share = memshare(tag_ext.cstr()); | |
| 1789 | share = memshare(tag_ext.c_str()); | |
| 1790 | 1790 | if (share != NULL) |
| 1791 | 1791 | m_extmem.set(*share, m_bytes_per_entry); |
| 1792 | 1792 | } |
| r245622 | r245623 | |
|---|---|---|
| 118 | 118 | machine().ui().popup_time(5, "Barcode length invalid!"); |
| 119 | 119 | else |
| 120 | 120 | { |
| 121 | current_device()->write_code(tmp_file.cstr(), tmp_file.len()); | |
| 121 | current_device()->write_code(tmp_file.c_str(), tmp_file.len()); | |
| 122 | 122 | // if sending was successful, reset char buffer |
| 123 | 123 | if (m_barcode_buffer[0] != '\0') |
| 124 | 124 | memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer)); |
| r245622 | r245623 | |
|---|---|---|
| 29 | 29 | device_iterator deviter(machine.config().root_device()); |
| 30 | 30 | for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) |
| 31 | 31 | { |
| 32 | if (strcmp(device->tag(), tmp_tag.cstr()) == 0) | |
| 32 | if (strcmp(device->tag(), tmp_tag.c_str()) == 0) | |
| 33 | 33 | { |
| 34 | 34 | m_mounted = true; |
| 35 | 35 | break; |
| r245622 | r245623 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | if (bios) |
| 179 | string.catprintf("* BIOS settings:\n %d options [default: %s]\n", bios, bios_str.cstr()); | |
| 179 | string.catprintf("* BIOS settings:\n %d options [default: %s]\n", bios, bios_str.c_str()); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0; |
| r245622 | r245623 | |
|---|---|---|
| 414 | 414 | item = itemarray[curitem]; |
| 415 | 415 | assert(nameformat[item->type] != NULL); |
| 416 | 416 | |
| 417 | if (item->owner_name && strcmp(item->owner_name, prev_owner.cstr()) != 0) | |
| 417 | if (item->owner_name && strcmp(item->owner_name, prev_owner.c_str()) != 0) | |
| 418 | 418 | { |
| 419 | 419 | if (first_entry) |
| 420 | 420 | first_entry = false; |
| r245622 | r245623 | |
| 568 | 568 | flags |= MENU_FLAG_RIGHT_ARROW; |
| 569 | 569 | |
| 570 | 570 | /* add the menu item */ |
| 571 | if (strcmp(field->device().tag(), prev_owner.cstr()) != 0) | |
| 571 | if (strcmp(field->device().tag(), prev_owner.c_str()) != 0) | |
| 572 | 572 | { |
| 573 | 573 | if (first_entry) |
| 574 | 574 | first_entry = false; |
| r245622 | r245623 | |
| 872 | 872 | analog_item_data *data; |
| 873 | 873 | UINT32 flags = 0; |
| 874 | 874 | astring name; |
| 875 | if (strcmp(field->device().tag(), prev_owner.cstr()) != 0) | |
| 875 | if (strcmp(field->device().tag(), prev_owner.c_str()) != 0) | |
| 876 | 876 | { |
| 877 | 877 | if (first_entry) |
| 878 | 878 | first_entry = false; |
| r245622 | r245623 | |
| 895 | 895 | { |
| 896 | 896 | default: |
| 897 | 897 | case ANALOG_ITEM_KEYSPEED: |
| 898 | text.printf("%s Digital Speed", name.cstr()); | |
| 898 | text.printf("%s Digital Speed", name.c_str()); | |
| 899 | 899 | subtext.printf("%d", settings.delta); |
| 900 | 900 | data->min = 0; |
| 901 | 901 | data->max = 255; |
| r245622 | r245623 | |
| 904 | 904 | break; |
| 905 | 905 | |
| 906 | 906 | case ANALOG_ITEM_CENTERSPEED: |
| 907 | text.printf("%s Autocenter Speed", name.cstr()); | |
| 907 | text.printf("%s Autocenter Speed", name.c_str()); | |
| 908 | 908 | subtext.printf("%d", settings.centerdelta); |
| 909 | 909 | data->min = 0; |
| 910 | 910 | data->max = 255; |
| r245622 | r245623 | |
| 913 | 913 | break; |
| 914 | 914 | |
| 915 | 915 | case ANALOG_ITEM_REVERSE: |
| 916 | text.printf("%s Reverse", name.cstr()); | |
| 916 | text.printf("%s Reverse", name.c_str()); | |
| 917 | 917 | subtext.cpy(settings.reverse ? "On" : "Off"); |
| 918 | 918 | data->min = 0; |
| 919 | 919 | data->max = 1; |
| r245622 | r245623 | |
| 922 | 922 | break; |
| 923 | 923 | |
| 924 | 924 | case ANALOG_ITEM_SENSITIVITY: |
| 925 | text.printf("%s Sensitivity", name.cstr()); | |
| 925 | text.printf("%s Sensitivity", name.c_str()); | |
| 926 | 926 | subtext.printf("%d", settings.sensitivity); |
| 927 | 927 | data->min = 1; |
| 928 | 928 | data->max = 255; |
| r245622 | r245623 | |
|---|---|---|
| 56 | 56 | item_append("Input (general)", NULL, 0, (void *)INPUT_GROUPS); |
| 57 | 57 | |
| 58 | 58 | menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun()); |
| 59 | item_append(menu_text.cstr(), NULL, 0, (void *)INPUT_SPECIFIC); | |
| 59 | item_append(menu_text.c_str(), NULL, 0, (void *)INPUT_SPECIFIC); | |
| 60 | 60 | |
| 61 | 61 | /* add optional input-related menus */ |
| 62 | 62 | if (machine().ioport().has_analog()) |
| r245622 | r245623 | |
| 66 | 66 | if (machine().ioport().has_configs()) |
| 67 | 67 | { |
| 68 | 68 | menu_text.printf("%s Configuration",emulator_info::get_capstartgamenoun()); |
| 69 | item_append(menu_text.cstr(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG); | |
| 69 | item_append(menu_text.c_str(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /* add bookkeeping menu */ |
| r245622 | r245623 | |
| 74 | 74 | |
| 75 | 75 | /* add game info menu */ |
| 76 | 76 | menu_text.printf("%s Information",emulator_info::get_capstartgamenoun()); |
| 77 | item_append(menu_text.cstr(), NULL, 0, (void *)GAME_INFO); | |
| 77 | item_append(menu_text.c_str(), NULL, 0, (void *)GAME_INFO); | |
| 78 | 78 | |
| 79 | 79 | image_interface_iterator imgiter(machine().root_device()); |
| 80 | 80 | if (imgiter.first() != NULL) |
| r245622 | r245623 | |
| 135 | 135 | |
| 136 | 136 | /* add reset and exit menus */ |
| 137 | 137 | menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun()); |
| 138 | item_append(menu_text.cstr(), NULL, 0, (void *)SELECT_GAME); | |
| 138 | item_append(menu_text.c_str(), NULL, 0, (void *)SELECT_GAME); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | ui_menu_main::~ui_menu_main() |
| r245622 | r245623 | |
|---|---|---|
| 185 | 185 | |
| 186 | 186 | // add an item to return |
| 187 | 187 | if (parent == NULL) |
| 188 | item_append(backtext.cstr(), NULL, 0, NULL); | |
| 188 | item_append(backtext.c_str(), NULL, 0, NULL); | |
| 189 | 189 | else if (parent->is_special_main_menu()) |
| 190 | 190 | item_append("Exit", NULL, 0, NULL); |
| 191 | 191 | else |
| r245622 | r245623 | |
|---|---|---|
| 128 | 128 | astring value; |
| 129 | 129 | astring temp; |
| 130 | 130 | value.printf("%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1); |
| 131 | machine().options().set_value(dev->owner()->tag()+1, value.cstr(), OPTION_PRIORITY_CMDLINE, error); | |
| 131 | machine().options().set_value(dev->owner()->tag()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error); | |
| 132 | 132 | assert(!error); |
| 133 | 133 | } |
| 134 | 134 | reset(UI_MENU_RESET_REMEMBER_REF); |
| r245622 | r245623 | |
|---|---|---|
| 330 | 330 | tempbuf[1].printf("%s, %-.100s", driver->year, driver->manufacturer); |
| 331 | 331 | |
| 332 | 332 | // next line source path |
| 333 | tempbuf[2].printf("Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).cstr()); | |
| 333 | tempbuf[2].printf("Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).c_str()); | |
| 334 | 334 | |
| 335 | 335 | // next line is overall driver status |
| 336 | 336 | if (driver->flags & GAME_NOT_WORKING) |
| r245622 | r245623 | |
|---|---|---|
| 87 | 87 | menu_part_name.cat(" (").cat(swpart->feature("part_id")).cat(")"); |
| 88 | 88 | entry->type = T_ENTRY; |
| 89 | 89 | entry->part = swpart; |
| 90 | item_append(m_info->shortname(), menu_part_name.cstr(), 0, entry); | |
| 90 | item_append(m_info->shortname(), menu_part_name.c_str(), 0, entry); | |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
| r245622 | r245623 | |
|---|---|---|
| 360 | 360 | { |
| 361 | 361 | astring warning; |
| 362 | 362 | warning.cpy("This driver requires images to be loaded in the following device(s): ").cat(messagebox_text.substr(0, messagebox_text.len() - 2)); |
| 363 | ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.cstr()); | |
| 363 | ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.c_str()); | |
| 364 | 364 | } |
| 365 | 365 | break; |
| 366 | 366 | } |
| r245622 | r245623 | |
| 1134 | 1134 | { |
| 1135 | 1135 | // print description, manufacturer, and CPU: |
| 1136 | 1136 | astring tempstr; |
| 1137 | string.printf("%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(tempstr, machine().system().source_file).cstr()); | |
| 1137 | string.printf("%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(tempstr, machine().system().source_file).c_str()); | |
| 1138 | 1138 | |
| 1139 | 1139 | // loop over all CPUs |
| 1140 | 1140 | execute_interface_iterator execiter(machine().root_device()); |
| r245622 | r245623 | |
| 1761 | 1761 | "Are you sure you want to quit?\n\n" |
| 1762 | 1762 | "Press ''%s'' to quit,\n" |
| 1763 | 1763 | "Press ''%s'' to return to emulation.", |
| 1764 | ui_select_text.cstr(), | |
| 1765 | ui_cancel_text.cstr()); | |
| 1764 | ui_select_text.c_str(), | |
| 1765 | ui_cancel_text.c_str()); | |
| 1766 | 1766 | |
| 1767 | 1767 | machine.ui().draw_text_box(container, quit_message, JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); |
| 1768 | 1768 | machine.pause(); |
| r245622 | r245623 | |
|---|---|---|
| 203 | 203 | if (m_errors > 0) |
| 204 | 204 | { |
| 205 | 205 | m_error_text.replace("\n", "\n "); |
| 206 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.cstr()); | |
| 206 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str()); | |
| 207 | 207 | } |
| 208 | 208 | if (m_warnings > 0) |
| 209 | 209 | { |
| 210 | 210 | m_warning_text.replace("\n", "\n "); |
| 211 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.cstr()); | |
| 211 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str()); | |
| 212 | 212 | } |
| 213 | 213 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); |
| 214 | 214 | } |
| r245622 | r245623 | |
| 299 | 299 | if (m_errors > start_errors || m_warnings > start_warnings) |
| 300 | 300 | { |
| 301 | 301 | astring tempstr; |
| 302 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).cstr(), m_errors - start_errors, m_warnings - start_warnings); | |
| 302 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings); | |
| 303 | 303 | if (m_errors > start_errors) |
| 304 | 304 | { |
| 305 | 305 | m_error_text.replace("\n", "\n "); |
| 306 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.cstr()); | |
| 306 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str()); | |
| 307 | 307 | } |
| 308 | 308 | if (m_warnings > start_warnings) |
| 309 | 309 | { |
| 310 | 310 | m_warning_text.replace("\n", "\n "); |
| 311 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.cstr()); | |
| 311 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str()); | |
| 312 | 312 | } |
| 313 | 313 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); |
| 314 | 314 | } |
| r245622 | r245623 | |
| 523 | 523 | if (m_names_map.add(m_current_driver->name, m_current_driver, false) == TMERR_DUPLICATE) |
| 524 | 524 | { |
| 525 | 525 | const game_driver *match = m_names_map.find(m_current_driver->name); |
| 526 | osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).cstr(), match->name); | |
| 526 | osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).c_str(), match->name); | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | // check for duplicate descriptions |
| 530 | 530 | if (m_descriptions_map.add(m_current_driver->description, m_current_driver, false) == TMERR_DUPLICATE) |
| 531 | 531 | { |
| 532 | 532 | const game_driver *match = m_descriptions_map.find(m_current_driver->description); |
| 533 | osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).cstr(), match->name); | |
| 533 | osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).c_str(), match->name); | |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | // determine if we are a clone |
| r245622 | r245623 | |
| 645 | 645 | // attempt to add it to the map, reporting duplicates as errors |
| 646 | 646 | current_length = ROMREGION_GETLENGTH(romp); |
| 647 | 647 | if (m_region_map.add(fulltag, current_length, false) == TMERR_DUPLICATE) |
| 648 | osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag.cstr()); | |
| 648 | osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag.c_str()); | |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // If this is a system bios, make sure it is using the next available bios number |
| r245622 | r245623 | |
| 883 | 883 | |
| 884 | 884 | // report any errors during construction |
| 885 | 885 | if (errorbuf) |
| 886 | osd_printf_error("I/O port error during construction:\n%s\n", errorbuf.cstr()); | |
| 886 | osd_printf_error("I/O port error during construction:\n%s\n", errorbuf.c_str()); | |
| 887 | 887 | |
| 888 | 888 | // do a first pass over ports to add their names and find duplicates |
| 889 | 889 | for (ioport_port *port = portlist.first(); port != NULL; port = port->next()) |
| r245622 | r245623 | |
| 1010 | 1010 | { |
| 1011 | 1011 | astring temptag("_"); |
| 1012 | 1012 | temptag.cat(option->name()); |
| 1013 | device_t *dev = const_cast<machine_config &>(*m_current_config).device_add(&m_current_config->root_device(), temptag.cstr(), option->devtype(), 0); | |
| 1013 | device_t *dev = const_cast<machine_config &>(*m_current_config).device_add(&m_current_config->root_device(), temptag.c_str(), option->devtype(), 0); | |
| 1014 | 1014 | |
| 1015 | 1015 | // notify this device and all its subdevices that they are now configured |
| 1016 | 1016 | device_iterator subiter(*dev); |
| r245622 | r245623 | |
| 1023 | 1023 | osd_printf_error("Device '%s' is slot cart device but does not have short name defined\n",dev->name()); |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | const_cast<machine_config &>(*m_current_config).device_remove(&m_current_config->root_device(), temptag.cstr()); | |
| 1026 | const_cast<machine_config &>(*m_current_config).device_remove(&m_current_config->root_device(), temptag.c_str()); | |
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 |
| r245622 | r245623 | |
|---|---|---|
| 1158 | 1158 | // copy the device name to an astring |
| 1159 | 1159 | astring snapdevname; |
| 1160 | 1160 | snapdevname.cpysubstr(snapstr, pos + 3, end - pos - 3); |
| 1161 | //printf("check template: %s\n", snapdevname.cstr()); | |
| 1161 | //printf("check template: %s\n", snapdevname.c_str()); | |
| 1162 | 1162 | |
| 1163 | 1163 | // verify that there is such a device for this system |
| 1164 | 1164 | image_interface_iterator iter(machine().root_device()); |
| r245622 | r245623 | |
| 1166 | 1166 | { |
| 1167 | 1167 | // get the device name |
| 1168 | 1168 | astring tempdevname(image->brief_instance_name()); |
| 1169 | //printf("check device: %s\n", tempdevname.cstr()); | |
| 1169 | //printf("check device: %s\n", tempdevname.c_str()); | |
| 1170 | 1170 | |
| 1171 | 1171 | if (snapdevname.cmp(tempdevname) == 0) |
| 1172 | 1172 | { |
| r245622 | r245623 | |
| 1181 | 1181 | // setup snapname and remove the %d_ |
| 1182 | 1182 | snapstr.replace(0, snapdevname, filename); |
| 1183 | 1183 | snapstr.del(pos, 3); |
| 1184 | //printf("check image: %s\n", filename.cstr()); | |
| 1184 | //printf("check image: %s\n", filename.c_str()); | |
| 1185 | 1185 | |
| 1186 | 1186 | name_found = 1; |
| 1187 | 1187 | } |
| r245622 | r245623 | |
| 1215 | 1215 | for (int seq = 0; ; seq++) |
| 1216 | 1216 | { |
| 1217 | 1217 | // build up the filename |
| 1218 | fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d", seq).cstr()); | |
| 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 | 1221 | file_error filerr = file.open(fname); |
| r245622 | r245623 | |
|---|---|---|
| 455 | 455 | mg_send_header(conn, "Cache-Control", "no-cache, no-store, must-revalidate"); |
| 456 | 456 | mg_send_header(conn, "Pragma", "no-cache"); |
| 457 | 457 | mg_send_header(conn, "Expires", "0"); |
| 458 | mg_send_file(conn, fullpath.cstr(), NULL); | |
| 458 | mg_send_file(conn, fullpath.c_str(), NULL); | |
| 459 | 459 | return MG_MORE; // It is important to return MG_MORE after mg_send_file! |
| 460 | 460 | } |
| 461 | 461 | return 0; |
| r245622 | r245623 | |
|---|---|---|
| 371 | 371 | timer_set(attotime::zero, TIMER_ID_AUTOPLAY); |
| 372 | 372 | |
| 373 | 373 | // indicate the name of the file we opened |
| 374 | popmessage("Opened %s\n", m_filename.cstr()); | |
| 374 | popmessage("Opened %s\n", m_filename.c_str()); | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 |
| r245622 | r245623 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | // C string conversion operators and helpers |
| 76 | 76 | operator const char *() const { return m_text; } |
| 77 | const char *cstr() const { return m_text; } | |
| 77 | const char *c_str() const { return m_text; } | |
| 78 | 78 | |
| 79 | 79 | // buffer management |
| 80 | 80 | astring &reset() { return cpy(""); } |
| r245622 | r245623 | |
| 86 | 86 | // copy helpers |
| 87 | 87 | astring &cpy(const char *src, int count); |
| 88 | 88 | astring &cpysubstr(const astring &src, int start, int count = -1); |
| 89 | astring &cpy(const astring &src) { return cpy(src.cstr(), src.len()); } | |
| 89 | astring &cpy(const astring &src) { return cpy(src.c_str(), src.len()); } | |
| 90 | 90 | astring &cpy(const char *src) { return cpy(src, strlen(src)); } |
| 91 | 91 | |
| 92 | 92 | // insertion helpers |
| 93 | 93 | astring &ins(int insbefore, const char *src, int count); |
| 94 | 94 | astring &inssubstr(int insbefore, const astring &src, int start, int count = -1); |
| 95 | astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.cstr(), src.len()); } | |
| 95 | astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.c_str(), src.len()); } | |
| 96 | 96 | astring &ins(int insbefore, const char *src) { return ins(insbefore, src, strlen(src)); } |
| 97 | 97 | |
| 98 | 98 | // concatenation helpers (== insert at end) |
| 99 | 99 | astring &cat(const char *src, int count) { return ins(-1, src, count); } |
| 100 | 100 | astring &catsubstr(const astring &src, int start, int count = -1) { return inssubstr(-1, src, start, count); } |
| 101 | astring &cat(const astring &src) { return ins(-1, src.cstr(), src.len()); } | |
| 101 | astring &cat(const astring &src) { return ins(-1, src.c_str(), src.len()); } | |
| 102 | 102 | astring &cat(const char *src) { return ins(-1, src, strlen(src)); } |
| 103 | 103 | astring &cat(char ch) { return ins(-1, &ch, 1); } |
| 104 | 104 | |
| r245622 | r245623 | |
| 117 | 117 | // comparison helpers |
| 118 | 118 | int cmp(const char *str2, int count) const; |
| 119 | 119 | int cmpsubstr(const astring &str2, int start, int count = -1) const; |
| 120 | int cmp(const astring &str2) const { return cmp(str2.cstr(), str2.len()); } | |
| 120 | int cmp(const astring &str2) const { return cmp(str2.c_str(), str2.len()); } | |
| 121 | 121 | int cmp(const char *str2) const { return cmp(str2, strlen(str2)); } |
| 122 | 122 | |
| 123 | 123 | // case-insensitive comparison helpers |
| 124 | 124 | int icmp(const char *str2, int count) const; |
| 125 | 125 | int icmpsubstr(const astring &str2, int start, int count = -1) const; |
| 126 | int icmp(const astring &str2) const { return icmp(str2.cstr(), str2.len()); } | |
| 126 | int icmp(const astring &str2) const { return icmp(str2.c_str(), str2.len()); } | |
| 127 | 127 | int icmp(const char *str2) const { return icmp(str2, strlen(str2)); } |
| 128 | 128 | |
| 129 | 129 | // character searching helpers |
| r245622 | r245623 | |
|---|---|---|
| 164 | 164 | file_error filerr = core_fopen(file->track_info.track[i].fname, OPEN_FLAG_READ, &file->fhandle[i]); |
| 165 | 165 | if (filerr != FILERR_NONE) |
| 166 | 166 | { |
| 167 | fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.cstr()); | |
| 167 | fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.c_str()); | |
| 168 | 168 | cdrom_close(file); |
| 169 | 169 | return NULL; |
| 170 | 170 | } |
| r245622 | r245623 | |
|---|---|---|
| 352 | 352 | chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen); |
| 353 | 353 | chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags); |
| 354 | 354 | chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM); |
| 355 | chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.cstr(), input.len() + 1, flags); } | |
| 355 | chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.len() + 1, flags); } | |
| 356 | 356 | chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input, input.count(), flags); } |
| 357 | 357 | chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex); |
| 358 | 358 | chd_error clone_all_metadata(chd_file &source); |
| r245622 | r245623 | |
|---|---|---|
| 695 | 695 | #if 0 |
| 696 | 696 | for(i=0; i < numtracks; i++) |
| 697 | 697 | { |
| 698 | printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.cstr(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes); | |
| 698 | printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.c_str(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes); | |
| 699 | 699 | } |
| 700 | 700 | #endif |
| 701 | 701 | |
| r245622 | r245623 | |
| 771 | 771 | wavlen = parse_wav_sample(lastfname, &wavoffs); |
| 772 | 772 | if (!wavlen) |
| 773 | 773 | { |
| 774 | printf("ERROR: couldn't read [%s] or not a valid .WAV\n", lastfname.cstr()); | |
| 774 | printf("ERROR: couldn't read [%s] or not a valid .WAV\n", lastfname.c_str()); | |
| 775 | 775 | return CHDERR_INVALID_DATA; |
| 776 | 776 | } |
| 777 | 777 | } |
| r245622 | r245623 | |
| 812 | 812 | |
| 813 | 813 | outinfo.track[trknum].fname.cpy(lastfname); // default filename to the last one |
| 814 | 814 | |
| 815 | // printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.cstr(), outinfo.track[trknum].offset); | |
| 815 | // printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.c_str(), outinfo.track[trknum].offset); | |
| 816 | 816 | |
| 817 | 817 | cdrom_convert_type_string_to_track_info(token, &outtoc.tracks[trknum]); |
| 818 | 818 | if (outtoc.tracks[trknum].datasize == 0) |
| r245622 | r245623 | |
| 927 | 927 | /* if we have the same filename as the last track, do it that way */ |
| 928 | 928 | if (trknum != 0 && outinfo.track[trknum].fname == outinfo.track[trknum-1].fname) |
| 929 | 929 | { |
| 930 | tlen = get_file_size(outinfo.track[trknum].fname.cstr()); | |
| 930 | tlen = get_file_size(outinfo.track[trknum].fname.c_str()); | |
| 931 | 931 | if (tlen == 0) |
| 932 | 932 | { |
| 933 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr()); | |
| 933 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); | |
| 934 | 934 | return CHDERR_FILE_NOT_FOUND; |
| 935 | 935 | } |
| 936 | 936 | outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); |
| r245622 | r245623 | |
| 941 | 941 | tlen = get_file_size(outinfo.track[trknum].fname); |
| 942 | 942 | if (tlen == 0) |
| 943 | 943 | { |
| 944 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr()); | |
| 944 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); | |
| 945 | 945 | return CHDERR_FILE_NOT_FOUND; |
| 946 | 946 | } |
| 947 | 947 | tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); |
| r245622 | r245623 | |
| 976 | 976 | tlen = get_file_size(outinfo.track[trknum].fname); |
| 977 | 977 | if (tlen == 0) |
| 978 | 978 | { |
| 979 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.cstr()); | |
| 979 | printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.c_str()); | |
| 980 | 980 | return CHDERR_FILE_NOT_FOUND; |
| 981 | 981 | } |
| 982 | 982 | tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); |
| r245622 | r245623 | |
|---|---|---|
| 364 | 364 | // can only have one command |
| 365 | 365 | if (m_command) |
| 366 | 366 | { |
| 367 | error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.cstr(), curarg); | |
| 367 | error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg); | |
| 368 | 368 | return false; |
| 369 | 369 | } |
| 370 | 370 | m_command = curentry->name(); |
| r245622 | r245623 | |
| 635 | 635 | { |
| 636 | 636 | astring tempstr; |
| 637 | 637 | tempstr.printf("%d", value); |
| 638 | return set_value(name, tempstr.cstr(), priority, error_string); | |
| 638 | return set_value(name, tempstr.c_str(), priority, error_string); | |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | bool core_options::set_value(const char *name, float value, int priority, astring &error_string) |
| 642 | 642 | { |
| 643 | 643 | astring tempstr; |
| 644 | 644 | tempstr.printf("%f", value); |
| 645 | return set_value(name, tempstr.cstr(), priority, error_string); | |
| 645 | return set_value(name, tempstr.c_str(), priority, error_string); | |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | |
| r245622 | r245623 | |
| 752 | 752 | case OPTION_BOOLEAN: |
| 753 | 753 | if (sscanf(data, "%d", &ival) != 1 || ival < 0 || ival > 1) |
| 754 | 754 | { |
| 755 | error_string.catprintf("Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); | |
| 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; |
| 757 | 757 | } |
| 758 | 758 | break; |
| r245622 | r245623 | |
| 761 | 761 | case OPTION_INTEGER: |
| 762 | 762 | if (sscanf(data, "%d", &ival) != 1) |
| 763 | 763 | { |
| 764 | error_string.catprintf("Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); | |
| 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; |
| 766 | 766 | } |
| 767 | 767 | if (curentry.has_range() && (ival < atoi(curentry.minimum()) || ival > atoi(curentry.maximum()))) |
| 768 | 768 | { |
| 769 | error_string.catprintf("Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.cstr(), curentry.minimum(), curentry.maximum(), curentry.value()); | |
| 769 | error_string.catprintf("Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); | |
| 770 | 770 | return false; |
| 771 | 771 | } |
| 772 | 772 | break; |
| r245622 | r245623 | |
| 775 | 775 | case OPTION_FLOAT: |
| 776 | 776 | if (sscanf(data, "%f", &fval) != 1) |
| 777 | 777 | { |
| 778 | error_string.catprintf("Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); | |
| 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; |
| 780 | 780 | } |
| 781 | 781 | if (curentry.has_range() && (fval < atof(curentry.minimum()) || fval > atof(curentry.maximum()))) |
| 782 | 782 | { |
| 783 | error_string.catprintf("Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.cstr(), curentry.minimum(), curentry.maximum(), curentry.value()); | |
| 783 | error_string.catprintf("Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); | |
| 784 | 784 | return false; |
| 785 | 785 | } |
| 786 | 786 | break; |
| r245622 | r245623 | |
|---|---|---|
| 75 | 75 | public: |
| 76 | 76 | // getters |
| 77 | 77 | entry *next() const { return m_next; } |
| 78 | const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && m_name[index]) ? m_name[index].cstr() : NULL; } | |
| 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 | 80 | const char *value() const { return m_data; } |
| 81 | 81 | const char *default_value() const { return m_defdata; } |
| r245622 | r245623 | |
|---|---|---|
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | |
| 240 | sc45helperlog("%s", tempstring.cstr()); | |
| 240 | sc45helperlog("%s", tempstring.c_str()); | |
| 241 | 241 | |
| 242 | 242 | sc45helperlog("\n"); |
| 243 | 243 | |
| r245622 | r245623 | |
| 316 | 316 | |
| 317 | 317 | if (ignoreports[i][j] > 0) |
| 318 | 318 | { |
| 319 | printf(" PORT_BIT( 0x%04x, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_%d_%d ) PORT_NAME(\"%s\")\n", 1 << j, i,j/*ignoreports[i][j]*/, sc4inputs[i][j].name.cstr()); | |
| 319 | printf(" PORT_BIT( 0x%04x, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_%d_%d ) PORT_NAME(\"%s\")\n", 1 << j, i,j/*ignoreports[i][j]*/, sc4inputs[i][j].name.c_str()); | |
| 320 | 320 | buttons_used++; |
| 321 | 321 | } |
| 322 | 322 | else if (ignoreports[i][j] == -3) |
| 323 | 323 | { |
| 324 | printf(" // 0x%04x - \"%s\" // standard input (motherboard)\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 324 | printf(" // 0x%04x - \"%s\" // standard input (motherboard)\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 325 | 325 | } |
| 326 | 326 | else if (ignoreports[i][j] == -2) |
| 327 | 327 | { |
| 328 | printf(" // 0x%04x - \"%s\" // standard input (expected here)\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 328 | printf(" // 0x%04x - \"%s\" // standard input (expected here)\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 329 | 329 | } |
| 330 | 330 | else if (ignoreports[i][j] == -1) |
| 331 | 331 | { |
| 332 | printf(" // 0x%04x - \"%s\" // unexpected here\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 332 | printf(" // 0x%04x - \"%s\" // unexpected here\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 333 | 333 | } |
| 334 | 334 | else if (ignoreports[i][j] == -4) |
| 335 | 335 | { |
| 336 | printf(" // 0x%04x - \"%s\" // known extended input, mapping not understood\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 336 | printf(" // 0x%04x - \"%s\" // known extended input, mapping not understood\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 337 | 337 | } |
| 338 | 338 | else if (ignoreports[i][j] == -5) |
| 339 | 339 | { |
| 340 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 340 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'top up'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 341 | 341 | } |
| 342 | 342 | else if (ignoreports[i][j] == -6) |
| 343 | 343 | { |
| 344 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'hopper low'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 344 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'hopper low'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 345 | 345 | } |
| 346 | 346 | else if (ignoreports[i][j] == -7) |
| 347 | 347 | { |
| 348 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'hopper fit'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 348 | printf(" // 0x%04x - \"%s\" // known extended input, usually 'hopper fit'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 349 | 349 | } |
| 350 | 350 | else if (ignoreports[i][j] == -8) |
| 351 | 351 | { |
| 352 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 352 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'top up'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 353 | 353 | } |
| 354 | 354 | else if (ignoreports[i][j] == -9) |
| 355 | 355 | { |
| 356 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop hi'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 356 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop hi'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 357 | 357 | } |
| 358 | 358 | else if (ignoreports[i][j] == -10) |
| 359 | 359 | { |
| 360 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop top'\n", 1 << j, sc4inputs[i][j].name.cstr()); | |
| 360 | printf(" // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop top'\n", 1 << j, sc4inputs[i][j].name.c_str()); | |
| 361 | 361 | } |
| 362 | 362 | buttons_used++; |
| 363 | 363 | } |
| r245622 | r245623 | |
| 390 | 390 | { |
| 391 | 391 | for (int x = 0; x < 16; x++) |
| 392 | 392 | { |
| 393 | if (!strcmp(teststring.cstr(), lamps[y][x].lampname_alt.cstr())) | |
| 393 | if (!strcmp(teststring.c_str(), lamps[y][x].lampname_alt.c_str())) | |
| 394 | 394 | { |
| 395 | 395 | lamps[y][x].clickport = clickport; |
| 396 | 396 | lamps[y][x].clickmask = clickmask; |
| r245622 | r245623 | |
| 507 | 507 | fatalerror("duplicate lamp?\n"); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | //sc45helperlog("%s", tempstring.cstr()); | |
| 510 | //sc45helperlog("%s", tempstring.c_str()); | |
| 511 | 511 | |
| 512 | 512 | //sc45helperlog("\n"); |
| 513 | 513 | |
| r245622 | r245623 | |
| 521 | 521 | //sc45helperlog("---ROW %02d---\n", y); |
| 522 | 522 | for (int x = 0; x < 16; x++) |
| 523 | 523 | { |
| 524 | sc45helperlog("<element name=\"lamplabelel%d\"><text string=\"%s\"><color red=\"1.0\" green=\"1.0\" blue=\"1.0\" /></text></element>\n", d, lamps[y][x].lampname.cstr()); | |
| 524 | sc45helperlog("<element name=\"lamplabelel%d\"><text string=\"%s\"><color red=\"1.0\" green=\"1.0\" blue=\"1.0\" /></text></element>\n", d, lamps[y][x].lampname.c_str()); | |
| 525 | 525 | d++; |
| 526 | 526 | } |
| 527 | 527 | } |
| r245622 | r245623 | |
| 536 | 536 | |
| 537 | 537 | for (int x = 0; x < 6; x++) |
| 538 | 538 | { |
| 539 | sc45helperlog("<element name=\"inputlabel%d-%d\"><text string=\"%s\"><color red=\"1.0\" green=\"1.0\" blue=\"1.0\" /></text></element>\n", realy,x,sc4inputs[realy][x].name.cstr()); | |
| 539 | sc45helperlog("<element name=\"inputlabel%d-%d\"><text string=\"%s\"><color red=\"1.0\" green=\"1.0\" blue=\"1.0\" /></text></element>\n", realy,x,sc4inputs[realy][x].name.c_str()); | |
| 540 | 540 | |
| 541 | 541 | } |
| 542 | 542 | } |
| r245622 | r245623 | |
| 593 | 593 | { |
| 594 | 594 | lamps[y][x].lampname_alt = lamps[y][x].lampname; |
| 595 | 595 | |
| 596 | if (!strcmp(lamps[y][x].lampname_alt.cstr(), "hold2/hi")) lamps[y][x].lampname_alt = "hold2"; | |
| 597 | if (!strcmp(lamps[y][x].lampname_alt.cstr(), "hold3/lo")) lamps[y][x].lampname_alt = "hold3"; | |
| 598 | if (!strcmp(lamps[y][x].lampname_alt.cstr(), "chg stake")) lamps[y][x].lampname_alt = "chnge stk"; | |
| 599 | if (!strcmp(lamps[y][x].lampname_alt.cstr(), "canc/coll")) lamps[y][x].lampname_alt = "cancel"; | |
| 600 | if (!strcmp(lamps[y][x].lampname_alt.cstr(), "start")) lamps[y][x].lampname_alt = "strt exch"; | |
| 596 | if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold2/hi")) lamps[y][x].lampname_alt = "hold2"; | |
| 597 | if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold3/lo")) lamps[y][x].lampname_alt = "hold3"; | |
| 598 | if (!strcmp(lamps[y][x].lampname_alt.c_str(), "chg stake")) lamps[y][x].lampname_alt = "chnge stk"; | |
| 599 | if (!strcmp(lamps[y][x].lampname_alt.c_str(), "canc/coll")) lamps[y][x].lampname_alt = "cancel"; | |
| 600 | if (!strcmp(lamps[y][x].lampname_alt.c_str(), "start")) lamps[y][x].lampname_alt = "strt exch"; | |
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | } |
| r245622 | r245623 | |
| 625 | 625 | { |
| 626 | 626 | for (int x = 0; x < 16; x++) |
| 627 | 627 | { |
| 628 | if (!strcmp(tempname2, lamps[y][x].lampname_alt.cstr())) | |
| 628 | if (!strcmp(tempname2, lamps[y][x].lampname_alt.c_str())) | |
| 629 | 629 | { |
| 630 | 630 | //sc45helperlog("%s found\n", tempname2); |
| 631 | 631 | lamps[y][x].draw_label = false; |
| r245622 | r245623 | |
| 640 | 640 | } |
| 641 | 641 | else |
| 642 | 642 | { |
| 643 | //printf("%s:%s:\n", tempname2, lamps[y][x].lampname_alt.cstr()); | |
| 643 | //printf("%s:%s:\n", tempname2, lamps[y][x].lampname_alt.c_str()); | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | } |
| r245622 | r245623 | |
| 679 | 679 | //sc45helperlog("---ROW %02d---\n", y); |
| 680 | 680 | for (int x = 0; x < 16; x++) |
| 681 | 681 | { |
| 682 | if (lamps[y][x].clickport== -1) sc45helperlog("<bezel name=\"lamp%d\" element=\"%s\" state=\"0\"><bounds x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/></bezel>\n", d, lamps[y][x].lamptypename.cstr(), lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); | |
| 683 | else sc45helperlog("<bezel name=\"lamp%d\" element=\"%s\" state=\"0\" inputtag=\"IN-%d\" inputmask=\"0x%02x\"><bounds x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" /></bezel>\n", d, lamps[y][x].lamptypename.cstr(), lamps[y][x].clickport, lamps[y][x].clickmask, lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); | |
| 682 | if (lamps[y][x].clickport== -1) sc45helperlog("<bezel name=\"lamp%d\" element=\"%s\" state=\"0\"><bounds x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/></bezel>\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); | |
| 683 | else sc45helperlog("<bezel name=\"lamp%d\" element=\"%s\" state=\"0\" inputtag=\"IN-%d\" inputmask=\"0x%02x\"><bounds x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" /></bezel>\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].clickport, lamps[y][x].clickmask, lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); | |
| 684 | 684 | |
| 685 | 685 | if (lamps[y][x].draw_label == false) sc45helperlog("<!-- Label not drawn\n"); |
| 686 | 686 | sc45helperlog("<bezel name=\"lamplabel%d\" element=\"lamplabelel%d\"><bounds x=\"%d\" y=\"%d\" width=\"%d\" height=\"10\" /></bezel>\n", d,d, lamps[y][x].x, lamps[y][x].y-10, lamps[y][x].width); |
| r245622 | r245623 | |
| 905 | 905 | tempstring.cat("PND"); |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | sc45helperlog("%s", tempstring.cstr()); | |
| 908 | sc45helperlog("%s", tempstring.c_str()); | |
| 909 | 909 | |
| 910 | 910 | |
| 911 | 911 |
| r245622 | r245623 | |
|---|---|---|
| 462 | 462 | TILE_GET_INFO_MEMBER(get_sfbonus_reel4_tile_info); |
| 463 | 463 | virtual void machine_reset(); |
| 464 | 464 | virtual void video_start(); |
| 465 | void draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int cat | |
| 465 | void draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int category); | |
| 466 | 466 | UINT32 screen_update_sfbonus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 467 | 467 | }; |
| 468 | 468 | |
| r245622 | r245623 | |
| 929 | 929 | |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | void sfbonus_state::draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int cat | |
| 932 | void sfbonus_state::draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int category) | |
| 933 | 933 | { |
| 934 | 934 | int zz; |
| 935 | 935 | int i; |
| r245622 | r245623 | |
| 1021 | 1021 | |
| 1022 | 1022 | if (rowenable2==0) |
| 1023 | 1023 | { |
| 1024 | m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1024 | m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),3); | |
| 1025 | 1025 | } |
| 1026 | 1026 | if (rowenable==0) |
| 1027 | 1027 | { |
| 1028 | m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1028 | m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),3); | |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | if (rowenable2==0x1) |
| 1032 | 1032 | { |
| 1033 | m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1033 | m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),2); | |
| 1034 | 1034 | } |
| 1035 | 1035 | if (rowenable==0x1) |
| 1036 | 1036 | { |
| 1037 | m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1037 | m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),2); | |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | if (rowenable2==0x2) |
| 1041 | 1041 | { |
| 1042 | m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1042 | m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),1); | |
| 1043 | 1043 | } |
| 1044 | 1044 | if (rowenable==0x2) |
| 1045 | 1045 | { |
| 1046 | m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1046 | m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),1); | |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | if (rowenable2==0x3) |
| 1050 | 1050 | { |
| 1051 | m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1051 | m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),4); | |
| 1052 | 1052 | } |
| 1053 | 1053 | if (rowenable==0x3) |
| 1054 | 1054 | { |
| 1055 | m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(cat | |
| 1055 | m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(category),4); | |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 |
| r245622 | r245623 | |
|---|---|---|
| 47 | 47 | |
| 48 | 48 | astring skey = parameter("key"); |
| 49 | 49 | if(skey) |
| 50 | key = strtoll(skey.cstr(), 0, 16); | |
| 50 | key = strtoll(skey.c_str(), 0, 16); | |
| 51 | 51 | else |
| 52 | 52 | { |
| 53 | 53 | logerror("%s: Warning: key not provided\n", tag()); |
| r245622 | r245623 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | astring skey = parameter("key"); |
| 34 | 34 | if(skey) |
| 35 | key = strtoll(skey.cstr(), 0, 16); | |
| 35 | key = strtoll(skey.c_str(), 0, 16); | |
| 36 | 36 | else |
| 37 | 37 | { |
| 38 | 38 | logerror("%s: Warning: key not provided\n", tag()); |
| r245622 | r245623 | |
|---|---|---|
| 159 | 159 | astring errmsg; |
| 160 | 160 | errmsg.printf("Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", |
| 161 | 161 | slot_tag, slot_tag); |
| 162 | image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.cstr()); | |
| 162 | image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); | |
| 163 | 163 | return IMAGE_INIT_FAIL; |
| 164 | 164 | } |
| 165 | 165 |
| r245622 | r245623 | |
|---|---|---|
| 19 | 19 | @27 HD38800A 1981, Bandai Packri Monster (DM-21Z) |
| 20 | 20 | *51 HD38800A 1981, Actronics(Hanzawa) Twinvader |
| 21 | 21 | @70 HD38800A 1982, Coleco Galaxian |
| 22 | @73 HD38800A 1982, Mattel Star Hawk | |
| 22 | 23 | |
| 23 | 24 | @23 HD38800B 1982, Tomy Kingman (THF-01II) |
| 24 | 25 | *24 HD38800B 1982, Actronics(Hanzawa) Wanted G-Man |
| r245622 | r245623 | |
| 43 | 44 | |
| 44 | 45 | ***************************************************************************/ |
| 45 | 46 | |
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | /*************************************************************************** | |
| 52 | ||
| 53 | Mattel Star Hawk (manufactured in Japan) | |
| 54 | * PCBs are labeled Kaken, PT-317B | |
| 55 | * Hitachi HD38800A73 MCU | |
| 56 | * cyan/red VFD display Futaba DM-41ZK, with partial color overlay | |
| 57 | ||
| 58 | NOTE!: MESS external artwork is recommended | |
| 59 | ||
| 60 | ***************************************************************************/ | |
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 46 | 67 | #include "emu.h" |
| 47 | 68 | #include "cpu/hmcs40/hmcs40.h" |
| 48 | 69 | #include "sound/speaker.h" |
| r245622 | r245623 | |
| 287 | 308 | /*************************************************************************** |
| 288 | 309 | |
| 289 | 310 | Bambino Basketball - Dribble Away (manufactured in Japan) |
| 290 | * | |
| 311 | * PCBs are labeled Emix Corp. ET-05 | |
| 291 | 312 | * Hitachi HD38750A08 MCU |
| 292 | 313 | * green VFD display Emix-106, with bezel overlay |
| 293 | 314 | |
| r245622 | r245623 | |
| 399 | 420 | /*************************************************************************** |
| 400 | 421 | |
| 401 | 422 | Bandai Packri Monster (manufactured in Japan) |
| 402 | * | |
| 423 | * PCB label DM-21ZA2 | |
| 403 | 424 | * Hitachi HD38800A27 MCU |
| 404 | 425 | * cyan/red/green VFD display Futaba DM-21ZK 2B, with bezel overlay |
| 405 | 426 | |
| r245622 | r245623 | |
| 731 | 752 | /*************************************************************************** |
| 732 | 753 | |
| 733 | 754 | Coleco Donkey Kong (manufactured in Taiwan) |
| 734 | * | |
| 755 | * PCB label Coleco Rev C 75790 DK | |
| 735 | 756 | * Hitachi HD38820A45 MCU |
| 736 | 757 | * cyan/red VFD display Futaba DM-47ZK 2K, with color overlay |
| 737 | 758 | |
| r245622 | r245623 | |
| 859 | 880 | /*************************************************************************** |
| 860 | 881 | |
| 861 | 882 | Coleco Galaxian (manufactured in Taiwan) |
| 862 | * | |
| 883 | * PCB label Coleco Rev A 75718 | |
| 863 | 884 | * Hitachi HD38800A70 MCU |
| 864 | 885 | * cyan/red VFD display Futaba DM-36Z 2H, with color overlay |
| 865 | 886 | |
| r245622 | r245623 | |
| 976 | 997 | /*************************************************************************** |
| 977 | 998 | |
| 978 | 999 | Coleco Pac-Man (manufactured in Taiwan) |
| 979 | * | |
| 1000 | * PCB label Coleco 75690 | |
| 980 | 1001 | * Hitachi HD38820A28/29 MCU |
| 981 | 1002 | * cyan/red VFD display Futaba DM-34Z 2A, with color overlay |
| 982 | 1003 | |
| r245622 | r245623 | |
| 1097 | 1118 | /*************************************************************************** |
| 1098 | 1119 | |
| 1099 | 1120 | Coleco Ms. Pac-Man (manufactured in Taiwan) |
| 1100 | * | |
| 1121 | * PCB label Coleco 911171 | |
| 1101 | 1122 | * Hitachi HD38820A61 MCU |
| 1102 | 1123 | * cyan/red VFD display Futaba DM-60Z 3I, with color overlay |
| 1103 | 1124 | |
| r245622 | r245623 | |
| 1501 | 1522 | /*************************************************************************** |
| 1502 | 1523 | |
| 1503 | 1524 | Tomy Kingman (manufactured in Japan) |
| 1504 | * | |
| 1525 | * PCBs are labeled THF-01II 2E138E01/2E128E02 | |
| 1505 | 1526 | * Hitachi HD38800B23 MCU |
| 1506 | 1527 | * cyan/red/blue VFD display Futaba DM-65ZK 3A |
| 1507 | 1528 | |
| r245622 | r245623 | |
| 1622 | 1643 | /*************************************************************************** |
| 1623 | 1644 | |
| 1624 | 1645 | Tomy(tronic) Tron (manufactured in Japan) |
| 1625 | * | |
| 1646 | * PCBs are labeled THN-02 2E114E07 | |
| 1626 | 1647 | * Hitachi HD38800A88 MCU |
| 1627 | * cyan/red/green VFD display NEC FIP10AM24T | |
| 1648 | * cyan/red/green VFD display NEC FIP10AM24T no. 2-8 1 | |
| 1628 | 1649 | |
| 1629 | 1650 | NOTE!: MESS external artwork is recommended |
| 1630 | 1651 |
| r245622 | r245623 | |
|---|---|---|
| 26 | 26 | *MP2139 TMS1370? 1982, Gakken Galaxy Invader 1000 |
| 27 | 27 | *MP2788 ? 1980, Bandai Flight Time (? note: VFD-capable) |
| 28 | 28 | @MP3226 TMS1000 1978, Milton Bradley Simon |
| 29 | *MP3301 TMS1000 1979, Milton Bradley Big | |
| 29 | *MP3301 TMS1000 1979, Milton Bradley Big Trak | |
| 30 | 30 | *MP3320A TMS1000 1979, Coleco Head to Head Basketball |
| 31 | 31 | MP3403 TMS1100 1978, Marx Electronic Bowling -> elecbowl.c |
| 32 | 32 | @MP3404 TMS1100 1978, Parker Brothers Merlin |
| r245622 | r245623 | |
| 918 | 918 | /*************************************************************************** |
| 919 | 919 | |
| 920 | 920 | Entex Electronic Baseball 2 |
| 921 | * | |
| 921 | * PCBs are labeled: ZENY | |
| 922 | 922 | * TMS1000 MCU, MP0923 (die labeled MP0923) |
| 923 | 923 | * 3 7seg LEDs, and other LEDs behind bezel, 1bit sound |
| 924 | 924 | |
| r245622 | r245623 | |
| 1045 | 1045 | /*************************************************************************** |
| 1046 | 1046 | |
| 1047 | 1047 | Entex Electronic Baseball 3 |
| 1048 | * | |
| 1048 | * PCBs are labeled: ZENY | |
| 1049 | 1049 | * TMS1100NLL 6007 MP1204 (die labeled MP1204) |
| 1050 | 1050 | * 2*SN75492N LED display driver |
| 1051 | 1051 | * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound |
| r245622 | r245623 | |
|---|---|---|
| 12 | 12 | @031 uPD553C 1979, Bambino Superstar Football (ET-03) |
| 13 | 13 | *042 uPD552C 1979, Tomy Space Attack |
| 14 | 14 | @048 uPD552C 1980, Tomy Tennis (TN-04) |
| 15 | @049 uPD553C 1979, Mego Mini-Vid Break Free | |
| 15 | 16 | @055 uPD553C 1980, Bambino Laser Fight (ET-12) |
| 16 | 17 | *085 uPD650C 1980, Roland TR-808 |
| 17 | 18 | *102 uPD553C 1981, Bandai Block Out |
| r245622 | r245623 | |
| 19 | 20 | *128 uPD650C 1982, Roland TR-606 |
| 20 | 21 | 133 uPD650C 1982, Roland TB-303 -> tb303.c |
| 21 | 22 | @160 uPD553C 1982, Tomy Pac Man (TN-08) |
| 23 | @192 uPD553C 1982, Tomy Scramble (TN-10) | |
| 22 | 24 | @202 uPD553C 1982, Epoch Astro Command |
| 23 | 25 | @206 uPD553C 1982, Epoch Dracula |
| 24 | | |
| 26 | @209 uPD553C 1982, Tomy Caveman (TN-12) | |
| 25 | 27 | @258 uPD553C 1984, Tomy Alien Chase (TN-16) |
| 26 | 28 | |
| 27 | 29 | (* denotes not yet emulated by MESS, @ denotes it's in this driver) |
| 28 | 30 | |
| 29 | 31 | ***************************************************************************/ |
| 30 | 32 | |
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | /*************************************************************************** | |
| 37 | ||
| 38 | Mego Mini-Vid Break Free (manufactured in Japan) | |
| 39 | * PCB label Mego 79 rev F | |
| 40 | * NEC uCOM-43 MCU, labeled D553C 031 | |
| 41 | * cyan VFD display Futaba DM-4.5 91 | |
| 42 | ||
| 43 | NOTE!: MESS external artwork is recommended | |
| 44 | ||
| 45 | ***************************************************************************/ | |
| 46 | ||
| 47 | ||
| 48 | /*************************************************************************** | |
| 49 | ||
| 50 | Tomy(tronic) Caveman (manufactured in Japan) | |
| 51 | * PCBs are labeled TN-12 2E114E03 | |
| 52 | * NEC uCOM-43 MCU, labeled D553C 209 | |
| 53 | * cyan/red/green VFD display NEC FIP8AM20T no. 2-42 | |
| 54 | ||
| 55 | NOTE!: MESS external artwork is recommended | |
| 56 | ||
| 57 | ***************************************************************************/ | |
| 58 | ||
| 59 | ||
| 60 | /*************************************************************************** | |
| 61 | ||
| 62 | Tomy(tronic) Scramble (manufactured in Japan) | |
| 63 | * PCBs are labeled TN-10 2E114E01 | |
| 64 | * NEC uCOM-43 MCU, labeled D553C 192 | |
| 65 | * cyan/red/green VFD display NEC FIP10CM20T no. 2-41 | |
| 66 | ||
| 67 | NOTE!: MESS external artwork is recommended | |
| 68 | ||
| 69 | ***************************************************************************/ | |
| 70 | ||
| 71 | ||
| 31 | 72 | #include "emu.h" |
| 32 | 73 | #include "cpu/ucom4/ucom4.h" |
| 33 | 74 | #include "sound/speaker.h" |
| r245622 | r245623 | |
| 515 | 556 | Epoch Astro Command (manufactured in Japan) |
| 516 | 557 | * PCB label 96111 |
| 517 | 558 | * NEC uCOM-43 MCU, labeled D553C 202 |
| 518 | * cyan/red VFD display NEC FIP9AM20T | |
| 559 | * cyan/red VFD display NEC FIP9AM20T no. 42-42, with color overlay (FIP=fluorescent indicator panel) | |
| 519 | 560 | |
| 520 | 561 | known releases: |
| 521 | 562 | - Japan: Astro Command |
| r245622 | r245623 | |
| 624 | 665 | Epoch Dracula (manufactured in Japan) |
| 625 | 666 | * PCB label 96121 |
| 626 | 667 | * NEC uCOM-43 MCU, labeled D553C 206 |
| 627 | * cyan/red/green VFD display NEC FIP8BM20T | |
| 668 | * cyan/red/green VFD display NEC FIP8BM20T no. 2-42 | |
| 628 | 669 | |
| 629 | 670 | known releases: |
| 630 | 671 | - Japan: Dracula House, yellow case |
| r245622 | r245623 | |
| 717 | 758 | /*************************************************************************** |
| 718 | 759 | |
| 719 | 760 | Tomy(tronic) Tennis (manufactured in Japan) |
| 720 | * | |
| 761 | * PCB labeled TOMY TN-04 TENNIS | |
| 721 | 762 | * NEC uCOM-44 MCU, labeled D552C 048 |
| 722 | * VFD display NEC FIP11AM15T | |
| 763 | * VFD display NEC FIP11AM15T tube no. 0F | |
| 723 | 764 | |
| 724 | 765 | The initial release of this game was in 1979, known as Pro-Tennis, |
| 725 | 766 | it has a D553 instead of D552, with just a little over 50% ROM used. |
| r245622 | r245623 | |
| 876 | 917 | /*************************************************************************** |
| 877 | 918 | |
| 878 | 919 | Tomy(tronic) Pac-Man (manufactured in Japan) |
| 879 | * | |
| 920 | * PCBs are labeled TN-08 2E108E01 | |
| 880 | 921 | * NEC uCOM-43 MCU, labeled D553C 160 |
| 881 | * cyan/red/green VFD display NEC FIP8AM18T | |
| 922 | * cyan/red/green VFD display NEC FIP8AM18T no. 2-21 | |
| 882 | 923 | * bright yellow round casing |
| 883 | 924 | |
| 884 | 925 | known releases: |
| r245622 | r245623 | |
| 984 | 1025 | /*************************************************************************** |
| 985 | 1026 | |
| 986 | 1027 | Tomy Alien Chase (manufactured in Japan) |
| 987 | * | |
| 1028 | * PCBs are labeled TN-16 2E121B01 | |
| 988 | 1029 | * NEC uCOM-43 MCU, labeled D553C 258 |
| 989 | 1030 | * red/green VFD display NEC FIP9AM24T, with color overlay, 2-sided* |
| 990 | 1031 |
| r245622 | r245623 | |
|---|---|---|
| 427 | 427 | { |
| 428 | 428 | astring errmsg; |
| 429 | 429 | errmsg.printf("Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); |
| 430 | image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.cstr()); | |
| 430 | image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); | |
| 431 | 431 | return IMAGE_INIT_FAIL; |
| 432 | 432 | } |
| 433 | 433 | } |
| r245622 | r245623 | |
|---|---|---|
| 64 | 64 | tempstring.catprintf(exec_format, exec); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | machine.ui().popup_time(10, "%s", tempstring.cstr()); | |
| 67 | machine.ui().popup_time(10, "%s", tempstring.c_str()); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /******************************************************************* |
| r245622 | r245623 | |
|---|---|---|
| 377 | 377 | { |
| 378 | 378 | astring errmsg; |
| 379 | 379 | errmsg.printf("Invalid cartridge size %u", size); |
| 380 | image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.cstr()); | |
| 380 | image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); | |
| 381 | 381 | return IMAGE_INIT_FAIL; |
| 382 | 382 | } |
| 383 | 383 | |
| r245622 | r245623 | |
| 1518 | 1518 | { |
| 1519 | 1519 | astring errmsg; |
| 1520 | 1520 | errmsg.printf("Invalid cartridge size %" I64FMT "d", size); |
| 1521 | image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.cstr()); | |
| 1521 | image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); | |
| 1522 | 1522 | return IMAGE_INIT_FAIL; |
| 1523 | 1523 | } |
| 1524 | 1524 |
| r245622 | r245623 | |
|---|---|---|
| 1227 | 1227 | { |
| 1228 | 1228 | // File name is in m_basename |
| 1229 | 1229 | // return true = error |
| 1230 | if (VERBOSE>8) LOG("cartridge_device: loading %s in slot %s\n", m_basename.cstr(), tag()); | |
| 1230 | if (VERBOSE>8) LOG("cartridge_device: loading %s in slot %s\n", m_basename.c_str(), tag()); | |
| 1231 | 1231 | |
| 1232 | 1232 | if (m_softlist) |
| 1233 | 1233 | { |
| r245622 | r245623 | |
| 2286 | 2286 | throw rpk_exception(RPK_INVALID_RAM_SPEC, "<ram type='persistent'> must have a 'file' attribute"); |
| 2287 | 2287 | } |
| 2288 | 2288 | astring ram_pathname(system_name, PATH_SEPARATOR, ram_filename); |
| 2289 | ram_pname = core_strdup(ram_pathname.cstr()); | |
| 2289 | ram_pname = core_strdup(ram_pathname.c_str()); | |
| 2290 | 2290 | // load, and fill rest with 00 |
| 2291 | 2291 | if (VERBOSE>6) LOG("gromport/RPK: Loading NVRAM contents from '%s'\n", ram_pname); |
| 2292 | 2292 | image_battery_load_by_name(options, ram_pname, contents, length, 0x00); |
| r245622 | r245623 | |
|---|---|---|
| 510 | 510 | { |
| 511 | 511 | if (m_detail==NULL) return error_text[(int)m_err]; |
| 512 | 512 | astring errormsg(error_text[(int)m_err], ": ", m_detail); |
| 513 | return core_strdup(errormsg.cstr()); | |
| 513 | return core_strdup(errormsg.c_str()); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | private: |
| r245622 | r245623 | |
|---|---|---|
| 114 | 114 | { |
| 115 | 115 | WindowQtConfig::applyToQWidget(widget); |
| 116 | 116 | DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget); |
| 117 | window->set_device(m_device_tag.cstr()); | |
| 117 | window->set_device(m_device_tag.c_str()); | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 |
| r245622 | r245623 | |
|---|---|---|
| 138 | 138 | // Window title |
| 139 | 139 | astring title; |
| 140 | 140 | title.printf("Debug: %s - %s '%s'", m_machine->system().name, processor->name(), processor->tag()); |
| 141 | setWindowTitle(title.cstr()); | |
| 141 | setWindowTitle(title.c_str()); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| r245622 | r245623 | |
| 466 | 466 | astring menuName; |
| 467 | 467 | menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]"); |
| 468 | 468 | |
| 469 | QMenu* interfaceMenu = imagesMenu->addMenu(menuName.cstr()); | |
| 469 | QMenu* interfaceMenu = imagesMenu->addMenu(menuName.c_str()); | |
| 470 | 470 | interfaceMenu->setObjectName(img->device().name()); |
| 471 | 471 | |
| 472 | 472 | QAction* mountAct = new QAction("Mount...", interfaceMenu); |
| r245622 | r245623 | |
|---|---|---|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | CTFontRef ct_font = NULL; |
| 57 | CFStringRef const font_name = CFStringCreateWithCString(NULL, name.cstr(), kCFStringEncodingUTF8); | |
| 57 | CFStringRef const font_name = CFStringCreateWithCString(NULL, name.c_str(), kCFStringEncodingUTF8); | |
| 58 | 58 | if (font_name != NULL) |
| 59 | 59 | { |
| 60 | 60 | CTFontDescriptorRef const font_descriptor = CTFontDescriptorCreateWithNameAndSize(font_name, 0.0); |
| r245622 | r245623 | |
| 68 | 68 | |
| 69 | 69 | if (!ct_font) |
| 70 | 70 | { |
| 71 | osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.cstr()); | |
| 71 | osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.c_str()); | |
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 |
| r245622 | r245623 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | if (!font) |
| 74 | 74 | { |
| 75 | osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); | |
| 75 | osd_printf_verbose("Searching font %s in -%s\n", name.c_str(), OPTION_FONTPATH); | |
| 76 | 76 | //emu_file file(options().font_path(), OPEN_FLAG_READ); |
| 77 | 77 | emu_file file(font_path, OPEN_FLAG_READ); |
| 78 | 78 | if (file.open(name) == FILERR_NONE) |
| r245622 | r245623 | |
| 80 | 80 | astring full_name = file.fullpath(); |
| 81 | 81 | font = TTF_OpenFont_Magic(full_name, POINT_SIZE); |
| 82 | 82 | if (font) |
| 83 | osd_printf_verbose("Found font %s\n", full_name.cstr()); | |
| 83 | osd_printf_verbose("Found font %s\n", full_name.c_str()); | |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| r245622 | r245623 | |
| 96 | 96 | { |
| 97 | 97 | if (!BDF_Check_Magic(name)) |
| 98 | 98 | { |
| 99 | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr()); | |
| 99 | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.c_str()); | |
| 100 | 100 | } |
| 101 | 101 | return NULL; |
| 102 | 102 | } |
| r245622 | r245623 | |
| 195 | 195 | if (memcmp(buffer, magic, 5)) |
| 196 | 196 | return NULL; |
| 197 | 197 | } |
| 198 | return TTF_OpenFont(name.cstr(), POINT_SIZE); | |
| 198 | return TTF_OpenFont(name.c_str(), POINT_SIZE); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | bool osd_font_sdl::BDF_Check_Magic(astring name) |
| r245622 | r245623 | |
| 227 | 227 | config = FcConfigGetCurrent(); |
| 228 | 228 | pat = FcPatternCreate(); |
| 229 | 229 | os = FcObjectSetCreate(); |
| 230 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); | |
| 230 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.c_str()); | |
| 231 | 231 | |
| 232 | 232 | // try and get a font with the requested styles baked-in |
| 233 | 233 | if (bold) |
| r245622 | r245623 | |
| 287 | 287 | FcFontSetDestroy(fontset); |
| 288 | 288 | |
| 289 | 289 | pat = FcPatternCreate(); |
| 290 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); | |
| 290 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.c_str()); | |
| 291 | 291 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); |
| 292 | 292 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); |
| 293 | 293 | fontset = FcFontList(config, pat, os); |
| r245622 | r245623 | |
|---|---|---|
| 260 | 260 | new_option_value.cat(t); |
| 261 | 261 | } |
| 262 | 262 | // TODO: core_strdup() is leaked |
| 263 | m_options.set_description(key, core_strdup(current_value.cat(new_option_value).cstr())); | |
| 263 | m_options.set_description(key, core_strdup(current_value.cat(new_option_value).c_str())); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 |
| r245622 | r245623 | |
|---|---|---|
| 245 | 245 | opt_val = ""; |
| 246 | 246 | else if (!m_mod_man.type_has_name(opt_name, opt_val)) |
| 247 | 247 | { |
| 248 | osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr()); | |
| 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 | 251 | return m_mod_man.select_module(opt_name, opt_val); |
| r245622 | r245623 | |
|---|---|---|
| 3489 | 3489 | for (int seq = 0; ; seq++) |
| 3490 | 3490 | { |
| 3491 | 3491 | // build up the filename |
| 3492 | fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d_%d", seq, idx).cstr()); | |
| 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 | 3495 | file_error filerr = file.open(fname); |
| r245622 | r245623 | |
|---|---|---|
| 742 | 742 | |
| 743 | 743 | devinfo->joystick.device = joy; |
| 744 | 744 | |
| 745 | osd_printf_verbose("Joystick: %s\n", devinfo->name.cstr()); | |
| 745 | osd_printf_verbose("Joystick: %s\n", devinfo->name.c_str()); | |
| 746 | 746 | osd_printf_verbose("Joystick: ... %d axes, %d buttons %d hats %d balls\n", SDL_JoystickNumAxes(joy), SDL_JoystickNumButtons(joy), SDL_JoystickNumHats(joy), SDL_JoystickNumBalls(joy)); |
| 747 | 747 | osd_printf_verbose("Joystick: ... Physical id %d mapped to logical id %d\n", physical_stick, stick + 1); |
| 748 | 748 | |
| r245622 | r245623 | |
| 758 | 758 | else |
| 759 | 759 | itemid = ITEM_ID_OTHER_AXIS_ABSOLUTE; |
| 760 | 760 | |
| 761 | sprintf(tempname, "A%d %s", axis, devinfo->name.cstr()); | |
| 761 | sprintf(tempname, "A%d %s", axis, devinfo->name.c_str()); | |
| 762 | 762 | devinfo->device->add_item(tempname, itemid, generic_axis_get_state, &devinfo->joystick.axes[axis]); |
| 763 | 763 | } |
| 764 | 764 | |
| r245622 | r245623 | |
| 809 | 809 | else |
| 810 | 810 | itemid = ITEM_ID_OTHER_AXIS_RELATIVE; |
| 811 | 811 | |
| 812 | sprintf(tempname, "R%d %s", ball * 2, devinfo->name.cstr()); | |
| 812 | sprintf(tempname, "R%d %s", ball * 2, devinfo->name.c_str()); | |
| 813 | 813 | devinfo->device->add_item(tempname, (input_item_id) itemid, generic_axis_get_state, &devinfo->joystick.balls[ball * 2]); |
| 814 | sprintf(tempname, "R%d %s", ball * 2 + 1, devinfo->name.cstr()); | |
| 814 | sprintf(tempname, "R%d %s", ball * 2 + 1, devinfo->name.c_str()); | |
| 815 | 815 | devinfo->device->add_item(tempname, (input_item_id) (itemid + 1), generic_axis_get_state, &devinfo->joystick.balls[ball * 2 + 1]); |
| 816 | 816 | } |
| 817 | 817 | } |
| r245622 | r245623 | |
| 869 | 869 | continue; |
| 870 | 870 | |
| 871 | 871 | // add the axes |
| 872 | sprintf(defname, "X %s", devinfo->name.cstr()); | |
| 872 | sprintf(defname, "X %s", devinfo->name.c_str()); | |
| 873 | 873 | devinfo->device->add_item(defname, ITEM_ID_XAXIS, generic_axis_get_state, &devinfo->mouse.lX); |
| 874 | sprintf(defname, "Y %s", devinfo->name.cstr()); | |
| 874 | sprintf(defname, "Y %s", devinfo->name.c_str()); | |
| 875 | 875 | devinfo->device->add_item(defname, ITEM_ID_YAXIS, generic_axis_get_state, &devinfo->mouse.lY); |
| 876 | 876 | |
| 877 | 877 | for (button = 0; button < 4; button++) |
| r245622 | r245623 | |
| 886 | 886 | |
| 887 | 887 | if (0 && mouse_enabled) |
| 888 | 888 | SDL_SetRelativeMouseMode(index, SDL_TRUE); |
| 889 | osd_printf_verbose("Mouse: Registered %s\n", devinfo->name.cstr()); | |
| 889 | osd_printf_verbose("Mouse: Registered %s\n", devinfo->name.c_str()); | |
| 890 | 890 | } |
| 891 | 891 | osd_printf_verbose("Mouse: End initialization\n"); |
| 892 | 892 | } |
| r245622 | r245623 | |
| 903 | 903 | |
| 904 | 904 | // SDL 1.2 has only 1 mouse - 1.3+ will also change that, so revisit this then |
| 905 | 905 | devinfo = generic_device_alloc(&mouse_list, "System mouse"); |
| 906 | devinfo->device = machine.input().device_class(DEVICE_CLASS_MOUSE).add_device(devinfo->name.cstr(), devinfo); | |
| 906 | devinfo->device = machine.input().device_class(DEVICE_CLASS_MOUSE).add_device(devinfo->name.c_str(), devinfo); | |
| 907 | 907 | |
| 908 | 908 | mouse_enabled = machine.options().mouse(); |
| 909 | 909 | |
| r245622 | r245623 | |
| 919 | 919 | devinfo->device->add_item(defname, itemid, generic_button_get_state, &devinfo->mouse.buttons[button]); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | osd_printf_verbose("Mouse: Registered %s\n", devinfo->name.cstr()); | |
| 922 | osd_printf_verbose("Mouse: Registered %s\n", devinfo->name.c_str()); | |
| 923 | 923 | osd_printf_verbose("Mouse: End initialization\n"); |
| 924 | 924 | } |
| 925 | 925 | #endif |
| r245622 | r245623 | |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | |
| 1129 | sprintf(defname, "X %s", devinfo->name.cstr()); | |
| 1129 | sprintf(defname, "X %s", devinfo->name.c_str()); | |
| 1130 | 1130 | devinfo->device->add_item(defname, ITEM_ID_XAXIS, generic_axis_get_state, &devinfo->lightgun.lX); |
| 1131 | sprintf(defname, "Y %s", devinfo->name.cstr()); | |
| 1131 | sprintf(defname, "Y %s", devinfo->name.c_str()); | |
| 1132 | 1132 | devinfo->device->add_item(defname, ITEM_ID_YAXIS, generic_axis_get_state, &devinfo->lightgun.lY); |
| 1133 | 1133 | |
| 1134 | 1134 | |
| r245622 | r245623 | |
| 1325 | 1325 | devinfo->device->add_item(defname, itemid, generic_button_get_state, &devinfo->keyboard.state[OSD_SDL_INDEX(key_trans_table[keynum].sdl_key)]); |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | osd_printf_verbose("Keyboard: Registered %s\n", devinfo->name.cstr()); | |
| 1328 | osd_printf_verbose("Keyboard: Registered %s\n", devinfo->name.c_str()); | |
| 1329 | 1329 | } |
| 1330 | 1330 | osd_printf_verbose("Keyboard: End initialization\n"); |
| 1331 | 1331 | } |
| r245622 | r245623 | |
| 1346 | 1346 | // SDL 1.2 only has 1 keyboard (1.3+ will have multiple, this must be revisited then) |
| 1347 | 1347 | // add it now |
| 1348 | 1348 | devinfo = generic_device_alloc(&keyboard_list, "System keyboard"); |
| 1349 | devinfo->device = machine.input().device_class(DEVICE_CLASS_KEYBOARD).add_device(devinfo->name.cstr(), devinfo); | |
| 1349 | devinfo->device = machine.input().device_class(DEVICE_CLASS_KEYBOARD).add_device(devinfo->name.c_str(), devinfo); | |
| 1350 | 1350 | |
| 1351 | 1351 | // populate it |
| 1352 | 1352 | for (keynum = 0; sdl_key_trans_table[keynum].mame_key != ITEM_ID_INVALID; keynum++) |
| r245622 | r245623 | |
| 1363 | 1363 | devinfo->device->add_item(defname, itemid, generic_button_get_state, &devinfo->keyboard.state[OSD_SDL_INDEX(key_trans_table[keynum].sdl_key)]); |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | osd_printf_verbose("Keyboard: Registered %s\n", devinfo->name.cstr()); | |
| 1366 | osd_printf_verbose("Keyboard: Registered %s\n", devinfo->name.c_str()); | |
| 1367 | 1367 | osd_printf_verbose("Keyboard: End initialization\n"); |
| 1368 | 1368 | } |
| 1369 | 1369 | #endif |
| r245622 | r245623 | |
| 1742 | 1742 | case SDL_KEYDOWN: |
| 1743 | 1743 | #ifdef SDL2_MULTIAPI |
| 1744 | 1744 | devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[event.key.which]); |
| 1745 | //printf("Key down %d %d %s => %d %s (scrlock keycode is %d)\n", event.key.which, event.key.keysym.scancode, devinfo->name.cstr(), OSD_SDL_INDEX_KEYSYM(&event.key.keysym), sdl_key_trans_table[event.key.keysym.scancode].mame_key_name, KEYCODE_SCRLOCK); | |
| 1745 | //printf("Key down %d %d %s => %d %s (scrlock keycode is %d)\n", event.key.which, event.key.keysym.scancode, devinfo->name.c_str(), OSD_SDL_INDEX_KEYSYM(&event.key.keysym), sdl_key_trans_table[event.key.keysym.scancode].mame_key_name, KEYCODE_SCRLOCK); | |
| 1746 | 1746 | #else |
| 1747 | 1747 | devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[0]); |
| 1748 | 1748 | #endif |
| r245622 | r245623 | |
| 1841 | 1841 | devinfo = generic_device_find_index(mouse_list, mouse_map.logical[0]); |
| 1842 | 1842 | #endif |
| 1843 | 1843 | devinfo->mouse.buttons[event.button.button-1] = 0x80; |
| 1844 | //printf("But down %d %d %d %d %s\n", event.button.which, event.button.button, event.button.x, event.button.y, devinfo->name.cstr()); | |
| 1844 | //printf("But down %d %d %d %d %s\n", event.button.which, event.button.button, event.button.x, event.button.y, devinfo->name.c_str()); | |
| 1845 | 1845 | if (event.button.button == 1) |
| 1846 | 1846 | { |
| 1847 | 1847 | // FIXME Move static declaration |
| r245622 | r245623 | |
| 1899 | 1899 | #endif |
| 1900 | 1900 | #if (SDLMAME_SDL2) |
| 1901 | 1901 | // FIXME: may apply to 1.2 as well ... |
| 1902 | //printf("Motion %d %d %d %s\n", event.motion.which, event.motion.x, event.motion.y, devinfo->name.cstr()); | |
| 1902 | //printf("Motion %d %d %d %s\n", event.motion.which, event.motion.x, event.motion.y, devinfo->name.c_str()); | |
| 1903 | 1903 | devinfo->mouse.lX += event.motion.xrel * INPUT_RELATIVE_PER_PIXEL; |
| 1904 | 1904 | devinfo->mouse.lY += event.motion.yrel * INPUT_RELATIVE_PER_PIXEL; |
| 1905 | 1905 | #else |
| r245622 | r245623 | |
|---|---|---|
| 212 | 212 | astring ini_path(INI_PATH); |
| 213 | 213 | add_entries(sdl_options::s_option_entries); |
| 214 | 214 | ini_path.replace(0, "APP_NAME", emulator_info::get_appname_lower()); |
| 215 | set_default_value(SDLOPTION_INIPATH, ini_path.cstr()); | |
| 215 | set_default_value(SDLOPTION_INIPATH, ini_path.c_str()); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | //============================================================ |
| r245622 | r245623 | |
|---|---|---|
| 327 | 327 | m_lastfile = m_info.track[tracknum].fname; |
| 328 | 328 | file_error filerr = core_fopen(m_lastfile, OPEN_FLAG_READ, &m_file); |
| 329 | 329 | if (filerr != FILERR_NONE) |
| 330 | report_error(1, "Error opening input file (%s)'", m_lastfile.cstr()); | |
| 330 | report_error(1, "Error opening input file (%s)'", m_lastfile.c_str()); | |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // iterate over frames |
| r245622 | r245623 | |
| 351 | 351 | core_fseek(m_file, src_frame_start, SEEK_SET); |
| 352 | 352 | UINT32 count = core_fread(m_file, dest, bytesperframe); |
| 353 | 353 | if (count != bytesperframe) |
| 354 | report_error(1, "Error reading input file (%s)'", m_lastfile.cstr()); | |
| 354 | report_error(1, "Error reading input file (%s)'", m_lastfile.c_str()); | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // swap if appropriate |
| r245622 | r245623 | |
| 940 | 940 | { |
| 941 | 941 | chd_error err = input_parent_chd.open(*input_chd_parent_str); |
| 942 | 942 | if (err != CHDERR_NONE) |
| 943 | report_error(1, "Error opening parent CHD file (%s): %s", input_chd_parent_str->cstr(), chd_file::error_string(err)); | |
| 943 | report_error(1, "Error opening parent CHD file (%s): %s", input_chd_parent_str->c_str(), chd_file::error_string(err)); | |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | // process input file |
| r245622 | r245623 | |
| 949 | 949 | { |
| 950 | 950 | chd_error err = input_chd.open(*input_chd_str, writeable, input_parent_chd.opened() ? &input_parent_chd : NULL); |
| 951 | 951 | if (err != CHDERR_NONE) |
| 952 | report_error(1, "Error opening CHD file (%s): %s", input_chd_str->cstr(), chd_file::error_string(err)); | |
| 952 | report_error(1, "Error opening CHD file (%s): %s", input_chd_str->c_str(), chd_file::error_string(err)); | |
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | |
| r245622 | r245623 | |
| 1028 | 1028 | { |
| 1029 | 1029 | chd_error err = output_parent_chd.open(*output_chd_parent_str); |
| 1030 | 1030 | if (err != CHDERR_NONE) |
| 1031 | report_error(1, "Error opening parent CHD file (%s): %s", output_chd_parent_str->cstr(), chd_file::error_string(err)); | |
| 1031 | report_error(1, "Error opening parent CHD file (%s): %s", output_chd_parent_str->c_str(), chd_file::error_string(err)); | |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | // process output file |
| r245622 | r245623 | |
| 1083 | 1083 | { |
| 1084 | 1084 | astring name(*compression_str, start, (end == -1) ? -1 : end - start); |
| 1085 | 1085 | if (name.len() != 4) |
| 1086 | report_error(1, "Invalid compressor '%s' specified", name.cstr()); | |
| 1086 | report_error(1, "Invalid compressor '%s' specified", name.c_str()); | |
| 1087 | 1087 | chd_codec_type type = CHD_MAKE_TAG(name[0], name[1], name[2], name[3]); |
| 1088 | 1088 | if (!chd_codec_list::codec_exists(type)) |
| 1089 | report_error(1, "Invalid compressor '%s' specified", name.cstr()); | |
| 1089 | report_error(1, "Invalid compressor '%s' specified", name.c_str()); | |
| 1090 | 1090 | compression[index++] = type; |
| 1091 | 1091 | if (end == -1) |
| 1092 | 1092 | break; |
| r245622 | r245623 | |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | 1260 | // output TRACK entry |
| 1261 | core_fprintf(file, " TRACK %02d %s\n", tracknum + 1, tempstr.cstr()); | |
| 1261 | core_fprintf(file, " TRACK %02d %s\n", tracknum + 1, tempstr.c_str()); | |
| 1262 | 1262 | |
| 1263 | 1263 | // output PREGAP tag if pregap sectors are not in the file |
| 1264 | 1264 | if ((info.pregap > 0) && (info.pgdatasize == 0)) |
| r245622 | r245623 | |
| 1296 | 1296 | modesubmode.format("%s %s", cdrom_get_type_string(info.trktype), cdrom_get_subtype_string(info.subtype)); |
| 1297 | 1297 | else |
| 1298 | 1298 | modesubmode.format("%s", cdrom_get_type_string(info.trktype)); |
| 1299 | core_fprintf(file, "TRACK %s\n", modesubmode.cstr()); | |
| 1299 | core_fprintf(file, "TRACK %s\n", modesubmode.c_str()); | |
| 1300 | 1300 | |
| 1301 | 1301 | // write out the attributes |
| 1302 | 1302 | core_fprintf(file, "NO COPY\n"); |
| r245622 | r245623 | |
| 1309 | 1309 | // output pregap |
| 1310 | 1310 | astring tempstr; |
| 1311 | 1311 | if (info.pregap > 0) |
| 1312 | core_fprintf(file, "ZERO %s %s\n", modesubmode.cstr(), msf_string_from_frames(tempstr, info.pregap)); | |
| 1312 | core_fprintf(file, "ZERO %s %s\n", modesubmode.c_str(), msf_string_from_frames(tempstr, info.pregap)); | |
| 1313 | 1313 | |
| 1314 | 1314 | // all tracks but the first one have a file offset |
| 1315 | 1315 | if (tracknum > 0) |
| r245622 | r245623 | |
| 1340 | 1340 | |
| 1341 | 1341 | // print filename and version |
| 1342 | 1342 | astring tempstr; |
| 1343 | printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 1343 | printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 1344 | 1344 | printf("File Version: %d\n", input_chd.version()); |
| 1345 | 1345 | if (input_chd.version() < 3) |
| 1346 | 1346 | report_error(1, "Unsupported version (%d); use an older chdman to upgrade to version 3 or later", input_chd.version()); |
| r245622 | r245623 | |
| 1504 | 1504 | UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_chd.logical_bytes() - offset); |
| 1505 | 1505 | chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); |
| 1506 | 1506 | if (err != CHDERR_NONE) |
| 1507 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); | |
| 1507 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err)); | |
| 1508 | 1508 | |
| 1509 | 1509 | // add to the checksum |
| 1510 | 1510 | rawsha1.append(buffer, bytes_to_read); |
| r245622 | r245623 | |
| 1568 | 1568 | { |
| 1569 | 1569 | file_error filerr = core_fopen(*input_file_str, OPEN_FLAG_READ, &input_file); |
| 1570 | 1570 | if (filerr != FILERR_NONE) |
| 1571 | report_error(1, "Unable to open file (%s)", input_file_str->cstr()); | |
| 1571 | report_error(1, "Unable to open file (%s)", input_file_str->c_str()); | |
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 1574 | 1574 | // process output CHD |
| r245622 | r245623 | |
| 1604 | 1604 | |
| 1605 | 1605 | // print some info |
| 1606 | 1606 | astring tempstr; |
| 1607 | printf("Output CHD: %s\n", output_chd_str->cstr()); | |
| 1607 | printf("Output CHD: %s\n", output_chd_str->c_str()); | |
| 1608 | 1608 | if (output_parent.opened()) |
| 1609 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr()); | |
| 1610 | printf("Input file: %s\n", input_file_str->cstr()); | |
| 1609 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); | |
| 1610 | printf("Input file: %s\n", input_file_str->c_str()); | |
| 1611 | 1611 | if (input_start != 0 || input_end != core_fsize(input_file)) |
| 1612 | 1612 | { |
| 1613 | 1613 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| r245622 | r245623 | |
| 1629 | 1629 | else |
| 1630 | 1630 | err = chd->create(*output_chd_str, input_end - input_start, hunk_size, unit_size, compression); |
| 1631 | 1631 | if (err != CHDERR_NONE) |
| 1632 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err)); | |
| 1632 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); | |
| 1633 | 1633 | |
| 1634 | 1634 | // if we have a parent, copy forward all the metadata |
| 1635 | 1635 | if (output_parent.opened()) |
| r245622 | r245623 | |
| 1665 | 1665 | { |
| 1666 | 1666 | file_error filerr = core_fopen(*input_file_str, OPEN_FLAG_READ, &input_file); |
| 1667 | 1667 | if (filerr != FILERR_NONE) |
| 1668 | report_error(1, "Unable to open file (%s)", input_file_str->cstr()); | |
| 1668 | report_error(1, "Unable to open file (%s)", input_file_str->c_str()); | |
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | // process output CHD |
| r245622 | r245623 | |
| 1740 | 1740 | // load the file |
| 1741 | 1741 | file_error filerr = core_fload(*ident_str, identdata); |
| 1742 | 1742 | if (filerr != FILERR_NONE) |
| 1743 | report_error(1, "Error reading ident file (%s)", ident_str->cstr()); | |
| 1743 | report_error(1, "Error reading ident file (%s)", ident_str->c_str()); | |
| 1744 | 1744 | |
| 1745 | 1745 | // must be at least 14 bytes; extract CHS data from there |
| 1746 | 1746 | if (identdata.count() < 14) |
| 1747 | report_error(1, "Ident file '%s' is invalid (too short)", ident_str->cstr()); | |
| 1747 | report_error(1, "Ident file '%s' is invalid (too short)", ident_str->c_str()); | |
| 1748 | 1748 | cylinders = (identdata[3] << 8) | identdata[2]; |
| 1749 | 1749 | heads = (identdata[7] << 8) | identdata[6]; |
| 1750 | 1750 | sectors = (identdata[13] << 8) | identdata[12]; |
| r245622 | r245623 | |
| 1775 | 1775 | |
| 1776 | 1776 | // print some info |
| 1777 | 1777 | astring tempstr; |
| 1778 | printf("Output CHD: %s\n", output_chd_str->cstr()); | |
| 1778 | printf("Output CHD: %s\n", output_chd_str->c_str()); | |
| 1779 | 1779 | if (output_parent.opened()) |
| 1780 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr()); | |
| 1780 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); | |
| 1781 | 1781 | if (input_file != NULL) |
| 1782 | 1782 | { |
| 1783 | printf("Input file: %s\n", input_file_str->cstr()); | |
| 1783 | printf("Input file: %s\n", input_file_str->c_str()); | |
| 1784 | 1784 | if (input_start != 0 || input_end != core_fsize(input_file)) |
| 1785 | 1785 | { |
| 1786 | 1786 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| r245622 | r245623 | |
| 1807 | 1807 | else |
| 1808 | 1808 | err = chd->create(*output_chd_str, UINT64(totalsectors) * UINT64(sector_size), hunk_size, sector_size, compression); |
| 1809 | 1809 | if (err != CHDERR_NONE) |
| 1810 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err)); | |
| 1810 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); | |
| 1811 | 1811 | |
| 1812 | 1812 | // add the standard hard disk metadata |
| 1813 | 1813 | astring metadata; |
| r245622 | r245623 | |
| 1856 | 1856 | { |
| 1857 | 1857 | chd_error err = chdcd_parse_toc(*input_file_str, toc, track_info); |
| 1858 | 1858 | if (err != CHDERR_NONE) |
| 1859 | report_error(1, "Error parsing input file (%s: %s)\n", input_file_str->cstr(), chd_file::error_string(err)); | |
| 1859 | report_error(1, "Error parsing input file (%s: %s)\n", input_file_str->c_str(), chd_file::error_string(err)); | |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | // process output CHD |
| r245622 | r245623 | |
| 1889 | 1889 | |
| 1890 | 1890 | // print some info |
| 1891 | 1891 | astring tempstr; |
| 1892 | printf("Output CHD: %s\n", output_chd_str->cstr()); | |
| 1892 | printf("Output CHD: %s\n", output_chd_str->c_str()); | |
| 1893 | 1893 | if (output_parent.opened()) |
| 1894 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr()); | |
| 1895 | printf("Input file: %s\n", input_file_str->cstr()); | |
| 1894 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); | |
| 1895 | printf("Input file: %s\n", input_file_str->c_str()); | |
| 1896 | 1896 | printf("Input tracks: %d\n", toc.numtrks); |
| 1897 | 1897 | printf("Input length: %s\n", msf_string_from_frames(tempstr, origtotalsectors)); |
| 1898 | 1898 | printf("Compression: %s\n", compression_string(tempstr, compression)); |
| r245622 | r245623 | |
| 1910 | 1910 | else |
| 1911 | 1911 | err = chd->create(*output_chd_str, UINT64(totalsectors) * UINT64(CD_FRAME_SIZE), hunk_size, CD_FRAME_SIZE, compression); |
| 1912 | 1912 | if (err != CHDERR_NONE) |
| 1913 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err)); | |
| 1913 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); | |
| 1914 | 1914 | |
| 1915 | 1915 | // add the standard CD metadata; we do this even if we have a parent because it might be different |
| 1916 | 1916 | err = cdrom_write_metadata(chd, &toc); |
| r245622 | r245623 | |
| 1947 | 1947 | { |
| 1948 | 1948 | avi_error avierr = avi_open(*input_file_str, &input_file); |
| 1949 | 1949 | if (avierr != AVIERR_NONE) |
| 1950 | report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->cstr(), avi_error_string(avierr)); | |
| 1950 | report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->c_str(), avi_error_string(avierr)); | |
| 1951 | 1951 | } |
| 1952 | 1952 | const avi_movie_info *aviinfo = avi_get_movie_info(input_file); |
| 1953 | 1953 | |
| r245622 | r245623 | |
| 1999 | 1999 | |
| 2000 | 2000 | // print some info |
| 2001 | 2001 | astring tempstr; |
| 2002 | printf("Output CHD: %s\n", output_chd_str->cstr()); | |
| 2002 | printf("Output CHD: %s\n", output_chd_str->c_str()); | |
| 2003 | 2003 | if (output_parent.opened()) |
| 2004 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr()); | |
| 2005 | printf("Input file: %s\n", input_file_str->cstr()); | |
| 2004 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); | |
| 2005 | printf("Input file: %s\n", input_file_str->c_str()); | |
| 2006 | 2006 | if (input_start != 0 && input_end != aviinfo->video_numsamples) |
| 2007 | 2007 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| 2008 | 2008 | printf("Input length: %s (%02d:%02d:%02d)\n", big_int_string(tempstr, input_end - input_start), |
| r245622 | r245623 | |
| 2028 | 2028 | else |
| 2029 | 2029 | err = chd->create(*output_chd_str, UINT64(input_end - input_start) * hunk_size, hunk_size, info.bytes_per_frame, compression); |
| 2030 | 2030 | if (err != CHDERR_NONE) |
| 2031 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err)); | |
| 2031 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); | |
| 2032 | 2032 | |
| 2033 | 2033 | // write the core A/V metadata |
| 2034 | 2034 | astring metadata; |
| r245622 | r245623 | |
| 2112 | 2112 | |
| 2113 | 2113 | // print some info |
| 2114 | 2114 | astring tempstr; |
| 2115 | printf("Output CHD: %s\n", output_chd_str->cstr()); | |
| 2115 | printf("Output CHD: %s\n", output_chd_str->c_str()); | |
| 2116 | 2116 | if (output_parent.opened()) |
| 2117 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr()); | |
| 2118 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2117 | printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); | |
| 2118 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2119 | 2119 | if (input_start != 0 || input_end != input_chd.logical_bytes()) |
| 2120 | 2120 | { |
| 2121 | 2121 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| r245622 | r245623 | |
| 2137 | 2137 | else |
| 2138 | 2138 | err = chd->create(*output_chd_str, input_end - input_start, hunk_size, input_chd.unit_bytes(), compression); |
| 2139 | 2139 | if (err != CHDERR_NONE) |
| 2140 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err)); | |
| 2140 | report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); | |
| 2141 | 2141 | |
| 2142 | 2142 | // clone all the metadata, upgrading where appropriate |
| 2143 | 2143 | dynamic_buffer metadata; |
| r245622 | r245623 | |
| 2221 | 2221 | |
| 2222 | 2222 | // print some info |
| 2223 | 2223 | astring tempstr; |
| 2224 | printf("Output File: %s\n", output_file_str->cstr()); | |
| 2225 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2224 | printf("Output File: %s\n", output_file_str->c_str()); | |
| 2225 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2226 | 2226 | if (input_start != 0 || input_end != input_chd.logical_bytes()) |
| 2227 | 2227 | { |
| 2228 | 2228 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| r245622 | r245623 | |
| 2236 | 2236 | // process output file |
| 2237 | 2237 | file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file); |
| 2238 | 2238 | if (filerr != FILERR_NONE) |
| 2239 | report_error(1, "Unable to open file (%s)", output_file_str->cstr()); | |
| 2239 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); | |
| 2240 | 2240 | |
| 2241 | 2241 | // copy all data |
| 2242 | 2242 | dynamic_buffer buffer((TEMP_BUFFER_SIZE / input_chd.hunk_bytes()) * input_chd.hunk_bytes()); |
| r245622 | r245623 | |
| 2248 | 2248 | UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_end - offset); |
| 2249 | 2249 | chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); |
| 2250 | 2250 | if (err != CHDERR_NONE) |
| 2251 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); | |
| 2251 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err)); | |
| 2252 | 2252 | |
| 2253 | 2253 | // write to the output |
| 2254 | 2254 | UINT32 count = core_fwrite(output_file, buffer, bytes_to_read); |
| 2255 | 2255 | if (count != bytes_to_read) |
| 2256 | report_error(1, "Error writing to file; check disk space (%s)", output_file_str->cstr()); | |
| 2256 | report_error(1, "Error writing to file; check disk space (%s)", output_file_str->c_str()); | |
| 2257 | 2257 | |
| 2258 | 2258 | // advance |
| 2259 | 2259 | offset += bytes_to_read; |
| r245622 | r245623 | |
| 2306 | 2306 | if (chop != -1) |
| 2307 | 2307 | default_name.substr(0, chop); |
| 2308 | 2308 | char basename[128]; |
| 2309 | strncpy(basename, default_name.cstr(), 127); | |
| 2309 | strncpy(basename, default_name.c_str(), 127); | |
| 2310 | 2310 | default_name.cat(".bin"); |
| 2311 | 2311 | if (output_bin_file_str == NULL) |
| 2312 | 2312 | output_bin_file_str = &default_name; |
| r245622 | r245623 | |
| 2314 | 2314 | |
| 2315 | 2315 | // print some info |
| 2316 | 2316 | astring tempstr; |
| 2317 | printf("Output TOC: %s\n", output_file_str->cstr()); | |
| 2318 | printf("Output Data: %s\n", output_bin_file_str->cstr()); | |
| 2319 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2317 | printf("Output TOC: %s\n", output_file_str->c_str()); | |
| 2318 | printf("Output Data: %s\n", output_bin_file_str->c_str()); | |
| 2319 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2320 | 2320 | |
| 2321 | 2321 | // catch errors so we can close & delete the output file |
| 2322 | 2322 | core_file *output_bin_file = NULL; |
| r245622 | r245623 | |
| 2337 | 2337 | // process output file |
| 2338 | 2338 | file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &output_toc_file); |
| 2339 | 2339 | if (filerr != FILERR_NONE) |
| 2340 | report_error(1, "Unable to open file (%s)", output_file_str->cstr()); | |
| 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 | 2345 | filerr = core_fopen(*output_bin_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); |
| 2346 | 2346 | if (filerr != FILERR_NONE) |
| 2347 | report_error(1, "Unable to open file (%s)", output_bin_file_str->cstr()); | |
| 2347 | report_error(1, "Unable to open file (%s)", output_bin_file_str->c_str()); | |
| 2348 | 2348 | } |
| 2349 | 2349 | |
| 2350 | 2350 | // determine total frames |
| r245622 | r245623 | |
| 2384 | 2384 | |
| 2385 | 2385 | filerr = core_fopen(trackbin_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); |
| 2386 | 2386 | if (filerr != FILERR_NONE) |
| 2387 | report_error(1, "Unable to open file (%s)", trackbin_name.cstr()); | |
| 2387 | report_error(1, "Unable to open file (%s)", trackbin_name.c_str()); | |
| 2388 | 2388 | |
| 2389 | 2389 | outputoffs = 0; |
| 2390 | 2390 | } |
| r245622 | r245623 | |
| 2449 | 2449 | core_fseek(output_bin_file, outputoffs, SEEK_SET); |
| 2450 | 2450 | UINT32 byteswritten = core_fwrite(output_bin_file, buffer, bufferoffs); |
| 2451 | 2451 | if (byteswritten != bufferoffs) |
| 2452 | report_error(1, "Error writing frame %d to file (%s): %s\n", frame, output_file_str->cstr(), chd_file::error_string(CHDERR_WRITE_ERROR)); | |
| 2452 | report_error(1, "Error writing frame %d to file (%s): %s\n", frame, output_file_str->c_str(), chd_file::error_string(CHDERR_WRITE_ERROR)); | |
| 2453 | 2453 | outputoffs += bufferoffs; |
| 2454 | 2454 | bufferoffs = 0; |
| 2455 | 2455 | } |
| r245622 | r245623 | |
| 2548 | 2548 | |
| 2549 | 2549 | // print some info |
| 2550 | 2550 | astring tempstr; |
| 2551 | printf("Output File: %s\n", output_file_str->cstr()); | |
| 2552 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2551 | printf("Output File: %s\n", output_file_str->c_str()); | |
| 2552 | printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2553 | 2553 | if (input_start != 0 || input_end != input_chd.hunk_count()) |
| 2554 | 2554 | { |
| 2555 | 2555 | printf("Input start: %s\n", big_int_string(tempstr, input_start)); |
| r245622 | r245623 | |
| 2563 | 2563 | // process output file |
| 2564 | 2564 | avi_error avierr = avi_create(*output_file_str, &info, &output_file); |
| 2565 | 2565 | if (avierr != AVIERR_NONE) |
| 2566 | report_error(1, "Unable to open file (%s)", output_file_str->cstr()); | |
| 2566 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); | |
| 2567 | 2567 | |
| 2568 | 2568 | // create the codec configuration |
| 2569 | 2569 | avhuff_decompress_config avconfig; |
| r245622 | r245623 | |
| 2592 | 2592 | if (err != CHDERR_NONE) |
| 2593 | 2593 | { |
| 2594 | 2594 | UINT64 filepos = core_ftell(input_chd); |
| 2595 | report_error(1, "Error reading hunk %" I64FMT "d at offset %" I64FMT "d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); | |
| 2595 | report_error(1, "Error reading hunk %" I64FMT "d at offset %" I64FMT "d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err)); | |
| 2596 | 2596 | } |
| 2597 | 2597 | |
| 2598 | 2598 | // write audio |
| r245622 | r245623 | |
| 2600 | 2600 | { |
| 2601 | 2601 | avi_error avierr = avi_append_sound_samples(output_file, chnum, avconfig.audio[chnum], actsamples, 0); |
| 2602 | 2602 | if (avierr != AVIERR_NONE) |
| 2603 | report_error(1, "Error writing samples for hunk %" I64FMT "d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr)); | |
| 2603 | report_error(1, "Error writing samples for hunk %" I64FMT "d to file (%s): %s\n", framenum, output_file_str->c_str(), avi_error_string(avierr)); | |
| 2604 | 2604 | } |
| 2605 | 2605 | |
| 2606 | 2606 | // write video |
| r245622 | r245623 | |
| 2608 | 2608 | { |
| 2609 | 2609 | avi_error avierr = avi_append_video_frame(output_file, fullbitmap); |
| 2610 | 2610 | if (avierr != AVIERR_NONE) |
| 2611 | report_error(1, "Error writing video for hunk %" I64FMT "d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr)); | |
| 2611 | report_error(1, "Error writing video for hunk %" I64FMT "d to file (%s): %s\n", framenum, output_file_str->c_str(), avi_error_string(avierr)); | |
| 2612 | 2612 | } |
| 2613 | 2613 | } |
| 2614 | 2614 | |
| r245622 | r245623 | |
| 2671 | 2671 | { |
| 2672 | 2672 | file_error filerr = core_fload(*file_str, file); |
| 2673 | 2673 | if (filerr != FILERR_NONE) |
| 2674 | report_error(1, "Error reading metadata file (%s)", file_str->cstr()); | |
| 2674 | report_error(1, "Error reading metadata file (%s)", file_str->c_str()); | |
| 2675 | 2675 | } |
| 2676 | 2676 | |
| 2677 | 2677 | // make sure we have one or the other |
| r245622 | r245623 | |
| 2687 | 2687 | |
| 2688 | 2688 | // print some info |
| 2689 | 2689 | astring tempstr; |
| 2690 | printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2690 | printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2691 | 2691 | printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); |
| 2692 | 2692 | printf("Index: %d\n", index); |
| 2693 | 2693 | if (text_str != NULL) |
| 2694 | printf("Text: %s\n", text.cstr()); | |
| 2694 | printf("Text: %s\n", text.c_str()); | |
| 2695 | 2695 | else |
| 2696 | printf("Data: %s (%d bytes)\n", file_str->cstr(), file.count()); | |
| 2696 | printf("Data: %s (%d bytes)\n", file_str->c_str(), file.count()); | |
| 2697 | 2697 | |
| 2698 | 2698 | // write the metadata |
| 2699 | 2699 | chd_error err; |
| r245622 | r245623 | |
| 2736 | 2736 | |
| 2737 | 2737 | // print some info |
| 2738 | 2738 | astring tempstr; |
| 2739 | printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr()); | |
| 2739 | printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); | |
| 2740 | 2740 | printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); |
| 2741 | 2741 | printf("Index: %d\n", index); |
| 2742 | 2742 | |
| r245622 | r245623 | |
| 2795 | 2795 | { |
| 2796 | 2796 | file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file); |
| 2797 | 2797 | if (filerr != FILERR_NONE) |
| 2798 | report_error(1, "Unable to open file (%s)", output_file_str->cstr()); | |
| 2798 | report_error(1, "Unable to open file (%s)", output_file_str->c_str()); | |
| 2799 | 2799 | |
| 2800 | 2800 | // output the metadata |
| 2801 | 2801 | UINT32 count = core_fwrite(output_file, buffer, buffer.count()); |
| 2802 | 2802 | if (count != buffer.count()) |
| 2803 | report_error(1, "Error writing file (%s)", output_file_str->cstr()); | |
| 2803 | report_error(1, "Error writing file (%s)", output_file_str->c_str()); | |
| 2804 | 2804 | core_fclose(output_file); |
| 2805 | 2805 | |
| 2806 | 2806 | // provide some feedback |
| 2807 | 2807 | astring tempstr; |
| 2808 | printf("File (%s) written, %s bytes\n", output_file_str->cstr(), big_int_string(tempstr, buffer.count())); | |
| 2808 | printf("File (%s) written, %s bytes\n", output_file_str->c_str(), big_int_string(tempstr, buffer.count())); | |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | 2811 | // flush to stdout |
| r245622 | r245623 | |
|---|---|---|
| 303 | 303 | fprintf(stderr, "%s", "WARNING: This is Work In Progress! - It may fail anytime\n"); |
| 304 | 304 | if (!opts.parse_command_line(argc, argv, OPTION_PRIORITY_DEFAULT, aerror)) |
| 305 | 305 | { |
| 306 | fprintf(stderr, "%s\n", aerror.cstr()); | |
| 306 | fprintf(stderr, "%s\n", aerror.c_str()); | |
| 307 | 307 | usage(opts); |
| 308 | 308 | return 1; |
| 309 | 309 | } |
| r245622 | r245623 | |
|---|---|---|
| 83 | 83 | filerr = core_fopen(imgfile1, OPEN_FLAG_READ, &file); |
| 84 | 84 | if (filerr != FILERR_NONE) |
| 85 | 85 | { |
| 86 | printf("Could not open %s (%d)\n", imgfile1.cstr(), filerr); | |
| 86 | printf("Could not open %s (%d)\n", imgfile1.c_str(), filerr); | |
| 87 | 87 | goto error; |
| 88 | 88 | } |
| 89 | 89 | |
| r245622 | r245623 | |
| 92 | 92 | core_fclose(file); |
| 93 | 93 | if (pngerr != PNGERR_NONE) |
| 94 | 94 | { |
| 95 | printf("Could not read %s (%d)\n", imgfile1.cstr(), pngerr); | |
| 95 | printf("Could not read %s (%d)\n", imgfile1.c_str(), pngerr); | |
| 96 | 96 | goto error; |
| 97 | 97 | } |
| 98 | 98 | |
| r245622 | r245623 | |
| 100 | 100 | filerr = core_fopen(imgfile2, OPEN_FLAG_READ, &file); |
| 101 | 101 | if (filerr != FILERR_NONE) |
| 102 | 102 | { |
| 103 | printf("Could not open %s (%d)\n", imgfile2.cstr(), filerr); | |
| 103 | printf("Could not open %s (%d)\n", imgfile2.c_str(), filerr); | |
| 104 | 104 | goto error; |
| 105 | 105 | } |
| 106 | 106 | |
| r245622 | r245623 | |
| 109 | 109 | core_fclose(file); |
| 110 | 110 | if (pngerr != PNGERR_NONE) |
| 111 | 111 | { |
| 112 | printf("Could not read %s (%d)\n", imgfile2.cstr(), pngerr); | |
| 112 | printf("Could not read %s (%d)\n", imgfile2.c_str(), pngerr); | |
| 113 | 113 | goto error; |
| 114 | 114 | } |
| 115 | 115 | |
| r245622 | r245623 | |
| 173 | 173 | filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); |
| 174 | 174 | if (filerr != FILERR_NONE) |
| 175 | 175 | { |
| 176 | printf("Could not open %s (%d)\n", outfilename.cstr(), filerr); | |
| 176 | printf("Could not open %s (%d)\n", outfilename.c_str(), filerr); | |
| 177 | 177 | goto error; |
| 178 | 178 | } |
| 179 | 179 | pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL); |
| 180 | 180 | core_fclose(file); |
| 181 | 181 | if (pngerr != PNGERR_NONE) |
| 182 | 182 | { |
| 183 | printf("Could not write %s (%d)\n", outfilename.cstr(), pngerr); | |
| 183 | printf("Could not write %s (%d)\n", outfilename.c_str(), pngerr); | |
| 184 | 184 | goto error; |
| 185 | 185 | } |
| 186 | 186 | } |
| r245622 | r245623 | |
|---|---|---|
| 571 | 571 | /* print a header */ |
| 572 | 572 | astring modified(templatefile); |
| 573 | 573 | modified.replace("<!--TITLE-->", title); |
| 574 | core_fwrite(file, modified.cstr(), modified.len()); | |
| 574 | core_fwrite(file, modified.c_str(), modified.len()); | |
| 575 | 575 | |
| 576 | 576 | /* return the file */ |
| 577 | 577 | return file; |
| r245622 | r245623 | |
| 587 | 587 | { |
| 588 | 588 | astring modified(templatefile); |
| 589 | 589 | modified.replace(0, "<!--TITLE-->", title); |
| 590 | core_fwrite(file, modified.cstr(), modified.len()); | |
| 590 | core_fwrite(file, modified.c_str(), modified.len()); | |
| 591 | 591 | core_fclose(file); |
| 592 | 592 | } |
| 593 | 593 | |
| r245622 | r245623 | |
| 686 | 686 | *buckettailptr[bucknum] = NULL; |
| 687 | 687 | |
| 688 | 688 | /* output header */ |
| 689 | tempname.printf("%s" PATH_SEPARATOR "%s", dirname.cstr(), "index.html"); | |
| 689 | tempname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); | |
| 690 | 690 | indexfile = create_file_and_output_header(tempname, tempheader, title); |
| 691 | 691 | if (indexfile == NULL) |
| 692 | 692 | { |
| 693 | fprintf(stderr, "Error creating file '%s'\n", tempname.cstr()); | |
| 693 | fprintf(stderr, "Error creating file '%s'\n", tempname.c_str()); | |
| 694 | 694 | return; |
| 695 | 695 | } |
| 696 | 696 | |
| r245622 | r245623 | |
| 843 | 843 | int starty; |
| 844 | 844 | |
| 845 | 845 | /* generate the common source filename */ |
| 846 | dstfilename.printf("%s" PATH_SEPARATOR "%s", destdir.cstr(), destname); | |
| 846 | dstfilename.printf("%s" PATH_SEPARATOR "%s", destdir.c_str(), destname); | |
| 847 | 847 | srcimgname.printf("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); |
| 848 | 848 | |
| 849 | 849 | /* open and load all unique bitmaps */ |
| 850 | 850 | for (listnum = 0; listnum < list_count; listnum++) |
| 851 | 851 | if (curfile->matchbitmap[listnum] == listnum) |
| 852 | 852 | { |
| 853 | tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.cstr()); | |
| 853 | tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); | |
| 854 | 854 | |
| 855 | 855 | /* open the source image */ |
| 856 | 856 | filerr = core_fopen(tempname, OPEN_FLAG_READ, &file); |
| r245622 | r245623 | |
| 961 | 961 | |
| 962 | 962 | /* output header */ |
| 963 | 963 | title.printf("%s Regressions (%s)", curfile->name, curfile->source); |
| 964 | linkname.printf("%s" PATH_SEPARATOR "%s", dirname.cstr(), filename.cstr()); | |
| 964 | linkname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), filename.c_str()); | |
| 965 | 965 | linkfile = create_file_and_output_header(linkname, tempheader, title); |
| 966 | 966 | if (linkfile == NULL) |
| 967 | 967 | { |
| 968 | fprintf(stderr, "Error creating file '%s'\n", filename.cstr()); | |
| 968 | fprintf(stderr, "Error creating file '%s'\n", filename.c_str()); | |
| 969 | 969 | return; |
| 970 | 970 | } |
| 971 | 971 | |
| r245622 | r245623 | |
| 1002 | 1002 | { |
| 1003 | 1003 | core_fprintf(linkfile, "\t<p>\n"); |
| 1004 | 1004 | core_fprintf(linkfile, "\t<b>Errors:</b>\n"); |
| 1005 | core_fprintf(linkfile, "\t<pre>%s</pre>\n", curfile->text[listnum].cstr()); | |
| 1005 | core_fprintf(linkfile, "\t<pre>%s</pre>\n", curfile->text[listnum].c_str()); | |
| 1006 | 1006 | core_fprintf(linkfile, "\t</p>\n"); |
| 1007 | 1007 | } |
| 1008 | 1008 | } |
| r245622 | r245623 | |
|---|---|---|
| 123 | 123 | filerr = core_fopen(splitfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &splitfile); |
| 124 | 124 | if (filerr != FILERR_NONE) |
| 125 | 125 | { |
| 126 | fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.cstr()); | |
| 126 | fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.c_str()); | |
| 127 | 127 | goto cleanup; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // write the basics out |
| 131 | core_fprintf(splitfile, "splitfile=%s\n", basefilename.cstr()); | |
| 131 | core_fprintf(splitfile, "splitfile=%s\n", basefilename.c_str()); | |
| 132 | 132 | core_fprintf(splitfile, "splitsize=%d\n", splitsize); |
| 133 | 133 | |
| 134 | printf("Split file is '%s'\n", splitfilename.cstr()); | |
| 135 | printf("Splitting file %s into chunks of %dMB...\n", basefilename.cstr(), splitsize / (1024 * 1024)); | |
| 134 | printf("Split file is '%s'\n", splitfilename.c_str()); | |
| 135 | printf("Splitting file %s into chunks of %dMB...\n", basefilename.c_str(), splitsize / (1024 * 1024)); | |
| 136 | 136 | |
| 137 | 137 | // now iterate until done |
| 138 | 138 | for (partnum = 0; partnum < 1000; partnum++) |
| r245622 | r245623 | |
| 150 | 150 | compute_hash_as_string(computedhash, splitbuffer, length); |
| 151 | 151 | |
| 152 | 152 | // write that info to the split file |
| 153 | core_fprintf(splitfile, "hash=%s file=%s.%03d\n", computedhash.cstr(), basefilename.cstr(), partnum); | |
| 153 | core_fprintf(splitfile, "hash=%s file=%s.%03d\n", computedhash.c_str(), basefilename.c_str(), partnum); | |
| 154 | 154 | |
| 155 | 155 | // compute the full filename for this guy |
| 156 | 156 | outfilename.printf("%s.%03d", basename, partnum); |
| r245622 | r245623 | |
| 160 | 160 | if (filerr != FILERR_NONE) |
| 161 | 161 | { |
| 162 | 162 | printf("\n"); |
| 163 | fprintf(stderr, "Fatal error: unable to create output file '%s'\n", outfilename.cstr()); | |
| 163 | fprintf(stderr, "Fatal error: unable to create output file '%s'\n", outfilename.c_str()); | |
| 164 | 164 | goto cleanup; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | printf(" writing %s.%03d...", basefilename.cstr(), partnum); | |
| 167 | printf(" writing %s.%03d...", basefilename.c_str(), partnum); | |
| 168 | 168 | |
| 169 | 169 | // write the data |
| 170 | 170 | actual = core_fwrite(outfile, splitbuffer, length); |
| r245622 | r245623 | |
| 273 | 273 | { |
| 274 | 274 | core_fclose(outfile); |
| 275 | 275 | outfile = NULL; |
| 276 | fprintf(stderr, "Fatal error: output file '%s' already exists\n", outfilename.cstr()); | |
| 276 | fprintf(stderr, "Fatal error: output file '%s' already exists\n", outfilename.c_str()); | |
| 277 | 277 | goto cleanup; |
| 278 | 278 | } |
| 279 | 279 | |
| r245622 | r245623 | |
| 281 | 281 | filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); |
| 282 | 282 | if (filerr != FILERR_NONE) |
| 283 | 283 | { |
| 284 | fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.cstr()); | |
| 284 | fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.c_str()); | |
| 285 | 285 | goto cleanup; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | printf("%s file '%s'...\n", write_output ? "Joining" : "Verifying", outfilename.cstr()); | |
| 289 | printf("%s file '%s'...\n", write_output ? "Joining" : "Verifying", outfilename.c_str()); | |
| 290 | 290 | |
| 291 | 291 | // now iterate through each file |
| 292 | 292 | while (core_fgets(buffer, sizeof(buffer), splitfile)) |
| r245622 | r245623 | |
| 302 | 302 | expectedhash.cpy(buffer + 5, SHA1_DIGEST_SIZE * 2); |
| 303 | 303 | infilename.cpy(buffer + 5 + SHA1_DIGEST_SIZE * 2 + 6).trimspace(); |
| 304 | 304 | |
| 305 | printf(" Reading file '%s'...", infilename.cstr()); | |
| 305 | printf(" Reading file '%s'...", infilename.c_str()); | |
| 306 | 306 | |
| 307 | 307 | // read the file's contents |
| 308 | 308 | infilename.ins(0, basepath); |
| r245622 | r245623 | |
| 310 | 310 | if (filerr != FILERR_NONE) |
| 311 | 311 | { |
| 312 | 312 | printf("\n"); |
| 313 | fprintf(stderr, "Fatal error: unable to load file '%s'\n", infilename.cstr()); | |
| 313 | fprintf(stderr, "Fatal error: unable to load file '%s'\n", infilename.c_str()); | |
| 314 | 314 | goto cleanup; |
| 315 | 315 | } |
| 316 | 316 | |
| r245622 | r245623 | |
| 321 | 321 | if (computedhash != expectedhash) |
| 322 | 322 | { |
| 323 | 323 | printf("\n"); |
| 324 | fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.cstr(), expectedhash.cstr(), computedhash.cstr()); | |
| 324 | fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.c_str(), expectedhash.c_str(), computedhash.c_str()); | |
| 325 | 325 | goto cleanup; |
| 326 | 326 | } |
| 327 | 327 |
| r245622 | r245623 | |
|---|---|---|
| 332 | 332 | |
| 333 | 333 | // create an index file |
| 334 | 334 | astring indexname; |
| 335 | indexname.printf("%s%c%s", dstdir.cstr(), PATH_SEPARATOR[0], "index.html"); | |
| 335 | indexname.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], "index.html"); | |
| 336 | 336 | core_file *indexfile = create_file_and_output_header(indexname, tempheader, srcdir_subpath); |
| 337 | 337 | |
| 338 | 338 | // output the directory navigation |
| r245622 | r245623 | |
| 402 | 402 | |
| 403 | 403 | // build the source filename |
| 404 | 404 | astring srcfile; |
| 405 | srcfile.printf("%s%c%s", srcdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr()); | |
| 405 | srcfile.printf("%s%c%s", srcdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); | |
| 406 | 406 | |
| 407 | 407 | // if we have a file, output it |
| 408 | 408 | astring dstfile; |
| r245622 | r245623 | |
| 420 | 420 | // if we got a valid file, process it |
| 421 | 421 | if (type != FILE_TYPE_INVALID) |
| 422 | 422 | { |
| 423 | dstfile.printf("%s%c%s.html", dstdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr()); | |
| 423 | dstfile.printf("%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); | |
| 424 | 424 | if (indexfile != NULL) |
| 425 | core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.cstr(), curlist->name.cstr()); | |
| 425 | core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.c_str(), curlist->name.c_str()); | |
| 426 | 426 | result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir == dstdir, tempheader, tempfooter); |
| 427 | 427 | } |
| 428 | 428 | } |
| r245622 | r245623 | |
| 430 | 430 | // if we have a directory, recurse |
| 431 | 431 | else |
| 432 | 432 | { |
| 433 | dstfile.printf("%s%c%s", dstdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr()); | |
| 433 | dstfile.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); | |
| 434 | 434 | if (indexfile != NULL) |
| 435 | core_fprintf(indexfile, "\t<li><a href=\"%s/index.html\">%s/</a></li>\n", curlist->name.cstr(), curlist->name.cstr()); | |
| 435 | core_fprintf(indexfile, "\t<li><a href=\"%s/index.html\">%s/</a></li>\n", curlist->name.c_str(), curlist->name.c_str()); | |
| 436 | 436 | result = recurse_dir(srcrootlen, dstrootlen, srcfile, dstfile, tempheader, tempfooter); |
| 437 | 437 | } |
| 438 | 438 | } |
| r245622 | r245623 | |
| 467 | 467 | astring srcfile_subpath; |
| 468 | 468 | normalized_subpath(srcfile_subpath, srcfile, srcrootlen + 1); |
| 469 | 469 | |
| 470 | fprintf(stderr, "Processing %s\n", srcfile_subpath.cstr()); | |
| 470 | fprintf(stderr, "Processing %s\n", srcfile_subpath.c_str()); | |
| 471 | 471 | |
| 472 | 472 | // set some defaults |
| 473 | 473 | bool color_quotes = false; |
| r245622 | r245623 | |
| 519 | 519 | core_file *src; |
| 520 | 520 | if (core_fopen(srcfile, OPEN_FLAG_READ, &src) != FILERR_NONE) |
| 521 | 521 | { |
| 522 | fprintf(stderr, "Unable to read file '%s'\n", srcfile.cstr()); | |
| 522 | fprintf(stderr, "Unable to read file '%s'\n", srcfile.c_str()); | |
| 523 | 523 | return 1; |
| 524 | 524 | } |
| 525 | 525 | |
| r245622 | r245623 | |
| 527 | 527 | core_file *dst = create_file_and_output_header(dstfile, tempheader, srcfile_subpath); |
| 528 | 528 | if (dst == NULL) |
| 529 | 529 | { |
| 530 | fprintf(stderr, "Unable to write file '%s'\n", dstfile.cstr()); | |
| 530 | fprintf(stderr, "Unable to write file '%s'\n", dstfile.c_str()); | |
| 531 | 531 | core_fclose(src); |
| 532 | 532 | return 1; |
| 533 | 533 | } |
| r245622 | r245623 | |
| 659 | 659 | astring target; |
| 660 | 660 | if (find_include_file(target, srcrootlen, dstrootlen, srcfile, dstfile, filename)) |
| 661 | 661 | { |
| 662 | dstline.catprintf("<a href=\"%s\">", target.cstr()); | |
| 662 | dstline.catprintf("<a href=\"%s\">", target.c_str()); | |
| 663 | 663 | quotes_are_linked = true; |
| 664 | 664 | } |
| 665 | 665 | } |
| r245622 | r245623 | |
| 738 | 738 | |
| 739 | 739 | // print a header |
| 740 | 740 | astring modified(templatefile); |
| 741 | modified.replace(0, "<!--PATH-->", path.cstr()); | |
| 742 | core_fwrite(file, modified.cstr(), modified.len()); | |
| 741 | modified.replace(0, "<!--PATH-->", path.c_str()); | |
| 742 | core_fwrite(file, modified.c_str(), modified.len()); | |
| 743 | 743 | |
| 744 | 744 | // return the file |
| 745 | 745 | return file; |
| r245622 | r245623 | |
| 754 | 754 | static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &path) |
| 755 | 755 | { |
| 756 | 756 | astring modified(templatefile); |
| 757 | modified.replace(0, "<!--PATH-->", path.cstr()); | |
| 758 | core_fwrite(file, modified.cstr(), modified.len()); | |
| 757 | modified.replace(0, "<!--PATH-->", path.c_str()); | |
| 758 | core_fwrite(file, modified.c_str(), modified.len()); | |
| 759 | 759 | core_fclose(file); |
| 760 | 760 | } |
| 761 | 761 | |
| r245622 | r245623 | |
| 807 | 807 | core_fprintf(file, "<a href=\""); |
| 808 | 808 | for (int depth = curdepth; depth < srcdepth; depth++) |
| 809 | 809 | core_fprintf(file, "../"); |
| 810 | core_fprintf(file, "index.html\">%s</a>/", substr.cstr()); | |
| 810 | core_fprintf(file, "index.html\">%s</a>/", substr.c_str()); | |
| 811 | 811 | |
| 812 | 812 | lastslash = slashindex + 1; |
| 813 | 813 | } |
| r245622 | r245623 | |
| 815 | 815 | // and a final link to the current directory |
| 816 | 816 | astring substr(path, lastslash, -1); |
| 817 | 817 | if (end_is_directory) |
| 818 | core_fprintf(file, "<a href=\"index.html\">%s</a>", substr.cstr()); | |
| 818 | core_fprintf(file, "<a href=\"index.html\">%s</a>", substr.c_str()); | |
| 819 | 819 | else if (link_to_file) |
| 820 | core_fprintf(file, "<a href=\"%s\">%s</a>", substr.cstr(), substr.cstr()); | |
| 820 | core_fprintf(file, "<a href=\"%s\">%s</a>", substr.c_str(), substr.c_str()); | |
| 821 | 821 | else |
| 822 | core_fprintf(file, "<a href=\"%s.html\">%s</a>", substr.cstr(), substr.cstr()); | |
| 822 | core_fprintf(file, "<a href=\"%s.html\">%s</a>", substr.c_str(), substr.c_str()); | |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 |
| https://github.com/mamedev/mame/commit/e1f0422bc0873a0355ab1c8a42ba115843cd754b |
| Previous | 199869 Revisions | Next |