| Previous | 15994 Revisions | Next |
| r10385 Saturday 12th February, 2011 at 16:15:16 UTC by Miodrag Milanović |
|---|
| Sync with MAME (file handling change). Baseline compile, will update else soon. |
| [src/emu] | audit.c cheat.c cheat.h clifront.c config.c crsshair.c devimage.c devintrf.c devintrf.h devlegcy.c devlegcy.h diexec.c diexec.h diimage.c diimage.h dimemory.c dimemory.h dinvram.h disound.c disound.h emu.mak emuopts.c fileio.c fileio.h hashfile.c hashfile.h image.c image.h inptport.c input.c machine.c machine.h mame.c mame.h mconfig.h render.c rendfont.c rendfont.h rendlay.c rendlay.h rendutil.c rendutil.h romload.c romload.h screen.c screen.h softlist.c softlist.h sound.c state.c state.h timer.c timer.h ui.c uimenu.c validity.c validity.h video.c video.h |
| [src/emu/debug] | debugcmd.c debugcpu.c |
| [src/emu/imagedev] | cartslot.c multcart.c multcart.h |
| [src/emu/machine] | at28c16.c at28c16.h ds2401.c ds2401.h ds2404.c ds2404.h eeprom.c eeprom.h er2055.c er2055.h generic.c generic.h i2cmem.c i2cmem.h intelfsh.c intelfsh.h mb3773.c mb3773.h mc146818.c mc146818.h nvram.c nvram.h ram.c rtc65271.c secflash.c* secflash.h* timekpr.c timekpr.h x2212.c x2212.h x76f041.c x76f041.h x76f100.c x76f100.h |
| [src/emu/sound] | okim9810.c okim9810.h samples.c tms5110r.c |
| [src/emu/video] | vector.c |
| [src/ldplayer] | ldplayer.c |
| [src/mame] | mamedriv.c |
| [src/mame/drivers] | bfm_sc2.c bmcbowl.c dgpix.c gal3.c jchan.c kaneko16.c ksys573.c mcr68.c mitchell.c mjkjidai.c moo.c namcona1.c namconb1.c namcos22.c naomi.c nbmj9195.c neogeo.c pinkiri8.c segas24.c seicross.c sfbonus.c vegas.c |
| [src/mame/etc] | jrcrypt.c |
| [src/mame/includes] | kaneko16.h naomibd.h |
| [src/mame/machine] | atari_vg.c fddebug.c kaneko16.c megadriv.c midwayic.c naomibd.c segamsys.c zs01.c zs01.h |
| [src/mame/video] | gp9001.c gp9001.h kaneko16.c |
| [src/mess/devices] | aescart.c sonydriv.c |
| [src/mess/drivers] | cat.c gp32.c ip22.c jaguar.c micronic.c nc.c ng_aes.c pocketc.c psion.c px4.c saturn.c x07.c |
| [src/mess/formats] | ti85_ser.c |
| [src/mess/includes] | msx_slot.h nc.h |
| [src/mess/machine] | apple2gs.c at29040.c at29040.h at45dbxx.c at45dbxx.h cybiko.c docg3.c europc.c lisa.c mac.c msx.c msx_slot.c pc1251.c pc1350.c pc1401.c pc1403.c pce.c pcf8593.c pcf8593.h sst39vfx.c sst39vfx.h strata.c strata.h tandy1t.c tc8521.c tc8521.h ti85.c wswan.c |
| [src/mess/machine/ti99] | evpc.c gromport.c hsgpl.c |
| [src/mess/tools/castool] | stubs.c |
| [src/mess/tools/imgtool] | stubs.c |
| [src/mess/tools/imgtool/windows] | wimgtool.c |
| [src/mess/tools/messdocs] | messdocs.c |
| [src/mess/tools/messtest] | testmess.c |
| [src/osd] | osdcore.h |
| [src/osd/sdl] | draw13.c drawogl.c drawsdl.c input.c sdlmain.c sdlos_unix.c sound.c video.c window.c window.h |
| [src/osd/windows] | debugwin.c debugwin.h drawd3d.c drawdd.c drawgdi.c drawnone.c input.c sound.c video.c window.c winmain.c |
| [src/tools] | chdcd.c chdman.c |
| r10384 | r10385 | |
|---|---|---|
| 93 | 93 | atari_vg_earom_state *earom = get_safe_token(device); |
| 94 | 94 | |
| 95 | 95 | if (read_or_write) |
| 96 | | |
| 96 | | |
| 97 | 97 | else if (file) |
| 98 | | |
| 98 | | |
| 99 | 99 | else |
| 100 | 100 | memset(earom,0,EAROM_SIZE); |
| 101 | 101 | } |
| r10384 | r10385 | |
|---|---|---|
| 520 | 520 | NVRAM_HANDLER( midway_serial_pic2 ) |
| 521 | 521 | { |
| 522 | 522 | if (read_or_write) |
| 523 | | |
| 523 | | |
| 524 | 524 | else if (file) |
| 525 | | |
| 525 | | |
| 526 | 526 | else |
| 527 | 527 | memcpy(pic.nvram, pic.default_nvram, sizeof(pic.nvram)); |
| 528 | 528 | } |
| r10384 | r10385 | |
|---|---|---|
| 581 | 581 | |
| 582 | 582 | static void load_overlay_file(running_machine *machine) |
| 583 | 583 | { |
| 584 | char filename[20]; | |
| 585 | file_error filerr; | |
| 586 | mame_file *file; | |
| 587 | 584 | int pcaddr; |
| 588 | 585 | |
| 589 | 586 | /* determine the filename and open the file */ |
| 590 | sprintf(filename, "%s.kov", machine->gamedrv->name); | |
| 591 | filerr = mame_fopen(SEARCHPATH_RAW, filename, OPEN_FLAG_READ, &file); | |
| 587 | emu_file file(machine->options(), SEARCHPATH_RAW, OPEN_FLAG_READ); | |
| 588 | file_error filerr = file.open(machine->gamedrv->name, ".kov"); | |
| 592 | 589 | if (filerr == FILERR_NONE) |
| 593 | 590 | { |
| 594 | mame_fread(file, keystatus, keystatus_words * 2); | |
| 595 | mame_fclose(file); | |
| 591 | file.read(keystatus, keystatus_words * 2); | |
| 596 | 592 | |
| 597 | 593 | /* convert from big-endian */ |
| 598 | 594 | for (pcaddr = 0; pcaddr < keystatus_words; pcaddr++) |
| r10384 | r10385 | |
| 611 | 607 | |
| 612 | 608 | static void save_overlay_file(running_machine *machine) |
| 613 | 609 | { |
| 614 | char filename[20]; | |
| 615 | file_error filerr; | |
| 616 | mame_file *file; | |
| 617 | 610 | int pcaddr; |
| 618 | 611 | |
| 619 | 612 | /* determin the filename and open the file */ |
| 620 | sprintf(filename, "%s.kov", machine->gamedrv->name); | |
| 621 | filerr = mame_fopen(SEARCHPATH_RAW, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 613 | emu_file file(machine->options(), SEARCHPATH_RAW, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 614 | file_error filerr = file.open(machine->gamedrv->name, ".kov"); | |
| 622 | 615 | if (filerr == FILERR_NONE) |
| 623 | 616 | { |
| 624 | 617 | /* convert to big-endian */ |
| r10384 | r10385 | |
| 626 | 619 | keystatus[pcaddr] = BIG_ENDIANIZE_INT16(keystatus[pcaddr]); |
| 627 | 620 | |
| 628 | 621 | /* write the data */ |
| 629 | mame_fwrite(file, keystatus, keystatus_words * 2); | |
| 630 | mame_fclose(file); | |
| 622 | file.write(keystatus, keystatus_words * 2); | |
| 631 | 623 | |
| 632 | 624 | /* convert from big-endian */ |
| 633 | 625 | for (pcaddr = 0; pcaddr < keystatus_words; pcaddr++) |
| r10384 | r10385 | |
| 756 | 748 | |
| 757 | 749 | static void execute_fdoutput(running_machine *machine, int ref, int params, const char **param) |
| 758 | 750 | { |
| 759 | file_error filerr; | |
| 760 | mame_file *file; | |
| 761 | ||
| 762 | 751 | /* make sure we're up-to-date */ |
| 763 | 752 | if (keydirty) |
| 764 | 753 | fd1094_regenerate_key(machine); |
| 765 | 754 | |
| 766 | 755 | /* determin the filename and open the file */ |
| 767 | filerr = mame_fopen(SEARCHPATH_RAW, param[0], OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 756 | emu_file file(machine->options(), SEARCHPATH_RAW, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 757 | file_error filerr = file.open(param[0]); | |
| 768 | 758 | if (filerr == FILERR_NONE) |
| 769 | { | |
| 770 | mame_fwrite(file, keyregion, KEY_SIZE); | |
| 771 | mame_fclose(file); | |
| 772 | } | |
| 759 | file.write(keyregion, KEY_SIZE); | |
| 760 | ||
| 773 | 761 | debug_console_printf(machine, "File '%s' saved\n", param[0]); |
| 774 | 762 | } |
| 775 | 763 | |
| r10384 | r10385 | |
| 1182 | 1170 | int origstate = fd1094_set_state(keyregion, -1); |
| 1183 | 1171 | const char *filename; |
| 1184 | 1172 | int skipped = FALSE; |
| 1185 | file_error filerr; | |
| 1186 | mame_file *file; | |
| 1187 | 1173 | UINT32 pcaddr; |
| 1188 | 1174 | |
| 1189 | 1175 | /* extract the parameters */ |
| 1190 | 1176 | filename = param[0]; |
| 1191 | 1177 | |
| 1192 | 1178 | /* open the file */ |
| 1193 | filerr = mame_fopen(SEARCHPATH_RAW, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 1179 | emu_file file(machine->options(), SEARCHPATH_RAW, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 1180 | file_error filerr = file.open(filename); | |
| 1194 | 1181 | if (filerr != FILERR_NONE) |
| 1195 | 1182 | { |
| 1196 | 1183 | debug_console_printf(machine, "Unable to create file '%s'\n", filename); |
| r10384 | r10385 | |
| 1243 | 1230 | |
| 1244 | 1231 | /* print the line */ |
| 1245 | 1232 | if (skipped) |
| 1246 | | |
| 1233 | | |
| 1247 | 1234 | skipped = FALSE; |
| 1248 | | |
| 1235 | | |
| 1249 | 1236 | for (pcoffs = 0; pcoffs < 5; pcoffs++) |
| 1250 | 1237 | { |
| 1251 | 1238 | if (pcoffs < length) |
| r10384 | r10385 | |
| 1254 | 1241 | int keystat = keystatus[pcaddr + pcoffs] & STATUS_MASK; |
| 1255 | 1242 | if (keystat != STATUS_LOCKED && keystat != STATUS_NOCHANGE) |
| 1256 | 1243 | unknowns = TRUE; |
| 1257 | | |
| 1244 | | |
| 1258 | 1245 | } |
| 1259 | 1246 | else |
| 1260 | | |
| 1247 | | |
| 1261 | 1248 | } |
| 1262 | | |
| 1249 | | |
| 1263 | 1250 | |
| 1264 | 1251 | /* if we have unknowns, display them as well */ |
| 1265 | 1252 | if (unknowns > 0) |
| r10384 | r10385 | |
| 1269 | 1256 | for (pnum = 0; pnum < posscount; pnum++) |
| 1270 | 1257 | if (strcmp(disasm, posslist[pnum].dasm) != 0) |
| 1271 | 1258 | { |
| 1272 | | |
| 1259 | | |
| 1273 | 1260 | for (pcoffs = 0; pcoffs < 5; pcoffs++) |
| 1274 | 1261 | if (pcoffs < posslist[pnum].length) |
| 1275 | | |
| 1262 | | |
| 1276 | 1263 | else |
| 1277 | mame_fprintf(file, " "); | |
| 1278 | mame_fprintf(file, "%s\n", posslist[pnum].dasm); | |
| 1264 | file.printf(" "); | |
| 1265 | file.printf("%s\n", posslist[pnum].dasm); | |
| 1279 | 1266 | } |
| 1280 | 1267 | } |
| 1281 | 1268 | |
| r10384 | r10385 | |
| 1284 | 1271 | } |
| 1285 | 1272 | |
| 1286 | 1273 | /* close the file */ |
| 1287 | mame_fclose(file); | |
| 1288 | 1274 | fd1094_set_state(keyregion, origstate); |
| 1289 | 1275 | } |
| 1290 | 1276 |
| r10384 | r10385 | |
|---|---|---|
| 9145 | 9145 | if (megadriv_backupram!=NULL) |
| 9146 | 9146 | { |
| 9147 | 9147 | if (read_or_write) |
| 9148 | | |
| 9148 | | |
| 9149 | 9149 | else |
| 9150 | 9150 | { |
| 9151 | 9151 | if (file) |
| 9152 | 9152 | { |
| 9153 | | |
| 9153 | | |
| 9154 | 9154 | } |
| 9155 | 9155 | else |
| 9156 | 9156 | { |
| r10384 | r10385 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "emu.h" |
| 11 | 11 | #include "machine/zs01.h" |
| 12 | #include "machine/ds2401.h" | |
| 12 | 13 | |
| 13 | #define VERBOSE_LEVEL | |
| 14 | #define VERBOSE_LEVEL | |
| 14 | 15 | |
| 15 | ||
| 16 | inline void ATTR_PRINTF(3,4) zs01_device::verboselog( | |
| 16 | 17 | { |
| 17 | if( | |
| 18 | if( | |
| 18 | 19 | { |
| 19 | 20 | va_list v; |
| 20 | char buf[ 32768 ]; | |
| 21 | va_start( v, s_fmt ); | |
| 22 | vsprintf( buf, s_fmt, v ); | |
| 23 | va_end( v ); | |
| 24 | logerror( "%s: %s", machine->describe_context(), buf ); | |
| 21 | char buf[32768]; | |
| 22 | va_start(v, s_fmt); | |
| 23 | vsprintf(buf, s_fmt, v); | |
| 24 | va_end(v); | |
| 25 | logerror("zs01 %s %s: %s", config.tag(), machine->describe_context(), buf); | |
| 25 | 26 | } |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | #define SIZE_WRITE_BUFFER ( 12 ) | |
| 29 | #define SIZE_READ_BUFFER ( 12 ) | |
| 30 | #define SIZE_DATA_BUFFER ( 8 ) | |
| 29 | const device_type ZS01 = zs01_device_config::static_alloc_device_config; | |
| 31 | 30 | |
| 32 | #define SIZE_RESPONSE_TO_RESET ( 4 ) | |
| 33 | #define SIZE_KEY ( 8 ) | |
| 34 | #define SIZE_DATA ( 4096 ) | |
| 31 | zs01_device_config::zs01_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 32 | : device_secure_serial_flash_config(mconfig, static_alloc_device_config, "ZS01", tag, owner, clock) | |
| 33 | { | |
| 34 | } | |
| 35 | 35 | |
| 36 | st | |
| 36 | void zs01_device_config::static_set_ds2401_tag(device_config *device, const char *ds2401_tag) | |
| 37 | 37 | { |
| 38 | int cs; | |
| 39 | int rst; | |
| 40 | int scl; | |
| 41 | int sdaw; | |
| 42 | int sdar; | |
| 43 | int state; | |
| 44 | int shift; | |
| 45 | int bit; | |
| 46 | int byte; | |
| 47 | UINT8 write_buffer[ SIZE_WRITE_BUFFER ]; | |
| 48 | UINT8 read_buffer[ SIZE_READ_BUFFER ]; | |
| 49 | UINT8 response_key[ SIZE_KEY ]; | |
| 50 | UINT8 *response_to_reset; | |
| 51 | UINT8 *command_key; | |
| 52 | UINT8 *data_key; | |
| 53 | UINT8 *data; | |
| 54 | UINT8 *ds2401; | |
| 55 | zs01_write_handler write; | |
| 56 | zs01_read_handler read; | |
| 57 | }; | |
| 38 | zs01_device_config *zs01 = downcast<zs01_device_config *>(device); | |
| 39 | zs01->ds2401_tag = ds2401_tag; | |
| 40 | } | |
| 58 | 41 | |
| 59 | static struct zs01_chip zs01[ ZS01_MAXCHIP ]; | |
| 42 | device_config *zs01_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 43 | { | |
| 44 | return global_alloc(zs01_device_config(mconfig, tag, owner, clock)); | |
| 45 | } | |
| 60 | 46 | |
| 61 | #define COMMAND_WRITE ( 0x00 ) | |
| 62 | #define COMMAND_READ ( 0x01 ) | |
| 47 | device_t *zs01_device_config::alloc_device(running_machine &machine) const | |
| 48 | { | |
| 49 | return auto_alloc(&machine, zs01_device(machine, *this)); | |
| 50 | } | |
| 63 | 51 | |
| 64 | #define STATE_STOP ( 0 ) | |
| 65 | #define STATE_RESPONSE_TO_RESET ( 1 ) | |
| 66 | #define STATE_LOAD_COMMAND ( 2 ) | |
| 67 | #define STATE_READ_DATA ( 3 ) | |
| 52 | zs01_device::zs01_device(running_machine &_machine, const zs01_device_config &_config) | |
| 53 | : device_secure_serial_flash(_machine, _config), | |
| 54 | config(_config) | |
| 55 | { | |
| 56 | } | |
| 68 | 57 | |
| 69 | void zs01_ | |
| 58 | void zs01_d | |
| 70 | 59 | { |
| 71 | int offset; | |
| 72 | struct zs01_chip *c; | |
| 60 | device_secure_serial_flash::device_start(); | |
| 61 | save_item(NAME(state)); | |
| 62 | save_item(NAME(shift)); | |
| 63 | save_item(NAME(bit)); | |
| 64 | save_item(NAME(byte)); | |
| 65 | save_item(NAME(write_buffer)); | |
| 66 | save_item(NAME(read_buffer)); | |
| 67 | save_item(NAME(response_key)); | |
| 68 | save_item(NAME(response_to_reset)); | |
| 69 | save_item(NAME(command_key)); | |
| 70 | save_item(NAME(data_key)); | |
| 71 | } | |
| 73 | 72 | |
| 74 | if( chip >= ZS01_MAXCHIP ) | |
| 75 | { | |
| 76 | verboselog( machine, 0, "zs01_init( %d ) chip out of range\n", chip ); | |
| 77 | return; | |
| 78 | } | |
| 73 | void zs01_device::device_reset() | |
| 74 | { | |
| 75 | device_secure_serial_flash::device_reset(); | |
| 76 | state = STATE_STOP; | |
| 77 | shift = 0; | |
| 78 | bit = 0; | |
| 79 | byte = 0; | |
| 80 | memset(write_buffer, 0, SIZE_WRITE_BUFFER); | |
| 81 | memset(read_buffer, 0, SIZE_READ_BUFFER); | |
| 82 | memset(response_key, 0, SIZE_KEY); | |
| 83 | } | |
| 79 | 84 | |
| 80 | c = &zs01[ chip ]; | |
| 81 | ||
| 82 | if( data == NULL ) | |
| 85 | void zs01_device::nvram_default() | |
| 86 | { | |
| 87 | // region always wins | |
| 88 | if(m_region) | |
| 83 | 89 | { |
| 84 | data = auto_alloc_array(machine, UINT8, | |
| 85 | SIZE_RESPONSE_TO_RESET + | |
| 86 | SIZE_KEY + | |
| 87 | SIZE_KEY + | |
| 88 | SIZE_DATA ); | |
| 90 | // Ensure the size is correct though | |
| 91 | if(m_region->bytes() != SIZE_RESPONSE_TO_RESET+SIZE_KEY+SIZE_KEY+SIZE_DATA) | |
| 92 | logerror("zs01 %s: Wrong region length for initialization data, expected 0x%x, got 0x%x\n", | |
| 93 | config.tag(), | |
| 94 | SIZE_RESPONSE_TO_RESET+SIZE_KEY+SIZE_KEY+SIZE_DATA, | |
| 95 | m_region->bytes()); | |
| 96 | else { | |
| 97 | UINT8 *rb = m_region->base(); | |
| 98 | int offset = 0; | |
| 99 | memcpy(response_to_reset, rb + offset, SIZE_RESPONSE_TO_RESET); offset += SIZE_RESPONSE_TO_RESET; | |
| 100 | memcpy(command_key, rb + offset, SIZE_KEY); offset += SIZE_KEY; | |
| 101 | memcpy(data_key, rb + offset, SIZE_KEY); offset += SIZE_KEY; | |
| 102 | memcpy(data, rb + offset, SIZE_DATA); offset += SIZE_DATA; | |
| 103 | return; | |
| 104 | } | |
| 89 | 105 | } |
| 90 | 106 | |
| 91 | if( ds2401 == NULL ) | |
| 92 | { | |
| 93 | ds2401 = auto_alloc_array(machine, UINT8, SIZE_DATA_BUFFER ); | |
| 94 | } | |
| 95 | ||
| 96 | c->cs = 0; | |
| 97 | c->rst = 0; | |
| 98 | c->scl = 0; | |
| 99 | c->sdaw = 0; | |
| 100 | c->sdar = 0; | |
| 101 | c->state = STATE_STOP; | |
| 102 | c->shift = 0; | |
| 103 | c->bit = 0; | |
| 104 | c->byte = 0; | |
| 105 | memset( c->write_buffer, 0, SIZE_WRITE_BUFFER ); | |
| 106 | memset( c->read_buffer, 0, SIZE_READ_BUFFER ); | |
| 107 | memset( c->response_key, 0, SIZE_KEY ); | |
| 108 | ||
| 109 | offset = 0; | |
| 110 | c->response_to_reset = &data[ offset ]; offset += SIZE_RESPONSE_TO_RESET; | |
| 111 | c->command_key = &data[ offset ]; offset += SIZE_KEY; | |
| 112 | c->data_key = &data[ offset ]; offset += SIZE_KEY; | |
| 113 | c->data = &data[ offset ]; offset += SIZE_DATA; | |
| 114 | c->ds2401 = ds2401; | |
| 115 | c->write = write; | |
| 116 | c->read = read; | |
| 117 | ||
| 118 | state_save_register_item( machine, "zs01", NULL, chip, c->cs ); | |
| 119 | state_save_register_item( machine, "zs01", NULL, chip, c->rst ); | |
| 120 | state_save_register_item( machine, "zs01", NULL, chip, c->scl ); | |
| 121 | state_save_register_item( machine, "zs01", NULL, chip, c->sdaw ); | |
| 122 | state_save_register_item( machine, "zs01", NULL, chip, c->sdar ); | |
| 123 | state_save_register_item( machine, "zs01", NULL, chip, c->state ); | |
| 124 | state_save_register_item( machine, "zs01", NULL, chip, c->shift ); | |
| 125 | state_save_register_item( machine, "zs01", NULL, chip, c->bit ); | |
| 126 | state_save_register_item( machine, "zs01", NULL, chip, c->byte ); | |
| 127 | state_save_register_item_array( machine, "zs01", NULL, chip, c->write_buffer ); | |
| 128 | state_save_register_item_array( machine, "zs01", NULL, chip, c->read_buffer ); | |
| 129 | state_save_register_item_array( machine, "zs01", NULL, chip, c->response_key ); | |
| 130 | state_save_register_item_pointer( machine, "zs01", NULL, chip, c->response_to_reset, SIZE_RESPONSE_TO_RESET ); | |
| 131 | state_save_register_item_pointer( machine, "zs01", NULL, chip, c->command_key, SIZE_KEY ); | |
| 132 | state_save_register_item_pointer( machine, "zs01", NULL, chip, c->data_key, SIZE_DATA ); | |
| 107 | // That chip isn't really usable without the passwords, so bitch | |
| 108 | // if there's no region | |
| 109 | logerror("zs01 %s: Warning, no default data provided, chip is unusable.\n", config.tag()); | |
| 110 | memset(response_to_reset, 0, SIZE_RESPONSE_TO_RESET); | |
| 111 | memset(command_key, 0, SIZE_KEY); | |
| 112 | memset(data_key, 0, SIZE_KEY); | |
| 113 | memset(data, 0, SIZE_DATA); | |
| 133 | 114 | } |
| 134 | 115 | |
| 135 | void zs01_ | |
| 116 | void zs01_d | |
| 136 | 117 | { |
| 137 | ||
| 118 | } | |
| 138 | 119 | |
| 139 | if( chip >= ZS01_MAXCHIP ) | |
| 140 | { | |
| 141 | verboselog( machine, 0, "zs01_rst_write( %d ) chip out of range\n", chip ); | |
| 142 | return; | |
| 143 | } | |
| 144 | ||
| 145 | c = &zs01[ chip ]; | |
| 146 | ||
| 147 | if( c->rst != rst ) | |
| 148 | { | |
| 149 | verboselog( machine, 2, "zs01(%d) rst=%d\n", chip, rst ); | |
| 150 | } | |
| 151 | if( c->rst == 0 && rst != 0 && c->cs == 0 ) | |
| 152 | { | |
| 153 | verboselog( machine, 1, "zs01(%d) goto response to reset\n", chip ); | |
| 154 | c->state = STATE_RESPONSE_TO_RESET; | |
| 155 | c->bit = 0; | |
| 156 | c->byte = 0; | |
| 157 | } | |
| 158 | c->rst = rst; | |
| 120 | void zs01_device::cs_1() | |
| 121 | { | |
| 159 | 122 | } |
| 160 | 123 | |
| 161 | void zs01_ | |
| 124 | void zs01_d | |
| 162 | 125 | { |
| 163 | ||
| 126 | } | |
| 164 | 127 | |
| 165 | if( chip >= ZS01_MAXCHIP ) | |
| 166 | { | |
| 167 | verboselog( machine, 0, "zs01_cs_write( %d ) chip out of range\n", chip ); | |
| 168 | return; | |
| 128 | void zs01_device::rst_1() | |
| 129 | { | |
| 130 | if(!cs) { | |
| 131 | verboselog(1, "goto response to reset\n"); | |
| 132 | state = STATE_RESPONSE_TO_RESET; | |
| 133 | bit = 0; | |
| 134 | byte = 0; | |
| 169 | 135 | } |
| 170 | ||
| 171 | c = &zs01[ chip ]; | |
| 172 | ||
| 173 | if( c->cs != cs ) | |
| 174 | { | |
| 175 | verboselog( machine, 2, "zs01(%d) cs=%d\n", chip, cs ); | |
| 176 | } | |
| 177 | // if( c->cs != 0 && cs == 0 ) | |
| 178 | // { | |
| 179 | // /* enable chip */ | |
| 180 | // c->state = STATE_STOP; | |
| 181 | // } | |
| 182 | // if( c->cs == 0 && cs != 0 ) | |
| 183 | // { | |
| 184 | // /* disable chip */ | |
| 185 | // c->state = STATE_STOP; | |
| 186 | // /* high impendence? */ | |
| 187 | // c->sdar = 0; | |
| 188 | // } | |
| 189 | c->cs = cs; | |
| 190 | 136 | } |
| 191 | 137 | |
| 192 | ||
| 138 | ||
| 193 | 139 | { |
| 194 | 140 | UINT32 a0; |
| 195 | 141 | UINT32 v1; |
| r10384 | r10385 | |
| 236 | 182 | } |
| 237 | 183 | } |
| 238 | 184 | |
| 239 | ||
| 185 | ||
| 240 | 186 | { |
| 241 | 187 | UINT32 a0; |
| 242 | 188 | UINT32 v1; |
| r10384 | r10385 | |
| 284 | 230 | } |
| 285 | 231 | } |
| 286 | 232 | |
| 287 | ||
| 233 | ||
| 288 | 234 | { |
| 289 | 235 | UINT32 t0; |
| 290 | 236 | UINT32 v0; |
| r10384 | r10385 | |
| 332 | 278 | } |
| 333 | 279 | } |
| 334 | 280 | |
| 335 | ||
| 281 | ||
| 336 | 282 | { |
| 337 | 283 | UINT32 v1; |
| 338 | 284 | UINT32 a3; |
| r10384 | r10385 | |
| 380 | 326 | return v0; |
| 381 | 327 | } |
| 382 | 328 | |
| 383 | ||
| 329 | ||
| 384 | 330 | { |
| 385 | int block = ( ( | |
| 331 | int block = ( ( | |
| 386 | 332 | |
| 387 | 333 | return block * SIZE_DATA_BUFFER; |
| 388 | 334 | } |
| 389 | 335 | |
| 390 | void zs01_ | |
| 336 | void zs01_d | |
| 391 | 337 | { |
| 392 | struct zs01_chip *c; | |
| 393 | ||
| 394 | if( chip >= ZS01_MAXCHIP ) | |
| 395 | { | |
| 396 | verboselog( machine, 0, "zs01_scl_write( %d ) chip out of range\n", chip ); | |
| 397 | return; | |
| 398 | } | |
| 399 | ||
| 400 | c = &zs01[ chip ]; | |
| 401 | ||
| 402 | if( c->scl != scl ) | |
| 403 | { | |
| 404 | verboselog( machine, 2, "zs01(%d) scl=%d\n", chip, scl ); | |
| 405 | } | |
| 406 | if( c->cs == 0 ) | |
| 407 | { | |
| 408 | switch( c->state ) | |
| 409 | { | |
| 338 | if(!cs) { | |
| 339 | switch(state) { | |
| 410 | 340 | case STATE_STOP: |
| 411 | 341 | break; |
| 412 | 342 | |
| 413 | 343 | case STATE_RESPONSE_TO_RESET: |
| 414 | if( c->scl != 0 && scl == 0 ) | |
| 415 | { | |
| 416 | if( c->bit == 0 ) | |
| 417 | { | |
| 418 | c->shift = c->response_to_reset[ c->byte ]; | |
| 419 | verboselog( machine, 1, "zs01(%d) <- response_to_reset[%d]: %02x\n", chip, c->byte, c->shift ); | |
| 420 | } | |
| 344 | if(!bit) { | |
| 345 | shift = response_to_reset[byte]; | |
| 346 | verboselog(1, "<- response_to_reset[%d]: %02x\n", byte, shift); | |
| 347 | } | |
| 421 | 348 | |
| 422 | c->sdar = ( c->shift >> 7 ) & 1; | |
| 423 | c->shift <<= 1; | |
| 424 | c->bit++; | |
| 349 | sdar = (shift >> 7) & 1; | |
| 350 | shift <<= 1; | |
| 351 | bit++; | |
| 425 | 352 | |
| 426 | if( c->bit == 8 ) | |
| 427 | { | |
| 428 | c->bit = 0; | |
| 429 | c->byte++; | |
| 430 | if( c->byte == 4 ) | |
| 431 | { | |
| 432 | c->sdar = 1; | |
| 433 | verboselog( machine, 1, "zs01(%d) goto stop\n", chip ); | |
| 434 | c->state = STATE_STOP; | |
| 435 | } | |
| 353 | if( bit == 8 ) { | |
| 354 | bit = 0; | |
| 355 | byte++; | |
| 356 | if( byte == 4 ) { | |
| 357 | sdar = true; | |
| 358 | verboselog(1, "goto stop\n"); | |
| 359 | state = STATE_STOP; | |
| 436 | 360 | } |
| 437 | 361 | } |
| 438 | 362 | break; |
| 439 | 363 | |
| 440 | 364 | case STATE_LOAD_COMMAND: |
| 441 | if( c->scl == 0 && scl != 0 ) | |
| 442 | { | |
| 443 | if( c->bit < 8 ) | |
| 444 | { | |
| 445 | verboselog( machine, 2, "zs01(%d) clock\n", chip ); | |
| 446 | c->shift <<= 1; | |
| 447 | if( c->sdaw != 0 ) | |
| 448 | { | |
| 449 | c->shift |= 1; | |
| 450 | } | |
| 451 | c->bit++; | |
| 452 | } | |
| 453 | else | |
| 454 | { | |
| 455 | c->sdar = 0; | |
| 365 | break; | |
| 456 | 366 | |
| 457 | switch( c->state ) | |
| 458 | { | |
| 459 | case STATE_LOAD_COMMAND: | |
| 460 | c->write_buffer[ c->byte ] = c->shift; | |
| 461 | verboselog( machine, 2, "zs01(%d) -> write_buffer[%d]: %02x\n", chip, c->byte, c->write_buffer[ c->byte ] ); | |
| 367 | case STATE_READ_DATA: | |
| 368 | break; | |
| 369 | } | |
| 370 | } | |
| 371 | } | |
| 462 | 372 | |
| 463 | c->byte++; | |
| 464 | if( c->byte == SIZE_WRITE_BUFFER ) | |
| 465 | { | |
| 466 | UINT16 crc; | |
| 373 | void zs01_device::scl_1() | |
| 374 | { | |
| 375 | if(!cs) { | |
| 376 | switch(state) { | |
| 377 | case STATE_STOP: | |
| 378 | break; | |
| 467 | 379 | |
| 468 | zs01_decrypt( c->write_buffer, c->write_buffer, SIZE_WRITE_BUFFER, c->command_key, 0xff ); | |
| 380 | case STATE_RESPONSE_TO_RESET: | |
| 381 | break; | |
| 469 | 382 | |
| 470 | if( ( c->write_buffer[ 0 ] & 4 ) != 0 ) | |
| 471 | { | |
| 472 | zs01_decrypt2( &c->write_buffer[ 2 ], &c->write_buffer[ 2 ], SIZE_DATA_BUFFER, c->data_key, 0x00 ); | |
| 473 | } | |
| 383 | case STATE_LOAD_COMMAND: | |
| 384 | if(bit < 8) { | |
| 385 | shift <<= 1; | |
| 386 | if(sdaw) | |
| 387 | shift |= 1; | |
| 388 | bit++; | |
| 389 | verboselog(2, "clock %d %02x\n", bit, shift); | |
| 390 | } else { | |
| 391 | sdar = false; | |
| 474 | 392 | |
| 475 | crc = zs01_crc( c->write_buffer, 10 ); | |
| 393 | switch(state) { | |
| 394 | case STATE_LOAD_COMMAND: | |
| 395 | write_buffer[byte] = shift; | |
| 396 | verboselog(2, "-> write_buffer[%d]: %02x\n", byte, write_buffer[byte]); | |
| 397 | byte++; | |
| 398 | if(byte == SIZE_WRITE_BUFFER) { | |
| 399 | UINT16 crc; | |
| 476 | 400 | |
| 477 | if( crc == ( ( c->write_buffer[ 10 ] << 8 ) | c->write_buffer[ 11 ] ) ) | |
| 478 | { | |
| 479 | verboselog( machine, 1, "zs01(%d) -> command: %02x\n", chip, c->write_buffer[ 0 ] ); | |
| 480 | verboselog( machine, 1, "zs01(%d) -> address: %02x\n", chip, c->write_buffer[ 1 ] ); | |
| 481 | verboselog( machine, 1, "zs01(%d) -> data: %02x%02x%02x%02x%02x%02x%02x%02x\n", chip, | |
| 482 | c->write_buffer[ 2 ], c->write_buffer[ 3 ], c->write_buffer[ 4 ], c->write_buffer[ 5 ], | |
| 483 | c->write_buffer[ 6 ], c->write_buffer[ 7 ], c->write_buffer[ 8 ], c->write_buffer[ 9 ] ); | |
| 484 | verboselog( machine, 1, "zs01(%d) -> crc: %02x%02x\n", chip, c->write_buffer[ 10 ], c->write_buffer[ 11 ] ); | |
| 401 | decrypt(write_buffer, write_buffer, SIZE_WRITE_BUFFER, command_key, 0xff); | |
| 485 | 402 | |
| 486 | switch( c->write_buffer[ 0 ] & 1 ) | |
| 487 | { | |
| 488 | case COMMAND_WRITE: | |
| 489 | memcpy( &c->data[ zs01_data_offset( c ) ], &c->write_buffer[ 2 ], SIZE_DATA_BUFFER ); | |
| 403 | if(write_buffer[0] & 4) | |
| 404 | decrypt2(&write_buffer[2], &write_buffer[2], SIZE_DATA_BUFFER, data_key, 0x00); | |
| 490 | 405 | |
| 491 | /* todo: find out what should be returned. */ | |
| 492 | memset( &c->read_buffer[ 0 ], 0, SIZE_WRITE_BUFFER ); | |
| 493 | break; | |
| 406 | crc = do_crc(write_buffer, 10); | |
| 494 | 407 | |
| 495 | case COMMAND_READ: | |
| 496 | /* todo: find out what should be returned. */ | |
| 497 | memset( &c->read_buffer[ 0 ], 0, 2 ); | |
| 408 | if(crc == ((write_buffer[10] << 8) | write_buffer[11])) { | |
| 409 | verboselog(1, "-> command: %02x\n", write_buffer[0]); | |
| 410 | verboselog(1, "-> address: %02x\n", write_buffer[1]); | |
| 411 | verboselog(1, "-> data: %02x%02x%02x%02x%02x%02x%02x%02x\n", | |
| 412 | write_buffer[2], write_buffer[3], write_buffer[4], write_buffer[5], | |
| 413 | write_buffer[6], write_buffer[7], write_buffer[8], write_buffer[9]); | |
| 414 | verboselog(1, "-> crc: %02x%02x\n", write_buffer[10], write_buffer[11]); | |
| 415 | switch(write_buffer[0] & 1) { | |
| 416 | case COMMAND_WRITE: | |
| 417 | memcpy(&data[data_offset()], &write_buffer[2], SIZE_DATA_BUFFER); | |
| 418 | ||
| 419 | /* todo: find out what should be returned. */ | |
| 420 | memset(&read_buffer[0] , 0, SIZE_WRITE_BUFFER); | |
| 421 | break; | |
| 498 | 422 | |
| 499 | switch( c->write_buffer[ 1 ] ) | |
| 500 | { | |
| 501 | case 0xfd: | |
| 502 | { | |
| 503 | /* TODO: use read/write to talk to the ds2401, which will require a timer. */ | |
| 504 | int i; | |
| 505 | for( i = 0; i < SIZE_DATA_BUFFER; i++ ) | |
| 506 | { | |
| 507 | c->read_buffer[ 2 + i ] = c->ds2401[ SIZE_DATA_BUFFER - i - 1 ]; | |
| 508 | } | |
| 509 | } | |
| 510 | break; | |
| 511 | default: | |
| 512 | memcpy( &c->read_buffer[ 2 ], &c->data[ zs01_data_offset( c ) ], SIZE_DATA_BUFFER ); | |
| 513 | break; | |
| 514 | } | |
| 423 | case COMMAND_READ: | |
| 424 | /* todo: find out what should be returned. */ | |
| 425 | memset(&read_buffer[0], 0, 2); | |
| 515 | 426 | |
| 516 | memcpy( c->response_key, &c->write_buffer[ 2 ], SIZE_KEY ); | |
| 427 | switch(write_buffer[1]) { | |
| 428 | case 0xfd: { | |
| 429 | /* TODO: use read/write to talk to the ds2401, which will require a timer. */ | |
| 430 | ds2401_device *ds2401 = machine->device<ds2401_device>(config.ds2401_tag); | |
| 431 | for(int i = 0; i < SIZE_DATA_BUFFER; i++) | |
| 432 | read_buffer[2+i] = ds2401->direct_read(SIZE_DATA_BUFFER-i-1); | |
| 517 | 433 | break; |
| 518 | 434 | } |
| 519 | } | |
| 520 | else | |
| 521 | { | |
| 522 | verboselog( machine, 0, "zs01(%d) bad crc\n", chip ); | |
| 435 | default: | |
| 436 | memcpy(&read_buffer[2], &data[data_offset()], SIZE_DATA_BUFFER); | |
| 437 | break; | |
| 438 | } | |
| 523 | 439 | |
| 524 | /* todo: find out what should be returned. */ | |
| 525 | memset( &c->read_buffer[ 0 ], 0xff, 2 ); | |
| 440 | memcpy(response_key, &write_buffer[2], SIZE_KEY); | |
| 441 | break; | |
| 526 | 442 | } |
| 443 | } else { | |
| 444 | verboselog(0, "bad crc\n"); | |
| 445 | /* todo: find out what should be returned. */ | |
| 446 | memset(&read_buffer[0], 0xff, 2 ); | |
| 447 | } | |
| 527 | 448 | |
| 528 | verboselog( machine, 1, "zs01(%d) <- status: %02x%02x\n", chip, | |
| 529 | c->read_buffer[ 0 ], c->read_buffer[ 1 ] ); | |
| 449 | verboselog(1, "<- status: %02x%02x\n", | |
| 450 | read_buffer[0], read_buffer[1]); | |
| 530 | 451 | |
| 531 | verboselog( machine, 1, "zs01(%d) <- data: %02x%02x%02x%02x%02x%02x%02x%02x\n", chip, | |
| 532 | c->read_buffer[ 2 ], c->read_buffer[ 3 ], c->read_buffer[ 4 ], c->read_buffer[ 5 ], | |
| 533 | c->read_buffer[ 6 ], c->read_buffer[ 7 ], c->read_buffer[ 8 ], c->read_buffer[ 9 ] ); | |
| 452 | verboselog(1, "<- data: %02x%02x%02x%02x%02x%02x%02x%02x\n", | |
| 453 | read_buffer[2], read_buffer[3], read_buffer[4], read_buffer[5], | |
| 454 | read_buffer[6], read_buffer[7], read_buffer[8], read_buffer[9]); | |
| 534 | 455 | |
| 535 | crc = zs01_crc( c->read_buffer, 10 ); | |
| 536 | c->read_buffer[ 10 ] = crc >> 8; | |
| 537 | c->read_buffer[ 11 ] = crc & 255; | |
| 456 | crc = do_crc(read_buffer, 10); | |
| 457 | read_buffer[10] = crc >> 8; | |
| 458 | read_buffer[11] = crc & 255; | |
| 538 | 459 | |
| 539 | | |
| 460 | | |
| 540 | 461 | |
| 541 | c->byte = 0; | |
| 542 | c->state = STATE_READ_DATA; | |
| 543 | } | |
| 544 | break; | |
| 462 | byte = 0; | |
| 463 | state = STATE_READ_DATA; | |
| 545 | 464 | } |
| 546 | ||
| 547 | c->bit = 0; | |
| 548 | c->shift = 0; | |
| 465 | break; | |
| 549 | 466 | } |
| 467 | ||
| 468 | bit = 0; | |
| 469 | shift = 0; | |
| 550 | 470 | } |
| 551 | 471 | break; |
| 552 | 472 | |
| 553 | 473 | case STATE_READ_DATA: |
| 554 | if( c->scl == 0 && scl != 0 ) | |
| 555 | { | |
| 556 | if( c->bit < 8 ) | |
| 557 | { | |
| 558 | if( c->bit == 0 ) | |
| 559 | { | |
| 560 | switch( c->state ) | |
| 561 | { | |
| 562 | case STATE_READ_DATA: | |
| 563 | c->shift = c->read_buffer[ c->byte ]; | |
| 564 | verboselog( machine, 2, "zs01(%d) <- read_buffer[%d]: %02x\n", chip, c->byte, c->shift ); | |
| 565 | break; | |
| 566 | } | |
| 474 | if(bit < 8) { | |
| 475 | if(bit == 0) { | |
| 476 | switch(state) { | |
| 477 | case STATE_READ_DATA: | |
| 478 | shift = read_buffer[byte]; | |
| 479 | verboselog(2, "<- read_buffer[%d]: %02x\n", byte, shift); | |
| 480 | break; | |
| 567 | 481 | } |
| 568 | c->sdar = ( c->shift >> 7 ) & 1; | |
| 569 | c->shift <<= 1; | |
| 570 | c->bit++; | |
| 571 | 482 | } |
| 572 | else | |
| 573 | { | |
| 574 | c->bit = 0; | |
| 575 | c->sdar = 0; | |
| 576 | if( c->sdaw == 0 ) | |
| 577 | { | |
| 578 | verboselog( machine, 2, "zs01(%d) ack <-\n", chip ); | |
| 579 | c->byte++; | |
| 580 | if( c->byte == SIZE_READ_BUFFER ) | |
| 581 | { | |
| 582 | c->byte = 0; | |
| 583 | c->sdar = 1; | |
| 584 | c->state = STATE_LOAD_COMMAND; | |
| 585 | } | |
| 483 | sdar = (shift >> 7) & 1; | |
| 484 | shift <<= 1; | |
| 485 | bit++; | |
| 486 | } else { | |
| 487 | bit = 0; | |
| 488 | sdar = false; | |
| 489 | if(!sdaw) { | |
| 490 | verboselog(2, "ack <-\n"); | |
| 491 | byte++; | |
| 492 | if(byte == SIZE_READ_BUFFER) { | |
| 493 | byte = 0; | |
| 494 | sdar = true; | |
| 495 | state = STATE_LOAD_COMMAND; | |
| 586 | 496 | } |
| 587 | else | |
| 588 | { | |
| 589 | verboselog( machine, 2, "zs01(%d) nak <-\n", chip ); | |
| 590 | } | |
| 497 | } else { | |
| 498 | verboselog(2, "nak <-\n"); | |
| 591 | 499 | } |
| 592 | 500 | } |
| 593 | 501 | break; |
| 594 | 502 | } |
| 595 | 503 | } |
| 596 | c->scl = scl; | |
| 597 | 504 | } |
| 598 | 505 | |
| 599 | void zs01_ | |
| 506 | void zs01_ | |
| 600 | 507 | { |
| 601 | struct zs01_chip *c; | |
| 602 | ||
| 603 | if( chip >= ZS01_MAXCHIP ) | |
| 604 | { | |
| 605 | verboselog( machine, 0, "zs01_sda_write( %d ) chip out of range\n", chip ); | |
| 606 | return; | |
| 508 | if(!cs && scl){ | |
| 509 | // state = STATE_STOP; | |
| 510 | // sdar = false; | |
| 607 | 511 | } |
| 608 | ||
| 609 | c = &zs01[ chip ]; | |
| 610 | ||
| 611 | if( c->sdaw != sda ) | |
| 612 | { | |
| 613 | verboselog( machine, 2, "zs01(%d) sdaw=%d\n", chip, sda ); | |
| 614 | } | |
| 615 | if( c->cs == 0 && c->scl != 0 ) | |
| 616 | { | |
| 617 | // if( c->sdaw == 0 && sda != 0 ) | |
| 618 | // { | |
| 619 | // verboselog( machine, 1, "zs01(%d) goto stop\n", chip ); | |
| 620 | // c->state = STATE_STOP; | |
| 621 | // c->sdar = 0; | |
| 622 | // } | |
| 623 | if( c->sdaw != 0 && sda == 0 ) | |
| 624 | { | |
| 625 | switch( c->state ) | |
| 626 | { | |
| 627 | case STATE_STOP: | |
| 628 | verboselog( machine, 1, "zs01(%d) goto start\n", chip ); | |
| 629 | c->state = STATE_LOAD_COMMAND; | |
| 630 | break; | |
| 631 | ||
| 632 | // default: | |
| 633 | // verboselog( machine, 1, "zs01(%d) skipped start (default)\n", chip ); | |
| 634 | // break; | |
| 635 | } | |
| 636 | ||
| 637 | c->bit = 0; | |
| 638 | c->byte = 0; | |
| 639 | c->shift = 0; | |
| 640 | c->sdar = 0; | |
| 641 | } | |
| 642 | } | |
| 643 | c->sdaw = sda; | |
| 644 | 512 | } |
| 645 | 513 | |
| 646 | i | |
| 514 | void | |
| 647 | 515 | { |
| 648 | struct zs01_chip *c; | |
| 516 | if(!cs && scl) { | |
| 517 | switch(state) { | |
| 518 | case STATE_STOP: | |
| 519 | verboselog(1, "goto start\n"); | |
| 520 | state = STATE_LOAD_COMMAND; | |
| 521 | break; | |
| 522 | // default: | |
| 523 | // verboselog(1, "skipped start (default)\n"); | |
| 524 | // break; | |
| 525 | } | |
| 649 | 526 | |
| 650 | if( chip >= ZS01_MAXCHIP ) | |
| 651 | { | |
| 652 | verboselog( machine, 0, "zs01_sda_read( %d ) chip out of range\n", chip ); | |
| 653 | return 1; | |
| 527 | bit = 0; | |
| 528 | byte = 0; | |
| 529 | shift = 0; | |
| 530 | sdar = false; | |
| 654 | 531 | } |
| 655 | ||
| 656 | c = &zs01[ chip ]; | |
| 657 | if( c->cs != 0 ) | |
| 658 | { | |
| 659 | verboselog( machine, 2, "zs01(%d) not selected\n", chip ); | |
| 660 | return 1; | |
| 661 | } | |
| 662 | verboselog( machine, 2, "zs01(%d) sdar=%d\n", chip, c->sdar ); | |
| 663 | ||
| 664 | return c->sdar; | |
| 665 | 532 | } |
| 666 | 533 | |
| 667 | ||
| 534 | ||
| 668 | 535 | { |
| 669 | struct zs01_chip *c; | |
| 670 | ||
| 671 | if( chip >= ZS01_MAXCHIP ) | |
| 672 | { | |
| 673 | verboselog( machine, 0, "nvram_handler_zs01( %d ) chip out of range\n", chip ); | |
| 674 | return; | |
| 675 | } | |
| 676 | ||
| 677 | c = &zs01[ chip ]; | |
| 678 | ||
| 679 | if( read_or_write ) | |
| 680 | { | |
| 681 | mame_fwrite( file, c->data, SIZE_DATA ); | |
| 682 | } | |
| 683 | else if( file ) | |
| 684 | { | |
| 685 | mame_fread( file, c->data, SIZE_DATA ); | |
| 686 | } | |
| 536 | file.read(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 537 | file.read(command_key, SIZE_KEY); | |
| 538 | file.read(data_key, SIZE_KEY); | |
| 539 | file.read(data, SIZE_DATA); | |
| 687 | 540 | } |
| 688 | 541 | |
| 689 | NVRAM_HANDLER( zs01_0 ) { nvram_handler_zs01( machine, file, read_or_write, 0 ); } | |
| 690 | NVRAM_HANDLER( zs01_1 ) { nvram_handler_zs01( machine, file, read_or_write, 1 ); } | |
| 542 | void zs01_device::nvram_write(emu_file &file) | |
| 543 | { | |
| 544 | file.write(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 545 | file.write(command_key, SIZE_KEY); | |
| 546 | file.write(data_key, SIZE_KEY); | |
| 547 | file.write(data, SIZE_DATA); | |
| 548 | } |
| r10384 | r10385 | |
|---|---|---|
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | #if !defined( ZS01_H ) | |
| 8 | #ifndef __ZS01_H__ | |
| 9 | #define __ZS01_H__ | |
| 9 | 10 | |
| 10 | #define ZS01_MAXCHIP ( 2 ) | |
| 11 | #define MCFG_ZS01_ADD(_tag, ds2401_tag) \ | |
| 12 | MCFG_DEVICE_ADD(_tag, ZS01, 0) \ | |
| 13 | zs01_device_config::static_set_ds2401_tag(device, ds2401_tag); \ | |
| 11 | 14 | |
| 12 | typedef void (*zs01_write_handler)( running_machine *machine, int pin, int value ); | |
| 13 | typedef int (*zs01_read_handler)( running_machine *machine, int pin ); | |
| 15 | #include "machine/secflash.h" | |
| 14 | 16 | |
| 15 | extern void zs01_init( running_machine *machine, int chip, UINT8 *data, zs01_write_handler write, zs01_read_handler read, UINT8 *ds2401 ); | |
| 16 | extern void zs01_cs_write( running_machine *machine, int chip, int cs ); | |
| 17 | extern void zs01_rst_write( running_machine *machine, int chip, int rst ); | |
| 18 | extern void zs01_scl_write( running_machine *machine, int chip, int scl ); | |
| 19 | extern void zs01_sda_write( running_machine *machine, int chip, int sda ); | |
| 20 | extern int zs01_sda_read( running_machine *machine, int chip ); | |
| 21 | extern NVRAM_HANDLER( zs01_0 ); | |
| 22 | extern NVRAM_HANDLER( zs01_1 ); | |
| 17 | class zs01_device_config : public device_secure_serial_flash_config | |
| 18 | { | |
| 19 | friend class zs01_device; | |
| 23 | 20 | |
| 24 | #define ZS01_H | |
| 21 | // construction/destruction | |
| 22 | zs01_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 23 | ||
| 24 | public: | |
| 25 | // allocators | |
| 26 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 27 | ||
| 28 | // inline configuration helpers | |
| 29 | static void static_set_ds2401_tag(device_config *device, const char *ds2401_tag); | |
| 30 | ||
| 31 | virtual device_t *alloc_device(running_machine &machine) const; | |
| 32 | ||
| 33 | protected: | |
| 34 | // internal state | |
| 35 | const char *ds2401_tag; | |
| 36 | }; | |
| 37 | ||
| 38 | class zs01_device : public device_secure_serial_flash | |
| 39 | { | |
| 40 | friend class zs01_device_config; | |
| 41 | ||
| 42 | // construction/destruction | |
| 43 | zs01_device(running_machine &_machine, const zs01_device_config &config); | |
| 44 | ||
| 45 | protected: | |
| 46 | // device-level overrides | |
| 47 | virtual void device_start(); | |
| 48 | virtual void device_reset(); | |
| 49 | ||
| 50 | // device_nvram_interface overrides | |
| 51 | virtual void nvram_default(); | |
| 52 | virtual void nvram_read(emu_file &file); | |
| 53 | virtual void nvram_write(emu_file &file); | |
| 54 | ||
| 55 | // device_secure_serial_flash implementations | |
| 56 | virtual void cs_0(); | |
| 57 | virtual void cs_1(); | |
| 58 | virtual void rst_0(); | |
| 59 | virtual void rst_1(); | |
| 60 | virtual void scl_0(); | |
| 61 | virtual void scl_1(); | |
| 62 | virtual void sda_0(); | |
| 63 | virtual void sda_1(); | |
| 64 | ||
| 65 | // internal state | |
| 66 | const zs01_device_config &config; | |
| 67 | ||
| 68 | enum { | |
| 69 | SIZE_WRITE_BUFFER = 12, | |
| 70 | SIZE_READ_BUFFER = 12, | |
| 71 | SIZE_DATA_BUFFER = 8, | |
| 72 | SIZE_RESPONSE_TO_RESET = 4, | |
| 73 | SIZE_KEY = 8, | |
| 74 | SIZE_DATA = 4096, | |
| 75 | ||
| 76 | COMMAND_WRITE = 0x00, | |
| 77 | COMMAND_READ = 0x01 | |
| 78 | }; | |
| 79 | ||
| 80 | enum { | |
| 81 | STATE_STOP, | |
| 82 | STATE_RESPONSE_TO_RESET, | |
| 83 | STATE_LOAD_COMMAND, | |
| 84 | STATE_READ_DATA | |
| 85 | }; | |
| 86 | ||
| 87 | int state, bit, byte; | |
| 88 | UINT8 shift; | |
| 89 | UINT8 write_buffer[SIZE_WRITE_BUFFER]; | |
| 90 | UINT8 read_buffer[SIZE_READ_BUFFER]; | |
| 91 | UINT8 response_key[SIZE_KEY]; | |
| 92 | UINT8 response_to_reset[SIZE_RESPONSE_TO_RESET]; | |
| 93 | UINT8 command_key[SIZE_KEY]; | |
| 94 | UINT8 data_key[SIZE_KEY]; | |
| 95 | UINT8 data[SIZE_DATA]; | |
| 96 | ||
| 97 | void decrypt(UINT8 *destination, UINT8 *source, int length, UINT8 *key, UINT8 previous_byte); | |
| 98 | void decrypt2(UINT8 *destination, UINT8 *source, int length, UINT8 *key, UINT8 previous_byte); | |
| 99 | void encrypt(UINT8 *destination, UINT8 *source, int length, UINT8 *key, UINT32 previous_byte); | |
| 100 | UINT16 do_crc(UINT8 *buffer, UINT32 length); | |
| 101 | int data_offset(); | |
| 102 | ||
| 103 | private: | |
| 104 | inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ...); | |
| 105 | }; | |
| 106 | ||
| 107 | ||
| 108 | // device type definition | |
| 109 | extern const device_type ZS01; | |
| 110 | ||
| 25 | 111 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 580 | 580 | { |
| 581 | 581 | UINT64 ret; |
| 582 | 582 | |
| 583 | ret = x76f100_ | |
| 583 | ret = device->machine->device<x76f100_ | |
| 584 | 584 | |
| 585 | 585 | return ret << 32; |
| 586 | 586 | } |
| r10384 | r10385 | |
| 903 | 903 | { |
| 904 | 904 | if(ACCESSING_BITS_0_15) |
| 905 | 905 | { |
| 906 | running_machine *machine = device->machine; | |
| 907 | ||
| 906 | x76f100_device *x76f100 = device->machine->device<x76f100_device>("naomibd_eeprom"); | |
| 908 | 907 | // NAOMI_BOARDID_WRITE |
| 909 | x76f100_cs_write(machine, 0, (data >> 2) & 1 ); | |
| 910 | x76f100_rst_write(machine, 0, (data >> 3) & 1 ); | |
| 911 | x76f100_scl_write(machine, 0, (data >> 1) & 1 ); | |
| 912 | x76f100_sda_write(machine, 0, (data >> 0) & 1 ); | |
| 908 | x76f100->cs_w((data >> 2) & 1); | |
| 909 | x76f100->rst_w((data >> 3) & 1); | |
| 910 | x76f100->scl_w((data >> 1) & 1); | |
| 911 | x76f100->sda_w((data >> 0) & 1); | |
| 913 | 912 | } |
| 914 | 913 | } |
| 915 | 914 | break; |
| r10384 | r10385 | |
| 1850 | 1849 | |
| 1851 | 1850 | |
| 1852 | 1851 | /*------------------------------------------------- |
| 1853 | device nvram callback | |
| 1854 | -------------------------------------------------*/ | |
| 1855 | ||
| 1856 | ||
| 1857 | static DEVICE_NVRAM( naomibd ) | |
| 1858 | { | |
| 1859 | //naomibd_state *v = get_safe_token(device); | |
| 1860 | static const UINT8 eeprom_romboard[20+48] = | |
| 1861 | { | |
| 1862 | 0x19,0x00,0xaa,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,0x79,0x68,0x6b,0x74,0x6d,0x68,0x6d, | |
| 1863 | 0xa1,0x09,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | |
| 1864 | 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | |
| 1865 | 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30 | |
| 1866 | }; | |
| 1867 | UINT8 *games_contents; | |
| 1868 | ||
| 1869 | if (read_or_write) | |
| 1870 | /*eeprom_save(file)*/; | |
| 1871 | else | |
| 1872 | { | |
| 1873 | /*if (file) | |
| 1874 | eeprom_load(file); | |
| 1875 | else*/ | |
| 1876 | games_contents = device->machine->region("naomibd_eeprom")->base(); | |
| 1877 | ||
| 1878 | if (games_contents) | |
| 1879 | { | |
| 1880 | x76f100_init( device->machine, 0, games_contents ); | |
| 1881 | } | |
| 1882 | else | |
| 1883 | { | |
| 1884 | UINT8 *eeprom = auto_alloc_array_clear(device->machine, UINT8, 0x84); | |
| 1885 | memcpy(eeprom, eeprom_romboard, sizeof(eeprom_romboard)); | |
| 1886 | x76f100_init( device->machine, 0, eeprom ); | |
| 1887 | } | |
| 1888 | ||
| 1889 | } | |
| 1890 | } | |
| 1891 | ||
| 1892 | /*------------------------------------------------- | |
| 1893 | 1852 | device get info callback |
| 1894 | 1853 | -------------------------------------------------*/ |
| 1895 | 1854 | |
| r10384 | r10385 | |
| 1910 | 1869 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(naomibd); break; |
| 1911 | 1870 | case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME(naomibd); break; |
| 1912 | 1871 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(naomibd); break; |
| 1913 | case DEVINFO_FCT_NVRAM: info->nvram = DEVICE_NVRAM_NAME(naomibd); break; | |
| 1914 | 1872 | |
| 1915 | 1873 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1916 | 1874 | case DEVINFO_STR_NAME: |
| r10384 | r10385 | |
| 1930 | 1888 | } |
| 1931 | 1889 | |
| 1932 | 1890 | |
| 1933 | DEFINE_LEGACY_ | |
| 1891 | DEFINE_LEGACY_ |
| r10384 | r10385 | |
|---|---|---|
| 1700 | 1700 | if (smsgg_backupram!=NULL) |
| 1701 | 1701 | { |
| 1702 | 1702 | if (read_or_write) |
| 1703 | | |
| 1703 | | |
| 1704 | 1704 | else |
| 1705 | 1705 | { |
| 1706 | 1706 | if (file) |
| 1707 | 1707 | { |
| 1708 | | |
| 1708 | | |
| 1709 | 1709 | } |
| 1710 | 1710 | } |
| 1711 | 1711 | } |
| r10384 | r10385 | |
|---|---|---|
| 2447 | 2447 | { |
| 2448 | 2448 | case 0x02: // Read from NVRAM |
| 2449 | 2449 | { |
| 2450 | mame_file *f; | |
| 2451 | if ((f = nvram_fopen(machine, OPEN_FLAG_READ)) != 0) | |
| 2452 | { | |
| 2453 | mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2454 | mame_fclose(f); | |
| 2455 | } | |
| 2450 | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); | |
| 2456 | 2451 | logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2); |
| 2457 | 2452 | } |
| 2458 | 2453 | break; |
| 2459 | 2454 | |
| 2460 | 2455 | case 0x42: // Write to NVRAM |
| 2461 | 2456 | { |
| 2462 | mame_file *f; | |
| 2463 | if ((f = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)) != 0) | |
| 2464 | { | |
| 2465 | mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2466 | mame_fclose(f); | |
| 2467 | } | |
| 2457 | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); | |
| 2468 | 2458 | logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2); |
| 2469 | 2459 | } |
| 2470 | 2460 | break; |
| r10384 | r10385 | |
| 2506 | 2496 | |
| 2507 | 2497 | case 0x02: // Read from NVRAM |
| 2508 | 2498 | { |
| 2509 | mame_file *f; | |
| 2510 | if ((f = nvram_fopen(machine, OPEN_FLAG_READ)) != 0) | |
| 2511 | { | |
| 2512 | mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2513 | mame_fclose(f); | |
| 2514 | } | |
| 2499 | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); | |
| 2515 | 2500 | logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2); |
| 2516 | 2501 | } |
| 2517 | 2502 | break; |
| 2518 | 2503 | |
| 2519 | 2504 | case 0x42: // Write to NVRAM |
| 2520 | 2505 | { |
| 2521 | mame_file *f; | |
| 2522 | if ((f = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)) != 0) | |
| 2523 | { | |
| 2524 | mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2525 | mame_fclose(f); | |
| 2526 | } | |
| 2506 | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); | |
| 2527 | 2507 | logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2); |
| 2528 | 2508 | } |
| 2529 | 2509 | break; |
| 2530 | 2510 | |
| 2531 | 2511 | case 0x43: // Initialize NVRAM - MCU writes Default Data Set directly to NVRAM |
| 2532 | 2512 | { |
| 2533 | mame_file *f; | |
| 2534 | if ((f = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)) != 0) | |
| 2535 | { | |
| 2536 | mame_fwrite(f, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); | |
| 2537 | mame_fclose(f); | |
| 2538 | } | |
| 2513 | memcpy(kaneko16_nvram_save, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); | |
| 2539 | 2514 | logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2); |
| 2540 | 2515 | } |
| 2541 | 2516 | break; |
| r10384 | r10385 | |
| 2601 | 2576 | |
| 2602 | 2577 | case 0x02: // Read from NVRAM |
| 2603 | 2578 | { |
| 2604 | mame_file *f; | |
| 2605 | if ((f = nvram_fopen(machine, OPEN_FLAG_READ)) != 0) | |
| 2606 | { | |
| 2607 | mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2608 | mame_fclose(f); | |
| 2609 | } | |
| 2579 | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); | |
| 2610 | 2580 | } |
| 2611 | 2581 | break; |
| 2612 | 2582 | |
| 2613 | 2583 | case 0x42: // Write to NVRAM |
| 2614 | 2584 | { |
| 2615 | mame_file *f; | |
| 2616 | if ((f = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)) != 0) | |
| 2617 | { | |
| 2618 | mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128); | |
| 2619 | mame_fclose(f); | |
| 2620 | } | |
| 2585 | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); | |
| 2621 | 2586 | } |
| 2622 | 2587 | break; |
| 2623 | 2588 |
| r10384 | r10385 | |
|---|---|---|
| 1494 | 1494 | DRIVER( archrivl2 ) /* (c) 1989 */ |
| 1495 | 1495 | DRIVER( trisport ) /* (c) 1989 */ |
| 1496 | 1496 | DRIVER( pigskin ) /* (c) 1990 */ |
| 1497 | DRIVER( pigskina ) /* (c) 1990 */ | |
| 1497 | 1498 | |
| 1498 | 1499 | /* Bally / Sente games */ |
| 1499 | 1500 | DRIVER( sentetst ) |
| r10384 | r10385 | |
| 5752 | 5753 | DRIVER( prmrsocr ) /* GX101 (c) 1993 (Europe) */ |
| 5753 | 5754 | DRIVER( prmrsocrj ) /* GX101 (c) 1993 (Japan) */ |
| 5754 | 5755 | DRIVER( qgakumon ) /* GX248 (c) 1993 (Japan) */ |
| 5755 | DRIVER( moo ) /* GX151 (c) 1992 (World) */ | |
| 5756 | DRIVER( mooua ) /* GX151 (c) 1992 (US) */ | |
| 5757 | DRIVER( mooaa ) /* GX151 (c) 1992 (US) */ | |
| 5758 | DRIVER( moobl ) /* bootleg */ | |
| 5756 | DRIVER( moomesa ) /* GX151 (c) 1992 (World) */ | |
| 5757 | DRIVER( moomesau ) /* GX151 (c) 1992 (US) */ | |
| 5758 | DRIVER( moomesaua ) /* GX151 (c) 1992 (US) */ | |
| 5759 | DRIVER( moomesaa ) /* GX151 (c) 1992 (Asia) */ | |
| 5760 | DRIVER( moomesabl ) /* bootleg */ | |
| 5759 | 5761 | DRIVER( bucky ) /* GX173 (c) 1992 (World) */ |
| 5760 | 5762 | DRIVER( buckyua ) /* GX173 (c) 1992 (US) */ |
| 5761 | 5763 | DRIVER( buckyaa ) /* GX173 (c) 1992 (Asia) */ |
| r10384 | r10385 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | #include "machine/nvram.h" | |
| 8 | ||
| 7 | 9 | /*----------- defined in machine/kaneko16.c -----------*/ |
| 8 | 10 | |
| 9 | 11 | extern UINT16 *kaneko16_mcu_ram; /* for calc3 and toybox */ |
| 12 | extern UINT8 kaneko16_nvram_save[128]; | |
| 10 | 13 | |
| 11 | 14 | READ16_HANDLER( galpanib_calc_r ); |
| 12 | 15 | WRITE16_HANDLER( galpanib_calc_w ); |
| r10384 | r10385 | |
|---|---|---|
| 94 | 94 | |
| 95 | 95 | /* ----- device interface ----- */ |
| 96 | 96 | |
| 97 | DECLARE_LEGACY_ | |
| 97 | DECLARE_LEGACY_ |
| r10384 | r10385 | |
|---|---|---|
| 55 | 55 | UINT16 kaneko16_sprite_yoffs, kaneko16_sprite_flipy; |
| 56 | 56 | UINT16 *kaneko16_sprites_regs; |
| 57 | 57 | |
| 58 | UINT8 kaneko16_nvram_save[128]; | |
| 58 | 59 | |
| 59 | 60 | UINT16 *kaneko16_bg15_select, *kaneko16_bg15_reg; |
| 60 | 61 | static bitmap_t *kaneko16_bg15_bitmap; |
| r10384 | r10385 | |
|---|---|---|
| 234 | 234 | vdp->m_gfxregion = gfxregion; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | bool gp9001vdp_device_config::device_validity_check(const game_driver &driver) const | |
| 237 | bool gp9001vdp_device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 238 | 238 | { |
| 239 | 239 | bool error = false; |
| 240 | 240 | return error; |
| r10384 | r10385 | |
|---|---|---|
| 10 | 10 | virtual device_t *alloc_device(running_machine &machine) const; |
| 11 | 11 | static void static_set_gfx_region(device_config *device, int gfxregion); |
| 12 | 12 | protected: |
| 13 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 13 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 14 | 14 | virtual const address_space_config *memory_space_config(int spacenum = 0) const; |
| 15 | 15 | address_space_config m_space_config; |
| 16 | 16 | UINT8 m_gfxregion; |
| r10384 | r10385 | |
|---|---|---|
| 486 | 486 | |
| 487 | 487 | void Load(char *name,byte *buffer,int from, int length) |
| 488 | 488 | { |
| 489 | file_error filerr; | |
| 490 | mame_file *file; | |
| 491 | ||
| 492 | filerr = mame_fopen(NULL, name, OPEN_FLAG_READ, &file); | |
| 489 | /* | |
| 490 | emu_file file(options, NULL, OPEN_FLAG_READ); | |
| 491 | file_error filerr = file.open(name); | |
| 493 | 492 | if (filerr != FILERR_NONE) |
| 494 | 493 | return; |
| 495 | 494 | while (length--) |
| 496 | buffer[from++]=mame_fgetc(file); | |
| 497 | mame_fclose(file); | |
| 495 | buffer[from++]=file->getc(); | |
| 496 | */ | |
| 498 | 497 | } |
| 499 | 498 | |
| 500 | 499 | void CreateJrDecodeTable(byte *x, int length) |
| r10384 | r10385 | |
|---|---|---|
| 101 | 101 | if (read_or_write) |
| 102 | 102 | { |
| 103 | 103 | if (nvram_size) /* Super Pang, Block Block */ |
| 104 | | |
| 104 | | |
| 105 | 105 | } |
| 106 | 106 | else |
| 107 | 107 | { |
| 108 | 108 | if (file) |
| 109 | 109 | { |
| 110 | 110 | if (nvram_size) /* Super Pang, Block Block */ |
| 111 | | |
| 111 | | |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
| r10384 | r10385 | |
|---|---|---|
| 50 | 50 | static NVRAM_HANDLER( nbmj9195 ) |
| 51 | 51 | { |
| 52 | 52 | if (read_or_write) |
| 53 | | |
| 53 | | |
| 54 | 54 | else { |
| 55 | 55 | if (file) |
| 56 | | |
| 56 | | |
| 57 | 57 | else |
| 58 | 58 | memset(nbmj9195_nvram, 0, nbmj9195_nvram_size); |
| 59 | 59 | } |
| r10384 | r10385 | |
|---|---|---|
| 1824 | 1824 | MCFG_PALETTE_INIT(berlwall) |
| 1825 | 1825 | MCFG_VIDEO_START(berlwall) |
| 1826 | 1826 | MCFG_VIDEO_UPDATE(berlwall) |
| 1827 | ||
| 1827 | ||
| 1828 | 1828 | /* sound hardware */ |
| 1829 | 1829 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1830 | 1830 | |
| r10384 | r10385 | |
| 1961 | 1961 | MCFG_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM) |
| 1962 | 1962 | |
| 1963 | 1963 | MCFG_MACHINE_RESET(gtmr) |
| 1964 | MCFG_NVRAM_ADD_0FILL("nvram") | |
| 1964 | 1965 | |
| 1965 | 1966 | /* video hardware */ |
| 1966 | 1967 | MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) |
| r10384 | r10385 | |
| 3842 | 3843 | |
| 3843 | 3844 | static DRIVER_INIT( bloodwar ) |
| 3844 | 3845 | { |
| 3846 | machine->device<nvram_device>("nvram")->set_base(kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); | |
| 3845 | 3847 | DRIVER_INIT_CALL(samplebank); |
| 3846 | 3848 | DRIVER_INIT_CALL(decrypt_toybox_rom); |
| 3847 | 3849 | } |
| 3848 | 3850 | |
| 3849 | 3851 | static DRIVER_INIT( gtmr2 ) |
| 3850 | 3852 | { |
| 3853 | machine->device<nvram_device>("nvram")->set_base(kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); | |
| 3851 | 3854 | DRIVER_INIT_CALL(samplebank); |
| 3852 | 3855 | DRIVER_INIT_CALL(decrypt_toybox_rom_alt); |
| 3853 | 3856 | } |
| r10384 | r10385 | |
|---|---|---|
| 74 | 74 | virtual device_t *alloc_device(running_machine &machine) const; |
| 75 | 75 | protected: |
| 76 | 76 | virtual void device_config_complete(); |
| 77 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 77 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 78 | 78 | virtual const address_space_config *memory_space_config(int spacenum = 0) const; |
| 79 | 79 | address_space_config m_space_config; |
| 80 | 80 | }; |
| r10384 | r10385 | |
| 117 | 117 | // m_space_config = address_space_config("janshi_vdp", ENDIANNESS_BIG, 8, address_bits, 0, *ADDRESS_MAP_NAME(janshi_vdp_map8)); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | bool janshi_vdp_device_config::device_validity_check(const game_driver &driver) const | |
| 120 | bool janshi_vdp_device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 121 | 121 | { |
| 122 | 122 | bool error = false; |
| 123 | 123 | return error; |
| r10384 | r10385 | |
|---|---|---|
| 574 | 574 | data[1] = (dword&0x00ff0000)>>16; |
| 575 | 575 | data[2] = (dword&0x0000ff00)>>8; |
| 576 | 576 | data[3] = dword&0xff; |
| 577 | | |
| 577 | | |
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | else |
| r10384 | r10385 | |
| 583 | 583 | { |
| 584 | 584 | for( i=0; i<NB1_NVMEM_SIZE/4; i++ ) |
| 585 | 585 | { |
| 586 | | |
| 586 | | |
| 587 | 587 | nvmem32[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; |
| 588 | 588 | } |
| 589 | 589 | } |
| r10384 | r10385 | |
|---|---|---|
| 158 | 158 | mjkjidai_state *state = machine->driver_data<mjkjidai_state>(); |
| 159 | 159 | |
| 160 | 160 | if (read_or_write) |
| 161 | | |
| 161 | | |
| 162 | 162 | else if (file) |
| 163 | | |
| 163 | | |
| 164 | 164 | else |
| 165 | 165 | { |
| 166 | 166 | state->nvram_init_count = 1; |
| r10384 | r10385 | |
|---|---|---|
| 242 | 242 | data[1] = (dword&0x00ff0000)>>16; |
| 243 | 243 | data[2] = (dword&0x0000ff00)>>8; |
| 244 | 244 | data[3] = dword&0xff; |
| 245 | | |
| 245 | | |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | else |
| r10384 | r10385 | |
| 251 | 251 | { |
| 252 | 252 | for( i=0; i<gal3_nvmem_size/4; i++ ) |
| 253 | 253 | { |
| 254 | | |
| 254 | | |
| 255 | 255 | gal3_nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; |
| 256 | 256 | } |
| 257 | 257 | } |
| r10384 | r10385 | |
|---|---|---|
| 1342 | 1342 | #include "cpu/arm7/arm7.h" |
| 1343 | 1343 | #include "machine/eeprom.h" |
| 1344 | 1344 | #include "machine/intelfsh.h" |
| 1345 | #include "machine/x76f100.h" | |
| 1345 | 1346 | #include "includes/naomibd.h" |
| 1346 | 1347 | #include "includes/naomi.h" |
| 1347 | 1348 | #include "cpu/sh4/sh4.h" |
| r10384 | r10385 | |
| 1417 | 1418 | if (read_or_write) |
| 1418 | 1419 | { |
| 1419 | 1420 | /* JVS 'eeprom' */ |
| 1420 | | |
| 1421 | | |
| 1421 | 1422 | } |
| 1422 | 1423 | else |
| 1423 | 1424 | { |
| 1424 | 1425 | if (file) |
| 1425 | 1426 | { |
| 1426 | 1427 | /* JVS 'eeprom' */ |
| 1427 | | |
| 1428 | | |
| 1428 | 1429 | } |
| 1429 | 1430 | else |
| 1430 | 1431 | { |
| r10384 | r10385 | |
| 2063 | 2064 | |
| 2064 | 2065 | static MACHINE_CONFIG_DERIVED( naomi, naomi_base ) |
| 2065 | 2066 | MCFG_NAOMI_ROM_BOARD_ADD("rom_board", "user1") |
| 2067 | MCFG_X76F100_ADD("naomibd_eeprom") | |
| 2066 | 2068 | MACHINE_CONFIG_END |
| 2067 | 2069 | |
| 2068 | 2070 | /* |
| r10384 | r10385 | |
| 2071 | 2073 | |
| 2072 | 2074 | static MACHINE_CONFIG_DERIVED( naomigd, naomi_base ) |
| 2073 | 2075 | MCFG_NAOMI_DIMM_BOARD_ADD("rom_board", "gdrom", "user1", "picreturn") |
| 2076 | MCFG_X76F100_ADD("naomibd_eeprom") | |
| 2074 | 2077 | MACHINE_CONFIG_END |
| 2075 | 2078 | |
| 2076 | 2079 | /* |
| r10384 | r10385 | |
| 2095 | 2098 | MCFG_CPU_PROGRAM_MAP(aw_map) |
| 2096 | 2099 | MCFG_MACRONIX_29L001MC_ADD("awflash") |
| 2097 | 2100 | MCFG_AW_ROM_BOARD_ADD("rom_board", "user1") |
| 2101 | MCFG_X76F100_ADD("naomibd_eeprom") | |
| 2098 | 2102 | MACHINE_CONFIG_END |
| 2099 | 2103 | |
| 2100 | 2104 | #define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ |
| r10384 | r10385 | |
| 2321 | 2325 | /* default EEPROM values, same works for all games */ |
| 2322 | 2326 | #define NAOMI_DEFAULT_EEPROM \ |
| 2323 | 2327 | ROM_REGION16_BE( 0x80, "main_eeprom", 0 ) \ |
| 2328 | ROM_LOAD16_WORD("eeprom-naomi-main-default.bin", 0x0000, 0x0080, CRC(fea29cbb) SHA1(4099f1747aafa07db34f6e072cd9bfaa83bae10e) ) \ | |
| 2329 | ROM_REGION( 0x84, "naomibd_eeprom", 0 ) \ | |
| 2330 | ROM_LOAD("eeprom-naomi-x76f100-default.bin", 0x0000, 0x0084, CRC(3ea24b6a) SHA1(3a730ebcf56e0060fef6b1b02eb2eb7cfb7e61dc) ) | |
| 2331 | ||
| 2332 | /* Version without the default x76f100 eeprom */ | |
| 2333 | #define NAOMI_DEFAULT_EEPROM_NO_BD \ | |
| 2334 | ROM_REGION16_BE( 0x80, "main_eeprom", 0 ) \ | |
| 2324 | 2335 | ROM_LOAD16_WORD("eeprom-naomi-main-default.bin", 0x0000, 0x0080, CRC(fea29cbb) SHA1(4099f1747aafa07db34f6e072cd9bfaa83bae10e) ) |
| 2325 | 2336 | |
| 2326 | 2337 | ROM_START( naomi ) |
| r10384 | r10385 | |
| 2613 | 2624 | ROM_START( doa2 ) |
| 2614 | 2625 | ROM_REGION( 0x200000, "maincpu", 0) |
| 2615 | 2626 | NAOMI_BIOS |
| 2616 | NAOMI_DEFAULT_EEPROM | |
| 2627 | NAOMI_DEFAULT_EEPROM_NO_BD | |
| 2617 | 2628 | |
| 2618 | 2629 | ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF) |
| 2619 | 2630 | ROM_LOAD("epr-22121.ic22",0x0000000, 0x0400000, CRC(30f93b5e) SHA1(0e33383e7ab9a721dab4708b063598f2e9c9f2e7) ) // partially encrypted |
| r10384 | r10385 | |
| 2641 | 2652 | ROM_LOAD("mpr-22120.ic21",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) ) |
| 2642 | 2653 | |
| 2643 | 2654 | // on-cart X76F100 eeprom contents |
| 2644 | ROM_REGION( 0x | |
| 2655 | ROM_REGION( 0x84 | |
| 2645 | 2656 | ROM_LOAD( "841-0003.sf", 0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) ) |
| 2646 | 2657 | |
| 2647 | 2658 | // trojaned protection data (filename is word offset) |
| r10384 | r10385 | |
| 2702 | 2713 | ROM_START( doa2m ) |
| 2703 | 2714 | ROM_REGION( 0x200000, "maincpu", 0) |
| 2704 | 2715 | NAOMI_BIOS |
| 2705 | NAOMI_DEFAULT_EEPROM | |
| 2716 | NAOMI_DEFAULT_EEPROM_NO_BD | |
| 2706 | 2717 | |
| 2707 | 2718 | ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF) |
| 2708 | 2719 | ROM_LOAD("doa2verm.ic22", 0x0000000, 0x0400000, CRC(94b16f08) SHA1(225cd3e5dd5f21facf0a1d5e66fa17db8497573d) ) |
| r10384 | r10385 | |
| 2730 | 2741 | ROM_LOAD("mpr-22120.ic21",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) ) |
| 2731 | 2742 | |
| 2732 | 2743 | // on-cart X76F100 eeprom contents |
| 2733 | ROM_REGION( 0x | |
| 2744 | ROM_REGION( 0x84 | |
| 2734 | 2745 | ROM_LOAD( "841-0003.sf", 0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) ) |
| 2735 | 2746 | |
| 2736 | 2747 | // trojaned protection data (filename is word offset) |
| r10384 | r10385 | |
| 3134 | 3145 | ROM_START( alpiltdx ) |
| 3135 | 3146 | ROM_REGION( 0x200000, "maincpu", 0) |
| 3136 | 3147 | AIRLINE_BIOS |
| 3137 | NAOMI_DEFAULT_EEPROM | |
| 3148 | NAOMI_DEFAULT_EEPROM_NO_BD | |
| 3138 | 3149 | |
| 3139 | 3150 | ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF) |
| 3140 | 3151 | ROM_LOAD( "epr-21787b.ic22", 0x0000000, 0x400000, CRC(56893156) SHA1(8e56e0633f92b1f50105421b7eb8428f51a78b27) ) |
| r10384 | r10385 | |
| 3151 | 3162 | ROM_LOAD( "mpr-21738.ic11", 0x5800000, 0x800000, CRC(95a592e8) SHA1(862dce467e8805381bab001df68262f1baf3c498) ) |
| 3152 | 3163 | |
| 3153 | 3164 | // on-cart X76F100 eeprom contents |
| 3154 | ROM_REGION( 0x | |
| 3165 | ROM_REGION( 0x84 | |
| 3155 | 3166 | ROM_LOAD( "airlinepdx.sf", 0x000000, 0x000084, CRC(404b2add) SHA1(540c8474806775646ace111a2993397b1419fee3) ) |
| 3156 | 3167 | ROM_END |
| 3157 | 3168 | |
| r10384 | r10385 | |
| 5089 | 5100 | |
| 5090 | 5101 | /* games on Namco custom ROM board */ |
| 5091 | 5102 | /* ???????? */ GAME( 2000, wldkicks, naomi, naomi, naomi, naomi, ROT0, "Capcom / Namco", "World Kicks", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 5092 | /* 25709801 */ GAME( 2001, gunsur2, naomi, naomi, naomi, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2: Bio Hazard Code Veronica", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 5103 | /* 25709801 */ GAME( 2001, gunsur2, naomi, naomi, naomi, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2: Bio Hazard Code Veronica", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 5093 | 5104 | |
| 5094 | 5105 | /* Games with game specific bios sets */ |
| 5095 | 5106 | /* BIOS */ GAME( 1998, hod2bios, 0, naomi, naomi, 0, ROT0, "Sega", "Naomi House of the Dead 2 Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT ) |
| r10384 | r10385 | |
| 5273 | 5284 | NAOMIGD_BIOS |
| 5274 | 5285 | NAOMI_DEFAULT_EEPROM |
| 5275 | 5286 | |
| 5276 | ||
| 5277 | ||
| 5278 | 5287 | DISK_REGION( "gdrom" ) |
| 5279 | 5288 | DISK_IMAGE_READONLY( "gdl-0013", 0, SHA1(c8869069c28bc8eec96d820886bc388d69d46143) ) |
| 5280 | 5289 | |
| r10384 | r10385 | |
| 5292 | 5301 | NAOMIGD_BIOS |
| 5293 | 5302 | NAOMI_DEFAULT_EEPROM |
| 5294 | 5303 | |
| 5295 | ||
| 5296 | ||
| 5297 | 5304 | DISK_REGION( "gdrom" ) |
| 5298 | 5305 | DISK_IMAGE_READONLY( "gdl-0014a", 0, SHA1(f88d8203c8692f51c9492d5549a3ad7d9583dc6f) ) |
| 5299 | 5306 | |
| r10384 | r10385 | |
| 5311 | 5318 | NAOMIGD_BIOS |
| 5312 | 5319 | NAOMI_DEFAULT_EEPROM |
| 5313 | 5320 | |
| 5314 | ||
| 5315 | ||
| 5316 | 5321 | DISK_REGION( "gdrom" ) |
| 5317 | 5322 | DISK_IMAGE_READONLY( "gdl-0017", 0, SHA1(94a9319633388968611892e36691b45c94b4f83f) ) |
| 5318 | 5323 | |
| r10384 | r10385 | |
| 5329 | 5334 | NAOMIGD_BIOS |
| 5330 | 5335 | NAOMI_DEFAULT_EEPROM |
| 5331 | 5336 | |
| 5332 | ||
| 5333 | ||
| 5334 | 5337 | DISK_REGION( "gdrom" ) |
| 5335 | 5338 | DISK_IMAGE_READONLY( "gdl-0018", 0, SHA1(3e40ca7d43173fe7048d199fdc127b9411e10360) ) |
| 5336 | 5339 | |
| r10384 | r10385 | |
| 5344 | 5347 | NAOMIGD_BIOS |
| 5345 | 5348 | NAOMI_DEFAULT_EEPROM |
| 5346 | 5349 | |
| 5347 | ||
| 5348 | ||
| 5349 | 5350 | DISK_REGION( "gdrom" ) |
| 5350 | 5351 | DISK_IMAGE_READONLY( "gdl-0019a", 0, SHA1(d44906505ff698eda6feee6c2b9402e19f64e5d3) ) |
| 5351 | 5352 | |
| r10384 | r10385 | |
| 5363 | 5364 | NAOMIGD_BIOS |
| 5364 | 5365 | NAOMI_DEFAULT_EEPROM |
| 5365 | 5366 | |
| 5366 | ||
| 5367 | ||
| 5368 | 5367 | DISK_REGION( "gdrom" ) |
| 5369 | 5368 | DISK_IMAGE_READONLY( "gdl-0020", 0, SHA1(7b2ef47ca2038d6a93615b760b03e8f7cb1b83c2) ) |
| 5370 | 5369 | |
| r10384 | r10385 | |
| 5382 | 5381 | NAOMIGD_BIOS |
| 5383 | 5382 | NAOMI_DEFAULT_EEPROM |
| 5384 | 5383 | |
| 5385 | ||
| 5386 | ||
| 5387 | 5384 | DISK_REGION( "gdrom" ) |
| 5388 | 5385 | DISK_IMAGE_READONLY( "gdl-0021", 0, SHA1(f5036711a28a211e8d71400a8322db3172c5733f) ) |
| 5389 | 5386 | |
| r10384 | r10385 | |
| 5401 | 5398 | NAOMIGD_BIOS |
| 5402 | 5399 | NAOMI_DEFAULT_EEPROM |
| 5403 | 5400 | |
| 5404 | ||
| 5405 | ||
| 5406 | 5401 | DISK_REGION( "gdrom" ) |
| 5407 | 5402 | DISK_IMAGE_READONLY( "gdl-0022", 0, SHA1(45deba05a12abbf6390c0fc0e4cdeaedfa7d2ca5) ) |
| 5408 | 5403 | |
| r10384 | r10385 | |
| 5420 | 5415 | NAOMIGD_BIOS |
| 5421 | 5416 | NAOMI_DEFAULT_EEPROM |
| 5422 | 5417 | |
| 5423 | ||
| 5424 | ||
| 5425 | 5418 | DISK_REGION( "gdrom" ) |
| 5426 | 5419 | DISK_IMAGE_READONLY( "gdl-0023a", 0, SHA1(caac915104d61f2122f5afe27da1ef5fa9cf9f9a) ) |
| 5427 | 5420 | |
| r10384 | r10385 | |
| 5440 | 5433 | NAOMIGD_BIOS |
| 5441 | 5434 | NAOMI_DEFAULT_EEPROM |
| 5442 | 5435 | |
| 5443 | ||
| 5444 | ||
| 5445 | 5436 | DISK_REGION( "gdrom" ) |
| 5446 | 5437 | DISK_IMAGE_READONLY( "gdl-0024", 0, SHA1(d346762036fb1c40a261a434b50e63459f306f14) ) |
| 5447 | 5438 | |
| r10384 | r10385 | |
| 5459 | 5450 | NAOMIGD_BIOS |
| 5460 | 5451 | NAOMI_DEFAULT_EEPROM |
| 5461 | 5452 | |
| 5462 | ||
| 5463 | ||
| 5464 | 5453 | DISK_REGION( "gdrom" ) |
| 5465 | 5454 | DISK_IMAGE_READONLY( "gdl-0025", 0, SHA1(be0d88eb4f48403a2ceaa7ef588ed60b96ba93bf) ) |
| 5466 | 5455 | |
| 5467 | ||
| 5468 | 5456 | ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE) |
| 5469 | 5457 | //ROM_LOAD("317-5102-com.data", 0x00, 0x50, CRC(32adf2eb) SHA1(d86752e6fe9ccac093c512828fca5b7ae62a3ff2) ) |
| 5470 | 5458 | |
| r10384 | r10385 | |
| 5479 | 5467 | NAOMIGD_BIOS |
| 5480 | 5468 | NAOMI_DEFAULT_EEPROM |
| 5481 | 5469 | |
| 5482 | ||
| 5483 | ||
| 5484 | 5470 | DISK_REGION( "gdrom" ) |
| 5485 | 5471 | DISK_IMAGE_READONLY( "gdl-0026", 0, SHA1(e4c1e51292a7923b25bfc61d38fe386bf596002a) ) |
| 5486 | 5472 | |
| 5487 | ||
| 5488 | 5473 | ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE) |
| 5489 | 5474 | //ROM_LOAD("317-5103-jpn.data", 0x00, 0x50, CRC(3affbf82) SHA1(268746e86e7546f4bab54bdd268f7b58f10c1aaf) ) |
| 5490 | 5475 | |
| r10384 | r10385 | |
| 5499 | 5484 | NAOMIGD_BIOS |
| 5500 | 5485 | NAOMI_DEFAULT_EEPROM |
| 5501 | 5486 | |
| 5502 | ||
| 5503 | ||
| 5504 | 5487 | DISK_REGION( "gdrom" ) |
| 5505 | 5488 | DISK_IMAGE_READONLY( "gdl-0028c", 0, SHA1(66de09738551e351784cc9695a58b35fdf6b6c4b) ) |
| 5506 | 5489 | |
| r10384 | r10385 | |
| 5518 | 5501 | NAOMIGD_BIOS |
| 5519 | 5502 | NAOMI_DEFAULT_EEPROM |
| 5520 | 5503 | |
| 5521 | ||
| 5522 | ||
| 5523 | 5504 | DISK_REGION( "gdrom" ) |
| 5524 | 5505 | DISK_IMAGE_READONLY( "gdl-0030a", 0, SHA1(1f7ade47e37a0026451b5baf3ba746400de8d156) ) |
| 5525 | 5506 | |
| r10384 | r10385 | |
| 5536 | 5517 | NAOMIGD_BIOS |
| 5537 | 5518 | NAOMI_DEFAULT_EEPROM |
| 5538 | 5519 | |
| 5539 | ||
| 5540 | ||
| 5541 | 5520 | DISK_REGION( "gdrom" ) |
| 5542 | 5521 | DISK_IMAGE_READONLY( "gdl-0030", 0, SHA1(c7f25c05f47a490c5da9369c588b6136e93c280e) ) |
| 5543 | 5522 | |
| r10384 | r10385 | |
| 7278 | 7257 | GAME( 2005, kofxi, awbios, aw, aw, kofxi, ROT0, "Sammy / SNK Playmore", "The King of Fighters XI", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 7279 | 7258 | GAME( 2005, fotns, awbios, aw, aw, fotns, ROT0, "Sega / Arc System Works", "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 7280 | 7259 | GAME( 2005, kofnw, awbios, aw, aw, kofnw, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 7281 | GAME( 2005, kofnwj, kofnw, aw, aw, kofnw, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave (Japan)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 7260 | GAME( 2005, kofnwj, kofnw, aw, aw, kofnw, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave (Japan)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 7282 | 7261 | GAME( 2005, xtrmhunt, awbios, aw, aw, xtrmhunt, ROT0, "Sammy", "Extreme Hunting", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 7283 | 7262 | GAME( 2006, mslug6, awbios, aw, aw, mslug6, ROT0, "Sega / SNK Playmore", "Metal Slug 6", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) |
| 7284 | 7263 | GAME( 2006, xtrmhnt2, awbios, aw, aw, xtrmhnt2, ROT0, "Sega", "Extreme Hunting 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| r10384 | r10385 | |
|---|---|---|
| 540 | 540 | { |
| 541 | 541 | if (read_or_write) |
| 542 | 542 | /* save the SRAM settings */ |
| 543 | | |
| 543 | | |
| 544 | 544 | else |
| 545 | 545 | { |
| 546 | 546 | /* load the SRAM settings */ |
| 547 | 547 | if (file) |
| 548 | | |
| 548 | | |
| 549 | 549 | else |
| 550 | 550 | memset(save_ram, 0, 0x10000); |
| 551 | 551 | } |
| r10384 | r10385 | |
| 615 | 615 | { |
| 616 | 616 | case MEMCARD_CREATE: |
| 617 | 617 | memset(memcard_data, 0, MEMCARD_SIZE); |
| 618 | | |
| 618 | | |
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | 621 | case MEMCARD_INSERT: |
| 622 | | |
| 622 | | |
| 623 | 623 | break; |
| 624 | 624 | |
| 625 | 625 | case MEMCARD_EJECT: |
| 626 | | |
| 626 | | |
| 627 | 627 | break; |
| 628 | 628 | } |
| 629 | 629 | } |
| r10384 | r10385 | |
|---|---|---|
| 610 | 610 | |
| 611 | 611 | |
| 612 | 612 | |
| 613 | ROM_START( moo ) /* Version EA - Euro Ver A */ | |
| 613 | ROM_START( moomesa ) /* Version EA - Euro Ver A */ | |
| 614 | 614 | ROM_REGION( 0x180000, "maincpu", 0 ) |
| 615 | 615 | /* main program */ |
| 616 | ROM_LOAD16_BYTE( "151b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) | |
| 617 | ROM_LOAD16_BYTE( "151b02.ea", 0x000001, 0x40000, CRC(37b30c01) SHA1(cb91739097a4a36f8f8d92998d822ffc851e1279) ) | |
| 616 | ROM_LOAD16_BYTE( "151_b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) | |
| 617 | ROM_LOAD16_BYTE( "151_ea_b02", 0x000001, 0x40000, CRC(37b30c01) SHA1(cb91739097a4a36f8f8d92998d822ffc851e1279) ) | |
| 618 | 618 | |
| 619 | 619 | /* data */ |
| 620 | 620 | ROM_LOAD16_BYTE( "151a03", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) |
| r10384 | r10385 | |
| 645 | 645 | ROM_LOAD( "moo.nv", 0x0000, 0x080, CRC(7bd904a8) SHA1(8747c5c62d1832e290be8ace73c61b1f228c0bec) ) |
| 646 | 646 | ROM_END |
| 647 | 647 | |
| 648 | ROM_START( moo | |
| 648 | ROM_START( moomesau ) /* Version UA - USA Ver A */ | |
| 649 | 649 | ROM_REGION( 0x180000, "maincpu", 0 ) |
| 650 | 650 | /* main program */ |
| 651 | ROM_LOAD16_BYTE( "151b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) | |
| 652 | ROM_LOAD16_BYTE( "151b02.ua", 0x000001, 0x40000, CRC(3d9f4d59) SHA1(db47044bd4935fce94ec659242c9819c30eb6d0f) ) | |
| 651 | ROM_LOAD16_BYTE( "151_c01", 0x000000, 0x40000, CRC(10555732) SHA1(b67cb756c250ddd6f3291683b3f3449e13a2ee83) ) /* Version UAC? */ | |
| 652 | ROM_LOAD16_BYTE( "151_ua_c02", 0x000001, 0x40000, CRC(52ae87b0) SHA1(552d41a2ddd040f92c6a3cfdc07f9d6e751ac9c1) ) | |
| 653 | 653 | |
| 654 | 654 | /* data */ |
| 655 | 655 | ROM_LOAD16_BYTE( "151a03", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) |
| r10384 | r10385 | |
| 680 | 680 | ROM_LOAD( "moou.nv", 0x0000, 0x080, CRC(a5cb137a) SHA1(119df859d6b5c366481305b1433eea0deadc3fa9) ) |
| 681 | 681 | ROM_END |
| 682 | 682 | |
| 683 | ROM_START( mooaa ) /* Version A | |
| 683 | ROM_START( moomesaua ) /* Version UA | |
| 684 | 684 | ROM_REGION( 0x180000, "maincpu", 0 ) |
| 685 | 685 | /* main program */ |
| 686 | ROM_LOAD16_BYTE( "151b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) | |
| 687 | ROM_LOAD16_BYTE( "151b02.aa", 0x000001, 0x40000, CRC(2162d593) SHA1(a6cfe4a57b3f22b2aa0f04f91acefe3b7bea9e76) ) | |
| 686 | ROM_LOAD16_BYTE( "151_b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) /* Version UAB? */ | |
| 687 | ROM_LOAD16_BYTE( "151_ua_b02", 0x000001, 0x40000, CRC(3d9f4d59) SHA1(db47044bd4935fce94ec659242c9819c30eb6d0f) ) | |
| 688 | 688 | |
| 689 | 689 | /* data */ |
| 690 | 690 | ROM_LOAD16_BYTE( "151a03", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) |
| r10384 | r10385 | |
| 712 | 712 | ROM_LOAD( "151a08", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) |
| 713 | 713 | |
| 714 | 714 | ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error |
| 715 | ROM_LOAD( "moou.nv", 0x0000, 0x080, CRC(a5cb137a) SHA1(119df859d6b5c366481305b1433eea0deadc3fa9) ) | |
| 716 | ROM_END | |
| 717 | ||
| 718 | ROM_START( moomesaa ) /* Version AA - Asia Ver A */ | |
| 719 | ROM_REGION( 0x180000, "maincpu", 0 ) | |
| 720 | /* main program */ | |
| 721 | ROM_LOAD16_BYTE( "151_b01", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) | |
| 722 | ROM_LOAD16_BYTE( "151_ua_b02", 0x000001, 0x40000, CRC(2162d593) SHA1(a6cfe4a57b3f22b2aa0f04f91acefe3b7bea9e76) ) | |
| 723 | ||
| 724 | /* data */ | |
| 725 | ROM_LOAD16_BYTE( "151a03", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) | |
| 726 | ROM_LOAD16_BYTE( "151a04", 0x100001, 0x40000, CRC(3b24706a) SHA1(c2a77944284e35ff57f0774fa7b67e53d3b63e1f) ) | |
| 727 | ||
| 728 | ROM_REGION( 0x050000, "soundcpu", 0 ) | |
| 729 | /* Z80 sound program */ | |
| 730 | ROM_LOAD( "151a07", 0x000000, 0x040000, CRC(cde247fc) SHA1(cdee0228db55d53ae43d7cd2d9001dadd20c2c61) ) | |
| 731 | ROM_RELOAD( 0x010000, 0x040000 ) | |
| 732 | ||
| 733 | ROM_REGION( 0x200000, "gfx1", 0 ) | |
| 734 | /* tilemaps */ | |
| 735 | ROM_LOAD( "151a05", 0x000000, 0x100000, CRC(bc616249) SHA1(58c1f1a03ce9bead8f79d12ce4b2d342432b24b5) ) | |
| 736 | ROM_LOAD( "151a06", 0x100000, 0x100000, CRC(38dbcac1) SHA1(c357779733921695b20ac586db5b475f5b2b8f4c) ) | |
| 737 | ||
| 738 | ROM_REGION( 0x800000, "gfx2", 0 ) | |
| 739 | /* sprites */ | |
| 740 | ROM_LOAD( "151a10", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) | |
| 741 | ROM_LOAD( "151a11", 0x200000, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) | |
| 742 | ROM_LOAD( "151a12", 0x400000, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) | |
| 743 | ROM_LOAD( "151a13", 0x600000, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) | |
| 744 | ||
| 745 | ROM_REGION( 0x200000, "k054539", 0 ) | |
| 746 | /* K054539 samples */ | |
| 747 | ROM_LOAD( "151a08", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) | |
| 748 | ||
| 749 | ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error | |
| 715 | 750 | ROM_LOAD( "moo.nv", 0x0000, 0x080, CRC(7bd904a8) SHA1(8747c5c62d1832e290be8ace73c61b1f228c0bec) ) |
| 716 | 751 | ROM_END |
| 717 | 752 | |
| r10384 | r10385 | |
| 824 | 859 | ROM_END |
| 825 | 860 | |
| 826 | 861 | |
| 827 | ROM_START( moobl ) | |
| 862 | ROM_START( moomesabl ) | |
| 828 | 863 | ROM_REGION( 0x180000, "maincpu", 0 ) |
| 829 | 864 | ROM_LOAD16_WORD_SWAP( "moo03.rom", 0x000000, 0x80000, CRC(fed6a1cb) SHA1(be58e266973930d643b5e15dcc974a82e1a3ae35) ) |
| 830 | 865 | ROM_LOAD16_WORD_SWAP( "moo04.rom", 0x100000, 0x80000, CRC(ec45892a) SHA1(594330cbbfbca87e61ddf519e565018b6eaf5a20) ) |
| r10384 | r10385 | |
| 885 | 920 | } |
| 886 | 921 | |
| 887 | 922 | |
| 888 | GAME( 1992, moo, 0, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver EA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 889 | GAME( 1992, mooua, moo, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver UA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 890 | GAME( 1992, mooaa, moo, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver AA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 891 | GAME( 1992, moobl, moo, moobl, moo, moo, ROT0, "bootleg", "Wild West C.O.W.-Boys of Moo Mesa (bootleg ver AA)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) | |
| 892 | GAME( 1992, bucky, 0, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver EA)", GAME_SUPPORTS_SAVE ) | |
| 893 | GAME( 1992, buckyua, bucky, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver UA)", GAME_SUPPORTS_SAVE ) | |
| 894 | GAME( 1992, buckyaa, bucky, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver AA)", GAME_SUPPORTS_SAVE ) | |
| 923 | GAME( 1992, moomesa, 0, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver EA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 924 | GAME( 1992, moomesau, moomesa, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver UA, set 1)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 925 | GAME( 1992, moomesaua,moomesa, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver UA, set 2)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 926 | GAME( 1992, moomesaa, moomesa, moo, moo, moo, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver AA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 927 | GAME( 1992, moomesabl,moomesa, moobl, moo, moo, ROT0, "bootleg", "Wild West C.O.W.-Boys of Moo Mesa (bootleg ver AA)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) | |
| 928 | GAME( 1992, bucky, 0, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver EA)", GAME_SUPPORTS_SAVE ) | |
| 929 | GAME( 1992, buckyua, bucky, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver UA)", GAME_SUPPORTS_SAVE ) | |
| 930 | GAME( 1992, buckyaa, bucky, bucky, bucky, moo, ROT0, "Konami", "Bucky O'Hare (ver AA)", GAME_SUPPORTS_SAVE ) |
| r10384 | r10385 | |
|---|---|---|
| 1225 | 1225 | static NVRAM_HANDLER( sfbonus ) |
| 1226 | 1226 | { |
| 1227 | 1227 | if (read_or_write) |
| 1228 | | |
| 1228 | | |
| 1229 | 1229 | else |
| 1230 | 1230 | { |
| 1231 | 1231 | if (file) |
| 1232 | 1232 | { |
| 1233 | 1233 | memset(nvram,0x00,nvram_size); |
| 1234 | | |
| 1234 | | |
| 1235 | 1235 | } |
| 1236 | 1236 | else |
| 1237 | 1237 | { |
| r10384 | r10385 | |
|---|---|---|
| 438 | 438 | static const UINT8 init_e2ram[10] = { 1, 4, 10, 20, 0, 1, 1, 4, 10, 20 }; |
| 439 | 439 | if ( read_or_write ) |
| 440 | 440 | { // writing |
| 441 | | |
| 441 | | |
| 442 | 442 | } |
| 443 | 443 | else |
| 444 | 444 | { // reading |
| 445 | 445 | if ( file ) |
| 446 | 446 | { |
| 447 | | |
| 447 | | |
| 448 | 448 | } |
| 449 | 449 | else |
| 450 | 450 | { |
| r10384 | r10385 | |
|---|---|---|
| 670 | 670 | static NVRAM_HANDLER( timekeeper_save ) |
| 671 | 671 | { |
| 672 | 672 | if (read_or_write) |
| 673 | | |
| 673 | | |
| 674 | 674 | else if (file) |
| 675 | | |
| 675 | | |
| 676 | 676 | else |
| 677 | 677 | memset(timekeeper_nvram, 0xff, timekeeper_nvram_size); |
| 678 | 678 | } |
| r10384 | r10385 | |
|---|---|---|
| 209 | 209 | { |
| 210 | 210 | if( read_or_write ) |
| 211 | 211 | { |
| 212 | | |
| 212 | | |
| 213 | 213 | } |
| 214 | 214 | else |
| 215 | 215 | { |
| 216 | 216 | if (file) |
| 217 | 217 | { |
| 218 | | |
| 218 | | |
| 219 | 219 | } |
| 220 | 220 | else |
| 221 | 221 | { |
| r10384 | r10385 | |
|---|---|---|
| 56 | 56 | size_t nvram_size = state->nvram_size; |
| 57 | 57 | |
| 58 | 58 | if (read_or_write) |
| 59 | | |
| 59 | | |
| 60 | 60 | else |
| 61 | 61 | { |
| 62 | 62 | if (file) |
| 63 | | |
| 63 | | |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | 66 | /* fill in the default values */ |
| r10384 | r10385 | |
|---|---|---|
| 216 | 216 | for( i = 0; i < 0x40000; i++ ) |
| 217 | 217 | tmp[i] = rom[WORD_XOR_BE(i)]; |
| 218 | 218 | |
| 219 | | |
| 219 | | |
| 220 | 220 | } |
| 221 | 221 | else if (file) |
| 222 | 222 | { |
| r10384 | r10385 | |
| 225 | 225 | UINT8 tmp[0x40000]; |
| 226 | 226 | int i; |
| 227 | 227 | |
| 228 | | |
| 228 | | |
| 229 | 229 | |
| 230 | 230 | // overlap the default settings with the saved ones |
| 231 | 231 | for( i = 0; i < 0x40000; i++ ) |
| r10384 | r10385 | |
|---|---|---|
| 289 | 289 | int i; |
| 290 | 290 | |
| 291 | 291 | if (read_or_write) |
| 292 | | |
| 292 | | |
| 293 | 293 | else |
| 294 | 294 | |
| 295 | 295 | #ifdef NVRAM_HACK |
| r10384 | r10385 | |
| 301 | 301 | init_stats(bmc_nv3,ARRAY_LENGTH(bmc_nv3),0xfe2); |
| 302 | 302 | #else |
| 303 | 303 | if (file) |
| 304 | | |
| 304 | | |
| 305 | 305 | else |
| 306 | 306 | |
| 307 | 307 | for (i = 0; i < stats_ram_size; i++) |
| r10384 | r10385 | |
|---|---|---|
| 170 | 170 | #include "emu.h" |
| 171 | 171 | #include "cpu/m68000/m68000.h" |
| 172 | 172 | #include "deprecat.h" |
| 173 | #include "machine/nvram.h" | |
| 173 | 174 | #include "sound/ymz280b.h" |
| 174 | 175 | #include "includes/suprnova.h" |
| 175 | 176 | #include "includes/kaneko16.h" |
| r10384 | r10385 | |
| 191 | 192 | |
| 192 | 193 | static UINT16 *mainsub_shared_ram; |
| 193 | 194 | |
| 195 | static UINT8 nvram_data[128]; | |
| 196 | ||
| 197 | ||
| 194 | 198 | /*************************************************************************** |
| 195 | 199 | |
| 196 | 200 | MCU Code Simulation |
| r10384 | r10385 | |
| 239 | 243 | |
| 240 | 244 | case 0x02: /* load game settings from 93C46 EEPROM ($1090-$10dc) */ |
| 241 | 245 | { |
| 242 | mame_file *f; | |
| 243 | if ((f = nvram_fopen(machine, OPEN_FLAG_READ)) != 0) | |
| 244 | { | |
| 245 | mame_fread(f,&mcu_ram[mcu_offset], 128); | |
| 246 | mame_fclose(f); | |
| 247 | } | |
| 246 | memcpy(&mcu_ram[mcu_offset], nvram_data, sizeof(nvram_data)); | |
| 248 | 247 | logerror("(load NVRAM settings)\n"); |
| 249 | 248 | } |
| 250 | 249 | break; |
| 251 | 250 | |
| 252 | 251 | case 0x42: /* save game settings to 93C46 EEPROM ($50d4) */ |
| 253 | 252 | { |
| 254 | mame_file *f; | |
| 255 | if ((f = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)) != 0) | |
| 256 | { | |
| 257 | mame_fwrite(f,&mcu_ram[mcu_offset], 128); | |
| 258 | mame_fclose(f); | |
| 259 | } | |
| 253 | memcpy(nvram_data, &mcu_ram[mcu_offset], sizeof(nvram_data)); | |
| 260 | 254 | logerror("(save NVRAM settings)\n"); |
| 261 | 255 | } |
| 262 | 256 | break; |
| r10384 | r10385 | |
| 678 | 672 | |
| 679 | 673 | MCFG_VIDEO_START(jchan) |
| 680 | 674 | MCFG_VIDEO_UPDATE(jchan) |
| 675 | ||
| 676 | MCFG_NVRAM_ADD_0FILL("nvram") | |
| 681 | 677 | |
| 682 | 678 | /* sound hardware */ |
| 683 | 679 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r10384 | r10385 | |
| 778 | 774 | |
| 779 | 775 | |
| 780 | 776 | memset(jchan_mcu_com, 0, 4 * sizeof( UINT16 ) ); |
| 777 | ||
| 778 | machine->device<nvram_device>("nvram")->set_base(nvram_data, sizeof(nvram_data)); | |
| 781 | 779 | } |
| 782 | 780 | |
| 783 | 781 |
| r10384 | r10385 | |
|---|---|---|
| 1946 | 1946 | data[1] = (dword&0x00ff0000)>>16; |
| 1947 | 1947 | data[2] = (dword&0x0000ff00)>>8; |
| 1948 | 1948 | data[3] = dword&0xff; |
| 1949 | | |
| 1949 | | |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
| 1952 | 1952 | else |
| r10384 | r10385 | |
| 1955 | 1955 | { |
| 1956 | 1956 | for( i=0; i<namcos22_nvmem_size/4; i++ ) |
| 1957 | 1957 | { |
| 1958 | | |
| 1958 | | |
| 1959 | 1959 | namcos22_nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; |
| 1960 | 1960 | } |
| 1961 | 1961 | } |
| r10384 | r10385 | |
|---|---|---|
| 392 | 392 | fujitsu_29f016a_device *flash_device[5][16]; |
| 393 | 393 | int security_cart_number; |
| 394 | 394 | |
| 395 | int chiptype[ 2 ]; | |
| 396 | int has_ds2401[ 2 ]; | |
| 397 | ||
| 398 | nvram_handler_func nvram_handler_security_cart_0; | |
| 399 | nvram_handler_func nvram_handler_security_cart_1; | |
| 400 | ||
| 401 | 395 | UINT32 control; |
| 402 | 396 | |
| 403 | 397 | emu_timer *atapi_timer; |
| r10384 | r10385 | |
| 467 | 461 | |
| 468 | 462 | static const char *const diskregions[] = { "cdrom0", "cdrom1" }; |
| 469 | 463 | |
| 470 | /* EEPROM handlers */ | |
| 471 | ||
| 472 | static NVRAM_HANDLER( konami573 ) | |
| 473 | { | |
| 474 | ksys573_state *state = machine->driver_data<ksys573_state>(); | |
| 475 | ||
| 476 | if( state->nvram_handler_security_cart_0 != NULL ) | |
| 477 | { | |
| 478 | state->nvram_handler_security_cart_0(machine, file, read_or_write); | |
| 479 | } | |
| 480 | ||
| 481 | if( state->nvram_handler_security_cart_1 != NULL ) | |
| 482 | { | |
| 483 | state->nvram_handler_security_cart_1(machine, file, read_or_write); | |
| 484 | } | |
| 485 | } | |
| 486 | ||
| 487 | 464 | static WRITE32_HANDLER( mb89371_w ) |
| 488 | 465 | { |
| 489 | 466 | verboselog( space->machine, 2, "mb89371_w %08x %08x %08x\n", offset, mem_mask, data ); |
| r10384 | r10385 | |
| 504 | 481 | UINT32 data = input_port_read(machine, "IN1"); |
| 505 | 482 | data |= 0x000000c0; |
| 506 | 483 | |
| 507 | if( state->has_ds2401[ security_cart_number ] ) | |
| 484 | ds2401_device *ds2401 = space->machine->device<ds2401_device>(security_cart_number ? "game_id" : "install_id"); | |
| 485 | device_secure_serial_flash *secflash = space->machine->device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom"); | |
| 486 | ||
| 487 | if( ds2401 ) | |
| 508 | 488 | { |
| 509 | data |= ds2401 | |
| 489 | data |= ds2401->read( | |
| 510 | 490 | } |
| 511 | 491 | |
| 512 | switch( state->chiptype[ security_cart_number ] ) | |
| 513 | { | |
| 514 | case 1: | |
| 515 | data |= x76f041_sda_read( machine, security_cart_number ) << 18; | |
| 516 | break; | |
| 492 | if( secflash ) | |
| 493 | data |= secflash->sda_r() << 18; | |
| 517 | 494 | |
| 518 | case 2: | |
| 519 | data |= x76f100_sda_read( machine, security_cart_number ) << 18; | |
| 520 | break; | |
| 521 | ||
| 522 | case 3: | |
| 523 | data |= zs01_sda_read( machine, security_cart_number ) << 18; | |
| 524 | break; | |
| 525 | } | |
| 526 | ||
| 527 | 495 | if( state->flash_device[1][0] == NULL ) |
| 528 | 496 | { |
| 529 | 497 | data |= ( 1 << 26 ); |
| r10384 | r10385 | |
| 560 | 528 | |
| 561 | 529 | state->flash_bank = -1; |
| 562 | 530 | |
| 563 | switch( state->chiptype[ state->security_cart_number ] ) | |
| 564 | { | |
| 565 | case 3: | |
| 566 | zs01_sda_write( space->machine, state->security_cart_number, !( ( control >> 6 ) & 1 ) ); /* 0x40 */ | |
| 567 | break; | |
| 568 | } | |
| 531 | // zs01 only, others are reached through security_w | |
| 532 | device_secure_serial_flash *secflash = space->machine->device<device_secure_serial_flash>(state->security_cart_number ? "game_eeprom" : "install_eeprom"); | |
| 533 | if( dynamic_cast<zs01_device *>(secflash) ) | |
| 534 | secflash->sda_w( !( ( control >> 6 ) & 1 ) ); /* 0x40 */ | |
| 569 | 535 | |
| 570 | 536 | if( state->flash_device[0][0] != NULL && ( control & ~0x43 ) == 0x00 ) |
| 571 | 537 | { |
| r10384 | r10385 | |
| 1137 | 1103 | |
| 1138 | 1104 | if( ACCESSING_BITS_0_15 ) |
| 1139 | 1105 | { |
| 1140 | switch( state->chiptype[ security_cart_number ] ) | |
| 1141 | { | |
| 1142 | case 1: | |
| 1143 | x76f041_sda_write( machine, security_cart_number, ( data >> 0 ) & 1 ); | |
| 1144 | x76f041_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 ); | |
| 1145 | x76f041_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 ); | |
| 1146 | x76f041_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 ); | |
| 1147 | break; | |
| 1106 | ds2401_device *ds2401 = space->machine->device<ds2401_device>(security_cart_number ? "game_id" : "install_id"); | |
| 1107 | device_secure_serial_flash *secflash = space->machine->device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom"); | |
| 1148 | 1108 | |
| 1149 | case 2: | |
| 1150 | x76f100_sda_write( machine, security_cart_number, ( data >> 0 ) & 1 ); | |
| 1151 | x76f100_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 ); | |
| 1152 | x76f100_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 ); | |
| 1153 | x76f100_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 ); | |
| 1154 | break; | |
| 1155 | ||
| 1156 | case 3: | |
| 1157 | zs01_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 ); | |
| 1158 | zs01_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 ); | |
| 1159 | zs01_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 ); | |
| 1160 | break; | |
| 1109 | if( secflash ) { | |
| 1110 | if( !dynamic_cast<zs01_device *>(secflash) ) | |
| 1111 | secflash->sda_w(( data >> 0 ) & 1); | |
| 1112 | secflash->scl_w(( data >> 1 ) & 1); | |
| 1113 | secflash->cs_w(( data >> 2 ) & 1); | |
| 1114 | secflash->rst_w(( data >> 3 ) & 1); | |
| 1161 | 1115 | } |
| 1162 | 1116 | |
| 1163 | if( | |
| 1117 | if( | |
| 1164 | 1118 | { |
| 1165 | ds2401 | |
| 1119 | ds2401->write( | |
| 1166 | 1120 | } |
| 1167 | 1121 | |
| 1168 | 1122 | if( state->security_callback != NULL ) |
| r10384 | r10385 | |
| 1496 | 1450 | return ret; |
| 1497 | 1451 | } |
| 1498 | 1452 | |
| 1499 | static void security_cart_init( running_machine *machine, int cart, const char *eeprom_region, const char *ds2401_region ) | |
| 1500 | { | |
| 1501 | ksys573_state *state = machine->driver_data<ksys573_state>(); | |
| 1502 | UINT8 *eeprom_rom = machine->region( eeprom_region )->base(); | |
| 1503 | int eeprom_length = machine->region( eeprom_region )->bytes(); | |
| 1504 | UINT8 *ds2401_rom = machine->region( ds2401_region )->base(); | |
| 1505 | ||
| 1506 | if( eeprom_rom != NULL ) | |
| 1507 | { | |
| 1508 | switch( eeprom_length ) | |
| 1509 | { | |
| 1510 | case 0x224: | |
| 1511 | x76f041_init( machine, cart, eeprom_rom ); | |
| 1512 | state->chiptype[ cart ] = 1; | |
| 1513 | ||
| 1514 | switch( cart ) | |
| 1515 | { | |
| 1516 | case 0: | |
| 1517 | state->nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f041_0); | |
| 1518 | break; | |
| 1519 | case 1: | |
| 1520 | state->nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f041_1); | |
| 1521 | break; | |
| 1522 | } | |
| 1523 | ||
| 1524 | break; | |
| 1525 | ||
| 1526 | case 0x84: | |
| 1527 | x76f100_init( machine, cart, eeprom_rom ); | |
| 1528 | state->chiptype[ cart ] = 2; | |
| 1529 | ||
| 1530 | switch( cart ) | |
| 1531 | { | |
| 1532 | case 0: | |
| 1533 | state->nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f100_0); | |
| 1534 | break; | |
| 1535 | case 1: | |
| 1536 | state->nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f100_1); | |
| 1537 | break; | |
| 1538 | } | |
| 1539 | ||
| 1540 | break; | |
| 1541 | ||
| 1542 | case 0x1014: | |
| 1543 | zs01_init( machine, cart, eeprom_rom, NULL, NULL, ds2401_rom ); | |
| 1544 | state->chiptype[ cart ] = 3; | |
| 1545 | ||
| 1546 | switch( cart ) | |
| 1547 | { | |
| 1548 | case 0: | |
| 1549 | state->nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(zs01_0); | |
| 1550 | break; | |
| 1551 | case 1: | |
| 1552 | state->nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(zs01_1); | |
| 1553 | break; | |
| 1554 | } | |
| 1555 | ||
| 1556 | break; | |
| 1557 | ||
| 1558 | default: | |
| 1559 | fatalerror( "security_cart_init(%d) invalid eeprom size %d\n", cart, eeprom_length ); | |
| 1560 | break; | |
| 1561 | } | |
| 1562 | } | |
| 1563 | else | |
| 1564 | { | |
| 1565 | state->chiptype[ cart ] = 0; | |
| 1566 | } | |
| 1567 | ||
| 1568 | if( state->chiptype[ cart ] != 3 && ds2401_rom != NULL ) | |
| 1569 | { | |
| 1570 | ds2401_init( machine, cart, ds2401_rom ); | |
| 1571 | state->has_ds2401[ cart ] = 1; | |
| 1572 | } | |
| 1573 | else | |
| 1574 | { | |
| 1575 | state->has_ds2401[ cart ] = 0; | |
| 1576 | } | |
| 1577 | } | |
| 1578 | ||
| 1579 | 1453 | static DRIVER_INIT( konami573 ) |
| 1580 | 1454 | { |
| 1581 | 1455 | ksys573_state *state = machine->driver_data<ksys573_state>(); |
| r10384 | r10385 | |
| 1593 | 1467 | |
| 1594 | 1468 | state->save_item( NAME(state->m_n_security_control) ); |
| 1595 | 1469 | |
| 1596 | security_cart_init( machine, 0, "user2", "user9" ); | |
| 1597 | security_cart_init( machine, 1, "user8", "user10" ); | |
| 1598 | ||
| 1599 | 1470 | state_save_register_item_array( machine, "KSYS573", NULL, 0, state->m_p_n_root_count ); |
| 1600 | 1471 | state_save_register_item_array( machine, "KSYS573", NULL, 0, state->m_p_n_root_mode ); |
| 1601 | 1472 | state_save_register_item_array( machine, "KSYS573", NULL, 0, state->m_p_n_root_target ); |
| r10384 | r10385 | |
| 1610 | 1481 | |
| 1611 | 1482 | psx_machine_init(machine); |
| 1612 | 1483 | |
| 1613 | if( state->chi | |
| 1484 | if( state->machine->device<device_secure_serial_flash>("install_eeprom") | |
| 1614 | 1485 | { |
| 1615 | 1486 | /* security cart */ |
| 1616 | 1487 | psx_sio_input( machine, 1, PSX_SIO_IN_DSR, PSX_SIO_IN_DSR ); |
| r10384 | r10385 | |
| 1638 | 1509 | int cd = input_port_read( machine, "CD" ); |
| 1639 | 1510 | SCSIInstance *new_cdrom; |
| 1640 | 1511 | |
| 1641 | if( state->chi | |
| 1512 | if( state->machin | |
| 1642 | 1513 | { |
| 1643 | 1514 | state->security_cart_number = cart; |
| 1644 | 1515 | } |
| r10384 | r10385 | |
| 2132 | 2003 | |
| 2133 | 2004 | /* GX894 digital i/o */ |
| 2134 | 2005 | |
| 2135 | static const UINT8 ds2401_xid[] = | |
| 2136 | { | |
| 2137 | 0x3d, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12, 0x01 | |
| 2138 | }; | |
| 2139 | ||
| 2140 | ||
| 2141 | 2006 | static READ32_HANDLER( gx894pwbba_r ) |
| 2142 | 2007 | { |
| 2143 | 2008 | ksys573_state *state = space->machine->driver_data<ksys573_state>(); |
| r10384 | r10385 | |
| 2218 | 2083 | case 0x3b: |
| 2219 | 2084 | if( ACCESSING_BITS_16_31 ) |
| 2220 | 2085 | { |
| 2221 | data |= | |
| 2086 | data |= | |
| 2222 | 2087 | } |
| 2223 | 2088 | break; |
| 2224 | 2089 | case 0x3d: |
| r10384 | r10385 | |
| 2391 | 2256 | logerror("FPGA MPEG key 3/3 %02x\n", data & 0xff); |
| 2392 | 2257 | if( ACCESSING_BITS_16_31 ) |
| 2393 | 2258 | { |
| 2394 | | |
| 2259 | | |
| 2395 | 2260 | } |
| 2396 | 2261 | break; |
| 2397 | 2262 | case 0x3e: |
| r10384 | r10385 | |
| 2454 | 2319 | state->gx894_ram_read_offset = 0; |
| 2455 | 2320 | state->gx894_ram = auto_alloc_array( machine, UINT16, gx894_ram_size/2 ); |
| 2456 | 2321 | |
| 2457 | ds2401_init( machine, 2, ds2401_xid ); /* todo: load this from roms */ | |
| 2458 | ||
| 2459 | 2322 | state->save_item( NAME(state->gx894pwbba_output_data) ); |
| 2460 | 2323 | state->save_pointer( NAME(state->gx894_ram), gx894_ram_size / 4 ); |
| 2461 | 2324 | } |
| r10384 | r10385 | |
| 2968 | 2831 | MCFG_CPU_VBLANK_INT("screen", sys573_vblank) |
| 2969 | 2832 | |
| 2970 | 2833 | MCFG_MACHINE_RESET( konami573 ) |
| 2971 | MCFG_NVRAM_HANDLER( konami573 ) | |
| 2972 | 2834 | |
| 2973 | 2835 | // onboard flash |
| 2974 | 2836 | MCFG_FUJITSU_29F016A_ADD("onboard.0") |
| r10384 | r10385 | |
| 3058 | 2920 | MCFG_UPD4701_ADD( "upd4701" ) |
| 3059 | 2921 | MACHINE_CONFIG_END |
| 3060 | 2922 | |
| 3061 | ||
| 3062 | 2923 | // Variants with additional digital sound board |
| 3063 | 2924 | static MACHINE_CONFIG_DERIVED( k573d, konami573 ) |
| 3064 | 2925 | MCFG_MAS3507D_ADD( "mpeg" ) |
| 2926 | MCFG_DS2401_ADD( "digital_id" ) | |
| 3065 | 2927 | MACHINE_CONFIG_END |
| 3066 | 2928 | |
| 3067 | 2929 | static MACHINE_CONFIG_DERIVED( pccard1d, pccard1 ) |
| 3068 | 2930 | MCFG_MAS3507D_ADD( "mpeg" ) |
| 2931 | MCFG_DS2401_ADD( "digital_id" ) | |
| 3069 | 2932 | MACHINE_CONFIG_END |
| 3070 | 2933 | |
| 3071 | 2934 | static MACHINE_CONFIG_DERIVED( pccard2d, pccard2 ) |
| 3072 | 2935 | MCFG_MAS3507D_ADD( "mpeg" ) |
| 2936 | MCFG_DS2401_ADD( "digital_id" ) | |
| 3073 | 2937 | MACHINE_CONFIG_END |
| 3074 | 2938 | |
| 2939 | // Security eeprom variants | |
| 2940 | // | |
| 2941 | // Suffixes are used to select them | |
| 2942 | // x = x76f041 | |
| 2943 | // y = x76f100 | |
| 2944 | // z = zs01 | |
| 2945 | // | |
| 2946 | // i = also use one or two ds2401 | |
| 2947 | // | |
| 2948 | // Up to two carts can be used | |
| 2949 | ||
| 2950 | static MACHINE_CONFIG_DERIVED( konami573x, konami573 ) | |
| 2951 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2952 | MACHINE_CONFIG_END | |
| 2953 | ||
| 2954 | static MACHINE_CONFIG_DERIVED( konami573xzi, konami573 ) | |
| 2955 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2956 | MCFG_DS2401_ADD( "install_id" ) | |
| 2957 | MCFG_ZS01_ADD( "game_eeprom", "game_id" ) | |
| 2958 | MCFG_DS2401_ADD( "game_id" ) | |
| 2959 | MACHINE_CONFIG_END | |
| 2960 | ||
| 2961 | static MACHINE_CONFIG_DERIVED( konami573y, konami573 ) | |
| 2962 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 2963 | MACHINE_CONFIG_END | |
| 2964 | ||
| 2965 | static MACHINE_CONFIG_DERIVED( konami573yi, konami573 ) | |
| 2966 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 2967 | MCFG_DS2401_ADD( "install_id" ) | |
| 2968 | MACHINE_CONFIG_END | |
| 2969 | ||
| 2970 | static MACHINE_CONFIG_DERIVED( konami573zi, konami573 ) | |
| 2971 | MCFG_ZS01_ADD( "install_eeprom", "install_id" ) | |
| 2972 | MCFG_DS2401_ADD( "install_id" ) | |
| 2973 | MACHINE_CONFIG_END | |
| 2974 | ||
| 2975 | static MACHINE_CONFIG_DERIVED( k573baitx, k573bait ) | |
| 2976 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2977 | MACHINE_CONFIG_END | |
| 2978 | ||
| 2979 | static MACHINE_CONFIG_DERIVED( k573dx, k573d ) | |
| 2980 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2981 | MACHINE_CONFIG_END | |
| 2982 | ||
| 2983 | static MACHINE_CONFIG_DERIVED( k573dxi, k573d ) | |
| 2984 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2985 | MCFG_DS2401_ADD( "install_id" ) | |
| 2986 | MACHINE_CONFIG_END | |
| 2987 | ||
| 2988 | static MACHINE_CONFIG_DERIVED( k573dxzi, k573d ) | |
| 2989 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 2990 | MCFG_DS2401_ADD( "install_id" ) | |
| 2991 | MCFG_ZS01_ADD( "game_eeprom", "game_id" ) | |
| 2992 | MCFG_DS2401_ADD( "game_id" ) | |
| 2993 | MACHINE_CONFIG_END | |
| 2994 | ||
| 2995 | static MACHINE_CONFIG_DERIVED( k573dyi, k573d ) | |
| 2996 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 2997 | MCFG_DS2401_ADD( "install_id" ) | |
| 2998 | MACHINE_CONFIG_END | |
| 2999 | ||
| 3000 | static MACHINE_CONFIG_DERIVED( k573dyyi, k573d ) | |
| 3001 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 3002 | MCFG_DS2401_ADD( "install_id" ) | |
| 3003 | MCFG_X76F100_ADD( "game_eeprom" ) | |
| 3004 | MCFG_DS2401_ADD( "game_id" ) | |
| 3005 | MACHINE_CONFIG_END | |
| 3006 | ||
| 3007 | static MACHINE_CONFIG_DERIVED( k573dzi, k573d ) | |
| 3008 | MCFG_ZS01_ADD( "install_eeprom", "install_id" ) | |
| 3009 | MCFG_DS2401_ADD( "install_id" ) | |
| 3010 | MACHINE_CONFIG_END | |
| 3011 | ||
| 3012 | static MACHINE_CONFIG_DERIVED( pccard1x, pccard1 ) | |
| 3013 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 3014 | MACHINE_CONFIG_END | |
| 3015 | ||
| 3016 | static MACHINE_CONFIG_DERIVED( pccard1xzi, pccard1 ) | |
| 3017 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 3018 | MCFG_DS2401_ADD( "install_id" ) | |
| 3019 | MCFG_ZS01_ADD( "game_eeprom", "game_id" ) | |
| 3020 | MCFG_DS2401_ADD( "game_id" ) | |
| 3021 | MACHINE_CONFIG_END | |
| 3022 | ||
| 3023 | static MACHINE_CONFIG_DERIVED( pccard1yi, pccard1 ) | |
| 3024 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 3025 | MCFG_DS2401_ADD( "install_id" ) | |
| 3026 | MACHINE_CONFIG_END | |
| 3027 | ||
| 3028 | static MACHINE_CONFIG_DERIVED( pccard1zi, pccard1 ) | |
| 3029 | MCFG_ZS01_ADD( "install_eeprom", "install_id" ) | |
| 3030 | MCFG_DS2401_ADD( "install_id" ) | |
| 3031 | MACHINE_CONFIG_END | |
| 3032 | ||
| 3033 | static MACHINE_CONFIG_DERIVED( pccard1dzi, pccard1d ) | |
| 3034 | MCFG_ZS01_ADD( "install_eeprom", "install_id" ) | |
| 3035 | MCFG_DS2401_ADD( "install_id" ) | |
| 3036 | MACHINE_CONFIG_END | |
| 3037 | ||
| 3038 | static MACHINE_CONFIG_DERIVED( pccard2yyi, pccard2 ) | |
| 3039 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 3040 | MCFG_DS2401_ADD( "install_id" ) | |
| 3041 | MCFG_X76F100_ADD( "game_eeprom" ) | |
| 3042 | MCFG_DS2401_ADD( "game_id" ) | |
| 3043 | MACHINE_CONFIG_END | |
| 3044 | ||
| 3045 | static MACHINE_CONFIG_DERIVED( pccard2dxzi, pccard2d ) | |
| 3046 | MCFG_X76F041_ADD( "install_eeprom" ) | |
| 3047 | MCFG_DS2401_ADD( "install_id" ) | |
| 3048 | MCFG_ZS01_ADD( "game_eeprom", "game_id" ) | |
| 3049 | MCFG_DS2401_ADD( "game_id" ) | |
| 3050 | MACHINE_CONFIG_END | |
| 3051 | ||
| 3052 | static MACHINE_CONFIG_DERIVED( pccard2dyyi, pccard2d ) | |
| 3053 | MCFG_X76F100_ADD( "install_eeprom" ) | |
| 3054 | MCFG_DS2401_ADD( "install_id" ) | |
| 3055 | MCFG_X76F100_ADD( "game_eeprom" ) | |
| 3056 | MCFG_DS2401_ADD( "game_id" ) | |
| 3057 | MACHINE_CONFIG_END | |
| 3058 | ||
| 3059 | static MACHINE_CONFIG_DERIVED( pccard2dzi, pccard2d ) | |
| 3060 | MCFG_ZS01_ADD( "install_eeprom", "install_id" ) | |
| 3061 | MCFG_DS2401_ADD( "install_id" ) | |
| 3062 | MACHINE_CONFIG_END | |
| 3063 | ||
| 3075 | 3064 | static INPUT_PORTS_START( konami573 ) |
| 3076 | 3065 | PORT_START("IN0") |
| 3077 | 3066 | PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r10384 | r10385 | |
| 3366 | 3355 | ROM_REGION32_LE( 0x080000, "bios", 0 ) \ |
| 3367 | 3356 | ROM_LOAD( "700a01.22g", 0x0000000, 0x080000, CRC(11812ef8) SHA1(e1284add4aaddd5337bd7f4e27614460d52b5b48)) |
| 3368 | 3357 | |
| 3358 | #define SYS573_DIGITAL_ID \ | |
| 3359 | ROM_REGION( 0x000008, "digital_id", 0 ) /* digital board id */ \ | |
| 3360 | ROM_LOAD( "digital-id.bin", 0x000000, 0x000008, CRC(2b977f4d) SHA1(2b108a56653f91cb3351718c45dfcf979bc35ef1) ) | |
| 3361 | ||
| 3369 | 3362 | // BIOS |
| 3370 | 3363 | ROM_START( sys573 ) |
| 3371 | 3364 | SYS573_BIOS_A |
| 3365 | SYS573_DIGITAL_ID | |
| 3372 | 3366 | ROM_END |
| 3373 | 3367 | |
| 3374 | 3368 | // Games |
| 3375 | 3369 | ROM_START( bassangl ) |
| 3376 | 3370 | SYS573_BIOS_A |
| 3377 | 3371 | |
| 3378 | ROM_REGION( 0x0000224, " | |
| 3372 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3379 | 3373 | ROM_LOAD( "ge765ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(ee1b32a7) SHA1(c0f6b14b054f5a95ce474e794a3e0ca78faac681) ) |
| 3380 | 3374 | |
| 3381 | 3375 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3385 | 3379 | ROM_START( bassang2 ) |
| 3386 | 3380 | SYS573_BIOS_A |
| 3387 | 3381 | |
| 3388 | ROM_REGION( 0x0000224, " | |
| 3382 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3389 | 3383 | ROM_LOAD( "gc865ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(095cbfb5) SHA1(529ce0a7b0986cf7e64c37f466d6c2dac95cea7f) ) |
| 3390 | 3384 | |
| 3391 | 3385 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3409 | 3403 | ROM_START( darkhleg ) |
| 3410 | 3404 | SYS573_BIOS_A |
| 3411 | 3405 | |
| 3412 | ROM_REGION( 0x0000224, " | |
| 3406 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3413 | 3407 | ROM_LOAD( "gx706ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(72b42574) SHA1(79dc959f0ce95ccb9ac0dbf0a72aec973e91bc56) ) |
| 3414 | 3408 | |
| 3415 | 3409 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3419 | 3413 | ROM_START( fmania ) |
| 3420 | 3414 | SYS573_BIOS_A |
| 3421 | 3415 | |
| 3422 | ROM_REGION( 0x0000224, " | |
| 3416 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3423 | 3417 | ROM_FILL( 0x000000, 0x000224, 0xff ) |
| 3424 | 3418 | |
| 3425 | 3419 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3428 | 3422 | |
| 3429 | 3423 | ROM_START( ddrextrm ) |
| 3430 | 3424 | SYS573_BIOS_A |
| 3425 | SYS573_DIGITAL_ID | |
| 3431 | 3426 | |
| 3432 | ROM_REGION( 0x0001014, " | |
| 3427 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3433 | 3428 | ROM_LOAD( "gcc36ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(c1601287) SHA1(929691a78f7bb6dd830f832f301116df0da1619b) ) |
| 3434 | 3429 | |
| 3435 | ROM_REGION( 0x000008, " | |
| 3430 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3436 | 3431 | ROM_LOAD( "gcc36ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3437 | 3432 | |
| 3438 | 3433 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3442 | 3437 | ROM_START( ddru ) |
| 3443 | 3438 | SYS573_BIOS_A |
| 3444 | 3439 | |
| 3445 | ROM_REGION( 0x0000224, " | |
| 3440 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3446 | 3441 | ROM_LOAD( "gn845ua.u1", 0x000000, 0x000224, BAD_DUMP CRC(c9e7fced) SHA1(aac4dde100091bc64d397f53484a0ffbf68b8101) ) |
| 3447 | 3442 | |
| 3448 | 3443 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3452 | 3447 | ROM_START( ddrj ) |
| 3453 | 3448 | SYS573_BIOS_A |
| 3454 | 3449 | |
| 3455 | ROM_REGION( 0x0000224, " | |
| 3450 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3456 | 3451 | ROM_LOAD( "gc845jb.u1", 0x000000, 0x000224, BAD_DUMP CRC(a16f42b8) SHA1(da4f1eb3eb2b28cb3a0bc74bb9b9945970f56ac2) ) |
| 3457 | 3452 | |
| 3458 | 3453 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3462 | 3457 | ROM_START( ddrja ) |
| 3463 | 3458 | SYS573_BIOS_A |
| 3464 | 3459 | |
| 3465 | ROM_REGION( 0x0000224, " | |
| 3460 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3466 | 3461 | ROM_LOAD( "gc845ja.u1", 0x000000, 0x000224, NO_DUMP ) |
| 3467 | 3462 | |
| 3468 | 3463 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 3492 | 3487 | ROM_START( ddrjb ) |
| 3493 | 3488 | SYS573_BIOS_A |
| 3494 | 3489 | |
| 3495 | ROM_REGION( 0x0000224, " | |
| 3490 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3496 | 3491 | ROM_LOAD( "gc845ja.u1", 0x000000, 0x000224, NO_DUMP ) |
| 3497 | 3492 | |
| 3498 | 3493 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 3522 | 3517 | ROM_START( ddra ) |
| 3523 | 3518 | SYS573_BIOS_A |
| 3524 | 3519 | |
| 3525 | ROM_REGION( 0x0000224, " | |
| 3520 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3526 | 3521 | ROM_LOAD( "gn845aa.u1", 0x000000, 0x000224, BAD_DUMP CRC(327c4851) SHA1(f0939224af706fd103a67aae9c96518c1db90ac9) ) |
| 3527 | 3522 | |
| 3528 | 3523 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3532 | 3527 | ROM_START( ddr2m ) |
| 3533 | 3528 | SYS573_BIOS_A |
| 3534 | 3529 | |
| 3535 | ROM_REGION( 0x0000224, " | |
| 3530 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3536 | 3531 | ROM_LOAD( "gn895jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(363f427e) SHA1(adec886a07b9bd91f142f286b04fc6582205f037) ) |
| 3537 | 3532 | |
| 3538 | 3533 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3542 | 3537 | ROM_START( ddr2mc ) |
| 3543 | 3538 | SYS573_BIOS_A |
| 3544 | 3539 | |
| 3545 | ROM_REGION( 0x0000224, " | |
| 3540 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3546 | 3541 | ROM_LOAD( "gn896ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(cbc984c5) SHA1(6c0cd78a41000999b4ffbd9fb3707738b50a9b50) ) |
| 3547 | 3542 | |
| 3548 | 3543 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3555 | 3550 | ROM_START( ddr2mc2 ) |
| 3556 | 3551 | SYS573_BIOS_A |
| 3557 | 3552 | |
| 3558 | ROM_REGION( 0x0000224, " | |
| 3553 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3559 | 3554 | ROM_LOAD( "ge984ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(cbc984c5) SHA1(6c0cd78a41000999b4ffbd9fb3707738b50a9b50) ) |
| 3560 | 3555 | |
| 3561 | 3556 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3571 | 3566 | ROM_REGION( 0x080000, "cpu2", 0 ) /* memory card reader */ |
| 3572 | 3567 | ROM_LOAD( "885a01.bin", 0x000000, 0x080000, CRC(e22d093f) SHA1(927f62f63b5caa7899392decacd12fea0e6fdbea) ) |
| 3573 | 3568 | |
| 3574 | ROM_REGION( 0x0000224, " | |
| 3569 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3575 | 3570 | ROM_LOAD( "ge885jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(cbc984c5) SHA1(6c0cd78a41000999b4ffbd9fb3707738b50a9b50) ) |
| 3576 | 3571 | |
| 3577 | 3572 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3580 | 3575 | |
| 3581 | 3576 | ROM_START( ddr3ma ) |
| 3582 | 3577 | SYS573_BIOS_A |
| 3578 | SYS573_DIGITAL_ID | |
| 3583 | 3579 | |
| 3584 | ROM_REGION( 0x0000084, " | |
| 3580 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3585 | 3581 | ROM_LOAD( "ge887aa.u1", 0x000000, 0x000084, BAD_DUMP CRC(4ce86d32) SHA1(94cdb9873a7f7503acc3b763e9b49ec6af53533f) ) |
| 3586 | 3582 | |
| 3587 | ROM_REGION( 0x0000084, " | |
| 3583 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3588 | 3584 | ROM_LOAD( "gn887aa.u1", 0x000000, 0x000084, BAD_DUMP CRC(bb14f9bd) SHA1(9d0adf5a32d8bbcaaea2f701f5c7a5d51ee0b8bf) ) |
| 3589 | 3585 | |
| 3590 | ROM_REGION( 0x000008, " | |
| 3586 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3591 | 3587 | ROM_LOAD( "ge887aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3592 | 3588 | |
| 3593 | ROM_REGION( 0x000008, " | |
| 3589 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3594 | 3590 | ROM_LOAD( "gn887aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3595 | 3591 | |
| 3596 | 3592 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3599 | 3595 | |
| 3600 | 3596 | ROM_START( ddr3mj ) |
| 3601 | 3597 | SYS573_BIOS_A |
| 3598 | SYS573_DIGITAL_ID | |
| 3602 | 3599 | |
| 3603 | ROM_REGION( 0x0000084, " | |
| 3600 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3604 | 3601 | ROM_LOAD( "ge887ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(3a377cec) SHA1(5bf3107a89547bd7697d9f0ab8f67240e101a559) ) |
| 3605 | 3602 | |
| 3606 | ROM_REGION( 0x0000084, " | |
| 3603 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3607 | 3604 | ROM_LOAD( "gn887ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(2f633432) SHA1(bce44f20a5a7318af6aea4fdfa8af64ddb76047c) ) |
| 3608 | 3605 | |
| 3609 | ROM_REGION( 0x000008, " | |
| 3606 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3610 | 3607 | ROM_LOAD( "ge887ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3611 | 3608 | |
| 3612 | ROM_REGION( 0x000008, " | |
| 3609 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3613 | 3610 | ROM_LOAD( "gn887ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3614 | 3611 | |
| 3615 | 3612 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3618 | 3615 | |
| 3619 | 3616 | ROM_START( ddr3mk ) |
| 3620 | 3617 | SYS573_BIOS_A |
| 3618 | SYS573_DIGITAL_ID | |
| 3621 | 3619 | |
| 3622 | ROM_REGION( 0x0000084, " | |
| 3620 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3623 | 3621 | ROM_LOAD( "ge887kb.u1", 0x000000, 0x000084, BAD_DUMP CRC(4ce86d32) SHA1(94cdb9873a7f7503acc3b763e9b49ec6af53533f) ) |
| 3624 | 3622 | |
| 3625 | ROM_REGION( 0x0000084, " | |
| 3623 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3626 | 3624 | ROM_LOAD( "gn887kb.u1", 0x000000, 0x000084, BAD_DUMP CRC(bb14f9bd) SHA1(9d0adf5a32d8bbcaaea2f701f5c7a5d51ee0b8bf) ) |
| 3627 | 3625 | |
| 3628 | ROM_REGION( 0x000008, " | |
| 3626 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3629 | 3627 | ROM_LOAD( "ge887kb.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3630 | 3628 | |
| 3631 | ROM_REGION( 0x000008, " | |
| 3629 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3632 | 3630 | ROM_LOAD( "gn887kb.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3633 | 3631 | |
| 3634 | 3632 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3637 | 3635 | |
| 3638 | 3636 | ROM_START( ddr3mka ) |
| 3639 | 3637 | SYS573_BIOS_A |
| 3638 | SYS573_DIGITAL_ID | |
| 3640 | 3639 | |
| 3641 | ROM_REGION( 0x0000084, " | |
| 3640 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3642 | 3641 | ROM_LOAD( "ge887ka.u1", 0x000000, 0x000084, BAD_DUMP CRC(4ce86d32) SHA1(94cdb9873a7f7503acc3b763e9b49ec6af53533f) ) |
| 3643 | 3642 | |
| 3644 | ROM_REGION( 0x0000084, " | |
| 3643 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3645 | 3644 | ROM_LOAD( "gn887ka.u1", 0x000000, 0x000084, BAD_DUMP CRC(bb14f9bd) SHA1(9d0adf5a32d8bbcaaea2f701f5c7a5d51ee0b8bf) ) |
| 3646 | 3645 | |
| 3647 | ROM_REGION( 0x000008, " | |
| 3646 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3648 | 3647 | ROM_LOAD( "ge887ka.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3649 | 3648 | |
| 3650 | ROM_REGION( 0x000008, " | |
| 3649 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3651 | 3650 | ROM_LOAD( "gn887ka.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3652 | 3651 | |
| 3653 | 3652 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3656 | 3655 | |
| 3657 | 3656 | ROM_START( ddr3mp ) |
| 3658 | 3657 | SYS573_BIOS_A |
| 3658 | SYS573_DIGITAL_ID | |
| 3659 | 3659 | |
| 3660 | ROM_REGION( 0x0000224, " | |
| 3660 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3661 | 3661 | ROM_LOAD( "gea22ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(ef370ff7) SHA1(cb7a043f8bfa535e54ae9af728031d1018ed0734) ) |
| 3662 | 3662 | |
| 3663 | ROM_REGION( 0x0001014, " | |
| 3663 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3664 | 3664 | ROM_LOAD( "gca22ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(6883c82c) SHA1(6fef1dc7150066eee427db685b6c5fb350b7768d) ) |
| 3665 | 3665 | |
| 3666 | ROM_REGION( 0x000008, " | |
| 3666 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3667 | 3667 | ROM_LOAD( "gea22ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3668 | 3668 | |
| 3669 | ROM_REGION( 0x000008, " | |
| 3669 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3670 | 3670 | ROM_LOAD( "gca22ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3671 | 3671 | |
| 3672 | 3672 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3675 | 3675 | |
| 3676 | 3676 | ROM_START( ddr4m ) |
| 3677 | 3677 | SYS573_BIOS_A |
| 3678 | SYS573_DIGITAL_ID | |
| 3678 | 3679 | |
| 3679 | ROM_REGION( 0x0000224, " | |
| 3680 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3680 | 3681 | ROM_LOAD( "gea33aa.u1", 0x000000, 0x000224, BAD_DUMP CRC(7bd2a24f) SHA1(62c73a54c4ed7697cf81ddbf3d13d4b0ca827be5) ) |
| 3681 | 3682 | |
| 3682 | ROM_REGION( 0x0001014, " | |
| 3683 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3683 | 3684 | ROM_LOAD( "gca33aa.u1", 0x000000, 0x001014, BAD_DUMP CRC(f6feb2bd) SHA1(dfd5bd532338849289e2e4c155c0ca86e79b9ae5) ) |
| 3684 | 3685 | |
| 3685 | ROM_REGION( 0x000008, " | |
| 3686 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3686 | 3687 | ROM_LOAD( "gea33aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3687 | 3688 | |
| 3688 | ROM_REGION( 0x000008, " | |
| 3689 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3689 | 3690 | ROM_LOAD( "gca33aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3690 | 3691 | |
| 3691 | 3692 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3694 | 3695 | |
| 3695 | 3696 | ROM_START( ddr4mj ) |
| 3696 | 3697 | SYS573_BIOS_A |
| 3698 | SYS573_DIGITAL_ID | |
| 3697 | 3699 | |
| 3698 | ROM_REGION( 0x0000224, " | |
| 3700 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3699 | 3701 | ROM_LOAD( "a33jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(10f1e9b8) SHA1(985bd26638964beebba5de4c7cda772b402d2e59) ) |
| 3700 | 3702 | |
| 3701 | ROM_REGION( 0x0001014, " | |
| 3703 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3702 | 3704 | ROM_LOAD( "gca33ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(e5230867) SHA1(44aea9ccc90d81e7f41e5e9a62b28fcbdd75363b) ) |
| 3703 | 3705 | |
| 3704 | ROM_REGION( 0x000008, " | |
| 3706 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3705 | 3707 | ROM_LOAD( "a33jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3706 | 3708 | |
| 3707 | ROM_REGION( 0x000008, " | |
| 3709 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3708 | 3710 | ROM_LOAD( "gca33ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3709 | 3711 | |
| 3710 | 3712 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3713 | 3715 | |
| 3714 | 3716 | ROM_START( ddr4ms ) |
| 3715 | 3717 | SYS573_BIOS_A |
| 3718 | SYS573_DIGITAL_ID | |
| 3716 | 3719 | |
| 3717 | ROM_REGION( 0x0000224, " | |
| 3720 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3718 | 3721 | ROM_LOAD( "gea33ab.u1", 0x000000, 0x000224, BAD_DUMP CRC(32fb3d13) SHA1(3ca6c77438f96b13d2c05f13a10fcff89a1403a2) ) |
| 3719 | 3722 | |
| 3720 | ROM_REGION( 0x0001014, " | |
| 3723 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3721 | 3724 | ROM_LOAD( "gca33ab.u1", 0x000000, 0x001014, BAD_DUMP CRC(312ac13f) SHA1(05d733edc03cfc5ea03db6c683f59ed6ff860b5a) ) |
| 3722 | 3725 | |
| 3723 | ROM_REGION( 0x000008, " | |
| 3726 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3724 | 3727 | ROM_LOAD( "gea33ab.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3725 | 3728 | |
| 3726 | ROM_REGION( 0x000008, " | |
| 3729 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3727 | 3730 | ROM_LOAD( "gca33ab.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3728 | 3731 | |
| 3729 | 3732 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3732 | 3735 | |
| 3733 | 3736 | ROM_START( ddr4msj ) |
| 3734 | 3737 | SYS573_BIOS_A |
| 3738 | SYS573_DIGITAL_ID | |
| 3735 | 3739 | |
| 3736 | ROM_REGION( 0x0000224, " | |
| 3740 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3737 | 3741 | ROM_LOAD( "a33jba.u1", 0x000000, 0x000224, BAD_DUMP CRC(babf6fdb) SHA1(a2ef6b855d42072f0d3c72c8de9aff1f867de3f7) ) |
| 3738 | 3742 | |
| 3739 | ROM_REGION( 0x0001014, " | |
| 3743 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3740 | 3744 | ROM_LOAD( "gca33jb.u1", 0x000000, 0x001014, BAD_DUMP CRC(00e4b531) SHA1(f421fc33642c5a3cd89fb14dc8cd601bdddd1f55) ) |
| 3741 | 3745 | |
| 3742 | ROM_REGION( 0x000008, " | |
| 3746 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3743 | 3747 | ROM_LOAD( "a33jba.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3744 | 3748 | |
| 3745 | ROM_REGION( 0x000008, " | |
| 3749 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3746 | 3750 | ROM_LOAD( "gca33jb.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3747 | 3751 | |
| 3748 | 3752 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3751 | 3755 | |
| 3752 | 3756 | ROM_START( ddr4mp ) |
| 3753 | 3757 | SYS573_BIOS_A |
| 3758 | SYS573_DIGITAL_ID | |
| 3754 | 3759 | |
| 3755 | ROM_REGION( 0x0000224, " | |
| 3760 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3756 | 3761 | ROM_LOAD( "gea34ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(10f1e9b8) SHA1(985bd26638964beebba5de4c7cda772b402d2e59) ) |
| 3757 | 3762 | |
| 3758 | ROM_REGION( 0x0001014, " | |
| 3763 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3759 | 3764 | ROM_LOAD( "gca34ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(e9b6ce56) SHA1(f040fba2b2b446baa840026dcd10f9785f8cc0a3) ) |
| 3760 | 3765 | |
| 3761 | ROM_REGION( 0x000008, " | |
| 3766 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3762 | 3767 | ROM_LOAD( "gea34ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3763 | 3768 | |
| 3764 | ROM_REGION( 0x000008, " | |
| 3769 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3765 | 3770 | ROM_LOAD( "gca34ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3766 | 3771 | |
| 3767 | 3772 | ROM_REGION( 0x002000, "m48t58", 0 ) /* timekeeper */ |
| r10384 | r10385 | |
| 3773 | 3778 | |
| 3774 | 3779 | ROM_START( ddr4mps ) |
| 3775 | 3780 | SYS573_BIOS_A |
| 3781 | SYS573_DIGITAL_ID | |
| 3776 | 3782 | |
| 3777 | ROM_REGION( 0x0000224, " | |
| 3783 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3778 | 3784 | ROM_LOAD( "gea34jb.u1", 0x000000, 0x000224, BAD_DUMP CRC(babf6fdb) SHA1(a2ef6b855d42072f0d3c72c8de9aff1f867de3f7) ) |
| 3779 | 3785 | |
| 3780 | ROM_REGION( 0x0001014, " | |
| 3786 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3781 | 3787 | ROM_LOAD( "gca34jb.u1", 0x000000, 0x001014, BAD_DUMP CRC(0c717300) SHA1(00d21f39fe90494ffec2f8799767cc46a9cd2b00) ) |
| 3782 | 3788 | |
| 3783 | ROM_REGION( 0x000008, " | |
| 3789 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3784 | 3790 | ROM_LOAD( "gea34jb.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3785 | 3791 | |
| 3786 | ROM_REGION( 0x000008, " | |
| 3792 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3787 | 3793 | ROM_LOAD( "gca34jb.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3788 | 3794 | |
| 3789 | 3795 | ROM_REGION( 0x002000, "m48t58", 0 ) /* timekeeper */ |
| r10384 | r10385 | |
| 3795 | 3801 | |
| 3796 | 3802 | ROM_START( ddr5m ) |
| 3797 | 3803 | SYS573_BIOS_A |
| 3804 | SYS573_DIGITAL_ID | |
| 3798 | 3805 | |
| 3799 | ROM_REGION( 0x0001014, " | |
| 3806 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3800 | 3807 | ROM_LOAD( "gca27ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(ec526036) SHA1(f47d94d19268fdfa3ae9d42db9f2e2f9be318f2b) ) |
| 3801 | 3808 | |
| 3802 | ROM_REGION( 0x000008, " | |
| 3809 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3803 | 3810 | ROM_LOAD( "gca27ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3804 | 3811 | |
| 3805 | 3812 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3809 | 3816 | ROM_START( ddrbocd ) |
| 3810 | 3817 | SYS573_BIOS_A |
| 3811 | 3818 | |
| 3812 | ROM_REGION( 0x0000224, " | |
| 3819 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3813 | 3820 | ROM_LOAD( "gn895jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(363f427e) SHA1(adec886a07b9bd91f142f286b04fc6582205f037) ) |
| 3814 | 3821 | |
| 3815 | 3822 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3821 | 3828 | |
| 3822 | 3829 | ROM_START( ddrs2k ) |
| 3823 | 3830 | SYS573_BIOS_A |
| 3831 | SYS573_DIGITAL_ID | |
| 3824 | 3832 | |
| 3825 | ROM_REGION( 0x0000084, " | |
| 3833 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3826 | 3834 | ROM_LOAD( "ge905aa.u1", 0x000000, 0x000084, BAD_DUMP CRC(36d18e2f) SHA1(e976047dfbee62de9ad9e5de8e7629a24c29d581) ) |
| 3827 | 3835 | |
| 3828 | ROM_REGION( 0x0000084, " | |
| 3836 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3829 | 3837 | ROM_LOAD( "gc905aa.u1", 0x000000, 0x000084, BAD_DUMP CRC(21073a3e) SHA1(afa12404ceb462b9016a41c40775da87aa09cfeb) ) |
| 3830 | 3838 | |
| 3831 | ROM_REGION( 0x000008, " | |
| 3839 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3832 | 3840 | ROM_LOAD( "ge905aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3833 | 3841 | |
| 3834 | ROM_REGION( 0x000008, " | |
| 3842 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3835 | 3843 | ROM_LOAD( "gc905aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3836 | 3844 | |
| 3837 | 3845 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3840 | 3848 | |
| 3841 | 3849 | ROM_START( ddrs2kj ) |
| 3842 | 3850 | SYS573_BIOS_A |
| 3851 | SYS573_DIGITAL_ID | |
| 3843 | 3852 | |
| 3844 | ROM_REGION( 0x0000084, " | |
| 3853 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3845 | 3854 | ROM_LOAD( "ge905ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(a077b0a1) SHA1(8f247b38c933a104a325ebf1f1691ef260480e1a) ) |
| 3846 | 3855 | |
| 3847 | ROM_REGION( 0x0000084, " | |
| 3856 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3848 | 3857 | ROM_LOAD( "gc905ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(b7a104b0) SHA1(0f6901e41640f729f8a084a33148a9b900475594) ) |
| 3849 | 3858 | |
| 3850 | ROM_REGION( 0x000008, " | |
| 3859 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3851 | 3860 | ROM_LOAD( "ge905ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3852 | 3861 | |
| 3853 | ROM_REGION( 0x000008, " | |
| 3862 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3854 | 3863 | ROM_LOAD( "gc905aa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3855 | 3864 | |
| 3856 | 3865 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3859 | 3868 | |
| 3860 | 3869 | ROM_START( ddrmax ) |
| 3861 | 3870 | SYS573_BIOS_A |
| 3871 | SYS573_DIGITAL_ID | |
| 3862 | 3872 | |
| 3863 | ROM_REGION( 0x0001014, " | |
| 3873 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3864 | 3874 | ROM_LOAD( "gcb19ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(2255626a) SHA1(cb70c4b551265ffc6cc41f7bd2678696e8067060) ) |
| 3865 | 3875 | |
| 3866 | ROM_REGION( 0x000008, " | |
| 3876 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3867 | 3877 | ROM_LOAD( "gcb19ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3868 | 3878 | |
| 3869 | 3879 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3872 | 3882 | |
| 3873 | 3883 | ROM_START( ddrmax2 ) |
| 3874 | 3884 | SYS573_BIOS_A |
| 3885 | SYS573_DIGITAL_ID | |
| 3875 | 3886 | |
| 3876 | ROM_REGION( 0x0001014, " | |
| 3887 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3877 | 3888 | ROM_LOAD( "gcb20ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(fb7e0f58) SHA1(e6da23257a2a2ba7c69e817a91a0a8864f009386) ) |
| 3878 | 3889 | |
| 3879 | ROM_REGION( 0x000008, " | |
| 3890 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3880 | 3891 | ROM_LOAD( "gcb20ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3881 | 3892 | |
| 3882 | 3893 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3885 | 3896 | |
| 3886 | 3897 | ROM_START( ddrsbm ) |
| 3887 | 3898 | SYS573_BIOS_A |
| 3899 | SYS573_DIGITAL_ID | |
| 3888 | 3900 | |
| 3889 | ROM_REGION( 0x0000084, " | |
| 3901 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3890 | 3902 | ROM_LOAD( "gq894ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(cc3a47de) SHA1(f6e2e101870370b1e295a4a9ed546aa2d8bc2010) ) |
| 3891 | 3903 | |
| 3892 | ROM_REGION( 0x000008, " | |
| 3904 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3893 | 3905 | ROM_LOAD( "gq894ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3894 | 3906 | |
| 3895 | 3907 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3898 | 3910 | |
| 3899 | 3911 | ROM_START( ddrusa ) |
| 3900 | 3912 | SYS573_BIOS_A |
| 3913 | SYS573_DIGITAL_ID | |
| 3901 | 3914 | |
| 3902 | ROM_REGION( 0x0001014, " | |
| 3915 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3903 | 3916 | ROM_LOAD( "gka44ua.u1", 0x000000, 0x001014, BAD_DUMP CRC(2ef7c4f1) SHA1(9004d27179ece86883d01b3e6bbfeebc1b478d57) ) |
| 3904 | 3917 | |
| 3905 | ROM_REGION( 0x000008, " | |
| 3918 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 3906 | 3919 | ROM_LOAD( "gka44ua.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3907 | 3920 | |
| 3908 | 3921 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3912 | 3925 | ROM_START( drmn ) |
| 3913 | 3926 | SYS573_BIOS_A |
| 3914 | 3927 | |
| 3915 | ROM_REGION( 0x0000224, " | |
| 3928 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3916 | 3929 | ROM_LOAD( "gq881ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(7dca0b3f) SHA1(db6d5c527e2a99133b516e01433024d3173848c6) ) |
| 3917 | 3930 | |
| 3918 | 3931 | ROM_REGION( 0x200000, "onboard.6", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 3932 | 3945 | |
| 3933 | 3946 | ROM_START( drmn2m ) |
| 3934 | 3947 | SYS573_BIOS_A |
| 3948 | SYS573_DIGITAL_ID | |
| 3935 | 3949 | |
| 3936 | ROM_REGION( 0x0000224, " | |
| 3950 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3937 | 3951 | ROM_LOAD( "ge912ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(1246fe5b) SHA1(b58d4f4c95e13abf639d645223565544bd79a58a) ) |
| 3938 | 3952 | |
| 3939 | ROM_REGION( 0x0001014, " | |
| 3953 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3940 | 3954 | ROM_LOAD( "gn912ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(34deea99) SHA1(f179e22eaf30453bb94177ed9c25d7996f020c99) ) |
| 3941 | 3955 | |
| 3942 | ROM_REGION( 0x000008, " | |
| 3956 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3943 | 3957 | ROM_LOAD( "ge912ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3944 | 3958 | |
| 3945 | ROM_REGION( 0x000008, " | |
| 3959 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3946 | 3960 | ROM_LOAD( "gn912ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3947 | 3961 | |
| 3948 | 3962 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3951 | 3965 | |
| 3952 | 3966 | ROM_START( drmn2mpu ) |
| 3953 | 3967 | SYS573_BIOS_A |
| 3968 | SYS573_DIGITAL_ID | |
| 3954 | 3969 | |
| 3955 | ROM_REGION( 0x0000224, " | |
| 3970 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3956 | 3971 | ROM_LOAD( "ge912ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(1246fe5b) SHA1(b58d4f4c95e13abf639d645223565544bd79a58a) ) |
| 3957 | 3972 | |
| 3958 | ROM_REGION( 0x0001014, " | |
| 3973 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3959 | 3974 | ROM_LOAD( "gn912ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(34deea99) SHA1(f179e22eaf30453bb94177ed9c25d7996f020c99) ) |
| 3960 | 3975 | |
| 3961 | ROM_REGION( 0x000008, " | |
| 3976 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3962 | 3977 | ROM_LOAD( "ge912ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3963 | 3978 | |
| 3964 | ROM_REGION( 0x000008, " | |
| 3979 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3965 | 3980 | ROM_LOAD( "gn912ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3966 | 3981 | |
| 3967 | 3982 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3973 | 3988 | |
| 3974 | 3989 | ROM_START( drmn3m ) |
| 3975 | 3990 | SYS573_BIOS_A |
| 3991 | SYS573_DIGITAL_ID | |
| 3976 | 3992 | |
| 3977 | ROM_REGION( 0x0000224, " | |
| 3993 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 3978 | 3994 | ROM_LOAD( "a23jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(90e544fa) SHA1(1feb617c36bad41aa720a6e5d3ec9e5cb2030567) ) |
| 3979 | 3995 | |
| 3980 | ROM_REGION( 0x0001014, " | |
| 3996 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 3981 | 3997 | ROM_LOAD( "gca23ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(5af1b5da) SHA1(cf862ef9ab60e8da89af96266943137827e4a261) ) |
| 3982 | 3998 | |
| 3983 | ROM_REGION( 0x000008, " | |
| 3999 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 3984 | 4000 | ROM_LOAD( "a23jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 3985 | 4001 | |
| 3986 | ROM_REGION( 0x000008, " | |
| 4002 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 3987 | 4003 | ROM_LOAD( "gca23ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 3988 | 4004 | |
| 3989 | 4005 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 3992 | 4008 | |
| 3993 | 4009 | ROM_START( dmx ) |
| 3994 | 4010 | SYS573_BIOS_A |
| 4011 | SYS573_DIGITAL_ID | |
| 3995 | 4012 | |
| 3996 | ROM_REGION( 0x0001014, " | |
| 4013 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 3997 | 4014 | ROM_LOAD( "ge874ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(c5536373) SHA1(1492221f7dd9485f7745ecb0a982a88c8e768e53) ) |
| 3998 | 4015 | |
| 3999 | ROM_REGION( 0x000008, " | |
| 4016 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4000 | 4017 | ROM_LOAD( "ge874ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4001 | 4018 | |
| 4002 | 4019 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4005 | 4022 | |
| 4006 | 4023 | ROM_START( dmx2m ) |
| 4007 | 4024 | SYS573_BIOS_A |
| 4025 | SYS573_DIGITAL_ID | |
| 4008 | 4026 | |
| 4009 | ROM_REGION( 0x0001014, " | |
| 4027 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4010 | 4028 | ROM_LOAD( "gca39ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(ecc75eb7) SHA1(af66ced28ba5e79ae32ae0ef12d2ebe4207f3822) ) |
| 4011 | 4029 | |
| 4012 | ROM_REGION( 0x000008, " | |
| 4030 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4013 | 4031 | ROM_LOAD( "gca39ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4014 | 4032 | |
| 4015 | 4033 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4018 | 4036 | |
| 4019 | 4037 | ROM_START( dmx2majp ) |
| 4020 | 4038 | SYS573_BIOS_A |
| 4039 | SYS573_DIGITAL_ID | |
| 4021 | 4040 | |
| 4022 | ROM_REGION( 0x0001014, " | |
| 4041 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4023 | 4042 | ROM_LOAD( "gca38ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(99a746b8) SHA1(333236e59a707ecaf840a66f9b947ceade2cf2c9) ) |
| 4024 | 4043 | |
| 4025 | 4044 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 4027 | 4046 | ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */ |
| 4028 | 4047 | ROM_LOAD( "gca38ja.27m", 0x000000, 0x200000, CRC(6c3934b8) SHA1(f0e4a692b6caaf60fefaec87fd23da577439f69d) ) |
| 4029 | 4048 | |
| 4030 | ROM_REGION( 0x000008, " | |
| 4049 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4031 | 4050 | ROM_LOAD( "gca38ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4032 | 4051 | |
| 4033 | 4052 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4036 | 4055 | |
| 4037 | 4056 | ROM_START( dncfrks ) |
| 4038 | 4057 | SYS573_BIOS_A |
| 4058 | SYS573_DIGITAL_ID | |
| 4039 | 4059 | |
| 4040 | ROM_REGION( 0x0001014, " | |
| 4060 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4041 | 4061 | ROM_LOAD( "gk874ka.u1", 0x000000, 0x001014, BAD_DUMP CRC(7a6f4672) SHA1(2e009e57760e92f48070a69cff5597c37a4783a2) ) |
| 4042 | 4062 | |
| 4043 | ROM_REGION( 0x000008, " | |
| 4063 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4044 | 4064 | ROM_LOAD( "gk874ka.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4045 | 4065 | |
| 4046 | 4066 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4049 | 4069 | |
| 4050 | 4070 | ROM_START( dsem ) |
| 4051 | 4071 | SYS573_BIOS_A |
| 4072 | SYS573_DIGITAL_ID | |
| 4052 | 4073 | |
| 4053 | ROM_REGION( 0x0000224, " | |
| 4074 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4054 | 4075 | ROM_LOAD( "ge936ea.u1", 0x000000, 0x000224, BAD_DUMP CRC(0f5b7ae3) SHA1(646dd49da1216cc2d3d6920bc9b3447d55ebfbf0) ) |
| 4055 | 4076 | |
| 4056 | ROM_REGION( 0x000008, " | |
| 4077 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4057 | 4078 | ROM_LOAD( "ge936ea.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4058 | 4079 | |
| 4059 | 4080 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4062 | 4083 | |
| 4063 | 4084 | ROM_START( dsem2 ) |
| 4064 | 4085 | SYS573_BIOS_A |
| 4086 | SYS573_DIGITAL_ID | |
| 4065 | 4087 | |
| 4066 | ROM_REGION( 0x0001014, " | |
| 4088 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4067 | 4089 | ROM_LOAD( "gkc23ea.u1", 0x000000, 0x001014, BAD_DUMP CRC(aec2421a) SHA1(5ea9e9ce6161ebc99a50db0b7304385511bd4553) ) |
| 4068 | 4090 | |
| 4069 | ROM_REGION( 0x000008, " | |
| 4091 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4070 | 4092 | ROM_LOAD( "gkc23ea.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4071 | 4093 | |
| 4072 | 4094 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4075 | 4097 | |
| 4076 | 4098 | ROM_START( dsfdct ) |
| 4077 | 4099 | SYS573_BIOS_A |
| 4100 | SYS573_DIGITAL_ID | |
| 4078 | 4101 | |
| 4079 | ROM_REGION( 0x0000084, " | |
| 4102 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4080 | 4103 | ROM_LOAD( "ge887ja_gn887ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(08a60147) SHA1(0d39dca5e9e17fff0e64f296c8416e4ca23fdc1b) ) |
| 4081 | 4104 | |
| 4082 | ROM_REGION( 0x0000084, " | |
| 4105 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4083 | 4106 | ROM_LOAD( "gc910jc.u1", 0x000000, 0x000084, BAD_DUMP CRC(3c1ca973) SHA1(32211a72e3ac88b2723f82dac0b26f93031b3a9c) ) |
| 4084 | 4107 | |
| 4085 | ROM_REGION( 0x000008, " | |
| 4108 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4086 | 4109 | ROM_LOAD( "ge887ja_gn887ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4087 | 4110 | |
| 4088 | ROM_REGION( 0x000008, " | |
| 4111 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4089 | 4112 | ROM_LOAD( "gc910jc.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4090 | 4113 | |
| 4091 | 4114 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4095 | 4118 | ROM_START( dsfdcta ) |
| 4096 | 4119 | SYS573_BIOS_A |
| 4097 | 4120 | |
| 4098 | ROM_REGION( 0x0000084, " | |
| 4121 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4099 | 4122 | ROM_LOAD( "gn884ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(ce6b98ce) SHA1(75549d9470345ce06d2706d373b19416d97e5b9a) ) |
| 4100 | 4123 | |
| 4101 | ROM_REGION( 0x0000084, " | |
| 4124 | ROM_REGION( 0x0000084, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4102 | 4125 | ROM_LOAD( "gc910ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(59a23808) SHA1(fcff1c68ff6cfbd391ac997a40fb5253fc62de82) ) |
| 4103 | 4126 | |
| 4104 | ROM_REGION( 0x000008, " | |
| 4127 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4105 | 4128 | ROM_LOAD( "gn884ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4106 | 4129 | |
| 4107 | ROM_REGION( 0x000008, " | |
| 4130 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4108 | 4131 | ROM_LOAD( "gc910ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4109 | 4132 | |
| 4110 | 4133 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4113 | 4136 | |
| 4114 | 4137 | ROM_START( dsfdr ) |
| 4115 | 4138 | SYS573_BIOS_A |
| 4139 | SYS573_DIGITAL_ID | |
| 4116 | 4140 | |
| 4117 | ROM_REGION( 0x0000224, " | |
| 4141 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4118 | 4142 | ROM_LOAD( "gea37ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(5321055e) SHA1(d06b0dca9caba8249d71340469ad9083b02fd087) ) |
| 4119 | 4143 | |
| 4120 | ROM_REGION( 0x0001014, " | |
| 4144 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4121 | 4145 | ROM_LOAD( "gca37ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(b6d9e7f9) SHA1(bc5f491de53a96d46745df09bc94e7853052296c) ) |
| 4122 | 4146 | |
| 4123 | ROM_REGION( 0x000008, " | |
| 4147 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4124 | 4148 | ROM_LOAD( "gea37ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 4125 | 4149 | |
| 4126 | ROM_REGION( 0x000008, " | |
| 4150 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4127 | 4151 | ROM_LOAD( "gca37ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4128 | 4152 | |
| 4129 | 4153 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4133 | 4157 | ROM_START( dsftkd ) |
| 4134 | 4158 | SYS573_BIOS_A |
| 4135 | 4159 | |
| 4136 | ROM_REGION( 0x0000084, " | |
| 4160 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4137 | 4161 | ROM_LOAD( "gn884ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(ce6b98ce) SHA1(75549d9470345ce06d2706d373b19416d97e5b9a) ) |
| 4138 | 4162 | |
| 4139 | ROM_REGION( 0x000008, " | |
| 4163 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4140 | 4164 | ROM_LOAD( "gn884ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4141 | 4165 | |
| 4142 | 4166 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4146 | 4170 | ROM_START( dstage ) |
| 4147 | 4171 | SYS573_BIOS_A |
| 4148 | 4172 | |
| 4149 | ROM_REGION( 0x0000224, " | |
| 4173 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4150 | 4174 | ROM_LOAD( "gn845ea.u1", 0x000000, 0x000224, BAD_DUMP CRC(db643af7) SHA1(881221da640b883302e657b906ea0a4e74555679) ) |
| 4151 | 4175 | |
| 4152 | 4176 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4156 | 4180 | ROM_START( fbait2bc ) |
| 4157 | 4181 | SYS573_BIOS_A |
| 4158 | 4182 | |
| 4159 | ROM_REGION( 0x0000224, " | |
| 4183 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4160 | 4184 | ROM_LOAD( "gc865ua.u1", 0x000000, 0x000224, BAD_DUMP CRC(ea8f0b4b) SHA1(363b1ea1a520b239ba8bca867366bbe8a9977a43) ) |
| 4161 | 4185 | |
| 4162 | 4186 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4166 | 4190 | ROM_START( fbaitbc ) |
| 4167 | 4191 | SYS573_BIOS_A |
| 4168 | 4192 | |
| 4169 | ROM_REGION( 0x0000224, " | |
| 4193 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4170 | 4194 | ROM_LOAD( "ge765ua.u1", 0x000000, 0x000224, BAD_DUMP CRC(588748c6) SHA1(ea1ead61e0dcb324ef7b6106cae00bcf6702d6c4) ) |
| 4171 | 4195 | |
| 4172 | 4196 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4176 | 4200 | ROM_START( fbaitmc ) |
| 4177 | 4201 | SYS573_BIOS_A |
| 4178 | 4202 | |
| 4179 | ROM_REGION( 0x0000224, " | |
| 4203 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4180 | 4204 | ROM_LOAD( "gx889ea.u1", 0x000000, 0x000224, BAD_DUMP CRC(753ad84e) SHA1(e024cefaaee7c9945ccc1f9a3d896b8560adce2e) ) |
| 4181 | 4205 | |
| 4182 | 4206 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4186 | 4210 | ROM_START( fbaitmca ) |
| 4187 | 4211 | SYS573_BIOS_A |
| 4188 | 4212 | |
| 4189 | ROM_REGION( 0x0000224, " | |
| 4213 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4190 | 4214 | ROM_LOAD( "gx889aa.u1", 0x000000, 0x000224, BAD_DUMP CRC(9c22aae8) SHA1(c107b0bf7fa76708f2d4f6aaf2cf27b3858378a3) ) |
| 4191 | 4215 | |
| 4192 | 4216 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4196 | 4220 | ROM_START( fbaitmcj ) |
| 4197 | 4221 | SYS573_BIOS_A |
| 4198 | 4222 | |
| 4199 | ROM_REGION( 0x0000224, " | |
| 4223 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4200 | 4224 | ROM_LOAD( "gx889ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(6278603c) SHA1(d6b59e270cfe4016e12565aedec8a4f0702e1a6f) ) |
| 4201 | 4225 | |
| 4202 | 4226 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4206 | 4230 | ROM_START( fbaitmcu ) |
| 4207 | 4231 | SYS573_BIOS_A |
| 4208 | 4232 | |
| 4209 | ROM_REGION( 0x0000224, " | |
| 4233 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4210 | 4234 | ROM_LOAD( "gx889ua.u1", 0x000000, 0x000224, BAD_DUMP CRC(67b91e54) SHA1(4d94bfab08e2bf6e34ee606dd3c4e345d8e5d158) ) |
| 4211 | 4235 | |
| 4212 | 4236 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4216 | 4240 | ROM_START( gtrfrks ) |
| 4217 | 4241 | SYS573_BIOS_A |
| 4218 | 4242 | |
| 4219 | ROM_REGION( 0x0000224, " | |
| 4243 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4220 | 4244 | ROM_LOAD( "gq886eac.u1", 0x000000, 0x000224, BAD_DUMP CRC(06bd6c4f) SHA1(61930e467ad135e2f31393ff5af981ed52f3bef9) ) |
| 4221 | 4245 | |
| 4222 | 4246 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4226 | 4250 | ROM_START( gtrfrksu ) |
| 4227 | 4251 | SYS573_BIOS_A |
| 4228 | 4252 | |
| 4229 | ROM_REGION( 0x0000224, " | |
| 4253 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4230 | 4254 | ROM_LOAD( "gq886uac.u1", 0x000000, 0x000224, BAD_DUMP CRC(143eaa55) SHA1(51a4fa3693f1cb1646a8986003f9b6cc1ae8b630) ) |
| 4231 | 4255 | |
| 4232 | 4256 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4236 | 4260 | ROM_START( gtrfrksj ) |
| 4237 | 4261 | SYS573_BIOS_A |
| 4238 | 4262 | |
| 4239 | ROM_REGION( 0x0000224, " | |
| 4263 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4240 | 4264 | ROM_LOAD( "gq886jac.u1", 0x000000, 0x000224, BAD_DUMP CRC(11ffd43d) SHA1(27f4f4d782604379254fb98c3c57e547aa4b321f) ) |
| 4241 | 4265 | |
| 4242 | 4266 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4246 | 4270 | ROM_START( gtrfrksa ) |
| 4247 | 4271 | SYS573_BIOS_A |
| 4248 | 4272 | |
| 4249 | ROM_REGION( 0x0000224, " | |
| 4273 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4250 | 4274 | ROM_LOAD( "gq886aac.u1", 0x000000, 0x000224, BAD_DUMP CRC(efa51ee9) SHA1(3374d936de69c287e0161bc526546441c2943555) ) |
| 4251 | 4275 | |
| 4252 | 4276 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4256 | 4280 | ROM_START( gtrfrk2m ) |
| 4257 | 4281 | SYS573_BIOS_A |
| 4258 | 4282 | |
| 4259 | ROM_REGION( 0x0000084, " | |
| 4283 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4260 | 4284 | ROM_LOAD( "gq883jad.u1", 0x000000, 0x000084, BAD_DUMP CRC(687868c4) SHA1(1230e74e4cf17953febe501df56d8bbec1de9356) ) |
| 4261 | 4285 | |
| 4262 | ROM_REGION( 0x000008, " | |
| 4286 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4263 | 4287 | ROM_LOAD( "gq883jad.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4264 | 4288 | |
| 4265 | 4289 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4269 | 4293 | ROM_START( gtrfrk3m ) |
| 4270 | 4294 | SYS573_BIOS_A |
| 4271 | 4295 | |
| 4272 | ROM_REGION( 0x0000224, " | |
| 4296 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4273 | 4297 | ROM_LOAD( "949jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(96c21d71) SHA1(871f1f0429154a486e547e182534db1557008dd6) ) |
| 4274 | 4298 | |
| 4275 | ROM_REGION( 0x0001014, " | |
| 4299 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4276 | 4300 | ROM_LOAD( "ge949jab.u1", 0x000000, 0x001014, BAD_DUMP CRC(8645e17f) SHA1(e8a833384cb6bdb05870fcd44e7c8ed48a03c852) ) |
| 4277 | 4301 | |
| 4278 | ROM_REGION( 0x000008, " | |
| 4302 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4279 | 4303 | ROM_LOAD( "949jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 4280 | 4304 | |
| 4281 | ROM_REGION( 0x000008, " | |
| 4305 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4282 | 4306 | ROM_LOAD( "ge949jab.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4283 | 4307 | |
| 4284 | 4308 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4291 | 4315 | ROM_START( gtfrk3ma ) |
| 4292 | 4316 | SYS573_BIOS_A |
| 4293 | 4317 | |
| 4294 | ROM_REGION( 0x0000224, " | |
| 4318 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4295 | 4319 | ROM_LOAD( "949jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(96c21d71) SHA1(871f1f0429154a486e547e182534db1557008dd6) ) |
| 4296 | 4320 | |
| 4297 | ROM_REGION( 0x0001014, " | |
| 4321 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4298 | 4322 | ROM_LOAD( "ge949jab.u1", 0x000000, 0x001014, BAD_DUMP CRC(8645e17f) SHA1(e8a833384cb6bdb05870fcd44e7c8ed48a03c852) ) |
| 4299 | 4323 | |
| 4300 | ROM_REGION( 0x000008, " | |
| 4324 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4301 | 4325 | ROM_LOAD( "949jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 4302 | 4326 | |
| 4303 | ROM_REGION( 0x000008, " | |
| 4327 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4304 | 4328 | ROM_LOAD( "ge949jab.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4305 | 4329 | |
| 4306 | 4330 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4310 | 4334 | ROM_START( gtfrk3mb ) |
| 4311 | 4335 | SYS573_BIOS_A |
| 4312 | 4336 | |
| 4313 | ROM_REGION( 0x0001014, " | |
| 4337 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* game security cart eeprom */ | |
| 4314 | 4338 | ROM_LOAD( "ge949jaa.u1", 0x000000, 0x001014, BAD_DUMP CRC(61f35ee1) SHA1(0a2b66742364d76ec18647b2761590bd49229625) ) |
| 4315 | 4339 | |
| 4316 | ROM_REGION( 0x000008, " | |
| 4340 | ROM_REGION( 0x000008, "install_id", 0 ) /* game security cart id */ | |
| 4317 | 4341 | ROM_LOAD( "ge949jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4318 | 4342 | |
| 4319 | 4343 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4323 | 4347 | ROM_START( gtrfrk4m ) |
| 4324 | 4348 | SYS573_BIOS_A |
| 4325 | 4349 | |
| 4326 | ROM_REGION( 0x0000224, " | |
| 4350 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4327 | 4351 | ROM_LOAD( "a24jaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(29e326fe) SHA1(41a600105b08accc9d7ebd2b8ae08c0863758aa0) ) |
| 4328 | 4352 | |
| 4329 | ROM_REGION( 0x0001014, " | |
| 4353 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4330 | 4354 | ROM_LOAD( "gea24ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(d1fccf11) SHA1(6dcd79f3171d6e4bd7e1149901638f8ea58ff623) ) |
| 4331 | 4355 | |
| 4332 | ROM_REGION( 0x000008, " | |
| 4356 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4333 | 4357 | ROM_LOAD( "a24jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 4334 | 4358 | |
| 4335 | ROM_REGION( 0x000008, " | |
| 4359 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4336 | 4360 | ROM_LOAD( "gea24ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4337 | 4361 | |
| 4338 | 4362 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4341 | 4365 | |
| 4342 | 4366 | ROM_START( gtrfrk5m ) |
| 4343 | 4367 | SYS573_BIOS_A |
| 4368 | SYS573_DIGITAL_ID | |
| 4344 | 4369 | |
| 4345 | ROM_REGION( 0x0001014, " | |
| 4370 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4346 | 4371 | ROM_LOAD( "gea26jaa.u1", 0x000000, 0x001014, BAD_DUMP CRC(c2725fca) SHA1(b70a3266c61af5cbe0478a6f3dd850ebcab980dc) ) |
| 4347 | 4372 | |
| 4348 | 4373 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 4350 | 4375 | ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */ |
| 4351 | 4376 | ROM_LOAD( "gea26jaa.27m", 0x000000, 0x200000, CRC(345dc5f2) SHA1(61af3fcfe6119c1e8e18b92693855ab4fe708b30) ) |
| 4352 | 4377 | |
| 4353 | ROM_REGION( 0x000008, " | |
| 4378 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4354 | 4379 | ROM_LOAD( "gea26jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4355 | 4380 | |
| 4356 | 4381 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4359 | 4384 | |
| 4360 | 4385 | ROM_START( gtrfrk6m ) |
| 4361 | 4386 | SYS573_BIOS_A |
| 4387 | SYS573_DIGITAL_ID | |
| 4362 | 4388 | |
| 4363 | ROM_REGION( 0x0001014, " | |
| 4389 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4364 | 4390 | ROM_LOAD( "gcb06ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(673c98ab) SHA1(b1d889bf4fc5e425056acb6b72b2c563966fb7d7) ) |
| 4365 | 4391 | |
| 4366 | ROM_REGION( 0x000008, " | |
| 4392 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4367 | 4393 | ROM_LOAD( "gcb06ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4368 | 4394 | |
| 4369 | 4395 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4372 | 4398 | |
| 4373 | 4399 | ROM_START( gtrfrk7m ) |
| 4374 | 4400 | SYS573_BIOS_A |
| 4401 | SYS573_DIGITAL_ID | |
| 4375 | 4402 | |
| 4376 | ROM_REGION( 0x0001014, " | |
| 4403 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4377 | 4404 | ROM_LOAD( "gcb17jaa.u1", 0x000000, 0x001014, BAD_DUMP CRC(5a338c31) SHA1(0fd9ee306335858dd6bef680a62557a8bf055cc3) ) |
| 4378 | 4405 | |
| 4379 | 4406 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ |
| r10384 | r10385 | |
| 4381 | 4408 | ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */ |
| 4382 | 4409 | ROM_LOAD( "gcb17jaa.27m", 0x000000, 0x200000, CRC(7e7da9a9) SHA1(1882418779a48b5aefd113895756116379a6a4f7) ) |
| 4383 | 4410 | |
| 4384 | ROM_REGION( 0x000008, " | |
| 4411 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4385 | 4412 | ROM_LOAD( "gcb17jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4386 | 4413 | |
| 4387 | 4414 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4390 | 4417 | |
| 4391 | 4418 | ROM_START( gtfrk11m ) |
| 4392 | 4419 | SYS573_BIOS_A |
| 4420 | SYS573_DIGITAL_ID | |
| 4393 | 4421 | |
| 4394 | ROM_REGION( 0x0001014, " | |
| 4422 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4395 | 4423 | ROM_LOAD( "gcd39ja.u1", 0x000000, 0x001014, BAD_DUMP CRC(9bd81d0a) SHA1(c95f6d7317bf88177f7217de4ba4376485d5cdbf) ) |
| 4396 | 4424 | |
| 4397 | ROM_REGION( 0x000008, " | |
| 4425 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4398 | 4426 | ROM_LOAD( "gcd39ja.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4399 | 4427 | |
| 4400 | 4428 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4404 | 4432 | ROM_START( hyperbbc ) |
| 4405 | 4433 | SYS573_BIOS_A |
| 4406 | 4434 | |
| 4407 | ROM_REGION( 0x0000084, " | |
| 4435 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4408 | 4436 | ROM_LOAD( "gx908ja.u1", 0x000000, 0x000084, BAD_DUMP CRC(fb6c0635) SHA1(0d974462a0a244ffb1a651adb316242cde427756) ) |
| 4409 | 4437 | |
| 4410 | 4438 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4414 | 4442 | ROM_START( hyperbbck ) |
| 4415 | 4443 | SYS573_BIOS_A |
| 4416 | 4444 | |
| 4417 | ROM_REGION( 0x0000084, " | |
| 4445 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4418 | 4446 | ROM_LOAD( "gx908ka.u1", 0x000000, 0x000084, BAD_DUMP CRC(f4f37fe1) SHA1(30f90cdb2d092e4f8d6c14cfd4ca4945e6d352cb) ) |
| 4419 | 4447 | |
| 4420 | 4448 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4424 | 4452 | ROM_START( konam80a ) |
| 4425 | 4453 | SYS573_BIOS_A |
| 4426 | 4454 | |
| 4427 | ROM_REGION( 0x0000224, " | |
| 4455 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4428 | 4456 | ROM_LOAD( "gc826aa.u1", 0x000000, 0x000224, BAD_DUMP CRC(9b38b959) SHA1(6b4fca340a9b1c2ae21ad3903c1ac1e39ab08b1a) ) |
| 4429 | 4457 | |
| 4430 | 4458 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4434 | 4462 | ROM_START( konam80j ) |
| 4435 | 4463 | SYS573_BIOS_A |
| 4436 | 4464 | |
| 4437 | ROM_REGION( 0x0000224, " | |
| 4465 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4438 | 4466 | ROM_LOAD( "gc826ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(e9e861e8) SHA1(45841db0b42d096213d9539a8d076d39391dca6d) ) |
| 4439 | 4467 | |
| 4440 | 4468 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4444 | 4472 | ROM_START( konam80k ) |
| 4445 | 4473 | SYS573_BIOS_A |
| 4446 | 4474 | |
| 4447 | ROM_REGION( 0x0000224, " | |
| 4475 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4448 | 4476 | ROM_LOAD( "gc826ka.u1", 0x000000, 0x000224, BAD_DUMP CRC(d41f7e38) SHA1(73e2bb132e23be72e72ea5b0686ccad28e47574a) ) |
| 4449 | 4477 | |
| 4450 | 4478 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4454 | 4482 | ROM_START( konam80s ) |
| 4455 | 4483 | SYS573_BIOS_A |
| 4456 | 4484 | |
| 4457 | ROM_REGION( 0x0000224, " | |
| 4485 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4458 | 4486 | ROM_LOAD( "gc826ea.u1", 0x000000, 0x000224, BAD_DUMP CRC(6ce4c619) SHA1(d2be08c213c0a74e30b7ebdd93946374cc64457f) ) |
| 4459 | 4487 | |
| 4460 | 4488 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4464 | 4492 | ROM_START( konam80u ) |
| 4465 | 4493 | SYS573_BIOS_A |
| 4466 | 4494 | |
| 4467 | ROM_REGION( 0x0000224, " | |
| 4495 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4468 | 4496 | ROM_LOAD( "gc826ua.u1", 0x000000, 0x000224, BAD_DUMP CRC(0577379b) SHA1(3988a2a5ef1f1d5981c4767cbed05b73351be903) ) |
| 4469 | 4497 | |
| 4470 | 4498 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4474 | 4502 | ROM_START( mamboagg ) |
| 4475 | 4503 | SYS573_BIOS_A |
| 4476 | 4504 | |
| 4477 | ROM_REGION( 0x0001014, " | |
| 4505 | ROM_REGION( 0x0001014, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4478 | 4506 | ROM_LOAD( "gqa40jab.u1", 0x000000, 0x001014, BAD_DUMP CRC(fd9e7c1f) SHA1(6dd4790589d48803f58328d099c908f0565b2c01) ) |
| 4479 | 4507 | |
| 4480 | ROM_REGION( 0x000008, " | |
| 4508 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4481 | 4509 | ROM_LOAD( "gqa40jab.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4482 | 4510 | |
| 4483 | 4511 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4487 | 4515 | ROM_START( pbballex ) |
| 4488 | 4516 | SYS573_BIOS_A |
| 4489 | 4517 | |
| 4490 | ROM_REGION( 0x0000224, " | |
| 4518 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4491 | 4519 | ROM_LOAD( "gx802ja.u1", 0x000000, 0x000224, BAD_DUMP CRC(ea8bdda3) SHA1(780034ab08871631ef0e3e9b779ca89e016c26a8) ) |
| 4492 | 4520 | |
| 4493 | 4521 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4497 | 4525 | ROM_START( pcnfrk3m ) |
| 4498 | 4526 | SYS573_BIOS_A |
| 4499 | 4527 | |
| 4500 | ROM_REGION( 0x0000224, " | |
| 4528 | ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* install security cart eeprom */ | |
| 4501 | 4529 | ROM_LOAD( "a23kaa.u1", 0x000000, 0x000224, BAD_DUMP CRC(d71c4b5c) SHA1(3911c5dd933c30e6e44c8cf417bb4c284ecb4b80) ) |
| 4502 | 4530 | |
| 4503 | ROM_REGION( 0x0001014, " | |
| 4531 | ROM_REGION( 0x0001014, "game_eeprom", 0 ) /* game security cart eeprom */ | |
| 4504 | 4532 | ROM_LOAD( "gca23ka.u1", 0x000000, 0x001014, BAD_DUMP CRC(f392349c) SHA1(e7eb7979db276de560d5820163a70d97e6c023d8) ) |
| 4505 | 4533 | |
| 4506 | ROM_REGION( 0x000008, " | |
| 4534 | ROM_REGION( 0x000008, "install_id", 0 ) /* install security cart id */ | |
| 4507 | 4535 | ROM_LOAD( "a23kaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) |
| 4508 | 4536 | |
| 4509 | ROM_REGION( 0x000008, " | |
| 4537 | ROM_REGION( 0x000008, "game_id", 0 ) /* game security cart id */ | |
| 4510 | 4538 | ROM_LOAD( "gca23ka.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4511 | 4539 | |
| 4512 | 4540 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4516 | 4544 | ROM_START( salarymc ) |
| 4517 | 4545 | SYS573_BIOS_A |
| 4518 | 4546 | |
| 4519 | ROM_REGION( 0x0000084, " | |
| 4547 | ROM_REGION( 0x0000084, "install_eeprom", 0 ) /* security cart eeprom */ | |
| 4520 | 4548 | ROM_LOAD( "gca18jaa.u1", 0x000000, 0x000084, CRC(c9197f67) SHA1(8e95a89008f756a79295f2cb557c39efca1351e7) ) |
| 4521 | 4549 | |
| 4522 | ROM_REGION( 0x000008, " | |
| 4550 | ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */ | |
| 4523 | 4551 | ROM_LOAD( "gca18jaa.u6", 0x000000, 0x000008, CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4524 | 4552 | |
| 4525 | 4553 | DISK_REGION( "cdrom0" ) |
| r10384 | r10385 | |
| 4527 | 4555 | ROM_END |
| 4528 | 4556 | |
| 4529 | 4557 | // System 573 BIOS (we're missing the later version that boots up with a pseudo-GUI) |
| 4530 | GAME( 1998, sys573, 0, konami573, konami573, konami573, ROT0, "Konami", "System 573 BIOS", GAME_IS_BIOS_ROOT ) | |
| 4558 | GAME( 1998, sys573, 0, konami573, konami573, konami573, ROT0, "Konami", "System 573 BIOS", GAME_IS_BIOS_ROOT ) | |
| 4531 | 4559 | |
| 4532 | GAME( 1998, darkhleg, sys573, konami573, konami573, konami573, ROT0, "Konami", "Dark Horse Legend (GX706 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4533 | GAME( 1998, fbaitbc, sys573, k573bait, fbaitbc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - A Bass Challenge (GE765 VER. UAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4534 | GAME( 1998, bassangl, fbaitbc, k573bait, fbaitbc, ge765pwbba, ROT0, "Konami", "Bass Angler (GE765 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4535 | GAME( 1998, pbballex, sys573, konami573, konami573, konami573, ROT0, "Konami", "Powerful Pro Baseball EX (GX802 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4536 | GAME( 1998, konam80s, sys573, konami573, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4537 | GAME( 1998, konam80u, konam80s, konami573, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4538 | GAME( 1998, konam80j, konam80s, konami573, konami573, konami573, ROT90, "Konami", "Konami 80's Gallery (GC826 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4539 | GAME( 1998, konam80a, konam80s, konami573, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4540 | GAME( 1998, konam80k, konam80s, konami573, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4541 | GAME( 1999, dstage, sys573, konami573, ddr, ddr, ROT0, "Konami", "Dancing Stage (GN845 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4542 | GAME( 1999, ddru, dstage, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GN845 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4543 | GAME( 1998, ddrj, dstage, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution - Internet Ranking Ver (GC845 VER. JBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4544 | GAME( 1998, ddrja, dstage, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4545 | GAME( 1998, ddrjb, dstage, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4546 | GAME( 1999, ddra, dstage, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GN845 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4547 | GAME( 1998, fbait2bc, sys573, k573bait, fbaitbc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait 2 - A Bass Challenge (GE865 VER. UAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4548 | GAME( 1998, bassang2, fbait2bc, k573bait, fbaitbc, ge765pwbba, ROT0, "Konami", "Bass Angler 2 (GE865 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4549 | GAME( 1999, drmn, sys573, konami573, drmn, drmn, ROT0, "Konami", "DrumMania (GQ881 VER. JAD)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4550 | GAME( 1999, gtrfrks, sys573, konami573, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. EAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4551 | GAME( 1999, gtrfrksu, gtrfrks, konami573, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. UAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4552 | GAME( 1999, gtrfrksj, gtrfrks, konami573, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. JAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4553 | GAME( 1999, gtrfrksa, gtrfrks, konami573, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. AAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4554 | GAME( 1999, fbaitmc, sys573, k573bait, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. EA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4555 | GAME( 1999, fbaitmcu, fbaitmc, k573bait, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. UA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4556 | GAME( 1999, fbaitmcj, fbaitmc, k573bait, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. JA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4557 | GAME( 1999, fbaitmca, fbaitmc, k573bait, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. AA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4558 | GAME( 1999, ddr2m, sys573, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix (GN895 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4559 | GAME( 1999, ddrbocd, ddr2m, pccard1, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution Best of Cool Dancers (GE892 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4560 | GAME( 1999, ddr2ml, ddr2m, pccard1, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix - Link Ver (GE885 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4561 | GAME( 1999, ddr2mc, ddr2m, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix with beatmaniaIIDX CLUB VERSiON (GE896 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4562 | GAME( 1999, ddr2mc2, ddr2m, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix with beatmaniaIIDX substream CLUB VERSiON 2 (GE984 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4563 | GAME( 1999, gtrfrk2m, sys573, pccard1, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks 2nd Mix Ver 1.01 (GQ883 VER. JAD)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4564 | GAME( 1999, dsftkd, sys573, konami573, ddr, ddr, ROT0, "Konami", "Dancing Stage featuring TRUE KiSS DESTiNATiON (G*884 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4565 | GAME( 1999, cr589fw, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater 2.0 (700B04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4566 | GAME( 1999, cr589fwa, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater (700A04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4567 | GAME( 2000, ddr3mk, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea2 (GN887 VER. KBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4568 | GAME( 2000, ddr3mka, ddr3mk, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea (GN887 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4569 | GAME( 1999, ddr3ma, ddr3mk, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix (GN887 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.1 */ | |
| 4570 | GAME( 1999, ddr3mj, ddr3mk, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix (GN887 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.0 */ | |
| 4571 | GAME( 1999, ddrsbm, sys573, konami573, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo Bass Mix (GQ894 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4572 | GAME( 1999, ddrs2k, sys573, konami573, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo 2000 (GC905 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4573 | GAME( 1999, ddrs2kj, ddrs2k, konami573, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo 2000 (GC905 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.2 */ | |
| 4574 | GAME( 1999, hyperbbc, sys573, konami573, hyperbbc, hyperbbc, ROT0, "Konami", "Hyper Bishi Bashi Champ (GX908 1999/08/24 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4575 | GAME( 1999, hyperbbck,hyperbbc, konami573, hyperbbc, hyperbbc, ROT0, "Konami", "Hyper Bishi Bashi Champ (GX908 1999/08/24 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4576 | GAME( 1999, dsfdct, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage featuring Dreams Come True (GC910 VER. JCA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4577 | GAME( 1999, dsfdcta, dsfdct, pccard2, ddr, ddr, ROT0, "Konami", "Dancing Stage featuring Dreams Come True (GC910 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4578 | GAME( 1999, drmn2m, sys573, k573d, drmn, drmndigital,ROT0, "Konami", "DrumMania 2nd Mix (GE912 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.5 */ | |
| 4579 | GAME( 1999, drmn2mpu, drmn2m, k573d, drmn, drmndigital,ROT0, "Konami", "DrumMania 2nd Mix Session Power Up Kit (GE912 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.5 */ | |
| 4580 | GAME( 2000, dncfrks, sys573, konami573, dmx, dmx, ROT0, "Konami", "Dance Freaks (G*874 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4581 | GAME( 2000, dmx, dncfrks, konami573, dmx, dmx, ROT0, "Konami", "Dance Maniax (G*874 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4582 | GAME( 2000, dsem, sys573, k573d, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Euro Mix (G*936 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.7 */ | |
| 4583 | GAME( 2000, gtrfrk3m, sys573, pccard1, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix (GE949 VER. JAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4584 | GAME( 2000, gtfrk3ma, gtrfrk3m, pccard1, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix (GE949 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4585 | GAME( 2000, gtfrk3mb, gtrfrk3m, pccard1, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix - security cassette versionup (949JAZ02)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4586 | GAME( 2000, salarymc, sys573, konami573, hyperbbc, salarymc, ROT0, "Konami", "Salary Man Champ (GCA18 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4587 | GAME( 2000, ddr3mp, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix Plus (G*A22 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4588 | GAME( 2000, pcnfrk3m, sys573, konami573, drmn, drmndigital,ROT0, "Konami", "Percussion Freaks 3rd Mix (G*A23 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4589 | GAME( 2000, drmn3m, pcnfrk3m, konami573, drmn, drmndigital,ROT0, "Konami", "DrumMania 3rd Mix (G*A23 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4590 | GAME( 2000, gtrfrk4m, sys573, pccard1, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 4th Mix (G*A24 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4591 | GAME( 2000, ddr4m, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix (G*A33 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4592 | GAME( 2000, ddr4mj, ddr4m, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix (G*A33 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4593 | GAME( 2000, ddr4ms, sys573, pccard2, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Solo (G*A33 VER. ABA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4594 | GAME( 2000, ddr4msj, ddr4ms, pccard2, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Solo (G*A33 VER. JBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4595 | GAME( 2000, dsfdr, sys573, k573d, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Featuring Disney's Rave (GCA37JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4596 | GAME( 2000, ddrusa, sys573, k573d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution USA (G*A44 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4597 | GAME( 2000, ddr4mp, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4598 | GAME( 2000, ddr4mps, sys573, pccard2, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus Solo (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4599 | GAME( 2000, dmx2m, sys573, konami573, dmx, dmx, ROT0, "Konami", "Dance Maniax 2nd Mix (G*A39 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4600 | GAME( 2000, fmania, sys573, konami573, konami573, konami573, ROT0, "Konami", "Fighting Mania (918 xx B02)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4601 | GAME( 2001, gtrfrk5m, sys573, pccard1d, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 5th Mix (G*A26 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4602 | GAME( 2001, ddr5m, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 5th Mix (G*A27 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4603 | GAME( 2001, dmx2majp, sys573, konami573, dmx, dmx, ROT0, "Konami", "Dance Maniax 2nd Mix Append J-Paradise (G*A38 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4604 | GAME( 2001, mamboagg, sys573, konami573, mamboagg, mamboagg, ROT0, "Konami", "Mambo A Go-Go (GQA40 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4605 | GAME( 2001, gtrfrk6m, sys573, pccard1d, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 6th Mix (G*B06 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4606 | GAME( 2001, gtrfrk7m, sys573, pccard1d, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 7th Mix (G*B17 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4607 | GAME( 2001, ddrmax, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "DDR Max - Dance Dance Revolution 6th Mix (G*B19 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4608 | GAME( 2002, ddrmax2, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "DDR Max 2 - Dance Dance Revolution 7th Mix (G*B20 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4609 | GAME( 2002, dsem2, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Euro Mix 2 (G*C23 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4610 | GAME( 2002, ddrextrm, sys573, pccard2d, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution Extreme (G*C36 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4611 | GAME( 2004, gtfrk11m, sys573, pccard1d, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 11th Mix (G*D39 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4560 | GAME( 1998, darkhleg, sys573, konami573x, konami573, konami573, ROT0, "Konami", "Dark Horse Legend (GX706 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4561 | GAME( 1998, fbaitbc, sys573, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - A Bass Challenge (GE765 VER. UAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4562 | GAME( 1998, bassangl, fbaitbc, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Bass Angler (GE765 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4563 | GAME( 1998, pbballex, sys573, konami573x, konami573, konami573, ROT0, "Konami", "Powerful Pro Baseball EX (GX802 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4564 | GAME( 1998, konam80s, sys573, konami573x, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4565 | GAME( 1998, konam80u, konam80s, konami573x, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4566 | GAME( 1998, konam80j, konam80s, konami573x, konami573, konami573, ROT90, "Konami", "Konami 80's Gallery (GC826 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4567 | GAME( 1998, konam80a, konam80s, konami573x, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4568 | GAME( 1998, konam80k, konam80s, konami573x, konami573, konami573, ROT90, "Konami", "Konami 80's AC Special (GC826 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4569 | GAME( 1999, dstage, sys573, konami573x, ddr, ddr, ROT0, "Konami", "Dancing Stage (GN845 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4570 | GAME( 1999, ddru, dstage, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GN845 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4571 | GAME( 1998, ddrj, dstage, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution - Internet Ranking Ver (GC845 VER. JBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4572 | GAME( 1998, ddrja, dstage, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4573 | GAME( 1998, ddrjb, dstage, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4574 | GAME( 1999, ddra, dstage, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution (GN845 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4575 | GAME( 1998, fbait2bc, sys573, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait 2 - A Bass Challenge (GE865 VER. UAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4576 | GAME( 1998, bassang2, fbait2bc, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Bass Angler 2 (GE865 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4577 | GAME( 1999, drmn, sys573, konami573x, drmn, drmn, ROT0, "Konami", "DrumMania (GQ881 VER. JAD)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4578 | GAME( 1999, gtrfrks, sys573, konami573x, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. EAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4579 | GAME( 1999, gtrfrksu, gtrfrks, konami573x, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. UAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4580 | GAME( 1999, gtrfrksj, gtrfrks, konami573x, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. JAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4581 | GAME( 1999, gtrfrksa, gtrfrks, konami573x, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks (GQ886 VER. AAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4582 | GAME( 1999, fbaitmc, sys573, k573baitx, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. EA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4583 | GAME( 1999, fbaitmcu, fbaitmc, k573baitx, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. UA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4584 | GAME( 1999, fbaitmcj, fbaitmc, k573baitx, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. JA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4585 | GAME( 1999, fbaitmca, fbaitmc, k573baitx, fbaitmc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - Marlin Challenge (GX889 VER. AA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4586 | GAME( 1999, ddr2m, sys573, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix (GN895 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4587 | GAME( 1999, ddrbocd, ddr2m, pccard1x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution Best of Cool Dancers (GE892 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4588 | GAME( 1999, ddr2ml, ddr2m, pccard1x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix - Link Ver (GE885 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4589 | GAME( 1999, ddr2mc, ddr2m, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix with beatmaniaIIDX CLUB VERSiON (GE896 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4590 | GAME( 1999, ddr2mc2, ddr2m, konami573x, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix with beatmaniaIIDX substream CLUB VERSiON 2 (GE984 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4591 | GAME( 1999, gtrfrk2m, sys573, pccard1yi, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks 2nd Mix Ver 1.01 (GQ883 VER. JAD)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4592 | GAME( 1999, dsftkd, sys573, konami573yi, ddr, ddr, ROT0, "Konami", "Dancing Stage featuring TRUE KiSS DESTiNATiON (G*884 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4593 | GAME( 1999, cr589fw, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater 2.0 (700B04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4594 | GAME( 1999, cr589fwa, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater (700A04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4595 | GAME( 2000, ddr3mk, sys573, pccard2dyyi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea2 (GN887 VER. KBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4596 | GAME( 2000, ddr3mka, ddr3mk, pccard2dyyi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea (GN887 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4597 | GAME( 1999, ddr3ma, ddr3mk, pccard2dyyi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix (GN887 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.1 */ | |
| 4598 | GAME( 1999, ddr3mj, ddr3mk, pccard2dyyi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix (GN887 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.0 */ | |
| 4599 | GAME( 1999, ddrsbm, sys573, k573dyi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo Bass Mix (GQ894 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4600 | GAME( 1999, ddrs2k, sys573, k573dyyi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo 2000 (GC905 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ | |
| 4601 | GAME( 1999, ddrs2kj, ddrs2k, k573dyyi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution Solo 2000 (GC905 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.2 */ | |
| 4602 | GAME( 1999, hyperbbc, sys573, konami573y, hyperbbc, hyperbbc, ROT0, "Konami", "Hyper Bishi Bashi Champ (GX908 1999/08/24 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4603 | GAME( 1999, hyperbbck,hyperbbc, konami573y, hyperbbc, hyperbbc, ROT0, "Konami", "Hyper Bishi Bashi Champ (GX908 1999/08/24 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4604 | GAME( 1999, dsfdct, sys573, pccard2dyyi, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage featuring Dreams Come True (GC910 VER. JCA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4605 | GAME( 1999, dsfdcta, dsfdct, pccard2yyi, ddr, ddr, ROT0, "Konami", "Dancing Stage featuring Dreams Come True (GC910 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4606 | GAME( 1999, drmn2m, sys573, k573dxzi, drmn, drmndigital,ROT0, "Konami", "DrumMania 2nd Mix (GE912 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.5 */ | |
| 4607 | GAME( 1999, drmn2mpu, drmn2m, k573dxzi, drmn, drmndigital,ROT0, "Konami", "DrumMania 2nd Mix Session Power Up Kit (GE912 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.5 */ | |
| 4608 | GAME( 2000, dncfrks, sys573, k573dzi, dmx, dmx, ROT0, "Konami", "Dance Freaks (G*874 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4609 | GAME( 2000, dmx, dncfrks, k573dzi, dmx, dmx, ROT0, "Konami", "Dance Maniax (G*874 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4610 | GAME( 2000, dsem, sys573, k573dxi, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Euro Mix (G*936 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.7 */ | |
| 4611 | GAME( 2000, gtrfrk3m, sys573, pccard1xzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix (GE949 VER. JAC)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4612 | GAME( 2000, gtfrk3ma, gtrfrk3m, pccard1xzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix (GE949 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4613 | GAME( 2000, gtfrk3mb, gtrfrk3m, pccard1zi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 3rd Mix - security cassette versionup (949JAZ02)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.4 */ | |
| 4614 | GAME( 2000, salarymc, sys573, konami573yi, hyperbbc, salarymc, ROT0, "Konami", "Salary Man Champ (GCA18 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 4615 | GAME( 2000, ddr3mp, sys573, pccard2dxzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix Plus (G*A22 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.6 */ | |
| 4616 | GAME( 2000, pcnfrk3m, sys573, konami573xzi, drmn, drmndigital,ROT0, "Konami", "Percussion Freaks 3rd Mix (G*A23 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4617 | GAME( 2000, drmn3m, pcnfrk3m, k573dxzi, drmn, drmndigital,ROT0, "Konami", "DrumMania 3rd Mix (G*A23 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4618 | GAME( 2000, gtrfrk4m, sys573, pccard1xzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 4th Mix (G*A24 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4619 | GAME( 2000, ddr4m, sys573, pccard2dxzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix (G*A33 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4620 | GAME( 2000, ddr4mj, ddr4m, pccard2dxzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix (G*A33 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4621 | GAME( 2000, ddr4ms, sys573, pccard2dxzi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Solo (G*A33 VER. ABA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4622 | GAME( 2000, ddr4msj, ddr4ms, pccard2dxzi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Solo (G*A33 VER. JBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4623 | GAME( 2000, dsfdr, sys573, k573dxzi, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Featuring Disney's Rave (GCA37JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4624 | GAME( 2000, ddrusa, sys573, k573dx, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution USA (G*A44 VER. UAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.8 */ | |
| 4625 | GAME( 2000, ddr4mp, sys573, pccard2dxzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4626 | GAME( 2000, ddr4mps, sys573, pccard2dxzi, ddrsolo, ddrsolo, ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus Solo (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4627 | GAME( 2000, dmx2m, sys573, k573dzi, dmx, dmx, ROT0, "Konami", "Dance Maniax 2nd Mix (G*A39 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4628 | GAME( 2000, fmania, sys573, konami573x, konami573, konami573, ROT0, "Konami", "Fighting Mania (918 xx B02)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 4629 | GAME( 2001, gtrfrk5m, sys573, pccard1dzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 5th Mix (G*A26 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4630 | GAME( 2001, ddr5m, sys573, pccard2dzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 5th Mix (G*A27 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4631 | GAME( 2001, dmx2majp, sys573, konami573zi, dmx, dmx, ROT0, "Konami", "Dance Maniax 2nd Mix Append J-Paradise (G*A38 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4632 | GAME( 2001, mamboagg, sys573, k573dzi, mamboagg, mamboagg, ROT0, "Konami", "Mambo A Go-Go (GQA40 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4633 | GAME( 2001, gtrfrk6m, sys573, pccard1dzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 6th Mix (G*B06 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4634 | GAME( 2001, gtrfrk7m, sys573, pccard1dzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 7th Mix (G*B17 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4635 | GAME( 2001, ddrmax, sys573, pccard2dzi, ddr, ddrdigital, ROT0, "Konami", "DDR Max - Dance Dance Revolution 6th Mix (G*B19 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4636 | GAME( 2002, ddrmax2, sys573, pccard2dzi, ddr, ddrdigital, ROT0, "Konami", "DDR Max 2 - Dance Dance Revolution 7th Mix (G*B20 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ | |
| 4637 | GAME( 2002, dsem2, sys573, pccard2dzi, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Euro Mix 2 (G*C23 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4638 | GAME( 2002, ddrextrm, sys573, pccard2dzi, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution Extreme (G*C36 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ | |
| 4639 | GAME( 2004, gtfrk11m, sys573, pccard1dzi, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 11th Mix (G*D39 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ |
| r10384 | r10385 | |
|---|---|---|
| 1471 | 1471 | ROM_END |
| 1472 | 1472 | |
| 1473 | 1473 | |
| 1474 | ROM_START( pigskina ) /* Initial boot screen reports REV 2.0 7/06/90 */ | |
| 1475 | ROM_REGION( 0x40000, "maincpu", 0 ) | |
| 1476 | ROM_LOAD16_BYTE( "pigskin_la2.a5", 0x00000, 0x10000, CRC(f75d36dd) SHA1(6afc8fbc900e17f9281ee214097d8ebd651d9291) ) | |
| 1477 | ROM_LOAD16_BYTE( "pigskin_la2.b5", 0x00001, 0x10000, CRC(c5ffdfad) SHA1(3b234f3629c8f21199f4845df7f44c43fd775c9b) ) | |
| 1478 | ROM_LOAD16_BYTE( "pigskin_la2.a6", 0x20000, 0x10000, CRC(2fc91002) SHA1(64d270b78c69d3f4fb36d1233a1632d6ba3d87a5) ) | |
| 1479 | ROM_LOAD16_BYTE( "pigskin_la2.b6", 0x20001, 0x10000, CRC(0b93dc66) SHA1(f3b516a1d1e4abd7b0d56243949e9cd7ac79178b) ) | |
| 1480 | ||
| 1481 | ROM_REGION( 0x90000, "cvsdcpu", 0 ) /* Audio System board */ | |
| 1482 | ROM_LOAD( "pigskin_sl1.u4", 0x10000, 0x10000, CRC(6daf2d37) SHA1(4c8098520fe44e36b01389bcfcfe3ad1d027cbde) ) | |
| 1483 | ROM_RELOAD( 0x20000, 0x10000 ) | |
| 1484 | ROM_LOAD( "pigskin_sl1.u19", 0x30000, 0x10000, CRC(56fd16a3) SHA1(b91aabdbd3185355f2b7177fc4d3a86fa110f51d) ) | |
| 1485 | ROM_RELOAD( 0x40000, 0x10000 ) | |
| 1486 | ROM_LOAD( "pigskin_sl1.u20", 0x50000, 0x10000, CRC(5d032fb8) SHA1(a236cdc64856637e560bec7119b051fac13efbe0) ) | |
| 1487 | ROM_RELOAD( 0x60000, 0x10000 ) | |
| 1488 | ||
| 1489 | ROM_REGION( 0x20000, "gfx1", ROMREGION_INVERT ) | |
| 1490 | ROM_LOAD( "pigskin_la1.e2", 0x00000, 0x10000, CRC(12d5737b) SHA1(73040233bb86eaa42257112e2f0540de1206e310) ) | |
| 1491 | ROM_LOAD( "pigskin_la1.e1", 0x10000, 0x10000, CRC(460202a9) SHA1(8c2f7ae3615519e13e750c99b89ccb28e9946bb8) ) | |
| 1492 | ||
| 1493 | ROM_REGION( 0x80000, "gfx2", 0 ) | |
| 1494 | ROM_LOAD( "pigskin_la1.h15", 0x00000, 0x20000, CRC(e43d5d93) SHA1(e7592ba11601f2d20d54d52f436a239671c4d3ac) ) | |
| 1495 | ROM_LOAD( "pigskin_la1.h17", 0x20000, 0x20000, CRC(6b780f1e) SHA1(a0689feb38ad31eff5604d80562d9a936b30a011) ) | |
| 1496 | ROM_LOAD( "pigskin_la1.h18", 0x40000, 0x20000, CRC(5e50f940) SHA1(c9593b11934fd6da2b6c971859c0581fd92a915f) ) | |
| 1497 | ROM_LOAD( "pigskin_la1.h14", 0x60000, 0x20000, CRC(f26279f4) SHA1(9a8cd5aa359f408c93aa7f322b6eac17be52f3d3) ) | |
| 1498 | ROM_END | |
| 1499 | ||
| 1500 | ||
| 1474 | 1501 | ROM_START( trisport ) |
| 1475 | 1502 | ROM_REGION( 0x40000, "maincpu", 0 ) |
| 1476 | 1503 | ROM_LOAD16_BYTE( "la3.a5", 0x00000, 0x10000, CRC(fe1e9e37) SHA1(583f18531583e038ca57a592b6a6c305896bf2c5) ) |
| r10384 | r10385 | |
| 1654 | 1681 | GAME( 1989, archrivl2,archrivl, archrivl, archrivl, archrivl, ROT0, "Bally Midway", "Arch Rivals (rev 2.0 5/03/89)", GAME_SUPPORTS_SAVE ) |
| 1655 | 1682 | GAME( 1989, trisport, 0, trisport, trisport, trisport, ROT270, "Bally Midway", "Tri-Sports", GAME_SUPPORTS_SAVE ) |
| 1656 | 1683 | GAME( 1990, pigskin, 0, pigskin, pigskin, pigskin, ROT0, "Midway", "Pigskin 621AD (rev 1.1K 8/01/90)", GAME_SUPPORTS_SAVE ) |
| 1684 | GAME( 1990, pigskina, pigskin, pigskin, pigskin, pigskin, ROT0, "Midway", "Pigskin 621AD (rev 2.0 7/06/90)", GAME_SUPPORTS_SAVE ) |
| r10384 | r10385 | |
|---|---|---|
| 1071 | 1071 | if(!track_size || !file) |
| 1072 | 1072 | return; |
| 1073 | 1073 | if(read_or_write) |
| 1074 | | |
| 1074 | | |
| 1075 | 1075 | else |
| 1076 | | |
| 1076 | | |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | static MACHINE_START( system24 ) |
| r10384 | r10385 | |
|---|---|---|
| 249 | 249 | return length; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | UINT16 read_uint16(FILE *infile) | |
| 253 | { | |
| 254 | UINT16 res = 0; | |
| 255 | unsigned char buffer[2]; | |
| 256 | ||
| 257 | fread(buffer, 2, 1, infile); | |
| 258 | ||
| 259 | res = buffer[1] | buffer[0]<<8; | |
| 260 | ||
| 261 | return res; | |
| 262 | } | |
| 263 | ||
| 264 | UINT32 read_uint32(FILE *infile) | |
| 265 | { | |
| 266 | UINT32 res = 0; | |
| 267 | unsigned char buffer[4]; | |
| 268 | ||
| 269 | fread(buffer, 4, 1, infile); | |
| 270 | ||
| 271 | res = buffer[3] | buffer[2]<<8 | buffer[1]<<16 | buffer[0]<<24; | |
| 272 | ||
| 273 | return res; | |
| 274 | } | |
| 275 | ||
| 276 | UINT64 read_uint64(FILE *infile) | |
| 277 | { | |
| 278 | UINT64 res0 = U64(0), res1 = U64(0); | |
| 279 | UINT64 res; | |
| 280 | unsigned char buffer[8]; | |
| 281 | ||
| 282 | fread(buffer, 8, 1, infile); | |
| 283 | ||
| 284 | res0 = buffer[3] | buffer[2]<<8 | buffer[1]<<16 | buffer[0]<<24; | |
| 285 | res1 = buffer[7] | buffer[6]<<8 | buffer[5]<<16 | buffer[4]<<24; | |
| 286 | ||
| 287 | res = res0<<32 | res1; | |
| 288 | ||
| 289 | return res; | |
| 290 | } | |
| 291 | ||
| 252 | 292 | /*------------------------------------------------- |
| 293 | chdcd_parse_toc - parse a CDRWin format CUE file | |
| 294 | -------------------------------------------------*/ | |
| 295 | ||
| 296 | chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc *outtoc, chdcd_track_input_info *outinfo) | |
| 297 | { | |
| 298 | FILE *infile; | |
| 299 | unsigned char buffer[12]; | |
| 300 | UINT32 chain_offs, chunk_size; | |
| 301 | int done = 0; | |
| 302 | ||
| 303 | infile = fopen(tocfname, "rt"); | |
| 304 | ||
| 305 | if (infile == (FILE *)NULL) | |
| 306 | { | |
| 307 | return CHDERR_FILE_NOT_FOUND; | |
| 308 | } | |
| 309 | ||
| 310 | /* clear structures */ | |
| 311 | memset(outtoc, 0, sizeof(cdrom_toc)); | |
| 312 | memset(outinfo, 0, sizeof(chdcd_track_input_info)); | |
| 313 | ||
| 314 | // seek to 12 bytes before the end | |
| 315 | fseek(infile, -12, SEEK_END); | |
| 316 | fread(buffer, 12, 1, infile); | |
| 317 | ||
| 318 | if (memcmp(buffer, "NER5", 4)) | |
| 319 | { | |
| 320 | printf("ERROR: Not a Nero 5.5 or later image!\n"); | |
| 321 | return CHDERR_FILE_NOT_FOUND; | |
| 322 | } | |
| 323 | ||
| 324 | chain_offs = buffer[11] | (buffer[10]<<8) | (buffer[9]<<16) | (buffer[8]<<24); | |
| 325 | ||
| 326 | if ((buffer[7] != 0) || (buffer[6] != 0) || (buffer[5] != 0) || (buffer[4] != 0)) | |
| 327 | { | |
| 328 | printf("ERROR: File size is > 4GB, this version of CHDMAN cannot handle it."); | |
| 329 | return CHDERR_FILE_NOT_FOUND; | |
| 330 | } | |
| 331 | ||
| 332 | // printf("NER5 detected, chain offset: %x\n", chain_offs); | |
| 333 | ||
| 334 | while (!done) | |
| 335 | { | |
| 336 | UINT32 toc_type, offset; | |
| 337 | UINT8 start, end; | |
| 338 | int track; | |
| 339 | ||
| 340 | fseek(infile, chain_offs, SEEK_SET); | |
| 341 | fread(buffer, 8, 1, infile); | |
| 342 | ||
| 343 | chunk_size = (buffer[7] | buffer[6]<<8 | buffer[5]<<16 | buffer[4]<<24); | |
| 344 | ||
| 345 | // printf("Chunk type: %c%c%c%c, size %x\n", buffer[0], buffer[1], buffer[2], buffer[3], chunk_size); | |
| 346 | ||
| 347 | // we want the DAOX chunk, which has the TOC information | |
| 348 | if (!memcmp(buffer, "DAOX", 4)) | |
| 349 | { | |
| 350 | // skip second chunk size and UPC code | |
| 351 | fseek(infile, 16, SEEK_CUR); | |
| 352 | ||
| 353 | toc_type = read_uint32(infile); | |
| 354 | fread(&start, 1, 1, infile); | |
| 355 | fread(&end, 1, 1, infile); | |
| 356 | ||
| 357 | // printf("TOC type: %08x. Start track %d End track: %d\n", toc_type, start, end); | |
| 358 | ||
| 359 | outtoc->numtrks = (end-start) + 1; | |
| 360 | ||
| 361 | offset = 0; | |
| 362 | for (track = start; track <= end; track++) | |
| 363 | { | |
| 364 | UINT32 size, mode; | |
| 365 | UINT64 index0, index1, index2; | |
| 366 | ||
| 367 | fseek(infile, 12, SEEK_CUR); // skip ISRC code | |
| 368 | size = read_uint16(infile); | |
| 369 | mode = read_uint32(infile); | |
| 370 | index0 = read_uint64(infile); | |
| 371 | index1 = read_uint64(infile); | |
| 372 | index2 = read_uint64(infile); | |
| 373 | ||
| 374 | // printf("Track %d: sector size %d mode %x index0 %llx index1 %llx index2 %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, index2, (UINT32)(index1-index0)/size, (UINT32)(index2-index1)/size); | |
| 375 | ||
| 376 | strcpy(outinfo->fname[track-1], tocfname); | |
| 377 | outinfo->offset[track-1] = offset + (UINT32)(index1-index0); | |
| 378 | outinfo->idx0offs[track-1] = 0; | |
| 379 | outinfo->idx1offs[track-1] = 0; | |
| 380 | ||
| 381 | switch (mode) | |
| 382 | { | |
| 383 | case 1: // 2048 byte data | |
| 384 | outtoc->tracks[track-1].trktype = CD_TRACK_MODE1; | |
| 385 | outinfo->swap[track-1] = 0; | |
| 386 | break; | |
| 387 | ||
| 388 | case 0x7000001: // 2352 byte audio | |
| 389 | outtoc->tracks[track-1].trktype = CD_TRACK_AUDIO; | |
| 390 | outinfo->swap[track-1] = 1; | |
| 391 | break; | |
| 392 | ||
| 393 | default: | |
| 394 | printf("ERROR: Unknown track type %x, contact MAMEDEV!\n", mode); | |
| 395 | break; | |
| 396 | } | |
| 397 | ||
| 398 | outtoc->tracks[track-1].datasize = size; | |
| 399 | ||
| 400 | outtoc->tracks[track-1].subtype = CD_SUB_NONE; | |
| 401 | outtoc->tracks[track-1].subsize = 0; | |
| 402 | ||
| 403 | outtoc->tracks[track-1].pregap = (UINT32)(index1-index0)/size; | |
| 404 | outtoc->tracks[track-1].frames = (UINT32)(index2-index1)/size; | |
| 405 | outtoc->tracks[track-1].postgap = 0; | |
| 406 | outtoc->tracks[track-1].pgtype = 0; | |
| 407 | outtoc->tracks[track-1].pgsub = CD_SUB_NONE; | |
| 408 | outtoc->tracks[track-1].pgdatasize = 0; | |
| 409 | outtoc->tracks[track-1].pgsubsize = 0; | |
| 410 | ||
| 411 | offset += (UINT32)index2-index1; | |
| 412 | } | |
| 413 | } | |
| 414 | ||
| 415 | if (!memcmp(buffer, "END!", 4)) | |
| 416 | { | |
| 417 | done = 1; | |
| 418 | } | |
| 419 | else | |
| 420 | { | |
| 421 | chain_offs += chunk_size + 8; | |
| 422 | } | |
| 423 | } | |
| 424 | ||
| 425 | ||
| 426 | return CHDERR_NONE; | |
| 427 | } | |
| 428 | ||
| 429 | /*------------------------------------------------- | |
| 253 | 430 | chdcd_parse_gdi - parse a Sega GD-ROM rip |
| 254 | 431 | -------------------------------------------------*/ |
| 255 | 432 | |
| r10384 | r10385 | |
| 642 | 819 | return chdcd_parse_cue(tocfname, outtoc, outinfo); |
| 643 | 820 | } |
| 644 | 821 | |
| 822 | if (strstr(tocfname,".nrg")) | |
| 823 | { | |
| 824 | return chdcd_parse_nero(tocfname, outtoc, outinfo); | |
| 825 | } | |
| 826 | ||
| 645 | 827 | infile = fopen(tocfname, "rt"); |
| 646 | 828 | |
| 647 | 829 | if (infile == (FILE *)NULL) |
| r10384 | r10385 | |
|---|---|---|
| 183 | 183 | printf(" or: chdman -createhd inputhd.raw output.chd [ident.bin] [inputoffs [cylinders heads sectors [sectorsize [hunksize]]]]\n"); |
| 184 | 184 | printf(" or: chdman -createuncomphd inputhd.raw output.chd [ident.bin] [inputoffs [cylinders heads sectors [sectorsize [hunksize]]]]\n"); |
| 185 | 185 | printf(" or: chdman -createblankhd output.chd cylinders heads sectors [sectorsize [hunksize]]\n"); |
| 186 | printf(" or: chdman -createcd input.(toc/cue/gdi) output.chd\n"); | |
| 186 | printf(" or: chdman -createcd input.(toc/cue/nrg/gdi) output.chd\n"); | |
| 187 | 187 | printf(" or: chdman -createav input.avi output.chd [firstframe [numframes]]\n"); |
| 188 | 188 | printf(" or: chdman -copydata input.chd output.chd\n"); |
| 189 | 189 | printf(" or: chdman -extract input.chd output.raw\n"); |
| r10384 | r10385 | |
|---|---|---|
| 154 | 154 | if ( info.subsystem != SDL_SYSWM_X11 ) |
| 155 | 155 | return NULL; |
| 156 | 156 | #if (SDL_VERSION_ATLEAST(1,3,0)) |
| 157 | if ( (display = info.x11.display) == NULL ) | |
| 157 | if ( (display = info.info.x11.display) == NULL ) | |
| 158 | 158 | return NULL; |
| 159 | if ( (our_win = info.x11.window) == None ) | |
| 159 | if ( (our_win = info.info.x11.window) == None ) | |
| 160 | 160 | return NULL; |
| 161 | 161 | #else |
| 162 | 162 | if ( (display = info.info.x11.display) == NULL ) |
| r10384 | r10385 | |
|---|---|---|
| 2 | 2 | // |
| 3 | 3 | // drawsdl.c - SDL software and OpenGL implementation |
| 4 | 4 | // |
| 5 | // Copyright (c) 1996-201 | |
| 5 | // Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team. | |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| r10384 | r10385 | |
| 38 | 38 | |
| 39 | 39 | typedef struct _sdl_scale_mode sdl_scale_mode; |
| 40 | 40 | |
| 41 | // FIXME: Only until there is a final decision from SAM on scalemodes | |
| 42 | #if (SDL_VERSION_ATLEAST(1,3,0)) | |
| 43 | #define SDL_SCALEMODE_NONE (0) | |
| 44 | #define SDL_SCALEMODE_FAST (0) | |
| 45 | #define SDL_SCALEMODE_BEST (0) | |
| 46 | #endif | |
| 47 | ||
| 41 | 48 | /* sdl_info is the information about SDL for the current screen */ |
| 42 | 49 | typedef struct _sdl_info sdl_info; |
| 43 | 50 | struct _sdl_info |
| r10384 | r10385 | |
| 46 | 53 | UINT32 extra_flags; |
| 47 | 54 | |
| 48 | 55 | #if (SDL_VERSION_ATLEAST(1,3,0)) |
| 49 | SDL_Texture | |
| 56 | SDL_Texture | |
| 50 | 57 | #else |
| 51 | 58 | // SDL surface |
| 52 | 59 | SDL_Surface *sdlsurf; |
| r10384 | r10385 | |
| 82 | 89 | #if (!SDL_VERSION_ATLEAST(1,3,0)) |
| 83 | 90 | int extra_flags; /* Texture/surface flags */ |
| 84 | 91 | #else |
| 85 | SDL_ScaleMode sdl_scale_mode; /* sdl 1.3 scale mode */ | |
| 92 | //SDL_ScaleMode sdl_scale_mode; /* sdl 1.3 scale mode */ | |
| 93 | int sdl_scale_mode; /* got removed recently - trying to get it in again */ | |
| 86 | 94 | #endif |
| 87 | 95 | int pixel_format; /* Pixel/Overlay format */ |
| 88 | 96 | void (*yuv_blit)(UINT16 *bitmap, sdl_info *sdl, UINT8 *ptr, int pitch); |
| r10384 | r10385 | |
| 283 | 291 | int w = sdl->hw_scale_width * sdl_sm->mult_w; |
| 284 | 292 | int h = sdl->hw_scale_height * sdl_sm->mult_h; |
| 285 | 293 | |
| 286 | sdl->texture_id = SDL_CreateTexture(fmt, SDL_TEXTUREACCESS_STREAMING, w, h); | |
| 294 | sdl->texture_id = SDL_CreateTexture(window->sdl_renderer, fmt, SDL_TEXTUREACCESS_STREAMING, w, h); | |
| 287 | 295 | |
| 288 | 296 | } |
| 289 | 297 | else |
| 290 | 298 | { |
| 291 | sdl->texture_id = SDL_CreateTexture(fmt, SDL_TEXTUREACCESS_STREAMING, | |
| 299 | sdl->texture_id = SDL_CreateTexture(window->sdl_renderer,fmt, SDL_TEXTUREACCESS_STREAMING, | |
| 292 | 300 | tempwidth, tempheight); |
| 293 | 301 | } |
| 294 | 302 | |
| 295 | SDL_SetTextureScaleMode(sdl->texture_id, sdl_sm->sdl_scale_mode); | |
| 303 | //SDL_SetTextureScaleMode(window->sdl_renderer,sdl->texture_id, sdl_sm->sdl_scale_mode); | |
| 296 | 304 | |
| 297 | 305 | } |
| 298 | 306 | #endif |
| r10384 | r10385 | |
| 365 | 373 | const char *name; |
| 366 | 374 | } rflist[] = |
| 367 | 375 | { |
| 376 | #if 0 | |
| 368 | 377 | RF_ENTRY(SDL_RENDERER_SINGLEBUFFER), |
| 369 | 378 | RF_ENTRY(SDL_RENDERER_PRESENTCOPY), |
| 370 | 379 | RF_ENTRY(SDL_RENDERER_PRESENTFLIP2), |
| 371 | 380 | RF_ENTRY(SDL_RENDERER_PRESENTFLIP3), |
| 372 | 381 | RF_ENTRY(SDL_RENDERER_PRESENTDISCARD), |
| 382 | #endif | |
| 373 | 383 | RF_ENTRY(SDL_RENDERER_PRESENTVSYNC), |
| 374 | 384 | RF_ENTRY(SDL_RENDERER_ACCELERATED), |
| 375 | 385 | {-1, NULL} |
| r10384 | r10385 | |
| 434 | 444 | // create a texture |
| 435 | 445 | |
| 436 | 446 | if (video_config.waitvsync) |
| 437 | SDL_CreateRenderer(window->sdl_window, -1, SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC); | |
| 447 | window->sdl_renderer = SDL_CreateRenderer(window->sdl_window, -1, /*SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD |*/ SDL_RENDERER_PRESENTVSYNC); | |
| 438 | 448 | else |
| 439 | SDL_CreateRenderer(window->sdl_window, -1, SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD); | |
| 449 | window->sdl_renderer = SDL_CreateRenderer(window->sdl_window, -1, /*SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD*/ 0); | |
| 440 | 450 | |
| 441 | SDL_SelectRenderer(window->sdl_window); | |
| 451 | //SDL_SelectRenderer(window->sdl_window); | |
| 442 | 452 | |
| 443 | 453 | { |
| 444 | 454 | struct SDL_RendererInfo render_info; |
| 445 | SDL_GetRendererInfo(&render_info); | |
| 455 | SDL_GetRendererInfo(window->sdl_renderer, &render_info); | |
| 446 | 456 | |
| 447 | 457 | drawsdl_show_info(window, &render_info); |
| 448 | 458 | |
| r10384 | r10385 | |
| 543 | 553 | return; |
| 544 | 554 | |
| 545 | 555 | #if (SDL_VERSION_ATLEAST(1,3,0)) |
| 546 | SDL_SelectRenderer(window->sdl_window); | |
| 556 | //SDL_SelectRenderer(window->sdl_window); | |
| 547 | 557 | SDL_DestroyTexture(sdl->texture_id); |
| 548 | 558 | //SDL_DestroyRenderer(window->sdl_window); |
| 549 | 559 | SDL_DestroyWindow(window->sdl_window); |
| r10384 | r10385 | |
| 696 | 706 | else |
| 697 | 707 | surfptr = (UINT8 *)sdl->sdlsurf->pixels; |
| 698 | 708 | #else |
| 699 | SDL_SelectRenderer(window->sdl_window); | |
| 709 | //SDL_SelectRenderer(window->sdl_window); | |
| 700 | 710 | |
| 701 | 711 | if (window->blitwidth != sdl->old_blitwidth || window->blitheight != sdl->old_blitheight) |
| 702 | 712 | { |
| r10384 | r10385 | |
| 720 | 730 | if (sdl->blittimer > 0) |
| 721 | 731 | { |
| 722 | 732 | /* SDL Underlays need alpha = 0 ! */ |
| 723 | SDL_SetRenderDrawColor(0,0,0,0); | |
| 724 | SDL_RenderFillRect(NULL); | |
| 733 | SDL_SetRenderDrawColor(window->sdl_renderer,0,0,0,0); | |
| 734 | SDL_RenderFillRect(window->sdl_renderer,NULL); | |
| 725 | 735 | //SDL_RenderFill(0,0,0,0 /*255*/,NULL); |
| 726 | 736 | sdl->blittimer--; |
| 727 | 737 | } |
| 728 | 738 | |
| 729 | SDL_LockTexture(sdl->texture_id, NULL, | |
| 739 | SDL_LockTexture(sdl->texture_id, NULL, | |
| 730 | 740 | |
| 731 | 741 | #endif |
| 732 | 742 | // get ready to center the image |
| r10384 | r10385 | |
| 856 | 866 | r.h=blitheight; |
| 857 | 867 | //printf("blitwidth %d %d - %d %d\n", blitwidth, blitheight, window->width, window->height); |
| 858 | 868 | //SDL_UpdateTexture(sdl->sdltex, NULL, sdl->sdlsurf->pixels, pitch); |
| 859 | SDL_RenderCopy(sdl->texture_id, NULL, &r); | |
| 860 | SDL_RenderPresent(); | |
| 869 | SDL_RenderCopy(window->sdl_renderer,sdl->texture_id, NULL, &r); | |
| 870 | SDL_RenderPresent(window->sdl_renderer); | |
| 861 | 871 | } |
| 862 | 872 | #endif |
| 863 | 873 | return 0; |
| r10384 | r10385 | |
|---|---|---|
| 105 | 105 | int pitch; |
| 106 | 106 | int pixels_own; // do we own / allocated it ? |
| 107 | 107 | |
| 108 | SDL_Texture | |
| 108 | SDL_Texture | |
| 109 | 109 | |
| 110 | 110 | copy_info *copyinfo; |
| 111 | 111 | Uint32 sdl_access; |
| r10384 | r10385 | |
| 123 | 123 | INT32 blittimer; |
| 124 | 124 | UINT32 extra_flags; |
| 125 | 125 | |
| 126 | SDL_Renderer *sdl_renderer; | |
| 126 | 127 | texture_info * texlist; // list of active textures |
| 127 | 128 | INT32 texture_max_width; // texture maximum width |
| 128 | 129 | INT32 texture_max_height; // texture maximum height |
| r10384 | r10385 | |
| 328 | 329 | return SDL_BLENDMODE_NONE; |
| 329 | 330 | } |
| 330 | 331 | |
| 331 | INLINE void set_coloralphamode(SDL_Texture | |
| 332 | INLINE void set_coloralphamode(SDL_Texture * | |
| 332 | 333 | { |
| 333 | 334 | UINT32 sr = (UINT32)(255.0f * color->r); |
| 334 | 335 | UINT32 sg = (UINT32)(255.0f * color->g); |
| r10384 | r10385 | |
| 362 | 363 | |
| 363 | 364 | INLINE void render_quad(sdl_info *sdl, texture_info *texture, render_primitive *prim, int x, int y) |
| 364 | 365 | { |
| 365 | SDL_Texture | |
| 366 | SDL_Texture * | |
| 366 | 367 | SDL_Rect target_rect; |
| 367 | 368 | |
| 368 | 369 | target_rect.x = x; |
| r10384 | r10385 | |
| 375 | 376 | texture_id = texture->texture_id; |
| 376 | 377 | |
| 377 | 378 | texture->copyinfo->time -= osd_ticks(); |
| 379 | #if 0 | |
| 378 | 380 | if ((PRIMFLAG_GET_SCREENTEX(prim->flags)) && video_config.filter) |
| 379 | 381 | { |
| 380 | 382 | SDL_SetTextureScaleMode(texture->texture_id, SDL_SCALEMODE_BEST); |
| r10384 | r10385 | |
| 383 | 385 | { |
| 384 | 386 | SDL_SetTextureScaleMode(texture->texture_id, SDL_SCALEMODE_NONE); |
| 385 | 387 | } |
| 388 | #endif | |
| 386 | 389 | SDL_SetTextureBlendMode(texture_id, texture->sdl_blendmode); |
| 387 | 390 | set_coloralphamode(texture_id, &prim->color); |
| 388 | SDL_RenderCopy(texture_id, NULL, &target_rect); | |
| 391 | SDL_RenderCopy(sdl->sdl_renderer, texture_id, NULL, &target_rect); | |
| 389 | 392 | texture->copyinfo->time += osd_ticks(); |
| 390 | 393 | |
| 391 | 394 | texture->copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->rawwidth * texture->rawheight)); |
| r10384 | r10385 | |
| 403 | 406 | UINT32 sb = (UINT32)(255.0f * prim->color.b); |
| 404 | 407 | UINT32 sa = (UINT32)(255.0f * prim->color.a); |
| 405 | 408 | |
| 406 | SDL_SetRenderDrawBlendMode(map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); | |
| 407 | SDL_SetRenderDrawColor(sr, sg, sb, sa); | |
| 408 | SDL_RenderFillRect(&target_rect); | |
| 409 | SDL_SetRenderDrawBlendMode(sdl->sdl_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); | |
| 410 | SDL_SetRenderDrawColor(sdl->sdl_renderer, sr, sg, sb, sa); | |
| 411 | SDL_RenderFillRect(sdl->sdl_renderer, &target_rect); | |
| 409 | 412 | } |
| 410 | 413 | } |
| 411 | 414 | |
| r10384 | r10385 | |
| 426 | 429 | return 0; |
| 427 | 430 | } |
| 428 | 431 | #else |
| 429 | static int RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat) | |
| 432 | static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat) | |
| 430 | 433 | { |
| 431 | 434 | int i; |
| 432 | SDL_Texture | |
| 435 | SDL_Texture | |
| 433 | 436 | for (i=0; fmt_support[i].format != 0; i++) |
| 434 | 437 | { |
| 435 | 438 | if (format == fmt_support[i].format) |
| r10384 | r10385 | |
| 440 | 443 | /* not tested yet */ |
| 441 | 444 | fmt_support[i].format = format; |
| 442 | 445 | fmt_support[i + 1].format = 0; |
| 443 | texid = SDL_CreateTexture(format, access, 16, 16); | |
| 446 | texid = SDL_CreateTexture(renderer, format, access, 16, 16); | |
| 444 | 447 | if (texid) |
| 445 | 448 | { |
| 446 | 449 | fmt_support[i].status = 1; |
| r10384 | r10385 | |
| 486 | 489 | } |
| 487 | 490 | } |
| 488 | 491 | |
| 489 | int draw13_init(sdl_draw_info *callbacks) | |
| 492 | int draw13_init(running_machine &machine, sdl_draw_info *callbacks) | |
| 490 | 493 | { |
| 491 | 494 | const char *stemp; |
| 492 | 495 | |
| r10384 | r10385 | |
| 503 | 506 | |
| 504 | 507 | // Load the GL library now - else MT will fail |
| 505 | 508 | |
| 506 | stemp = options_get_string(ma | |
| 509 | stemp = options_get_string(&machine.options(), SDLOPTION_GL_LIB); | |
| 507 | 510 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) == 0) |
| 508 | 511 | stemp = NULL; |
| 509 | 512 | |
| r10384 | r10385 | |
| 563 | 566 | { |
| 564 | 567 | // allocate memory for our structures |
| 565 | 568 | sdl_info *sdl = (sdl_info *) osd_malloc(sizeof(*sdl)); |
| 566 | int result; | |
| 567 | 569 | |
| 568 | 570 | mame_printf_verbose("Enter draw13_window_create\n"); |
| 569 | 571 | |
| r10384 | r10385 | |
| 572 | 574 | window->dxdata = sdl; |
| 573 | 575 | |
| 574 | 576 | sdl->extra_flags = (window->fullscreen ? |
| 575 | SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN: SDL_WINDOW_RESIZABLE); | |
| 577 | SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE); | |
| 576 | 578 | |
| 577 | 579 | // create the SDL window |
| 578 | 580 | SDL_SelectVideoDisplay(window->monitor->handle); |
| r10384 | r10385 | |
| 616 | 618 | // create renderer |
| 617 | 619 | |
| 618 | 620 | if (video_config.waitvsync) |
| 619 | | |
| 621 | | |
| 620 | 622 | else |
| 621 | | |
| 623 | | |
| 622 | 624 | |
| 623 | if ( | |
| 625 | if (! | |
| 624 | 626 | { |
| 625 | 627 | fatalerror("Error on creating renderer: %s \n", SDL_GetError()); |
| 626 | 628 | } |
| 627 | 629 | |
| 628 | SDL_SelectRenderer(window->sdl_window); | |
| 630 | //SDL_SelectRenderer(window->sdl_window); | |
| 629 | 631 | |
| 630 | 632 | SDL_ShowWindow(window->sdl_window); |
| 631 | 633 | //SDL_SetWindowFullscreen(window->window_id, window->fullscreen); |
| r10384 | r10385 | |
| 640 | 642 | sdl->texture_max_width = 64; |
| 641 | 643 | sdl->texture_max_height = 64; |
| 642 | 644 | |
| 643 | SDL_RenderPresent(); | |
| 645 | SDL_RenderPresent(sdl->sdl_renderer); | |
| 644 | 646 | mame_printf_verbose("Leave draw13_window_create\n"); |
| 645 | 647 | return 0; |
| 646 | 648 | } |
| r10384 | r10385 | |
| 723 | 725 | sdl->resize_pending = 0; |
| 724 | 726 | } |
| 725 | 727 | |
| 726 | SDL_SelectRenderer(window->sdl_window); | |
| 728 | //SDL_SelectRenderer(window->sdl_window); | |
| 727 | 729 | |
| 728 | 730 | if (sdl->blittimer > 0) |
| 729 | 731 | { |
| 730 | 732 | /* SDL Underlays need alpha = 0 ! */ |
| 731 | SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); | |
| 733 | SDL_SetRenderDrawBlendMode(sdl->sdl_renderer, SDL_BLENDMODE_NONE); | |
| 732 | 734 | //SDL_SetRenderDrawColor(0,0,0,255); |
| 733 | SDL_SetRenderDrawColor(0,0,0,0); | |
| 734 | SDL_RenderFillRect(NULL); | |
| 735 | SDL_SetRenderDrawColor(sdl->sdl_renderer, 0,0,0,0); | |
| 736 | SDL_RenderFillRect(sdl->sdl_renderer, NULL); | |
| 735 | 737 | sdl->blittimer--; |
| 736 | 738 | } |
| 737 | 739 | |
| r10384 | r10385 | |
| 781 | 783 | sb = (int)(255.0f * prim->color.b); |
| 782 | 784 | sa = (int)(255.0f * prim->color.a); |
| 783 | 785 | |
| 784 | SDL_SetRenderDrawBlendMode(map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); | |
| 785 | SDL_SetRenderDrawColor(sr, sg, sb, sa); | |
| 786 | SDL_RenderDrawLine(prim->bounds.x0 + hofs, prim->bounds.y0 + vofs, | |
| 786 | SDL_SetRenderDrawBlendMode(sdl->sdl_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); | |
| 787 | SDL_SetRenderDrawColor(sdl->sdl_renderer, sr, sg, sb, sa); | |
| 788 | SDL_RenderDrawLine(sdl->sdl_renderer, prim->bounds.x0 + hofs, prim->bounds.y0 + vofs, | |
| 787 | 789 | prim->bounds.x1 + hofs, prim->bounds.y1 + vofs); |
| 788 | 790 | break; |
| 789 | 791 | case render_primitive::QUAD: |
| r10384 | r10385 | |
| 803 | 805 | |
| 804 | 806 | sdl->last_blit_pixels = blit_pixels; |
| 805 | 807 | sdl->last_blit_time = -osd_ticks(); |
| 806 | SDL_RenderPresent(); | |
| 808 | SDL_RenderPresent(sdl->sdl_renderer); | |
| 807 | 809 | sdl->last_blit_time += osd_ticks(); |
| 808 | 810 | |
| 809 | 811 | return 0; |
| r10384 | r10385 | |
| 852 | 854 | // texture_compute_size and type |
| 853 | 855 | //============================================================ |
| 854 | 856 | |
| 855 | static copy_info *texture_compute_size_type(const render_texinfo *texsource, texture_info *texture, UINT32 flags) | |
| 857 | static copy_info *texture_compute_size_type(SDL_Renderer *renderer, const render_texinfo *texsource, texture_info *texture, UINT32 flags) | |
| 856 | 858 | { |
| 857 | 859 | copy_info *bi; |
| 858 | 860 | copy_info *result = NULL; |
| r10384 | r10385 | |
| 864 | 866 | if ((texture->is_rotated == bi->rotate) |
| 865 | 867 | && (texture->sdl_blendmode == bi->bm_mask)) |
| 866 | 868 | { |
| 867 | if (RendererSupportsFormat(bi->dst_fmt, texture->sdl_access, bi->dstname)) | |
| 869 | if (RendererSupportsFormat(renderer, bi->dst_fmt, texture->sdl_access, bi->dstname)) | |
| 868 | 870 | { |
| 869 | 871 | if (bi->perf == 0) |
| 870 | 872 | return bi; |
| r10384 | r10385 | |
| 883 | 885 | { |
| 884 | 886 | if ((texture->is_rotated == bi->rotate) |
| 885 | 887 | && (texture->sdl_blendmode == bi->bm_mask)) |
| 886 | if (RendererSupportsFormat(bi->dst_fmt, texture->sdl_access, bi->dstname)) | |
| 888 | if (RendererSupportsFormat(renderer, bi->dst_fmt, texture->sdl_access, bi->dstname)) | |
| 887 | 889 | return bi; |
| 888 | 890 | } |
| 889 | 891 | //FIXME: crash implement a -do nothing handler */ |
| r10384 | r10385 | |
| 953 | 955 | mame_printf_warning("Trying to create texture with zero dim\n"); |
| 954 | 956 | |
| 955 | 957 | // compute the size |
| 956 | texture->copyinfo = texture_compute_size_type(texsource, texture, flags); | |
| 958 | texture->copyinfo = texture_compute_size_type(sdl->sdl_renderer, texsource, texture, flags); | |
| 957 | 959 | |
| 958 | texture->texture_id = SDL_CreateTexture(texture->copyinfo->dst_fmt, texture->sdl_access, | |
| 960 | texture->texture_id = SDL_CreateTexture(sdl->sdl_renderer, texture->copyinfo->dst_fmt, texture->sdl_access, | |
| 959 | 961 | texture->setup.rotwidth, texture->setup.rotheight); |
| 960 | 962 | |
| 961 | 963 | if (!texture->texture_id) |
| r10384 | r10385 | |
| 999 | 1001 | } |
| 1000 | 1002 | else |
| 1001 | 1003 | { |
| 1002 | SDL_LockTexture(texture->texture_id, NULL, | |
| 1004 | SDL_LockTexture(texture->texture_id, NULL, | |
| 1003 | 1005 | if ( texture->copyinfo->func ) |
| 1004 | 1006 | texture->copyinfo->func(texture, texsource); |
| 1005 | 1007 | else |
| r10384 | r10385 | |
| 1091 | 1093 | /* would we choose another blitter ? */ |
| 1092 | 1094 | if ((texture->copyinfo->samples & 0x1f) == 0x1f) |
| 1093 | 1095 | { |
| 1094 | if (texture->copyinfo != texture_compute_size_type(&texture->texinfo, texture, prim->flags)) | |
| 1096 | if (texture->copyinfo != texture_compute_size_type(sdl->sdl_renderer, &texture->texinfo, texture, prim->flags)) | |
| 1095 | 1097 | return NULL; |
| 1096 | 1098 | #if 0 |
| 1097 | 1099 | else |
| r10384 | r10385 | |
|---|---|---|
| 88 | 88 | |
| 89 | 89 | static void video_exit(running_machine &machine); |
| 90 | 90 | static void init_monitors(void); |
| 91 | static sdl_monitor_info *pick_monitor(int index); | |
| 91 | static sdl_monitor_info *pick_monitor(core_options &options, int index); | |
| 92 | 92 | |
| 93 | 93 | static void check_osd_inputs(running_machine *machine); |
| 94 | 94 | |
| 95 | 95 | static void extract_video_config(running_machine *machine); |
| 96 | 96 | static void extract_window_config(running_machine *machine, int index, sdl_window_config *conf); |
| 97 | static float get_aspect(const char *name, int report_error); | |
| 98 | static void get_resolution(const char *name, sdl_window_config *config, int report_error); | |
| 97 | static float get_aspect(core_options &options, const char *name, int report_error); | |
| 98 | static void get_resolution(core_options &options, const char *name, sdl_window_config *config, int report_error); | |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | //============================================================ |
| r10384 | r10385 | |
| 116 | 116 | init_monitors(); |
| 117 | 117 | |
| 118 | 118 | // we need the beam width in a float, contrary to what the core does. |
| 119 | video_config.beamwidth = options_get_float(machine->options(), OPTION_BEAM); | |
| 119 | video_config.beamwidth = options_get_float(&machine->options(), OPTION_BEAM); | |
| 120 | 120 | |
| 121 | 121 | // initialize the window system so we can make windows |
| 122 | 122 | if (sdlwindow_init(machine)) |
| r10384 | r10385 | |
| 131 | 131 | memset(&conf, 0, sizeof(conf)); |
| 132 | 132 | extract_window_config(machine, index, &conf); |
| 133 | 133 | conf.totalColors = tc; |
| 134 | if (sdlwindow_video_window_create(machine, index, pick_monitor(index), &conf)) | |
| 134 | if (sdlwindow_video_window_create(machine, index, pick_monitor(machine->options(), index), &conf)) | |
| 135 | 135 | goto error; |
| 136 | 136 | } |
| 137 | 137 | |
| r10384 | r10385 | |
| 501 | 501 | //============================================================ |
| 502 | 502 | |
| 503 | 503 | #if (SDL_VERSION_ATLEAST(1,3,0)) || defined(SDLMAME_WIN32) |
| 504 | static sdl_monitor_info *pick_monitor(int index) | |
| 504 | static sdl_monitor_info *pick_monitor(core_options &options, int index) | |
| 505 | 505 | { |
| 506 | 506 | sdl_monitor_info *monitor; |
| 507 | 507 | const char *scrname; |
| r10384 | r10385 | |
| 511 | 511 | |
| 512 | 512 | // get the screen option |
| 513 | 513 | sprintf(option, SDLOPTION_SCREEN("%d"), index); |
| 514 | scrname = options_get_string( | |
| 514 | scrname = options_get_string(& | |
| 515 | 515 | |
| 516 | 516 | // get the aspect ratio |
| 517 | 517 | sprintf(option, SDLOPTION_ASPECT("%d"), index); |
| 518 | aspect = get_aspect(option, TRUE); | |
| 518 | aspect = get_aspect(options, option, TRUE); | |
| 519 | 519 | |
| 520 | 520 | // look for a match in the name first |
| 521 | 521 | if (scrname != NULL) |
| r10384 | r10385 | |
| 543 | 543 | return monitor; |
| 544 | 544 | } |
| 545 | 545 | #else |
| 546 | static sdl_monitor_info *pick_monitor(int index) | |
| 546 | static sdl_monitor_info *pick_monitor(core_options &options, int index) | |
| 547 | 547 | { |
| 548 | 548 | sdl_monitor_info *monitor; |
| 549 | 549 | char option[20]; |
| r10384 | r10385 | |
| 551 | 551 | |
| 552 | 552 | // get the aspect ratio |
| 553 | 553 | sprintf(option, SDLOPTION_ASPECT("%d"), index); |
| 554 | aspect = get_aspect(option, TRUE); | |
| 554 | aspect = get_aspect(options, option, TRUE); | |
| 555 | 555 | |
| 556 | 556 | // return the primary just in case all else fails |
| 557 | 557 | monitor = primary_monitor; |
| r10384 | r10385 | |
| 618 | 618 | |
| 619 | 619 | sprintf(buf,SDLOPTION_RESOLUTION("%d"), index); |
| 620 | 620 | // per-window options: extract the data |
| 621 | get_resolution(buf, conf, TRUE); | |
| 621 | get_resolution(machine->options(), buf, conf, TRUE); | |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | //============================================================ |
| r10384 | r10385 | |
| 629 | 629 | { |
| 630 | 630 | const char *stemp; |
| 631 | 631 | |
| 632 | video_config.perftest = options_get_bool(machine->options(), SDLOPTION_SDLVIDEOFPS); | |
| 632 | video_config.perftest = options_get_bool(&machine->options(), SDLOPTION_SDLVIDEOFPS); | |
| 633 | 633 | |
| 634 | 634 | // global options: extract the data |
| 635 | video_config.windowed = options_get_bool(machine->options(), SDLOPTION_WINDOW); | |
| 636 | video_config.keepaspect = options_get_bool(machine->options(), SDLOPTION_KEEPASPECT); | |
| 637 | video_config.numscreens = options_get_int(machine->options(), SDLOPTION_NUMSCREENS); | |
| 638 | video_config.fullstretch = options_get_bool(machine->options(), SDLOPTION_UNEVENSTRETCH); | |
| 635 | video_config.windowed = options_get_bool(&machine->options(), SDLOPTION_WINDOW); | |
| 636 | video_config.keepaspect = options_get_bool(&machine->options(), SDLOPTION_KEEPASPECT); | |
| 637 | video_config.numscreens = options_get_int(&machine->options(), SDLOPTION_NUMSCREENS); | |
| 638 | video_config.fullstretch = options_get_bool(&machine->options(), SDLOPTION_UNEVENSTRETCH); | |
| 639 | 639 | #ifdef SDLMAME_X11 |
| 640 | video_config.restrictonemonitor = !options_get_bool(machine->options(), SDLOPTION_USEALLHEADS); | |
| 640 | video_config.restrictonemonitor = !options_get_bool(&machine->options(), SDLOPTION_USEALLHEADS); | |
| 641 | 641 | #endif |
| 642 | 642 | |
| 643 | 643 | |
| r10384 | r10385 | |
| 648 | 648 | video_config.novideo = 0; |
| 649 | 649 | |
| 650 | 650 | // d3d options: extract the data |
| 651 | stemp = options_get_string(machine->options(), SDLOPTION_VIDEO); | |
| 651 | stemp = options_get_string(&machine->options(), SDLOPTION_VIDEO); | |
| 652 | 652 | if (strcmp(stemp, SDLOPTVAL_SOFT) == 0) |
| 653 | 653 | video_config.mode = VIDEO_MODE_SOFT; |
| 654 | 654 | else if (strcmp(stemp, SDLOPTVAL_NONE) == 0) |
| r10384 | r10385 | |
| 656 | 656 | video_config.mode = VIDEO_MODE_SOFT; |
| 657 | 657 | video_config.novideo = 1; |
| 658 | 658 | |
| 659 | if (options_get_int(machine->options(), OPTION_SECONDS_TO_RUN) == 0) | |
| 659 | if (options_get_int(&machine->options(), OPTION_SECONDS_TO_RUN) == 0) | |
| 660 | 660 | mame_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); |
| 661 | 661 | } |
| 662 | 662 | else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) |
| r10384 | r10385 | |
| 677 | 677 | video_config.mode = VIDEO_MODE_SOFT; |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | video_config.switchres = options_get_bool(machine->options(), SDLOPTION_SWITCHRES); | |
| 681 | video_config.centerh = options_get_bool(machine->options(), SDLOPTION_CENTERH); | |
| 682 | video_config.centerv = options_get_bool(machine->options(), SDLOPTION_CENTERV); | |
| 683 | video_config.waitvsync = options_get_bool(machine->options(), SDLOPTION_WAITVSYNC); | |
| 684 | video_config.syncrefresh = options_get_bool(machine->options(), SDLOPTION_SYNCREFRESH); | |
| 680 | video_config.switchres = options_get_bool(&machine->options(), SDLOPTION_SWITCHRES); | |
| 681 | video_config.centerh = options_get_bool(&machine->options(), SDLOPTION_CENTERH); | |
| 682 | video_config.centerv = options_get_bool(&machine->options(), SDLOPTION_CENTERV); | |
| 683 | video_config.waitvsync = options_get_bool(&machine->options(), SDLOPTION_WAITVSYNC); | |
| 684 | video_config.syncrefresh = options_get_bool(&machine->options(), SDLOPTION_SYNCREFRESH); | |
| 685 | 685 | if (!video_config.waitvsync && video_config.syncrefresh) |
| 686 | 686 | { |
| 687 | 687 | mame_printf_warning("-syncrefresh specified without -waitsync. Reverting to -nosyncrefresh\n"); |
| r10384 | r10385 | |
| 690 | 690 | |
| 691 | 691 | if (USE_OPENGL || SDL_VERSION_ATLEAST(1,3,0)) |
| 692 | 692 | { |
| 693 | video_config.filter = options_get_bool(machine->options(), SDLOPTION_FILTER); | |
| 693 | video_config.filter = options_get_bool(&machine->options(), SDLOPTION_FILTER); | |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | if (USE_OPENGL) |
| 697 | 697 | { |
| 698 | video_config.prescale = options_get_int(machine->options(), SDLOPTION_PRESCALE); | |
| 698 | video_config.prescale = options_get_int(&machine->options(), SDLOPTION_PRESCALE); | |
| 699 | 699 | if (video_config.prescale < 1 || video_config.prescale > 3) |
| 700 | 700 | { |
| 701 | 701 | mame_printf_warning("Invalid prescale option, reverting to '1'\n"); |
| r10384 | r10385 | |
| 703 | 703 | } |
| 704 | 704 | // default to working video please |
| 705 | 705 | video_config.prefer16bpp_tex = 0; |
| 706 | video_config.forcepow2texture = options_get_bool(machine->options(), SDLOPTION_GL_FORCEPOW2TEXTURE)==1; | |
| 707 | video_config.allowtexturerect = options_get_bool(machine->options(), SDLOPTION_GL_NOTEXTURERECT)==0; | |
| 708 | video_config.vbo = options_get_bool(machine->options(), SDLOPTION_GL_VBO); | |
| 709 | video_config.pbo = options_get_bool(machine->options(), SDLOPTION_GL_PBO); | |
| 710 | video_config.glsl = options_get_bool(machine->options(), SDLOPTION_GL_GLSL); | |
| 706 | video_config.forcepow2texture = options_get_bool(&machine->options(), SDLOPTION_GL_FORCEPOW2TEXTURE)==1; | |
| 707 | video_config.allowtexturerect = options_get_bool(&machine->options(), SDLOPTION_GL_NOTEXTURERECT)==0; | |
| 708 | video_config.vbo = options_get_bool(&machine->options(), SDLOPTION_GL_VBO); | |
| 709 | video_config.pbo = options_get_bool(&machine->options(), SDLOPTION_GL_PBO); | |
| 710 | video_config.glsl = options_get_bool(&machine->options(), SDLOPTION_GL_GLSL); | |
| 711 | 711 | if ( video_config.glsl ) |
| 712 | 712 | { |
| 713 | 713 | int i; |
| 714 | 714 | static char buffer[20]; // gl_glsl_filter[0..9]? |
| 715 | 715 | |
| 716 | video_config.glsl_filter = options_get_int (machine->options(), SDLOPTION_GLSL_FILTER); | |
| 716 | video_config.glsl_filter = options_get_int (&machine->options(), SDLOPTION_GLSL_FILTER); | |
| 717 | 717 | |
| 718 | 718 | video_config.glsl_shader_mamebm_num=0; |
| 719 | 719 | |
| r10384 | r10385 | |
| 721 | 721 | { |
| 722 | 722 | snprintf(buffer, 18, SDLOPTION_SHADER_MAME("%d"), i); buffer[17]=0; |
| 723 | 723 | |
| 724 | stemp = options_get_string(machine->options(), buffer); | |
| 724 | stemp = options_get_string(&machine->options(), buffer); | |
| 725 | 725 | if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0) |
| 726 | 726 | { |
| 727 | 727 | video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); |
| r10384 | r10385 | |
| 738 | 738 | { |
| 739 | 739 | snprintf(buffer, 20, SDLOPTION_SHADER_SCREEN("%d"), i); buffer[19]=0; |
| 740 | 740 | |
| 741 | stemp = options_get_string(machine->options(), buffer); | |
| 741 | stemp = options_get_string(&machine->options(), buffer); | |
| 742 | 742 | if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0) |
| 743 | 743 | { |
| 744 | 744 | video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); |
| r10384 | r10385 | |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | video_config.glsl_vid_attributes = options_get_int (machine->options(), SDLOPTION_GL_GLSL_VID_ATTR); | |
| 752 | video_config.glsl_vid_attributes = options_get_int (&machine->options(), SDLOPTION_GL_GLSL_VID_ATTR); | |
| 753 | 753 | { |
| 754 | 754 | // Disable feature: glsl_vid_attributes, as long we have the gamma calculation |
| 755 | 755 | // disabled within the direct shaders .. -> too slow. |
| 756 | 756 | // IMHO the gamma setting should be done global anyways, and for the whole system, |
| 757 | 757 | // not just MAME .. |
| 758 | float gamma = options_get_float(machine->options(), OPTION_GAMMA); | |
| 758 | float gamma = options_get_float(&machine->options(), OPTION_GAMMA); | |
| 759 | 759 | if (gamma != 1.0 && video_config.glsl_vid_attributes && video_config.glsl) |
| 760 | 760 | { |
| 761 | 761 | video_config.glsl_vid_attributes = FALSE; |
| r10384 | r10385 | |
| 796 | 796 | } |
| 797 | 797 | #endif |
| 798 | 798 | // yuv settings ... |
| 799 | stemp = options_get_string(machine->options(), SDLOPTION_SCALEMODE); | |
| 799 | stemp = options_get_string(&machine->options(), SDLOPTION_SCALEMODE); | |
| 800 | 800 | video_config.scale_mode = drawsdl_scale_mode(stemp); |
| 801 | 801 | if (video_config.scale_mode < 0) |
| 802 | 802 | { |
| r10384 | r10385 | |
| 815 | 815 | // get_aspect |
| 816 | 816 | //============================================================ |
| 817 | 817 | |
| 818 | static float get_aspect(const char *name, int report_error) | |
| 818 | static float get_aspect(core_options &options, const char *name, int report_error) | |
| 819 | 819 | { |
| 820 | const char *defdata = options_get_string(mame_options(), SDLOPTION_ASPECT("")); | |
| 821 | const char *data = options_get_string(mame_options(), name); | |
| 820 | const char *defdata = options_get_string(&options, SDLOPTION_ASPECT("")); | |
| 821 | const char *data = options_get_string(&options, name); | |
| 822 | 822 | int num = 0, den = 1; |
| 823 | 823 | |
| 824 | 824 | if (strcmp(data, SDLOPTVAL_AUTO) == 0) |
| r10384 | r10385 | |
| 837 | 837 | // get_resolution |
| 838 | 838 | //============================================================ |
| 839 | 839 | |
| 840 | static void get_resolution(const char *name, sdl_window_config *config, int report_error) | |
| 840 | static void get_resolution(core_options &options, const char *name, sdl_window_config *config, int report_error) | |
| 841 | 841 | { |
| 842 | const char *defdata = options_get_string(mame_options(), SDLOPTION_RESOLUTION("")); | |
| 843 | const char *data = options_get_string(mame_options(), name); | |
| 842 | const char *defdata = options_get_string(&options, SDLOPTION_RESOLUTION("")); | |
| 843 | const char *data = options_get_string(&options, name); | |
| 844 | 844 | |
| 845 | 845 | config->width = config->height = config->depth = config->refresh = 0; |
| 846 | 846 | if (strcmp(data, SDLOPTVAL_AUTO) == 0) |
| r10384 | r10385 | |
|---|---|---|
| 2 | 2 | // |
| 3 | 3 | // sdlmain.c - main file for SDLMAME. |
| 4 | 4 | // |
| 5 | // Copyright (c) 1996-201 | |
| 5 | // Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team. | |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| r10384 | r10385 | |
| 527 | 527 | const char *stemp; |
| 528 | 528 | |
| 529 | 529 | // determine if we are benchmarking, and adjust options appropriately |
| 530 | int bench = options_get_int(machine.options(), SDLOPTION_BENCH); | |
| 530 | int bench = options_get_int(&machine.options(), SDLOPTION_BENCH); | |
| 531 | 531 | if (bench > 0) |
| 532 | 532 | { |
| 533 | options_set_bool(machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 534 | options_set_bool(machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM); | |
| 535 | options_set_string(machine.options(), SDLOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); | |
| 536 | options_set_int(machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); | |
| 533 | options_set_bool(&machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 534 | options_set_bool(&machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM); | |
| 535 | options_set_string(&machine.options(), SDLOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); | |
| 536 | options_set_int(&machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); | |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | // Some driver options - must be before audio init! |
| 540 | stemp = options_get_string(machine.options(), SDLOPTION_AUDIODRIVER); | |
| 540 | stemp = options_get_string(&machine.options(), SDLOPTION_AUDIODRIVER); | |
| 541 | 541 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) |
| 542 | 542 | { |
| 543 | 543 | mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp); |
| 544 | 544 | osd_setenv(SDLENV_AUDIODRIVER, stemp, 1); |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | stemp = options_get_string(machine.options(), SDLOPTION_VIDEODRIVER); | |
| 547 | stemp = options_get_string(&machine.options(), SDLOPTION_VIDEODRIVER); | |
| 548 | 548 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) |
| 549 | 549 | { |
| 550 | 550 | mame_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp); |
| r10384 | r10385 | |
| 553 | 553 | |
| 554 | 554 | if (SDL_VERSION_ATLEAST(1,3,0)) |
| 555 | 555 | { |
| 556 | stemp = options_get_string(machine.options(), SDLOPTION_RENDERDRIVER); | |
| 556 | stemp = options_get_string(&machine.options(), SDLOPTION_RENDERDRIVER); | |
| 557 | 557 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) |
| 558 | 558 | { |
| 559 | 559 | mame_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp); |
| r10384 | r10385 | |
| 566 | 566 | */ |
| 567 | 567 | /* FIXME: move lib loading code from drawogl.c here */ |
| 568 | 568 | |
| 569 | stemp = options_get_string(machine.options(), SDLOPTION_GL_LIB); | |
| 569 | stemp = options_get_string(&machine.options(), SDLOPTION_GL_LIB); | |
| 570 | 570 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) |
| 571 | 571 | { |
| 572 | 572 | osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1); |
| r10384 | r10385 | |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /* get number of processors */ |
| 577 | stemp = options_get_string(machine.options(), SDLOPTION_NUMPROCESSORS); | |
| 577 | stemp = options_get_string(&machine.options(), SDLOPTION_NUMPROCESSORS); | |
| 578 | 578 | |
| 579 | 579 | sdl_num_processors = 0; |
| 580 | 580 | |
| r10384 | r10385 | |
| 630 | 630 | |
| 631 | 631 | sdloutput_init(&machine); |
| 632 | 632 | |
| 633 | if (options_get_bool(machine.options(), SDLOPTION_OSLOG)) | |
| 633 | if (options_get_bool(&machine.options(), SDLOPTION_OSLOG)) | |
| 634 | 634 | machine.add_logerror_callback(output_oslog); |
| 635 | 635 | |
| 636 | 636 | /* now setup watchdog */ |
| 637 | 637 | |
| 638 | int watchdog_timeout = options_get_int(machine.options(), SDLOPTION_WATCHDOG); | |
| 639 | int str = options_get_int(machine.options(), OPTION_SECONDS_TO_RUN); | |
| 638 | int watchdog_timeout = options_get_int(&machine.options(), SDLOPTION_WATCHDOG); | |
| 639 | int str = options_get_int(&machine.options(), OPTION_SECONDS_TO_RUN); | |
| 640 | 640 | |
| 641 | 641 | /* only enable watchdog if seconds_to_run is enabled *and* relatively short (time taken from ui.c) */ |
| 642 | 642 | if ((watchdog_timeout != 0) && (str > 0) && (str < 60*5 )) |
| r10384 | r10385 | |
| 941 | 941 | |
| 942 | 942 | if (!font) |
| 943 | 943 | { |
| 944 | mame_file *t; | |
| 945 | ||
| 946 | 944 | mame_printf_verbose("Searching font %s in -%s\n", name.cstr(), SEARCHPATH_FONT); |
| 947 | if (mame_fopen(SEARCHPATH_FONT, name.cstr(), OPEN_FLAG_READ, &t) == FILERR_NONE) | |
| 945 | emu_file file(machine().options(), SEARCHPATH_FONT, OPEN_FLAG_READ); | |
| 946 | if (file.open(name) == FILERR_NONE) | |
| 948 | 947 | { |
| 949 | astring full_name = mame_file_full_name(t); | |
| 950 | mame_fclose(t); | |
| 948 | astring full_name = file.fullpath(); | |
| 951 | 949 | font = TTF_OpenFont(full_name.cstr(), POINT_SIZE); |
| 952 | 950 | if (font) |
| 953 | 951 | mame_printf_verbose("Found font %s\n", full_name.cstr()); |
| r10384 | r10385 | |
|---|---|---|
| 2 | 2 | // |
| 3 | 3 | // drawogl.c - SDL software and OpenGL implementation |
| 4 | 4 | // |
| 5 | // Copyright (c) 1996-201 | |
| 5 | // Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team. | |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| r10384 | r10385 | |
| 353 | 353 | static void drawogl_destroy_all_textures(sdl_window_info *window); |
| 354 | 354 | static void drawogl_window_clear(sdl_window_info *window); |
| 355 | 355 | static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt); |
| 356 | static void load_gl_lib( | |
| 356 | static void load_gl_lib(running_machine &machine); | |
| 357 | 357 | |
| 358 | 358 | |
| 359 | 359 | |
| r10384 | r10385 | |
| 429 | 429 | // drawogl_init |
| 430 | 430 | //============================================================ |
| 431 | 431 | |
| 432 | int drawogl_init(sdl_draw_info *callbacks) | |
| 432 | int drawogl_init(running_machine &machine, sdl_draw_info *callbacks) | |
| 433 | 433 | { |
| 434 | 434 | // fill in the callbacks |
| 435 | 435 | callbacks->exit = drawogl_exit; |
| r10384 | r10385 | |
| 443 | 443 | mame_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); |
| 444 | 444 | |
| 445 | 445 | #if (SDL_VERSION_ATLEAST(1,3,0)) |
| 446 | load_gl_lib(); | |
| 446 | load_gl_lib(machine); | |
| 447 | 447 | #endif |
| 448 | 448 | |
| 449 | 449 | return 0; |
| r10384 | r10385 | |
| 502 | 502 | // Load GL library |
| 503 | 503 | //============================================================ |
| 504 | 504 | |
| 505 | static void load_gl_lib( | |
| 505 | static void load_gl_lib(running_machine &machine) | |
| 506 | 506 | { |
| 507 | 507 | #ifdef USE_DISPATCH_GL |
| 508 | 508 | if (!dll_loaded) |
| r10384 | r10385 | |
| 513 | 513 | */ |
| 514 | 514 | const char *stemp; |
| 515 | 515 | |
| 516 | stemp = options_get_string(ma | |
| 516 | stemp = options_get_string(&machine.options(), SDLOPTION_GL_LIB); | |
| 517 | 517 | if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) == 0) |
| 518 | 518 | stemp = NULL; |
| 519 | 519 | |
| r10384 | r10385 | |
| 553 | 553 | |
| 554 | 554 | SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); |
| 555 | 555 | //Moved into init |
| 556 | //load_gl_lib(); | |
| 556 | //load_gl_lib(*window->machine); | |
| 557 | 557 | |
| 558 | 558 | // create the SDL window |
| 559 | 559 | SDL_SelectVideoDisplay(window->monitor->handle); |
| r10384 | r10385 | |
| 603 | 603 | SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0); |
| 604 | 604 | #endif |
| 605 | 605 | |
| 606 | load_gl_lib(); | |
| 606 | load_gl_lib(*window->machine); | |
| 607 | 607 | |
| 608 | 608 | // create the SDL surface (which creates the window in windowed mode) |
| 609 | 609 | sdl->sdlsurf = SDL_SetVideoMode(width, height, |
| r10384 | r10385 | |
| 1241 | 1241 | // we're doing nothing 3d, so the Z-buffer is currently not interesting |
| 1242 | 1242 | glDisable(GL_DEPTH_TEST); |
| 1243 | 1243 | |
| 1244 | if (options_get_bool(window->machine->options(), OPTION_ANTIALIAS)) | |
| 1244 | if (options_get_bool(&window->machine->options(), OPTION_ANTIALIAS)) | |
| 1245 | 1245 | { |
| 1246 | 1246 | // enable antialiasing for lines |
| 1247 | 1247 | glEnable(GL_LINE_SMOOTH); |
| r10384 | r10385 | |
| 2960 | 2960 | container->get_user_settings(settings); |
| 2961 | 2961 | //FIXME: Intended behaviour |
| 2962 | 2962 | #if 1 |
| 2963 | vid_attributes[0] = options_get_float(window->machine->options(), OPTION_GAMMA); | |
| 2964 | vid_attributes[1] = options_get_float(window->machine->options(), OPTION_CONTRAST); | |
| 2965 | vid_attributes[2] = options_get_float(window->machine->options(), OPTION_BRIGHTNESS); | |
| 2963 | vid_attributes[0] = options_get_float(&window->machine->options(), OPTION_GAMMA); | |
| 2964 | vid_attributes[1] = options_get_float(&window->machine->options(), OPTION_CONTRAST); | |
| 2965 | vid_attributes[2] = options_get_float(&window->machine->options(), OPTION_BRIGHTNESS); | |
| 2966 | 2966 | #else |
| 2967 | 2967 | vid_attributes[0] = settings.gamma; |
| 2968 | 2968 | vid_attributes[1] = settings.contrast; |
| r10384 | r10385 | |
|---|---|---|
| 464 | 464 | |
| 465 | 465 | sdl_xfer_samples = obtained.samples; |
| 466 | 466 | |
| 467 | audio_latency = options_get_int(machine->options(), SDLOPTION_AUDIO_LATENCY); | |
| 467 | audio_latency = options_get_int(&machine->options(), SDLOPTION_AUDIO_LATENCY); | |
| 468 | 468 | |
| 469 | 469 | // pin audio latency |
| 470 | 470 | if (audio_latency > MAX_AUDIO_LATENCY) |
| r10384 | r10385 | |
|---|---|---|
| 2 | 2 | // |
| 3 | 3 | // input.c - SDL implementation of MAME input routines |
| 4 | 4 | // |
| 5 | // Copyright (c) 1996-201 | |
| 5 | // Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team. | |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| r10384 | r10385 | |
| 638 | 638 | const char *dev_name; |
| 639 | 639 | sprintf(defname, "%s%d", opt, dev + 1); |
| 640 | 640 | |
| 641 | dev_name = options_get_string(machine->options(), defname); | |
| 641 | dev_name = options_get_string(&machine->options(), defname); | |
| 642 | 642 | if (dev_name && *dev_name && strcmp(dev_name,SDLOPTVAL_AUTO)) |
| 643 | 643 | { |
| 644 | 644 | devmap->map[dev].name = remove_spaces(machine, dev_name); |
| r10384 | r10385 | |
| 795 | 795 | { |
| 796 | 796 | int index, physical_mouse; |
| 797 | 797 | |
| 798 | mouse_enabled = options_get_bool(machine->options(), OPTION_MOUSE); | |
| 798 | mouse_enabled = options_get_bool(&machine->options(), OPTION_MOUSE); | |
| 799 | 799 | |
| 800 | 800 | devmap_init(machine, &mouse_map, SDLOPTION_MOUSEINDEX, 8, "Mouse mapping"); |
| 801 | 801 | |
| r10384 | r10385 | |
| 855 | 855 | devinfo = generic_device_alloc(&mouse_list, "System mouse"); |
| 856 | 856 | devinfo->device = input_device_add(machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo); |
| 857 | 857 | |
| 858 | mouse_enabled = options_get_bool(machine->options(), OPTION_MOUSE); | |
| 858 | mouse_enabled = options_get_bool(&machine->options(), OPTION_MOUSE); | |
| 859 | 859 | |
| 860 | 860 | // add the axes |
| 861 | 861 | input_device_item_add(devinfo->device, "X", &devinfo->mouse.lX, ITEM_ID_XAXIS, generic_axis_get_state); |
| r10384 | r10385 | |
| 942 | 942 | char sks[21]; |
| 943 | 943 | char kns[21]; |
| 944 | 944 | |
| 945 | if (!options_get_bool(machine->options(), SDLOPTION_KEYMAP)) | |
| 945 | if (!options_get_bool(&machine->options(), SDLOPTION_KEYMAP)) | |
| 946 | 946 | return sdl_key_trans_table; |
| 947 | 947 | |
| 948 | keymap_filename = (char *)options_get_string(machine->options(), SDLOPTION_KEYMAP_FILE); | |
| 948 | keymap_filename = (char *)options_get_string(&machine->options(), SDLOPTION_KEYMAP_FILE); | |
| 949 | 949 | mame_printf_verbose("Keymap: Start reading keymap_file %s\n", keymap_filename); |
| 950 | 950 | |
| 951 | 951 | keymap_file = fopen(keymap_filename, "r"); |
| r10384 | r10385 | |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | // get Sixaxis special mode info |
| 1128 | sixaxis_mode = options_get_bool(machine->options(), SDLOPTION_SIXAXIS); | |
| 1128 | sixaxis_mode = options_get_bool(&machine->options(), SDLOPTION_SIXAXIS); | |
| 1129 | 1129 | |
| 1130 | 1130 | // register the joysticks |
| 1131 | 1131 | sdlinput_register_joysticks(machine); |
| r10384 | r10385 | |
| 1602 | 1602 | { |
| 1603 | 1603 | // configurable UI mode switch |
| 1604 | 1604 | case IPT_UI_TOGGLE_UI: |
| 1605 | uimode = (const char *)options_get_string(ma | |
| 1605 | uimode = (const char *)options_get_string(&machine().options(), SDLOPTION_UIMODEKEY); | |
| 1606 | 1606 | if(!strcmp(uimode,"auto")) { |
| 1607 | 1607 | #if defined(__APPLE__) && defined(__MACH__) |
| 1608 | 1608 | mameid_code = lookup_mame_code("ITEM_ID_INSERT"); |
| r10384 | r10385 | |
|---|---|---|
| 206 | 206 | { |
| 207 | 207 | mame_printf_verbose("Enter sdlwindow_init\n"); |
| 208 | 208 | // determine if we are using multithreading or not |
| 209 | multithreading_enabled = options_get_bool(machine->options(), SDLOPTION_MULTITHREADING); | |
| 209 | multithreading_enabled = options_get_bool(&machine->options(), SDLOPTION_MULTITHREADING); | |
| 210 | 210 | |
| 211 | 211 | // get the main thread ID before anything else |
| 212 | 212 | main_threadid = SDL_ThreadID(); |
| r10384 | r10385 | |
| 234 | 234 | #if USE_OPENGL |
| 235 | 235 | if (video_config.mode == VIDEO_MODE_OPENGL) |
| 236 | 236 | { |
| 237 | if (drawogl_init(&draw)) | |
| 237 | if (drawogl_init(*machine, &draw)) | |
| 238 | 238 | video_config.mode = VIDEO_MODE_SOFT; |
| 239 | 239 | } |
| 240 | 240 | #endif |
| 241 | 241 | #if SDL_VERSION_ATLEAST(1,3,0) |
| 242 | 242 | if (video_config.mode == VIDEO_MODE_SDL13) |
| 243 | 243 | { |
| 244 | if (draw13_init(&draw)) | |
| 244 | if (draw13_init(*machine, &draw)) | |
| 245 | 245 | video_config.mode = VIDEO_MODE_SOFT; |
| 246 | 246 | } |
| 247 | 247 | #endif |
| r10384 | r10385 | |
| 676 | 676 | |
| 677 | 677 | // set the initial maximized state |
| 678 | 678 | // FIXME: Does not belong here |
| 679 | window->startmaximized = options_get_bool(machine->options(), SDLOPTION_MAXIMIZE); | |
| 679 | window->startmaximized = options_get_bool(&machine->options(), SDLOPTION_MAXIMIZE); | |
| 680 | 680 | |
| 681 | 681 | if (!window->fullscreen) |
| 682 | 682 | { |
| r10384 | r10385 | |
| 699 | 699 | |
| 700 | 700 | // set the specific view |
| 701 | 701 | sprintf(option, SDLOPTION_VIEW("%d"), index); |
| 702 | set_starting_view(machine, index, window, options_get_string(machine->options(), option)); | |
| 702 | set_starting_view(machine, index, window, options_get_string(&machine->options(), option)); | |
| 703 | 703 | |
| 704 | 704 | // make the window title |
| 705 | 705 | if (video_config.numscreens == 1) |
| r10384 | r10385 | |
| 1012 | 1012 | |
| 1013 | 1013 | static void set_starting_view(running_machine *machine, int index, sdl_window_info *window, const char *view) |
| 1014 | 1014 | { |
| 1015 | const char *defview = options_get_string(machine->options(), SDLOPTION_VIEW( )); | |
| 1015 | const char *defview = options_get_string(&machine->options(), SDLOPTION_VIEW( )); | |
| 1016 | 1016 | int viewindex; |
| 1017 | 1017 | |
| 1018 | 1018 | ASSERT_MAIN_THREAD(); |
| r10384 | r10385 | |
|---|---|---|
| 96 | 96 | #if (SDL_VERSION_ATLEAST(1,3,0)) |
| 97 | 97 | // Needs to be here as well so we can identify window |
| 98 | 98 | SDL_Window *sdl_window; |
| 99 | SDL_Renderer *sdl_renderer; | |
| 99 | 100 | // These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE |
| 100 | 101 | int resize_width; |
| 101 | 102 | int resize_height; |
| r10384 | r10385 | |
| 146 | 147 | // PROTOTYPES - drawogl.c |
| 147 | 148 | //============================================================ |
| 148 | 149 | |
| 149 | int drawogl_init(sdl_draw_info *callbacks); | |
| 150 | int drawogl_init(running_machine &machine, sdl_draw_info *callbacks); | |
| 150 | 151 | |
| 151 | 152 | //============================================================ |
| 152 | 153 | // PROTOTYPES - draw13.c |
| 153 | 154 | //============================================================ |
| 154 | 155 | |
| 155 | int draw13_init(sdl_draw_info *callbacks); | |
| 156 | int draw13_init(running_machine &machine, sdl_draw_info *callbacks); | |
| 156 | 157 | |
| 157 | 158 | #endif /* __SDLWINDOW__ */ |
| r10384 | r10385 | |
|---|---|---|
| 117 | 117 | |
| 118 | 118 | Notes: |
| 119 | 119 | |
| 120 | This function is called by | |
| 120 | This function is called by core_fopen and several other places in | |
| 121 | 121 | the core to access files. These functions will construct paths by |
| 122 | 122 | concatenating various search paths held in the options.c options |
| 123 | 123 | database with partial paths specified by the core. The core assumes |
| r10384 | r10385 | |
|---|---|---|
| 68 | 68 | // drawnone_init |
| 69 | 69 | //============================================================ |
| 70 | 70 | |
| 71 | int drawnone_init(win_draw_callbacks *callbacks) | |
| 71 | int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks) | |
| 72 | 72 | { |
| 73 | 73 | // fill in the callbacks |
| 74 | 74 | callbacks->exit = drawnone_exit; |
| r10384 | r10385 | |
|---|---|---|
| 87 | 87 | // drawgdi_init |
| 88 | 88 | //============================================================ |
| 89 | 89 | |
| 90 | int drawgdi_init(win_draw_callbacks *callbacks) | |
| 90 | int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks) | |
| 91 | 91 | { |
| 92 | 92 | // fill in the callbacks |
| 93 | 93 | callbacks->exit = drawgdi_exit; |
| r10384 | r10385 | |
|---|---|---|
| 115 | 115 | void winsound_init(running_machine *machine) |
| 116 | 116 | { |
| 117 | 117 | // if no sound, don't create anything |
| 118 | if (!options_get_bool(machine->options(), OPTION_SOUND)) | |
| 118 | if (!options_get_bool(&machine->options(), OPTION_SOUND)) | |
| 119 | 119 | return; |
| 120 | 120 | |
| 121 | 121 | // ensure we get called on the way out |
| r10384 | r10385 | |
| 305 | 305 | stream_format.nAvgBytesPerSec = stream_format.nSamplesPerSec * stream_format.nBlockAlign; |
| 306 | 306 | |
| 307 | 307 | // compute the buffer size based on the output sample rate |
| 308 | stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * options_get_int(machine->options(), WINOPTION_AUDIO_LATENCY) / 10; | |
| 308 | stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * options_get_int(&machine->options(), WINOPTION_AUDIO_LATENCY) / 10; | |
| 309 | 309 | stream_buffer_size = (stream_buffer_size / 1024) * 1024; |
| 310 | 310 | if (stream_buffer_size < 1024) |
| 311 | 311 | stream_buffer_size = 1024; |
| r10384 | r10385 | |
|---|---|---|
| 508 | 508 | assert_always(input_lock != NULL, "Failed to allocate input_lock"); |
| 509 | 509 | |
| 510 | 510 | // decode the options |
| 511 | lightgun_shared_axis_mode = options_get_bool(machine->options(), WINOPTION_DUAL_LIGHTGUN); | |
| 511 | lightgun_shared_axis_mode = options_get_bool(&machine->options(), WINOPTION_DUAL_LIGHTGUN); | |
| 512 | 512 | |
| 513 | 513 | // initialize RawInput and DirectInput (RawInput first so we can fall back) |
| 514 | 514 | rawinput_init(machine); |
| r10384 | r10385 | |
|---|---|---|
| 518 | 518 | const char *stemp; |
| 519 | 519 | |
| 520 | 520 | // determine if we are benchmarking, and adjust options appropriately |
| 521 | int bench = options_get_int(machine.options(), WINOPTION_BENCH); | |
| 521 | int bench = options_get_int(&machine.options(), WINOPTION_BENCH); | |
| 522 | 522 | if (bench > 0) |
| 523 | 523 | { |
| 524 | options_set_bool(machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 525 | options_set_bool(machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM); | |
| 526 | options_set_string(machine.options(), WINOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); | |
| 527 | options_set_int(machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); | |
| 524 | options_set_bool(&machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 525 | options_set_bool(&machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM); | |
| 526 | options_set_string(&machine.options(), WINOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); | |
| 527 | options_set_int(&machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | // determine if we are profiling, and adjust options appropriately |
| 531 | int profile = options_get_int(machine.options(), WINOPTION_PROFILE); | |
| 531 | int profile = options_get_int(&machine.options(), WINOPTION_PROFILE); | |
| 532 | 532 | if (profile > 0) |
| 533 | 533 | { |
| 534 | options_set_bool(machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 535 | options_set_bool(machine.options(), WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM); | |
| 536 | options_set_int(machine.options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM); | |
| 534 | options_set_bool(&machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); | |
| 535 | options_set_bool(&machine.options(), WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM); | |
| 536 | options_set_int(&machine.options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM); | |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | // thread priority |
| 540 | 540 | if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)) |
| 541 | SetThreadPriority(GetCurrentThread(), options_get_int(machine.options(), WINOPTION_PRIORITY)); | |
| 541 | SetThreadPriority(GetCurrentThread(), options_get_int(&machine.options(), WINOPTION_PRIORITY)); | |
| 542 | 542 | |
| 543 | 543 | // ensure we get called on the way out |
| 544 | 544 | machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit); |
| 545 | 545 | |
| 546 | 546 | // get number of processors |
| 547 | stemp = options_get_string(machine.options(), WINOPTION_NUMPROCESSORS); | |
| 547 | stemp = options_get_string(&machine.options(), WINOPTION_NUMPROCESSORS); | |
| 548 | 548 | |
| 549 | 549 | osd_num_processors = 0; |
| 550 | 550 | |
| r10384 | r10385 | |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | // hook up the debugger log |
| 576 | if (options_get_bool(machine.options(), WINOPTION_OSLOG)) | |
| 576 | if (options_get_bool(&machine.options(), WINOPTION_OSLOG)) | |
| 577 | 577 | machine.add_logerror_callback(output_oslog); |
| 578 | 578 | |
| 579 | 579 | // crank up the multimedia timer resolution to its max |
| r10384 | r10385 | |
| 587 | 587 | // mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index); |
| 588 | 588 | |
| 589 | 589 | // if a watchdog thread is requested, create one |
| 590 | int watchdog = options_get_int(machine.options(), WINOPTION_WATCHDOG); | |
| 590 | int watchdog = options_get_int(&machine.options(), WINOPTION_WATCHDOG); | |
| 591 | 591 | if (watchdog != 0) |
| 592 | 592 | { |
| 593 | 593 | watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL); |
| r10384 | r10385 | |
|---|---|---|
| 381 | 381 | // debugwin_init_windows |
| 382 | 382 | //============================================================ |
| 383 | 383 | |
| 384 | void debugwin_init_windows( | |
| 384 | void debugwin_init_windows(running_machine &machine) | |
| 385 | 385 | { |
| 386 | 386 | static int class_registered; |
| 387 | 387 | |
| r10384 | r10385 | |
| 427 | 427 | |
| 428 | 428 | if (temp_dc != NULL) |
| 429 | 429 | { |
| 430 | int size = options_get_int(ma | |
| 430 | int size = options_get_int(&machine.options(), WINOPTION_DEBUGGER_FONT_SIZE); | |
| 431 | 431 | TCHAR *t_face; |
| 432 | 432 | |
| 433 | 433 | // create a standard font |
| 434 | t_face = tstring_from_utf8(options_get_string(ma | |
| 434 | t_face = tstring_from_utf8(options_get_string(&machine.options(), WINOPTION_DEBUGGER_FONT)); | |
| 435 | 435 | debug_font = CreateFont(-MulDiv(size, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, |
| 436 | 436 | ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, t_face); |
| 437 | 437 | osd_free(t_face); |
| r10384 | r10385 | |
|---|---|---|
| 216 | 216 | // drawdd_init |
| 217 | 217 | //============================================================ |
| 218 | 218 | |
| 219 | int drawdd_init(win_draw_callbacks *callbacks) | |
| 219 | int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks) | |
| 220 | 220 | { |
| 221 | 221 | // dynamically grab the create function from ddraw.dll |
| 222 | 222 | dllhandle = LoadLibrary(TEXT("ddraw.dll")); |
| r10384 | r10385 | |
| 613 | 613 | if (window->fullscreen) |
| 614 | 614 | { |
| 615 | 615 | // only set the gamma if it's not 1.0f |
| 616 | float brightness = options_get_float(mame_options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 617 | float contrast = options_get_float(mame_options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 618 | float gamma = options_get_float(mame_options(), WINOPTION_FULLSCREENGAMMA); | |
| 616 | float brightness = options_get_float(&window->machine->options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 617 | float contrast = options_get_float(&window->machine->options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 618 | float gamma = options_get_float(&window->machine->options(), WINOPTION_FULLSCREENGAMMA); | |
| 619 | 619 | if (brightness != 1.0f || contrast != 1.0f || gamma != 1.0f) |
| 620 | 620 | { |
| 621 | 621 | // see if we can get a GammaControl object |
| r10384 | r10385 | |
|---|---|---|
| 92 | 92 | static void winvideo_exit(running_machine &machine); |
| 93 | 93 | static void init_monitors(void); |
| 94 | 94 | static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data); |
| 95 | static win_monitor_info *pick_monitor(int index); | |
| 95 | static win_monitor_info *pick_monitor(core_options &options, int index); | |
| 96 | 96 | |
| 97 | 97 | static void check_osd_inputs(running_machine *machine); |
| 98 | 98 | |
| 99 | 99 | static void extract_video_config(running_machine *machine); |
| 100 | static float get_aspect(const char *name, int report_error); | |
| 101 | static void get_resolution(const char *name, win_window_config *config, int report_error); | |
| 100 | static float get_aspect(core_options &options, const char *name, int report_error); | |
| 101 | static void get_resolution(core_options &options, const char *name, win_window_config *config, int report_error); | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | |
| r10384 | r10385 | |
| 124 | 124 | |
| 125 | 125 | // create the windows |
| 126 | 126 | for (index = 0; index < video_config.numscreens; index++) |
| 127 | winwindow_video_window_create(machine, index, pick_monitor(index), &video_config.window[index]); | |
| 127 | winwindow_video_window_create(machine, index, pick_monitor(machine->options(), index), &video_config.window[index]); | |
| 128 | 128 | if (video_config.mode != VIDEO_MODE_NONE) |
| 129 | 129 | SetForegroundWindow(win_window_list->hwnd); |
| 130 | 130 | |
| 131 | 131 | // possibly create the debug window, but don't show it yet |
| 132 | 132 | if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) |
| 133 | debugwin_init_windows(); | |
| 133 | debugwin_init_windows(*machine); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| r10384 | r10385 | |
| 300 | 300 | // pick_monitor |
| 301 | 301 | //============================================================ |
| 302 | 302 | |
| 303 | static win_monitor_info *pick_monitor(int index) | |
| 303 | static win_monitor_info *pick_monitor(core_options &options, int index) | |
| 304 | 304 | { |
| 305 | 305 | const char *scrname, *scrname2; |
| 306 | 306 | win_monitor_info *monitor; |
| r10384 | r10385 | |
| 309 | 309 | float aspect; |
| 310 | 310 | |
| 311 | 311 | // get the screen option |
| 312 | scrname = options_get_string( | |
| 312 | scrname = options_get_string(& | |
| 313 | 313 | sprintf(option, "screen%d", index); |
| 314 | scrname2 = options_get_string( | |
| 314 | scrname2 = options_get_string(& | |
| 315 | 315 | |
| 316 | 316 | // decide which one we want to use |
| 317 | 317 | if (strcmp(scrname2, "auto") != 0) |
| r10384 | r10385 | |
| 319 | 319 | |
| 320 | 320 | // get the aspect ratio |
| 321 | 321 | sprintf(option, "aspect%d", index); |
| 322 | aspect = get_aspect(option, TRUE); | |
| 322 | aspect = get_aspect(options, option, TRUE); | |
| 323 | 323 | |
| 324 | 324 | // look for a match in the name first |
| 325 | 325 | if (scrname[0] != 0) |
| r10384 | r10385 | |
| 379 | 379 | const char *stemp; |
| 380 | 380 | |
| 381 | 381 | // global options: extract the data |
| 382 | video_config.windowed = options_get_bool(machine->options(), WINOPTION_WINDOW); | |
| 383 | video_config.prescale = options_get_int(machine->options(), WINOPTION_PRESCALE); | |
| 384 | video_config.keepaspect = options_get_bool(machine->options(), WINOPTION_KEEPASPECT); | |
| 385 | video_config.numscreens = options_get_int(machine->options(), WINOPTION_NUMSCREENS); | |
| 382 | video_config.windowed = options_get_bool(&machine->options(), WINOPTION_WINDOW); | |
| 383 | video_config.prescale = options_get_int(&machine->options(), WINOPTION_PRESCALE); | |
| 384 | video_config.keepaspect = options_get_bool(&machine->options(), WINOPTION_KEEPASPECT); | |
| 385 | video_config.numscreens = options_get_int(&machine->options(), WINOPTION_NUMSCREENS); | |
| 386 | 386 | |
| 387 | 387 | // if we are in debug mode, never go full screen |
| 388 | 388 | if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) |
| 389 | 389 | video_config.windowed = TRUE; |
| 390 | 390 | |
| 391 | 391 | // per-window options: extract the data |
| 392 | get_resolution(WINOPTION_RESOLUTION0, &video_config.window[0], TRUE); | |
| 393 | get_resolution(WINOPTION_RESOLUTION1, &video_config.window[1], TRUE); | |
| 394 | get_resolution(WINOPTION_RESOLUTION2, &video_config.window[2], TRUE); | |
| 395 | get_resolution(WINOPTION_RESOLUTION3, &video_config.window[3], TRUE); | |
| 392 | get_resolution(machine->options(), WINOPTION_RESOLUTION0, &video_config.window[0], TRUE); | |
| 393 | get_resolution(machine->options(), WINOPTION_RESOLUTION1, &video_config.window[1], TRUE); | |
| 394 | get_resolution(machine->options(), WINOPTION_RESOLUTION2, &video_config.window[2], TRUE); | |
| 395 | get_resolution(machine->options(), WINOPTION_RESOLUTION3, &video_config.window[3], TRUE); | |
| 396 | 396 | |
| 397 | 397 | // video options: extract the data |
| 398 | stemp = options_get_string(machine->options(), WINOPTION_VIDEO); | |
| 398 | stemp = options_get_string(&machine->options(), WINOPTION_VIDEO); | |
| 399 | 399 | if (strcmp(stemp, "d3d") == 0) |
| 400 | 400 | video_config.mode = VIDEO_MODE_D3D; |
| 401 | 401 | else if (strcmp(stemp, "ddraw") == 0) |
| r10384 | r10385 | |
| 405 | 405 | else if (strcmp(stemp, "none") == 0) |
| 406 | 406 | { |
| 407 | 407 | video_config.mode = VIDEO_MODE_NONE; |
| 408 | if (options_get_int(machine->options(), OPTION_SECONDS_TO_RUN) == 0) | |
| 408 | if (options_get_int(&machine->options(), OPTION_SECONDS_TO_RUN) == 0) | |
| 409 | 409 | mame_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); |
| 410 | 410 | } |
| 411 | 411 | else |
| r10384 | r10385 | |
| 413 | 413 | mame_printf_warning("Invalid video value %s; reverting to gdi\n", stemp); |
| 414 | 414 | video_config.mode = VIDEO_MODE_GDI; |
| 415 | 415 | } |
| 416 | video_config.waitvsync = options_get_bool(machine->options(), WINOPTION_WAITVSYNC); | |
| 417 | video_config.syncrefresh = options_get_bool(machine->options(), WINOPTION_SYNCREFRESH); | |
| 418 | video_config.triplebuf = options_get_bool(machine->options(), WINOPTION_TRIPLEBUFFER); | |
| 419 | video_config.switchres = options_get_bool(machine->options(), WINOPTION_SWITCHRES); | |
| 416 | video_config.waitvsync = options_get_bool(&machine->options(), WINOPTION_WAITVSYNC); | |
| 417 | video_config.syncrefresh = options_get_bool(&machine->options(), WINOPTION_SYNCREFRESH); | |
| 418 | video_config.triplebuf = options_get_bool(&machine->options(), WINOPTION_TRIPLEBUFFER); | |
| 419 | video_config.switchres = options_get_bool(&machine->options(), WINOPTION_SWITCHRES); | |
| 420 | 420 | |
| 421 | 421 | // ddraw options: extract the data |
| 422 | video_config.hwstretch = options_get_bool(machine->options(), WINOPTION_HWSTRETCH); | |
| 422 | video_config.hwstretch = options_get_bool(&machine->options(), WINOPTION_HWSTRETCH); | |
| 423 | 423 | |
| 424 | 424 | // d3d options: extract the data |
| 425 | video_config.filter = options_get_bool(machine->options(), WINOPTION_FILTER); | |
| 425 | video_config.filter = options_get_bool(&machine->options(), WINOPTION_FILTER); | |
| 426 | 426 | if (video_config.prescale == 0) |
| 427 | 427 | video_config.prescale = 1; |
| 428 | 428 | |
| r10384 | r10385 | |
| 431 | 431 | // per-window options: sanity check values |
| 432 | 432 | |
| 433 | 433 | // d3d options: sanity check values |
| 434 | options_get_int(machine->options(), WINOPTION_D3DVERSION); | |
| 434 | options_get_int(&machine->options(), WINOPTION_D3DVERSION); | |
| 435 | 435 | |
| 436 | options_get_float(machine->options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 437 | options_get_float(machine->options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 438 | options_get_float(machine->options(), WINOPTION_FULLSCREENGAMMA); | |
| 436 | options_get_float(&machine->options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 437 | options_get_float(&machine->options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 438 | options_get_float(&machine->options(), WINOPTION_FULLSCREENGAMMA); | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | |
| r10384 | r10385 | |
| 444 | 444 | // get_aspect |
| 445 | 445 | //============================================================ |
| 446 | 446 | |
| 447 | static float get_aspect(const char *name, int report_error) | |
| 447 | static float get_aspect(core_options &options, const char *name, int report_error) | |
| 448 | 448 | { |
| 449 | const char *defdata = options_get_string(mame_options(), WINOPTION_ASPECT); | |
| 450 | const char *data = options_get_string(mame_options(), name); | |
| 449 | const char *defdata = options_get_string(&options, WINOPTION_ASPECT); | |
| 450 | const char *data = options_get_string(&options, name); | |
| 451 | 451 | int num = 0, den = 1; |
| 452 | 452 | |
| 453 | 453 | if (strcmp(data, "auto") == 0) |
| r10384 | r10385 | |
| 467 | 467 | // get_resolution |
| 468 | 468 | //============================================================ |
| 469 | 469 | |
| 470 | static void get_resolution(const char *name, win_window_config *config, int report_error) | |
| 470 | static void get_resolution(core_options &options, const char *name, win_window_config *config, int report_error) | |
| 471 | 471 | { |
| 472 | const char *defdata = options_get_string(mame_options(), WINOPTION_RESOLUTION); | |
| 473 | const char *data = options_get_string(mame_options(), name); | |
| 472 | const char *defdata = options_get_string(&options, WINOPTION_RESOLUTION); | |
| 473 | const char *data = options_get_string(&options, name); | |
| 474 | 474 | |
| 475 | 475 | config->width = config->height = config->refresh = 0; |
| 476 | 476 | if (strcmp(data, "auto") == 0) |
| r10384 | r10385 | |
|---|---|---|
| 69 | 69 | #include "config.h" |
| 70 | 70 | #include "winutf8.h" |
| 71 | 71 | |
| 72 | extern int drawnone_init(win_draw_callbacks *callbacks); | |
| 73 | extern int drawgdi_init(win_draw_callbacks *callbacks); | |
| 74 | extern int drawdd_init(win_draw_callbacks *callbacks); | |
| 75 | extern int drawd3d_init(win_draw_callbacks *callbacks); | |
| 72 | extern int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks); | |
| 73 | extern int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks); | |
| 74 | extern int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks); | |
| 75 | extern int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks); | |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | //============================================================ |
| r10384 | r10385 | |
| 224 | 224 | size_t temp; |
| 225 | 225 | |
| 226 | 226 | // determine if we are using multithreading or not |
| 227 | multithreading_enabled = options_get_bool(machine->options(), WINOPTION_MULTITHREADING); | |
| 227 | multithreading_enabled = options_get_bool(&machine->options(), WINOPTION_MULTITHREADING); | |
| 228 | 228 | |
| 229 | 229 | // get the main thread ID before anything else |
| 230 | 230 | main_threadid = GetCurrentThreadId(); |
| r10384 | r10385 | |
| 268 | 268 | // initialize the drawers |
| 269 | 269 | if (video_config.mode == VIDEO_MODE_D3D) |
| 270 | 270 | { |
| 271 | if (drawd3d_init(&draw)) | |
| 271 | if (drawd3d_init(*machine, &draw)) | |
| 272 | 272 | video_config.mode = VIDEO_MODE_GDI; |
| 273 | 273 | } |
| 274 | 274 | if (video_config.mode == VIDEO_MODE_DDRAW) |
| 275 | 275 | { |
| 276 | if (drawdd_init(&draw)) | |
| 276 | if (drawdd_init(*machine, &draw)) | |
| 277 | 277 | video_config.mode = VIDEO_MODE_GDI; |
| 278 | 278 | } |
| 279 | 279 | if (video_config.mode == VIDEO_MODE_GDI) |
| 280 | drawgdi_init(&draw); | |
| 280 | drawgdi_init(*machine, &draw); | |
| 281 | 281 | if (video_config.mode == VIDEO_MODE_NONE) |
| 282 | drawnone_init(&draw); | |
| 282 | drawnone_init(*machine, &draw); | |
| 283 | 283 | |
| 284 | 284 | // set up the window list |
| 285 | 285 | last_window_ptr = &win_window_list; |
| r10384 | r10385 | |
| 636 | 636 | |
| 637 | 637 | // set the specific view |
| 638 | 638 | sprintf(option, "view%d", index); |
| 639 | set_starting_view(index, window, options_get_string(machine->options(), option)); | |
| 639 | set_starting_view(index, window, options_get_string(&machine->options(), option)); | |
| 640 | 640 | |
| 641 | 641 | // remember the current values in case they change |
| 642 | 642 | window->targetview = window->target->view(); |
| r10384 | r10385 | |
| 650 | 650 | sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index); |
| 651 | 651 | |
| 652 | 652 | // set the initial maximized state |
| 653 | window->startmaximized = options_get_bool(machine->options(), WINOPTION_MAXIMIZE); | |
| 653 | window->startmaximized = options_get_bool(&machine->options(), WINOPTION_MAXIMIZE); | |
| 654 | 654 | |
| 655 | 655 | // finish the window creation on the window thread |
| 656 | 656 | if (multithreading_enabled) |
| r10384 | r10385 | |
| 850 | 850 | |
| 851 | 851 | static void set_starting_view(int index, win_window_info *window, const char *view) |
| 852 | 852 | { |
| 853 | const char *defview = options_get_string(ma | |
| 853 | const char *defview = options_get_string(&window->machine->options(), WINOPTION_VIEW); | |
| 854 | 854 | int viewindex; |
| 855 | 855 | |
| 856 | 856 | assert(GetCurrentThreadId() == main_threadid); |
| r10384 | r10385 | |
| 1121 | 1121 | monitorbounds = window->monitor->info.rcMonitor; |
| 1122 | 1122 | |
| 1123 | 1123 | // create the window menu if needed |
| 1124 | if (options_get_bool(ma | |
| 1124 | if (options_get_bool(&window->machine->options(), "menu")) { | |
| 1125 | 1125 | if (win_create_menu(window->machine, &menu)) |
| 1126 | 1126 | return 1; |
| 1127 | 1127 | } |
| r10384 | r10385 | |
|---|---|---|
| 55 | 55 | // PROTOTYPES |
| 56 | 56 | //============================================================ |
| 57 | 57 | |
| 58 | void debugwin_init_windows( | |
| 58 | void debugwin_init_windows(running_machine &machine); | |
| 59 | 59 | void debugwin_destroy_windows(void); |
| 60 | 60 | void debugwin_show(int type); |
| 61 | 61 | void debugwin_update_during_game(running_machine *machine); |
| r10384 | r10385 | |
|---|---|---|
| 478 | 478 | // drawd3d_init |
| 479 | 479 | //============================================================ |
| 480 | 480 | |
| 481 | int drawd3d_init(win_draw_callbacks *callbacks) | |
| 481 | int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks) | |
| 482 | 482 | { |
| 483 | int version = options_get_int(ma | |
| 483 | int version = options_get_int(&machine.options(), WINOPTION_D3DVERSION); | |
| 484 | 484 | d3dintf = NULL; |
| 485 | 485 | |
| 486 | 486 | // try Direct3D 9 if requested |
| r10384 | r10385 | |
| 537 | 537 | |
| 538 | 538 | // experimental: load a PNG to use for vector rendering; it is treated |
| 539 | 539 | // as a brightness map |
| 540 | d3d->vector_bitmap = render_load_png(OPTION_ARTPATH, NULL, "vector.png", NULL, NULL); | |
| 540 | emu_file file(window->machine->options(), OPTION_ARTPATH, OPEN_FLAG_READ); | |
| 541 | d3d->vector_bitmap = render_load_png(file, NULL, "vector.png", NULL, NULL); | |
| 541 | 542 | if (d3d->vector_bitmap != NULL) |
| 542 | 543 | { |
| 543 | 544 | bitmap_fill(d3d->vector_bitmap, NULL, MAKE_ARGB(0xff,0xff,0xff,0xff)); |
| 544 | d3d->vector_bitmap = render_load_png( | |
| 545 | d3d->vector_bitmap = render_load_png(file | |
| 545 | 546 | } |
| 546 | 547 | |
| 547 | 548 | // configure the adapter for the mode we want |
| r10384 | r10385 | |
| 806 | 807 | if (window->fullscreen) |
| 807 | 808 | { |
| 808 | 809 | // only set the gamma if it's not 1.0f |
| 809 | float brightness = options_get_float(mame_options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 810 | float contrast = options_get_float(mame_options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 811 | float gamma = options_get_float(mame_options(), WINOPTION_FULLSCREENGAMMA); | |
| 810 | float brightness = options_get_float(&window->machine->options(), WINOPTION_FULLSCREENBRIGHTNESS); | |
| 811 | float contrast = options_get_float(&window->machine->options(), WINOPTION_FULLLSCREENCONTRAST); | |
| 812 | float gamma = options_get_float(&window->machine->options(), WINOPTION_FULLSCREENGAMMA); | |
| 812 | 813 | if (brightness != 1.0f || contrast != 1.0f || gamma != 1.0f) |
| 813 | 814 | { |
| 814 | 815 | // warn if we can't do it |
| r10384 | r10385 | |
|---|---|---|
| 359 | 359 | // flush the file |
| 360 | 360 | if (found_comments) |
| 361 | 361 | { |
| 362 | astring fname(machine->basename(), ".cmt"); | |
| 363 | mame_file *fp; | |
| 364 | file_error filerr = mame_fopen(SEARCHPATH_COMMENT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &fp); | |
| 365 | ||
| 362 | emu_file file(machine->options(), SEARCHPATH_COMMENT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 363 | file_error filerr = file.open(machine->basename(), ".cmt"); | |
| 366 | 364 | if (filerr == FILERR_NONE) |
| 367 | { | |
| 368 | xml_file_write(root, mame_core_file(fp)); | |
| 369 | mame_fclose(fp); | |
| 370 | } | |
| 365 | xml_file_write(root, file); | |
| 371 | 366 | } |
| 372 | 367 | } |
| 373 | 368 | catch (emu_exception &) |
| r10384 | r10385 | |
| 390 | 385 | bool debug_comment_load(running_machine *machine) |
| 391 | 386 | { |
| 392 | 387 | // open the file |
| 393 | astring fname(machine->basename(), ".cmt"); | |
| 394 | mame_file *fp; | |
| 395 | file_error filerr = mame_fopen(SEARCHPATH_COMMENT, fname, OPEN_FLAG_READ, &fp); | |
| 388 | emu_file file(machine->options(), SEARCHPATH_COMMENT, OPEN_FLAG_READ); | |
| 389 | file_error filerr = file.open(machine->basename(), ".cmt"); | |
| 396 | 390 | |
| 397 | 391 | // if an error, just return false |
| 398 | 392 | if (filerr != FILERR_NONE) |
| 399 | 393 | return false; |
| 400 | 394 | |
| 401 | 395 | // wrap in a try/catch to handle errors |
| 402 | xml_data_node *root = xml_file_read( | |
| 396 | xml_data_node *root = xml_file_read( | |
| 403 | 397 | try |
| 404 | 398 | { |
| 405 | 399 | // read the file |
| r10384 | r10385 | |
| 436 | 430 | // clean up in case of error |
| 437 | 431 | if (root != NULL) |
| 438 | 432 | xml_file_free(root); |
| 439 | mame_fclose(fp); | |
| 440 | 433 | return false; |
| 441 | 434 | } |
| 442 | 435 | |
| 443 | 436 | // free the parser |
| 444 | 437 | xml_file_free(root); |
| 445 | mame_fclose(fp); | |
| 446 | 438 | return true; |
| 447 | 439 | } |
| 448 | 440 |
| r10384 | r10385 | |
|---|---|---|
| 372 | 372 | machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_command_exit); |
| 373 | 373 | |
| 374 | 374 | /* set up the initial debugscript if specified */ |
| 375 | name = options_get_string(machine->options(), OPTION_DEBUGSCRIPT); | |
| 375 | name = options_get_string(&machine->options(), OPTION_DEBUGSCRIPT); | |
| 376 | 376 | if (name[0] != 0) |
| 377 | 377 | debug_cpu_source_script(machine, name); |
| 378 | 378 | } |
| r10384 | r10385 | |
| 2489 | 2489 | /* otherwise, we have to open the file ourselves */ |
| 2490 | 2490 | else |
| 2491 | 2491 | { |
| 2492 | file_error filerr; | |
| 2493 | mame_file *fp; | |
| 2494 | 2492 | const char *filename = param[0]; |
| 2495 | 2493 | int scrnum = (params > 1) ? atoi(param[1]) : 0; |
| 2496 | 2494 | |
| r10384 | r10385 | |
| 2505 | 2503 | astring fname(filename); |
| 2506 | 2504 | if (fname.find(0, ".png") == -1) |
| 2507 | 2505 | fname.cat(".png"); |
| 2508 | filerr = mame_fopen(SEARCHPATH_SCREENSHOT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &fp); | |
| 2506 | emu_file file(machine->options(), SEARCHPATH_SCREENSHOT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 2507 | file_error filerr = file.open(fname); | |
| 2509 | 2508 | |
| 2510 | 2509 | if (filerr != FILERR_NONE) |
| 2511 | 2510 | { |
| r10384 | r10385 | |
| 2513 | 2512 | return; |
| 2514 | 2513 | } |
| 2515 | 2514 | |
| 2516 | screen->machine->video().save_snapshot(screen, *fp); | |
| 2517 | mame_fclose(fp); | |
| 2515 | screen->machine->video().save_snapshot(screen, file); | |
| 2518 | 2516 | debug_console_printf(machine, "Saved screen #%d snapshot as '%s'\n", scrnum, filename); |
| 2519 | 2517 | } |
| 2520 | 2518 | } |
| r10384 | r10385 | |
|---|---|---|
| 80 | 80 | |
| 81 | 81 | // public accessors... for now |
| 82 | 82 | void nvram_reset() { nvram_default(); } |
| 83 | void nvram_load(mame_file &file) { nvram_read(file); } | |
| 84 | void nvram_save(mame_file &file) { nvram_write(file); } | |
| 83 | void nvram_load(emu_file &file) { nvram_read(file); } | |
| 84 | void nvram_save(emu_file &file) { nvram_write(file); } | |
| 85 | 85 | |
| 86 | 86 | protected: |
| 87 | 87 | // derived class overrides |
| 88 | 88 | virtual void nvram_default() = 0; |
| 89 | virtual void nvram_read(mame_file &file) = 0; | |
| 90 | virtual void nvram_write(mame_file &file) = 0; | |
| 89 | virtual void nvram_read(emu_file &file) = 0; | |
| 90 | virtual void nvram_write(emu_file &file) = 0; | |
| 91 | 91 | |
| 92 | 92 | // configuration |
| 93 | 93 | const device_config_nvram_interface &m_nvram_config; // reference to our device_config_execute_interface |
| r10384 | r10385 | |
|---|---|---|
| 175 | 175 | |
| 176 | 176 | VIDEO_START( vector ) |
| 177 | 177 | { |
| 178 | beam_width = options_get_float(machine->options(), OPTION_BEAM); | |
| 178 | beam_width = options_get_float(&machine->options(), OPTION_BEAM); | |
| 179 | 179 | |
| 180 | 180 | /* Grab the settings for this session */ |
| 181 | vector_set_flicker(options_get_float(machine->options(), OPTION_FLICKER)); | |
| 181 | vector_set_flicker(options_get_float(&machine->options(), OPTION_FLICKER)); | |
| 182 | 182 | |
| 183 | 183 | vector_index = 0; |
| 184 | 184 | |
| r10384 | r10385 | |
| 256 | 256 | |
| 257 | 257 | VIDEO_UPDATE( vector ) |
| 258 | 258 | { |
| 259 | UINT32 flags = PRIMFLAG_ANTIALIAS(options_get_bool(screen->machine->options(), OPTION_ANTIALIAS) ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD); | |
| 259 | UINT32 flags = PRIMFLAG_ANTIALIAS(options_get_bool(&screen->machine->options(), OPTION_ANTIALIAS) ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD); | |
| 260 | 260 | const rectangle &visarea = screen->visible_area(); |
| 261 | 261 | float xscale = 1.0f / (65536 * (visarea.max_x - visarea.min_x)); |
| 262 | 262 | float yscale = 1.0f / (65536 * (visarea.max_y - visarea.min_y)); |
| r10384 | r10385 | |
|---|---|---|
| 213 | 213 | { |
| 214 | 214 | const char *result = NULL; |
| 215 | 215 | |
| 216 | if (options_get_bool(image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) | |
| 216 | if (options_get_bool(&image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) | |
| 217 | 217 | { |
| 218 | 218 | /* access the option */ |
| 219 | result = options_get_string_priority(image->device().machine->options(), image->image_config().instance_name(), OPTION_PRIORITY_DRIVER_INI); | |
| 219 | result = options_get_string_priority(&image->device().machine->options(), image->image_config().instance_name(), OPTION_PRIORITY_DRIVER_INI); | |
| 220 | 220 | } |
| 221 | 221 | return result; |
| 222 | 222 | } |
| r10384 | r10385 | |
|---|---|---|
| 1405 | 1405 | |
| 1406 | 1406 | void ui_menu_force_game_select(running_machine *machine, render_container *container) |
| 1407 | 1407 | { |
| 1408 | char *gamename = (char *)options_get_string(machine->options(), OPTION_GAMENAME); | |
| 1408 | char *gamename = (char *)options_get_string(&machine->options(), OPTION_GAMENAME); | |
| 1409 | 1409 | |
| 1410 | 1410 | /* reset the menu stack */ |
| 1411 | 1411 | ui_menu_stack_reset(machine); |
| r10384 | r10385 | |
| 1570 | 1570 | ui_menu_item_append(menu, "Crosshair Options", NULL, 0, (void *)menu_crosshair); |
| 1571 | 1571 | |
| 1572 | 1572 | /* add cheat menu */ |
| 1573 | if (options_get_bool(machine->options(), OPTION_CHEAT) && machine->cheat().first() != NULL) | |
| 1573 | if (options_get_bool(&machine->options(), OPTION_CHEAT) && machine->cheat().first() != NULL) | |
| 1574 | 1574 | ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat); |
| 1575 | 1575 | |
| 1576 | 1576 | /* add memory card menu */ |
| r10384 | r10385 | |
| 3254 | 3254 | int player; |
| 3255 | 3255 | UINT8 use_auto = FALSE; |
| 3256 | 3256 | UINT32 flags = 0; |
| 3257 | mame_path *path; | |
| 3258 | 3257 | |
| 3259 | 3258 | /* loop over player and add the manual items */ |
| 3260 | 3259 | for (player = 0; player < MAX_PLAYERS; player++) |
| r10384 | r10385 | |
| 3300 | 3299 | /* search for crosshair graphics */ |
| 3301 | 3300 | |
| 3302 | 3301 | /* open a path to the crosshairs */ |
| 3303 | path = mame_openpath(machine->options(), OPTION_CROSSHAIRPATH); | |
| 3304 | if (path != NULL) | |
| 3305 | { | |
| 3306 | const osd_directory_entry *dir; | |
| 3302 | file_enumerator path(machine->options(), OPTION_CROSSHAIRPATH); | |
| 3303 | const osd_directory_entry *dir; | |
| 3304 | /* reset search flags */ | |
| 3305 | int using_default = FALSE; | |
| 3306 | int finished = FALSE; | |
| 3307 | int found = FALSE; | |
| 3307 | 3308 | |
| 3308 | /* reset search flags */ | |
| 3309 | int using_default = FALSE; | |
| 3310 | int finished = FALSE; | |
| 3311 | int found = FALSE; | |
| 3309 | /* if we are using the default, then we just need to find the first in the list */ | |
| 3310 | if (strlen(settings.name) == 0) | |
| 3311 | using_default = TRUE; | |
| 3312 | 3312 | |
| 3313 | /* if we are using the default, then we just need to find the first in the list */ | |
| 3314 | if (strlen(settings.name) == 0) | |
| 3315 | using_default = TRUE; | |
| 3313 | /* look for the current name, then remember the name before */ | |
| 3314 | /* and find the next name */ | |
| 3315 | while (((dir = path.next()) != NULL) && !finished) | |
| 3316 | { | |
| 3317 | int length = strlen(dir->name); | |
| 3316 | 3318 | |
| 3317 | /* look for the current name, then remember the name before */ | |
| 3318 | /* and find the next name */ | |
| 3319 | while (((dir = mame_readpath(path)) != NULL) && !finished) | |
| 3319 | /* look for files ending in .png with a name not larger then 9 chars*/ | |
| 3320 | if ((length > 4) && (length <= CROSSHAIR_PIC_NAME_LENGTH + 4) && | |
| 3321 | dir->name[length - 4] == '.' && | |
| 3322 | tolower((UINT8)dir->name[length - 3]) == 'p' && | |
| 3323 | tolower((UINT8)dir->name[length - 2]) == 'n' && | |
| 3324 | tolower((UINT8)dir->name[length - 1]) == 'g') | |
| 3325 | ||
| 3320 | 3326 | { |
| 3321 | int length = strlen(dir->name); | |
| 3327 | /* remove .png from length */ | |
| 3328 | length -= 4; | |
| 3322 | 3329 | |
| 3323 | /* look for files ending in .png with a name not larger then 9 chars*/ | |
| 3324 | if ((length > 4) && (length <= CROSSHAIR_PIC_NAME_LENGTH + 4) && | |
| 3325 | dir->name[length - 4] == '.' && | |
| 3326 | tolower((UINT8)dir->name[length - 3]) == 'p' && | |
| 3327 | tolower((UINT8)dir->name[length - 2]) == 'n' && | |
| 3328 | tolower((UINT8)dir->name[length - 1]) == 'g') | |
| 3329 | ||
| 3330 | if (found || using_default) | |
| 3330 | 3331 | { |
| 3331 | /* remove .png from length */ | |
| 3332 | length -= 4; | |
| 3333 | ||
| 3334 | if (found || using_default) | |
| 3335 | { | |
| 3336 | /* get the next name */ | |
| 3337 | strncpy(data->next_name, dir->name, length); | |
| 3338 | data->next_name[length] = 0; | |
| 3339 | finished = TRUE; | |
| 3340 | } | |
| 3341 | else if (!strncmp(dir->name, settings.name, length)) | |
| 3342 | { | |
| 3343 | /* we found the current name */ | |
| 3344 | /* so loop once more to find the next name */ | |
| 3345 | found = TRUE; | |
| 3346 | } | |
| 3347 | else | |
| 3348 | /* remember last name */ | |
| 3349 | /* we will do it here in case files get added to the directory */ | |
| 3350 | { | |
| 3351 | strncpy(data->last_name, dir->name, length); | |
| 3352 | data->last_name[length] = 0; | |
| 3353 | } | |
| 3332 | /* get the next name */ | |
| 3333 | strncpy(data->next_name, dir->name, length); | |
| 3334 | data->next_name[length] = 0; | |
| 3335 | finished = TRUE; | |
| 3354 | 3336 | } |
| 3337 | else if (!strncmp(dir->name, settings.name, length)) | |
| 3338 | { | |
| 3339 | /* we found the current name */ | |
| 3340 | /* so loop once more to find the next name */ | |
| 3341 | found = TRUE; | |
| 3342 | } | |
| 3343 | else | |
| 3344 | /* remember last name */ | |
| 3345 | /* we will do it here in case files get added to the directory */ | |
| 3346 | { | |
| 3347 | strncpy(data->last_name, dir->name, length); | |
| 3348 | data->last_name[length] = 0; | |
| 3349 | } | |
| 3355 | 3350 | } |
| 3356 | /* if name not found then next item is DEFAULT */ | |
| 3357 | if (!found && !using_default) | |
| 3358 | { | |
| 3359 | data->next_name[0] = 0; | |
| 3360 | finished = TRUE; | |
| 3361 | } | |
| 3362 | /* setup the selection flags */ | |
| 3363 | flags = 0; | |
| 3364 | if (finished) | |
| 3365 | flags |= MENU_FLAG_RIGHT_ARROW; | |
| 3366 | if (found) | |
| 3367 | flags |= MENU_FLAG_LEFT_ARROW; | |
| 3368 | ||
| 3369 | /* add CROSSHAIR_ITEM_PIC menu */ | |
| 3370 | sprintf(temp_text, "P%d Crosshair", player + 1); | |
| 3371 | ui_menu_item_append(menu, temp_text, using_default ? "DEFAULT" : settings.name, flags, data); | |
| 3372 | 3351 | } |
| 3352 | /* if name not found then next item is DEFAULT */ | |
| 3353 | if (!found && !using_default) | |
| 3354 | { | |
| 3355 | data->next_name[0] = 0; | |
| 3356 | finished = TRUE; | |
| 3357 | } | |
| 3358 | /* setup the selection flags */ | |
| 3359 | flags = 0; | |
| 3360 | if (finished) | |
| 3361 | flags |= MENU_FLAG_RIGHT_ARROW; | |
| 3362 | if (found) | |
| 3363 | flags |= MENU_FLAG_LEFT_ARROW; | |
| 3364 | ||
| 3365 | /* add CROSSHAIR_ITEM_PIC menu */ | |
| 3366 | sprintf(temp_text, "P%d Crosshair", player + 1); | |
| 3367 | ui_menu_item_append(menu, temp_text, using_default ? "DEFAULT" : settings.name, flags, data); | |
| 3373 | 3368 | } |
| 3374 | 3369 | } |
| 3375 | 3370 | if (use_auto) |
| r10384 | r10385 | |
| 3467 | 3462 | int audit_result; |
| 3468 | 3463 | |
| 3469 | 3464 | /* audit the game first to see if we're going to work */ |
| 3470 | audit_records = audit_images(menu->machine->options(), driver, AUDIT_VALIDATE_FAST, &audit); | |
| 3465 | audit_records = audit_images(&menu->machine->options(), driver, AUDIT_VALIDATE_FAST, &audit); | |
| 3471 | 3466 | audit_result = audit_summary(driver, audit_records, audit, FALSE); |
| 3472 | 3467 | if (audit_records > 0) |
| 3473 | 3468 | global_free(audit); |
| r10384 | r10385 | |
| 3608 | 3603 | { |
| 3609 | 3604 | int driver_count = driver_list_get_count(drivers); |
| 3610 | 3605 | int drivnum, listnum; |
| 3611 | mame_path *path; | |
| 3612 | 3606 | UINT8 *found; |
| 3613 | 3607 | |
| 3614 | 3608 | /* create a sorted copy of the main driver list */ |
| r10384 | r10385 | |
| 3620 | 3614 | memset(found, 0, (driver_count + 7) / 8); |
| 3621 | 3615 | |
| 3622 | 3616 | /* open a path to the ROMs and find them in the array */ |
| 3623 | path = mame_openpath(menu->machine->options(), OPTION_ROMPATH); | |
| 3624 | if (path != NULL) | |
| 3617 | file_enumerator path(menu->machine->options(), OPTION_ROMPATH); | |
| 3618 | const osd_directory_entry *dir; | |
| 3619 | ||
| 3620 | /* iterate while we get new objects */ | |
| 3621 | while ((dir = path.next()) != NULL) | |
| 3625 | 3622 | { |
| 3626 | const osd_directory_entry *dir; | |
| 3623 | game_driver tempdriver; | |
| 3624 | game_driver *tempdriver_ptr; | |
| 3625 | const game_driver **found_driver; | |
| 3626 | char drivername[50]; | |
| 3627 | char *dst = drivername; | |
| 3628 | const char *src; | |
| 3627 | 3629 | |
| 3628 | /* iterate while we get new objects */ | |
| 3629 | while ((dir = mame_readpath(path)) != NULL) | |
| 3630 | { | |
| 3631 | game_driver tempdriver; | |
| 3632 | game_driver *tempdriver_ptr; | |
| 3633 | const game_driver **found_driver; | |
| 3634 | char drivername[50]; | |
| 3635 | char *dst = drivername; | |
| 3636 | const char *src; | |
| 3630 | /* build a name for it */ | |
| 3631 | for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++) | |
| 3632 | *dst++ = tolower((UINT8)*src); | |
| 3633 | *dst = 0; | |
| 3637 | 3634 | |
| 3638 | /* build a name for it */ | |
| 3639 | for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++) | |
| 3640 | *dst++ = tolower((UINT8)*src); | |
| 3641 | *dst = 0; | |
| 3635 | /* find it in the array */ | |
| 3636 | tempdriver.name = drivername; | |
| 3637 | tempdriver_ptr = &tempdriver; | |
| 3638 | found_driver = (const game_driver **)bsearch(&tempdriver_ptr, menustate->driverlist, driver_count, sizeof(*menustate->driverlist), menu_select_game_driver_compare); | |
| 3642 | 3639 | |
| 3643 | /* find it in the array */ | |
| 3644 | tempdriver.name = drivername; | |
| 3645 | tempdriver_ptr = &tempdriver; | |
| 3646 | found_driver = (const game_driver **)bsearch(&tempdriver_ptr, menustate->driverlist, driver_count, sizeof(*menustate->driverlist), menu_select_game_driver_compare); | |
| 3647 | ||
| 3648 | /* if found, mark the corresponding entry in the array */ | |
| 3649 | if (found_driver != NULL) | |
| 3650 | { | |
| 3651 | int index = found_driver - menustate->driverlist; | |
| 3652 | found[index / 8] |= 1 << (index % 8); | |
| 3653 | } | |
| 3640 | /* if found, mark the corresponding entry in the array */ | |
| 3641 | if (found_driver != NULL) | |
| 3642 | { | |
| 3643 | int index = found_driver - menustate->driverlist; | |
| 3644 | found[index / 8] |= 1 << (index % 8); | |
| 3654 | 3645 | } |
| 3655 | mame_closepath(path); | |
| 3656 | 3646 | } |
| 3657 | 3647 | |
| 3658 | 3648 | /* now build the final list */ |
| r10384 | r10385 | |
|---|---|---|
| 112 | 112 | m_overall_real_ticks(0), |
| 113 | 113 | m_overall_emutime(attotime::zero), |
| 114 | 114 | m_overall_valid_counter(0), |
| 115 | m_throttle(options_get_bool(machine.options(), OPTION_THROTTLE)), | |
| 115 | m_throttle(options_get_bool(&machine.options(), OPTION_THROTTLE)), | |
| 116 | 116 | m_fastforward(false), |
| 117 | m_seconds_to_run(options_get_int(machine.options(), OPTION_SECONDS_TO_RUN)), | |
| 118 | m_auto_frameskip(options_get_bool(machine.options(), OPTION_AUTOFRAMESKIP)), | |
| 117 | m_seconds_to_run(options_get_int(&machine.options(), OPTION_SECONDS_TO_RUN)), | |
| 118 | m_auto_frameskip(options_get_bool(&machine.options(), OPTION_AUTOFRAMESKIP)), | |
| 119 | 119 | m_speed(original_speed_setting()), |
| 120 | 120 | m_empty_skip_count(0), |
| 121 | m_frameskip_level(options_get_int(machine.options(), OPTION_FRAMESKIP)), | |
| 121 | m_frameskip_level(options_get_int(&machine.options(), OPTION_FRAMESKIP)), | |
| 122 | 122 | m_frameskip_counter(0), |
| 123 | 123 | m_frameskip_adjust(0), |
| 124 | 124 | m_skipping_this_frame(false), |
| r10384 | r10385 | |
| 142 | 142 | update_refresh_speed(); |
| 143 | 143 | |
| 144 | 144 | // create a render target for snapshots |
| 145 | const char *viewname = options_get_string(machine.options(), OPTION_SNAPVIEW); | |
| 145 | const char *viewname = options_get_string(&machine.options(), OPTION_SNAPVIEW); | |
| 146 | 146 | m_snap_native = (machine.primary_screen != NULL && (viewname[0] == 0 || strcmp(viewname, "native") == 0)); |
| 147 | 147 | |
| 148 | 148 | // the native target is hard-coded to our internal layout and has all options disabled |
| r10384 | r10385 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // extract snap resolution if present |
| 168 | if (sscanf(options_get_string(machine.options(), OPTION_SNAPSIZE), "%dx%d", &m_snap_width, &m_snap_height) != 2) | |
| 168 | if (sscanf(options_get_string(&machine.options(), OPTION_SNAPSIZE), "%dx%d", &m_snap_width, &m_snap_height) != 2) | |
| 169 | 169 | m_snap_width = m_snap_height = 0; |
| 170 | 170 | |
| 171 | 171 | // start recording movie if specified |
| 172 | const char *filename = options_get_string(machine.options(), OPTION_MNGWRITE); | |
| 172 | const char *filename = options_get_string(&machine.options(), OPTION_MNGWRITE); | |
| 173 | 173 | if (filename[0] != 0) |
| 174 | 174 | begin_recording(filename, MF_MNG); |
| 175 | 175 | |
| 176 | filename = options_get_string(machine.options(), OPTION_AVIWRITE); | |
| 176 | filename = options_get_string(&machine.options(), OPTION_AVIWRITE); | |
| 177 | 177 | if (filename[0] != 0) |
| 178 | 178 | begin_recording(filename, MF_AVI); |
| 179 | 179 | |
| r10384 | r10385 | |
| 220 | 220 | // only render sound and video if we're in the running phase |
| 221 | 221 | int phase = m_machine.phase(); |
| 222 | 222 | bool skipped_it = m_skipping_this_frame; |
| 223 | if (phase == MACHINE_PHASE_RUNNING && (!m_machine.paused() || options_get_bool(m_machine.options(), OPTION_UPDATEINPAUSE))) | |
| 223 | if (phase == MACHINE_PHASE_RUNNING && (!m_machine.paused() || options_get_bool(&m_machine.options(), OPTION_UPDATEINPAUSE))) | |
| 224 | 224 | { |
| 225 | 225 | bool anything_changed = finish_screen_updates(); |
| 226 | 226 | |
| r10384 | r10385 | |
| 325 | 325 | // file handle |
| 326 | 326 | //------------------------------------------------- |
| 327 | 327 | |
| 328 | void video_manager::save_snapshot(screen_device *screen, | |
| 328 | void video_manager::save_snapshot(screen_device *screen, | |
| 329 | 329 | { |
| 330 | 330 | // validate |
| 331 | 331 | assert(!m_snap_native || screen != NULL); |
| r10384 | r10385 | |
| 342 | 342 | |
| 343 | 343 | // now do the actual work |
| 344 | 344 | const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; |
| 345 | png_error error = png_write_bitmap( | |
| 345 | png_error error = png_write_bitmap( | |
| 346 | 346 | if (error != PNGERR_NONE) |
| 347 | 347 | mame_printf_error("Error generating PNG for snapshot: png_error = %d\n", error); |
| 348 | 348 | |
| r10384 | r10385 | |
| 365 | 365 | for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) |
| 366 | 366 | if (m_machine.render().is_live(*screen)) |
| 367 | 367 | { |
| 368 | mame_file *fp; | |
| 369 | file_error filerr = mame_fopen_next(SEARCHPATH_SCREENSHOT, "png", fp); | |
| 368 | emu_file file(m_machine.options(), SEARCHPATH_SCREENSHOT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 369 | file_error filerr = open_next(file, "png"); | |
| 370 | 370 | if (filerr == FILERR_NONE) |
| 371 | { | |
| 372 | save_snapshot(screen, *fp); | |
| 373 | mame_fclose(fp); | |
| 374 | } | |
| 371 | save_snapshot(screen, file); | |
| 375 | 372 | } |
| 376 | 373 | } |
| 377 | 374 | |
| 378 | 375 | // otherwise, just write a single snapshot |
| 379 | 376 | else |
| 380 | 377 | { |
| 381 | mame_file *fp; | |
| 382 | file_error filerr = mame_fopen_next(SEARCHPATH_SCREENSHOT, "png", fp); | |
| 378 | emu_file file(m_machine.options(), SEARCHPATH_SCREENSHOT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 379 | file_error filerr = open_next(file, "png"); | |
| 383 | 380 | if (filerr == FILERR_NONE) |
| 384 | { | |
| 385 | save_snapshot(NULL, *fp); | |
| 386 | mame_fclose(fp); | |
| 387 | } | |
| 381 | save_snapshot(NULL, file); | |
| 388 | 382 | } |
| 389 | 383 | } |
| 390 | 384 | |
| r10384 | r10385 | |
| 427 | 421 | info.audio_samplerate = m_machine.sample_rate; |
| 428 | 422 | |
| 429 | 423 | // create a new temporary movie file |
| 430 | mame_file *tempfile; | |
| 431 | 424 | file_error filerr; |
| 432 | if (name != NULL) | |
| 433 | filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &tempfile); | |
| 434 | else | |
| 435 | filerr = mame_fopen_next(SEARCHPATH_MOVIE, "avi", tempfile); | |
| 425 | astring fullpath; | |
| 426 | { | |
| 427 | emu_file tempfile(m_machine.options(), SEARCHPATH_MOVIE, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 428 | if (name != NULL) | |
| 429 | filerr = tempfile.open(name); | |
| 430 | else | |
| 431 | filerr = open_next(tempfile, "avi"); | |
| 436 | 432 | |
| 437 | // compute the frame time | |
| 438 | m_movie_frame_period = attotime::from_seconds(1000) / info.video_timescale; | |
| 433 | // compute the frame time | |
| 434 | m_movie_frame_period = attotime::from_seconds(1000) / info.video_timescale; | |
| 439 | 435 | |
| 440 | // if we succeeded, make a copy of the name and create the real file over top | |
| 436 | // if we succeeded, make a copy of the name and create the real file over top | |
| 437 | if (filerr == FILERR_NONE) | |
| 438 | fullpath = tempfile.fullpath(); | |
| 439 | } | |
| 440 | ||
| 441 | 441 | if (filerr == FILERR_NONE) |
| 442 | 442 | { |
| 443 | astring fullname(mame_file_full_name(tempfile)); | |
| 444 | mame_fclose(tempfile); | |
| 445 | ||
| 446 | 443 | // create the file and free the string |
| 447 | avi_error avierr = avi_create(full | |
| 444 | avi_error avierr = avi_create(fullpath, &info, &m_avifile); | |
| 448 | 445 | if (avierr != AVIERR_NONE) |
| 449 | 446 | mame_printf_error("Error creating AVI: %s\n", avi_error_string(avierr)); |
| 450 | 447 | } |
| r10384 | r10385 | |
| 454 | 451 | else if (format == MF_MNG) |
| 455 | 452 | { |
| 456 | 453 | // create a new movie file and start recording |
| 454 | m_mngfile = auto_alloc(&m_machine, emu_file(m_machine.options(), SEARCHPATH_MOVIE, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); | |
| 457 | 455 | file_error filerr; |
| 458 | 456 | if (name != NULL) |
| 459 | filerr = m | |
| 457 | filerr = m | |
| 460 | 458 | else |
| 461 | filerr = mame_fopen_next(SEARCHPATH_MOVIE, "mng", m_mngfile); | |
| 459 | filerr = open_next(*m_mngfile, "mng"); | |
| 460 | ||
| 461 | if (filerr == FILERR_NONE) | |
| 462 | { | |
| 463 | // start the capture | |
| 464 | int rate = (m_machine.primary_screen != NULL) ? ATTOSECONDS_TO_HZ(m_machine.primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE; | |
| 465 | png_error pngerr = mng_capture_start(*m_mngfile, m_snap_bitmap, rate); | |
| 466 | if (pngerr != PNGERR_NONE) | |
| 467 | return end_recording(); | |
| 462 | 468 | |
| 463 | // start the capture | |
| 464 | int rate = (m_machine.primary_screen != NULL) ? ATTOSECONDS_TO_HZ(m_machine.primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE; | |
| 465 | png_error pngerr = mng_capture_start(mame_core_file(m_mngfile), m_snap_bitmap, rate); | |
| 466 | if (pngerr != PNGERR_NONE) | |
| 467 | return end_recording(); | |
| 468 | ||
| 469 | // compute the frame time | |
| 470 | m_movie_frame_period = attotime::from_hz(rate); | |
| 469 | // compute the frame time | |
| 470 | m_movie_frame_period = attotime::from_hz(rate); | |
| 471 | } | |
| 472 | else | |
| 473 | { | |
| 474 | mame_printf_error("Error creating MNG\n"); | |
| 475 | global_free(m_mngfile); | |
| 476 | m_mngfile = NULL; | |
| 477 | } | |
| 471 | 478 | } |
| 472 | 479 | } |
| 473 | 480 | |
| r10384 | r10385 | |
| 488 | 495 | // close the file if it exists |
| 489 | 496 | if (m_mngfile != NULL) |
| 490 | 497 | { |
| 491 | mng_capture_stop(mame_core_file(m_mngfile)); | |
| 492 | mame_fclose(m_mngfile); | |
| 498 | mng_capture_stop(*m_mngfile); | |
| 499 | auto_free(&m_machine, m_mngfile); | |
| 493 | 500 | m_mngfile = NULL; |
| 494 | 501 | } |
| 495 | 502 | |
| r10384 | r10385 | |
| 642 | 649 | |
| 643 | 650 | inline int video_manager::original_speed_setting() const |
| 644 | 651 | { |
| 645 | return options_get_float(m | |
| 652 | return options_get_float(&m_machine.options(), OPTION_SPEED) * 100.0 + 0.5; | |
| 646 | 653 | } |
| 647 | 654 | |
| 648 | 655 | |
| r10384 | r10385 | |
| 842 | 849 | // we're allowed to sleep via the OSD code only if we're configured to do so |
| 843 | 850 | // and we're not frameskipping due to autoframeskip, or if we're paused |
| 844 | 851 | bool allowed_to_sleep = false; |
| 845 | if (options_get_bool(m_machine.options(), OPTION_SLEEP) && (!effective_autoframeskip() || effective_frameskip() == 0)) | |
| 852 | if (options_get_bool(&m_machine.options(), OPTION_SLEEP) && (!effective_autoframeskip() || effective_frameskip() == 0)) | |
| 846 | 853 | allowed_to_sleep = true; |
| 847 | 854 | if (m_machine.paused()) |
| 848 | 855 | allowed_to_sleep = true; |
| r10384 | r10385 | |
| 948 | 955 | void video_manager::update_refresh_speed() |
| 949 | 956 | { |
| 950 | 957 | // only do this if the refreshspeed option is used |
| 951 | if (options_get_bool(m_machine.options(), OPTION_REFRESHSPEED)) | |
| 958 | if (options_get_bool(&m_machine.options(), OPTION_REFRESHSPEED)) | |
| 952 | 959 | { |
| 953 | 960 | float minrefresh = m_machine.render().max_update_rate(); |
| 954 | 961 | if (minrefresh != 0) |
| r10384 | r10385 | |
| 1034 | 1041 | { |
| 1035 | 1042 | if (m_machine.primary_screen != NULL) |
| 1036 | 1043 | { |
| 1037 | astring fname(m_machine.basename(), PATH_SEPARATOR "final.png"); | |
| 1038 | ||
| 1039 | 1044 | // create a final screenshot |
| 1040 | mame_file *file; | |
| 1041 | file_error filerr = mame_fopen(SEARCHPATH_SCREENSHOT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 1045 | emu_file file(m_machine.options(), SEARCHPATH_SCREENSHOT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 1046 | file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "final.png"); | |
| 1042 | 1047 | if (filerr == FILERR_NONE) |
| 1043 | { | |
| 1044 | save_snapshot(m_machine.primary_screen, *file); | |
| 1045 | mame_fclose(file); | |
| 1046 | } | |
| 1048 | save_snapshot(m_machine.primary_screen, file); | |
| 1047 | 1049 | } |
| 1048 | 1050 | |
| 1049 | 1051 | // schedule our demise |
| r10384 | r10385 | |
| 1092 | 1094 | |
| 1093 | 1095 | |
| 1094 | 1096 | //------------------------------------------------- |
| 1095 | // mame_fopen_next - open the next non-existing | |
| 1096 | // file of type filetype according to our | |
| 1097 | // numbering scheme | |
| 1097 | // open_next - open the next non-existing file of | |
| 1098 | // type filetype according to our numbering | |
| 1099 | // scheme | |
| 1098 | 1100 | //------------------------------------------------- |
| 1099 | 1101 | |
| 1100 | file_error video_manager:: | |
| 1102 | file_error video_manager:: | |
| 1101 | 1103 | { |
| 1104 | UINT32 origflags = file.openflags(); | |
| 1105 | ||
| 1102 | 1106 | // handle defaults |
| 1103 | const char *snapname = options_get_string(m_machine.options(), OPTION_SNAPNAME); | |
| 1107 | const char *snapname = options_get_string(&m_machine.options(), OPTION_SNAPNAME); | |
| 1104 | 1108 | |
| 1105 | 1109 | if (snapname == NULL || snapname[0] == 0) |
| 1106 | 1110 | snapname = "%g/%i"; |
| r10384 | r10385 | |
| 1204 | 1208 | fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d", seq).cstr()); |
| 1205 | 1209 | |
| 1206 | 1210 | // try to open the file; stop when we fail |
| 1207 | file_error filerr = mame_fopen(pathoption, fname, OPEN_FLAG_READ, &file); | |
| 1211 | file.set_openflags(OPEN_FLAG_READ); | |
| 1212 | file_error filerr = file.open(fname); | |
| 1208 | 1213 | if (filerr != FILERR_NONE) |
| 1209 | 1214 | break; |
| 1210 | mame_fclose(file); | |
| 1211 | 1215 | } |
| 1212 | 1216 | } |
| 1213 | 1217 | |
| 1214 | 1218 | // create the final file |
| 1215 | return mame_fopen(pathoption, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 1219 | file.set_openflags(origflags); | |
| 1220 | return file.open(fname); | |
| 1216 | 1221 | } |
| 1217 | 1222 | |
| 1218 | 1223 | |
| r10384 | r10385 | |
| 1264 | 1269 | |
| 1265 | 1270 | // write the next frame |
| 1266 | 1271 | const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; |
| 1267 | png_error error = mng_capture_frame(m | |
| 1272 | png_error error = mng_capture_frame(*m | |
| 1268 | 1273 | png_free(&pnginfo); |
| 1269 | 1274 | if (error != PNGERR_NONE) |
| 1270 | 1275 | { |
| r10384 | r10385 | |
|---|---|---|
| 107 | 107 | double speed_percent() const { return m_speed_percent; } |
| 108 | 108 | |
| 109 | 109 | // snapshots |
| 110 | void save_snapshot(screen_device *screen, | |
| 110 | void save_snapshot(screen_device *screen, | |
| 111 | 111 | void save_active_screen_snapshots(); |
| 112 | 112 | |
| 113 | 113 | // movies |
| r10384 | r10385 | |
| 138 | 138 | |
| 139 | 139 | // snapshot/movie helpers |
| 140 | 140 | void create_snapshot_bitmap(device_t *screen); |
| 141 | file_error | |
| 141 | file_error | |
| 142 | 142 | void record_frame(); |
| 143 | 143 | |
| 144 | 144 | // internal state |
| r10384 | r10385 | |
| 187 | 187 | INT32 m_snap_height; // height of snapshots (0 == auto) |
| 188 | 188 | |
| 189 | 189 | // movie recording |
| 190 | | |
| 190 | | |
| 191 | 191 | avi_file * m_avifile; // handle to the open movie file |
| 192 | 192 | attotime m_movie_frame_period; // period of a single movie frame |
| 193 | 193 | attotime m_movie_next_frame_time; // time of next frame |
| r10384 | r10385 | |
|---|---|---|
| 288 | 288 | attoseconds_t last_delta_nsec; /* nanoseconds that passed since the previous callback */ |
| 289 | 289 | |
| 290 | 290 | /* playback/record information */ |
| 291 | mame_file * record_file; /* recording file (NULL if not recording) */ | |
| 292 | mame_file * playback_file; /* playback file (NULL if not recording) */ | |
| 291 | emu_file * record_file; /* recording file (NULL if not recording) */ | |
| 292 | emu_file * playback_file; /* playback file (NULL if not recording) */ | |
| 293 | 293 | UINT64 playback_accumulated_speed;/* accumulated speed during playback */ |
| 294 | 294 | UINT32 playback_accumulated_frames;/* accumulated frames during playback */ |
| 295 | 295 | |
| r10384 | r10385 | |
| 776 | 776 | /* initialization helpers */ |
| 777 | 777 | static void init_port_types(running_machine *machine); |
| 778 | 778 | static void init_port_state(running_machine *machine); |
| 779 | static void init_autoselect_devices( | |
| 779 | static void init_autoselect_devices(runn | |
| 780 | 780 | static device_field_info *init_field_device_info(const input_field_config *field,const char *device_name); |
| 781 | 781 | static analog_field_state *init_field_analog_state(const input_field_config *field); |
| 782 | 782 | |
| r10384 | r10385 | |
| 2012 | 2012 | |
| 2013 | 2013 | static void init_port_state(running_machine *machine) |
| 2014 | 2014 | { |
| 2015 | const char *joystick_map_default = options_get_string(machine->options(), OPTION_JOYSTICK_MAP); | |
| 2015 | const char *joystick_map_default = options_get_string(&machine->options(), OPTION_JOYSTICK_MAP); | |
| 2016 | 2016 | input_port_private *portdata = machine->input_port_data; |
| 2017 | 2017 | const input_field_config *field; |
| 2018 | 2018 | const input_port_config *port; |
| r10384 | r10385 | |
| 2094 | 2094 | } |
| 2095 | 2095 | |
| 2096 | 2096 | /* handle autoselection of devices */ |
| 2097 | init_autoselect_devices(machine->m_portlist, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle"); | |
| 2098 | init_autoselect_devices(machine->m_portlist, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick"); | |
| 2099 | init_autoselect_devices(machine->m_portlist, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun"); | |
| 2100 | init_autoselect_devices(machine->m_portlist, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal"); | |
| 2101 | init_autoselect_devices(machine->m_portlist, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial"); | |
| 2102 | init_autoselect_devices(machine->m_portlist, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball"); | |
| 2103 | init_autoselect_devices(machine->m_portlist, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional"); | |
| 2104 | init_autoselect_devices(machine->m_portlist, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse"); | |
| 2097 | init_autoselect_devices(*machine, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle"); | |
| 2098 | init_autoselect_devices(*machine, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick"); | |
| 2099 | init_autoselect_devices(*machine, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun"); | |
| 2100 | init_autoselect_devices(*machine, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal"); | |
| 2101 | init_autoselect_devices(*machine, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial"); | |
| 2102 | init_autoselect_devices(*machine, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball"); | |
| 2103 | init_autoselect_devices(*machine, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional"); | |
| 2104 | init_autoselect_devices(*machine, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse"); | |
| 2105 | 2105 | |
| 2106 | 2106 | /* look for 4-way joysticks and change the default map if we find any */ |
| 2107 | 2107 | if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0) |
| r10384 | r10385 | |
| 2121 | 2121 | in and the corresponding option |
| 2122 | 2122 | -------------------------------------------------*/ |
| 2123 | 2123 | |
| 2124 | static void init_autoselect_devices( | |
| 2124 | static void init_autoselect_devices(runn | |
| 2125 | 2125 | { |
| 2126 | const char *stemp = options_get_string(mame_options(), option); | |
| 2126 | const ioport_list &portlist = machine.m_portlist; | |
| 2127 | const char *stemp = options_get_string(&machine.options(), option); | |
| 2127 | 2128 | input_device_class autoenable = DEVICE_CLASS_KEYBOARD; |
| 2128 | 2129 | const char *autostring = "keyboard"; |
| 2129 | 2130 | const input_field_config *field; |
| r10384 | r10385 | |
| 2846 | 2847 | } |
| 2847 | 2848 | |
| 2848 | 2849 | /* skip locked-out coin inputs */ |
| 2849 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && options_get_bool(ma | |
| 2850 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && options_get_bool(&field->port->machine->options(), OPTION_COIN_LOCKOUT)) | |
| 2850 | 2851 | { |
| 2851 | 2852 | ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field)); |
| 2852 | 2853 | return FALSE; |
| r10384 | r10385 | |
| 4324 | 4325 | return 0; |
| 4325 | 4326 | |
| 4326 | 4327 | /* read the value; if we fail, end playback */ |
| 4327 | if ( | |
| 4328 | if ( | |
| 4328 | 4329 | { |
| 4329 | 4330 | playback_end(machine, "End of file"); |
| 4330 | 4331 | return 0; |
| r10384 | r10385 | |
| 4350 | 4351 | return 0; |
| 4351 | 4352 | |
| 4352 | 4353 | /* read the value; if we fail, end playback */ |
| 4353 | if ( | |
| 4354 | if ( | |
| 4354 | 4355 | { |
| 4355 | 4356 | playback_end(machine, "End of file"); |
| 4356 | 4357 | return 0; |
| r10384 | r10385 | |
| 4376 | 4377 | return 0; |
| 4377 | 4378 | |
| 4378 | 4379 | /* read the value; if we fail, end playback */ |
| 4379 | if ( | |
| 4380 | if ( | |
| 4380 | 4381 | { |
| 4381 | 4382 | playback_end(machine, "End of file"); |
| 4382 | 4383 | return 0; |
| r10384 | r10385 | |
| 4393 | 4394 | |
| 4394 | 4395 | static time_t playback_init(running_machine *machine) |
| 4395 | 4396 | { |
| 4396 | const char *filename = options_get_string(machine->options(), OPTION_PLAYBACK); | |
| 4397 | const char *filename = options_get_string(&machine->options(), OPTION_PLAYBACK); | |
| 4397 | 4398 | input_port_private *portdata = machine->input_port_data; |
| 4398 | 4399 | UINT8 header[INP_HEADER_SIZE]; |
| 4399 | file_error filerr; | |
| 4400 | 4400 | time_t basetime; |
| 4401 | 4401 | |
| 4402 | 4402 | /* if no file, nothing to do */ |
| r10384 | r10385 | |
| 4404 | 4404 | return 0; |
| 4405 | 4405 | |
| 4406 | 4406 | /* open the playback file */ |
| 4407 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_READ, &portdata->playback_file); | |
| 4407 | portdata->playback_file = auto_alloc(machine, emu_file(machine->options(), SEARCHPATH_INPUTLOG, OPEN_FLAG_READ)); | |
| 4408 | file_error filerr = portdata->playback_file->open(filename); | |
| 4408 | 4409 | assert_always(filerr == FILERR_NONE, "Failed to open file for playback"); |
| 4409 | 4410 | |
| 4410 | 4411 | /* read the header and verify that it is a modern version; if not, print an error */ |
| 4411 | if ( | |
| 4412 | if ( | |
| 4412 | 4413 | fatalerror("Input file is corrupt or invalid (missing header)"); |
| 4413 | 4414 | if (memcmp(header, "MAMEINP\0", 8) != 0) |
| 4414 | 4415 | fatalerror("Input file invalid or in an older, unsupported format"); |
| r10384 | r10385 | |
| 4428 | 4429 | mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine->gamedrv->name); |
| 4429 | 4430 | |
| 4430 | 4431 | /* enable compression */ |
| 4431 | | |
| 4432 | | |
| 4432 | 4433 | |
| 4433 | 4434 | return basetime; |
| 4434 | 4435 | } |
| r10384 | r10385 | |
| 4446 | 4447 | if (portdata->playback_file != NULL) |
| 4447 | 4448 | { |
| 4448 | 4449 | /* close the file */ |
| 4449 | | |
| 4450 | | |
| 4450 | 4451 | portdata->playback_file = NULL; |
| 4451 | 4452 | |
| 4452 | 4453 | /* pop a message */ |
| r10384 | r10385 | |
| 4540 | 4541 | return; |
| 4541 | 4542 | |
| 4542 | 4543 | /* read the value; if we fail, end playback */ |
| 4543 | if ( | |
| 4544 | if ( | |
| 4544 | 4545 | record_end(machine, "Out of space"); |
| 4545 | 4546 | } |
| 4546 | 4547 | |
| r10384 | r10385 | |
| 4560 | 4561 | return; |
| 4561 | 4562 | |
| 4562 | 4563 | /* read the value; if we fail, end playback */ |
| 4563 | if ( | |
| 4564 | if ( | |
| 4564 | 4565 | record_end(machine, "Out of space"); |
| 4565 | 4566 | } |
| 4566 | 4567 | |
| r10384 | r10385 | |
| 4580 | 4581 | return; |
| 4581 | 4582 | |
| 4582 | 4583 | /* read the value; if we fail, end playback */ |
| 4583 | if ( | |
| 4584 | if ( | |
| 4584 | 4585 | record_end(machine, "Out of space"); |
| 4585 | 4586 | } |
| 4586 | 4587 | |
| r10384 | r10385 | |
| 4591 | 4592 | |
| 4592 | 4593 | static void record_init(running_machine *machine) |
| 4593 | 4594 | { |
| 4594 | const char *filename = options_get_string(machine->options(), OPTION_RECORD); | |
| 4595 | const char *filename = options_get_string(&machine->options(), OPTION_RECORD); | |
| 4595 | 4596 | input_port_private *portdata = machine->input_port_data; |
| 4596 | 4597 | UINT8 header[INP_HEADER_SIZE]; |
| 4597 | 4598 | system_time systime; |
| 4598 | file_error filerr; | |
| 4599 | 4599 | |
| 4600 | 4600 | /* if no file, nothing to do */ |
| 4601 | 4601 | if (filename[0] == 0) |
| 4602 | 4602 | return; |
| 4603 | 4603 | |
| 4604 | 4604 | /* open the record file */ |
| 4605 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &portdata->record_file); | |
| 4605 | portdata->record_file = auto_alloc(machine, emu_file(machine->options(), SEARCHPATH_INPUTLOG, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); | |
| 4606 | file_error filerr = portdata->record_file->open(filename); | |
| 4606 | 4607 | assert_always(filerr == FILERR_NONE, "Failed to open file for recording"); |
| 4607 | 4608 | |
| 4608 | 4609 | /* get the base time */ |
| r10384 | r10385 | |
| 4625 | 4626 | sprintf((char *)header + 0x20, APPNAME " %s", build_version); |
| 4626 | 4627 | |
| 4627 | 4628 | /* write it */ |
| 4628 | | |
| 4629 | | |
| 4629 | 4630 | |
| 4630 | 4631 | /* enable compression */ |
| 4631 | | |
| 4632 | | |
| 4632 | 4633 | } |
| 4633 | 4634 | |
| 4634 | 4635 | |
| r10384 | r10385 | |
| 4644 | 4645 | if (portdata->record_file != NULL) |
| 4645 | 4646 | { |
| 4646 | 4647 | /* close the file */ |
| 4647 | | |
| 4648 | | |
| 4648 | 4649 | portdata->record_file = NULL; |
| 4649 | 4650 | |
| 4650 | 4651 | /* pop a message */ |
| r10384 | r10385 | |
|---|---|---|
| 269 | 269 | // constructed |
| 270 | 270 | //------------------------------------------------- |
| 271 | 271 | |
| 272 | bool device_config_interface::interface_validity_check(const game_driver &driver) const | |
| 272 | bool device_config_interface::interface_validity_check(core_options &options, const game_driver &driver) const | |
| 273 | 273 | { |
| 274 | 274 | return false; |
| 275 | 275 | } |
| r10384 | r10385 | |
| 336 | 336 | // configuration has been constructed |
| 337 | 337 | //------------------------------------------------- |
| 338 | 338 | |
| 339 | bool device_config::validity_check(const game_driver &driver) const | |
| 339 | bool device_config::validity_check(core_options &options, const game_driver &driver) const | |
| 340 | 340 | { |
| 341 | 341 | bool error = false; |
| 342 | 342 | |
| 343 | 343 | // validate via the interfaces |
| 344 | 344 | for (device_config_interface *intf = m_interface_list; intf != NULL; intf = intf->interface_next()) |
| 345 | if (intf->interface_validity_check(driver)) | |
| 345 | if (intf->interface_validity_check(options, driver)) | |
| 346 | 346 | error = true; |
| 347 | 347 | |
| 348 | 348 | // let the device itself validate |
| 349 | if (device_validity_check(driver)) | |
| 349 | if (device_validity_check(options, driver)) | |
| 350 | 350 | error = true; |
| 351 | 351 | |
| 352 | 352 | return error; |
| r10384 | r10385 | |
| 370 | 370 | // the configuration has been constructed |
| 371 | 371 | //------------------------------------------------- |
| 372 | 372 | |
| 373 | bool device_config::device_validity_check(const game_driver &driver) const | |
| 373 | bool device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 374 | 374 | { |
| 375 | 375 | // indicate no error by default |
| 376 | 376 | return false; |
| r10384 | r10385 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | struct _hash_file |
| 18 | 18 | { |
| 19 | | |
| 19 | | |
| 20 | 20 | object_pool *pool; |
| 21 | 21 | unsigned int functions[IO_COUNT]; |
| 22 | 22 | |
| r10384 | r10385 | |
| 341 | 341 | UINT32 len; |
| 342 | 342 | XML_Memory_Handling_Suite memcallbacks; |
| 343 | 343 | |
| 344 | | |
| 344 | | |
| 345 | 345 | |
| 346 | 346 | memset(&state, 0, sizeof(state)); |
| 347 | 347 | state.hashfile = hashfile; |
| r10384 | r10385 | |
| 364 | 364 | |
| 365 | 365 | while(!state.done) |
| 366 | 366 | { |
| 367 | len = mame_fread(hashfile->file, buf, sizeof(buf)); | |
| 368 | state.done = mame_feof(hashfile->file); | |
| 367 | len = hashfile->file->read(buf, sizeof(buf)); | |
| 368 | state.done = hashfile->file->eof(); | |
| 369 | 369 | if (XML_Parse(state.parser, buf, len, state.done) == XML_STATUS_ERROR) |
| 370 | 370 | { |
| 371 | 371 | parse_error(&state, "[%lu:%lu]: %s\n", |
| r10384 | r10385 | |
| 403 | 403 | |
| 404 | 404 | |
| 405 | 405 | /*------------------------------------------------- |
| 406 | hashfile_open | |
| 406 | hashfile_open | |
| 407 | 407 | -------------------------------------------------*/ |
| 408 | 408 | |
| 409 | hash_file *hashfile_open | |
| 409 | hash_file *hashfile_open | |
| 410 | 410 | void (*error_proc)(const char *message)) |
| 411 | 411 | { |
| 412 | file_error filerr; | |
| 413 | astring *fname; | |
| 414 | 412 | hash_file *hashfile = NULL; |
| 415 | 413 | object_pool *pool = NULL; |
| 414 | file_error filerr; | |
| 416 | 415 | |
| 417 | 416 | /* create a pool for this hash file */ |
| 418 | 417 | pool = pool_alloc_lib(error_proc); |
| r10384 | r10385 | |
| 430 | 429 | hashfile->error_proc = error_proc; |
| 431 | 430 | |
| 432 | 431 | /* open a file */ |
| 433 | fname = astring_assemble_2(astring_alloc(), sysname, ".hsi"); | |
| 434 | filerr = mame_fopen_options(opts, SEARCHPATH_HASH, astring_c(fname), OPEN_FLAG_READ, &hashfile->file); | |
| 435 | astring_free(fname); | |
| 436 | ||
| 432 | hashfile->file = global_alloc(emu_file(options, SEARCHPATH_HASH, OPEN_FLAG_READ)); | |
| 433 | filerr = hashfile->file->open(sysname, ".hsi"); | |
| 437 | 434 | if (filerr != FILERR_NONE) |
| 435 | { | |
| 436 | global_free(hashfile->file); | |
| 437 | hashfile->file = NULL; | |
| 438 | 438 | goto error; |
| 439 | } | |
| 439 | 440 | |
| 440 | 441 | if (is_preload) |
| 441 | 442 | hashfile_parse(hashfile, NULL, preload_use_proc, hashfile->error_proc, NULL); |
| r10384 | r10385 | |
| 451 | 452 | |
| 452 | 453 | |
| 453 | 454 | /*------------------------------------------------- |
| 454 | hashfile_open | |
| 455 | -------------------------------------------------*/ | |
| 456 | ||
| 457 | hash_file *hashfile_open(const char *sysname, int is_preload, | |
| 458 | void (*error_proc)(const char *message)) | |
| 459 | { | |
| 460 | return hashfile_open_options(mame_options(), sysname, is_preload, error_proc); | |
| 461 | } | |
| 462 | ||
| 463 | ||
| 464 | ||
| 465 | /*------------------------------------------------- | |
| 466 | 455 | hashfile_close |
| 467 | 456 | -------------------------------------------------*/ |
| 468 | 457 | |
| 469 | 458 | void hashfile_close(hash_file *hashfile) |
| 470 | 459 | { |
| 471 | if (hashfile->file) | |
| 472 | mame_fclose(hashfile->file); | |
| 460 | global_free(hashfile->file); | |
| 473 | 461 | pool_free_lib(hashfile->pool); |
| 474 | 462 | } |
| 475 | 463 | |
| r10384 | r10385 | |
| 548 | 536 | hashfile_verify |
| 549 | 537 | -------------------------------------------------*/ |
| 550 | 538 | |
| 551 | int hashfile_verify(const char *sysname, void (*my_error_proc)(const char *message)) | |
| 539 | int hashfile_verify(core_options &options, const char *sysname, void (*my_error_proc)(const char *message)) | |
| 552 | 540 | { |
| 553 | 541 | hash_file *hashfile; |
| 554 | 542 | |
| 555 | hashfile = hashfile_open(sysname, FALSE, my_error_proc); | |
| 543 | hashfile = hashfile_open(options, sysname, FALSE, my_error_proc); | |
| 556 | 544 | if (!hashfile) |
| 557 | 545 | return -1; |
| 558 | 546 |
| r10384 | r10385 | |
|---|---|---|
| 291 | 291 | |
| 292 | 292 | // methods that wrap both interface-level and device-level behavior |
| 293 | 293 | void config_complete(); |
| 294 | bool validity_check(const game_driver &driver) const; | |
| 294 | bool validity_check(core_options &options, const game_driver &driver) const; | |
| 295 | 295 | |
| 296 | 296 | // configuration helpers |
| 297 | 297 | static void static_set_clock(device_config *device, UINT32 clock) { device->m_clock = clock; } |
| r10384 | r10385 | |
| 305 | 305 | // optional operation overrides |
| 306 | 306 | protected: |
| 307 | 307 | virtual void device_config_complete(); |
| 308 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 308 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 309 | 309 | |
| 310 | 310 | public: |
| 311 | 311 | // optional information overrides |
| r10384 | r10385 | |
| 359 | 359 | |
| 360 | 360 | // optional operation overrides |
| 361 | 361 | virtual void interface_config_complete(); |
| 362 | virtual bool interface_validity_check(const game_driver &driver) const; | |
| 362 | virtual bool interface_validity_check(core_options &options, const game_driver &driver) const; | |
| 363 | 363 | |
| 364 | 364 | protected: |
| 365 | 365 | const device_config & m_device_config; |
| r10384 | r10385 | |
|---|---|---|
| 40 | 40 | ***************************************************************************/ |
| 41 | 41 | |
| 42 | 42 | /* opens a hash file; if is_preload is non-zero, the entire file is preloaded */ |
| 43 | hash_file *hashfile_open(const char *sysname, int is_preload, hashfile_error_func error_proc); | |
| 43 | hash_file *hashfile_open(core_options &options, const char *sysname, int is_preload, hashfile_error_func error_proc); | |
| 44 | 44 | |
| 45 | /* opens a hash file; if is_preload is non-zero, the entire file is preloaded */ | |
| 46 | hash_file *hashfile_open_options(core_options *opts, const char *sysname, int is_preload, | |
| 47 | hashfile_error_func error_proc); | |
| 48 | ||
| 49 | 45 | /* closes a hash file and associated resources */ |
| 50 | 46 | void hashfile_close(hash_file *hashfile); |
| 51 | 47 |
| r10384 | r10385 | |
|---|---|---|
| 596 | 596 | m_type(CTYPE_INVALID), |
| 597 | 597 | m_state(0), |
| 598 | 598 | m_bitmap(NULL), |
| 599 | m_file(NULL), | |
| 599 | 600 | m_hasalpha(false) |
| 600 | 601 | { |
| 601 | 602 | // fetch common data |
| r10384 | r10385 | |
| 610 | 611 | m_dirname = dirname; |
| 611 | 612 | m_imagefile = xml_get_attribute_string_with_subst(machine, compnode, "file", ""); |
| 612 | 613 | m_alphafile = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", ""); |
| 614 | m_file = global_alloc(emu_file(machine.options(), OPTION_ARTPATH, OPEN_FLAG_READ)); | |
| 613 | 615 | } |
| 614 | 616 | |
| 615 | 617 | // text nodes |
| r10384 | r10385 | |
| 663 | 665 | |
| 664 | 666 | layout_element::component::~component() |
| 665 | 667 | { |
| 668 | global_free(m_file); | |
| 666 | 669 | global_free(m_bitmap); |
| 667 | 670 | } |
| 668 | 671 | |
| r10384 | r10385 | |
| 898 | 901 | bitmap_t *layout_element::component::load_bitmap() |
| 899 | 902 | { |
| 900 | 903 | // load the basic bitmap |
| 901 | bitmap_t *bitmap = render_load_png(OPTION_ARTPATH, m_dirname, m_imagefile, NULL, &m_hasalpha); | |
| 904 | assert(m_file != NULL); | |
| 905 | bitmap_t *bitmap = render_load_png(*m_file, m_dirname, m_imagefile, NULL, &m_hasalpha); | |
| 902 | 906 | if (bitmap != NULL && m_alphafile) |
| 903 | 907 | |
| 904 | 908 | // load the alpha bitmap if specified |
| 905 | if (render_load_png( | |
| 909 | if (render_load_png(*m | |
| 906 | 910 | { |
| 907 | 911 | global_free(bitmap); |
| 908 | 912 | bitmap = NULL; |
| r10384 | r10385 | |
|---|---|---|
| 531 | 531 | const hash_info *info = NULL; |
| 532 | 532 | |
| 533 | 533 | /* open the hash file */ |
| 534 | hashfile = hashfile_open(sysname, FALSE, NULL); | |
| 534 | hashfile = hashfile_open(device().machine->options(), sysname, FALSE, NULL); | |
| 535 | 535 | if (!hashfile) |
| 536 | 536 | goto done; |
| 537 | 537 | |
| r10384 | r10385 | |
| 652 | 652 | { |
| 653 | 653 | astring *fname = astring_assemble_4(astring_alloc(), device().machine->gamedrv->name, PATH_SEPARATOR, m_basename_noext, ".nv"); |
| 654 | 654 | |
| 655 | image_battery_load_by_name(astring_c(fname), buffer, length, fill); | |
| 655 | image_battery_load_by_name(device().machine->options(), astring_c(fname), buffer, length, fill); | |
| 656 | 656 | astring_free(fname); |
| 657 | 657 | } |
| 658 | 658 | |
| r10384 | r10385 | |
| 666 | 666 | { |
| 667 | 667 | astring *fname = astring_assemble_4(astring_alloc(), device().machine->gamedrv->name, PATH_SEPARATOR, m_basename_noext, ".nv"); |
| 668 | 668 | |
| 669 | image_battery_save_by_name(astring_c(fname), buffer, length); | |
| 669 | image_battery_save_by_name(device().machine->options(), astring_c(fname), buffer, length); | |
| 670 | 670 | astring_free(fname); |
| 671 | 671 | } |
| 672 | 672 |
| r10384 | r10385 | |
|---|---|---|
| 152 | 152 | astring m_string; // string for text components |
| 153 | 153 | bitmap_t * m_bitmap; // source bitmap for images |
| 154 | 154 | astring m_dirname; // directory name of image file (for lazy loading) |
| 155 | emu_file * m_file; // file object for reading image/alpha files | |
| 155 | 156 | astring m_imagefile; // name of the image file (for lazy loading) |
| 156 | 157 | astring m_alphafile; // name of the alpha file (for lazy loading) |
| 157 | 158 | bool m_hasalpha; // is there any alpha component present? |
| r10384 | r10385 | |
|---|---|---|
| 114 | 114 | #include "uiinput.h" |
| 115 | 115 | #include "crsshair.h" |
| 116 | 116 | #include "validity.h" |
| 117 | #include "unzip.h" | |
| 117 | 118 | #include "debug/debugcon.h" |
| 118 | 119 | |
| 119 | 120 | #include <time.h> |
| r10384 | r10385 | |
| 260 | 261 | void running_machine::start() |
| 261 | 262 | { |
| 262 | 263 | // initialize basic can't-fail systems here |
| 263 | fileio_init(this); | |
| 264 | 264 | config_init(this); |
| 265 | 265 | input_init(this); |
| 266 | 266 | output_init(this); |
| r10384 | r10385 | |
| 361 | 361 | // if we have a logfile, set up the callback |
| 362 | 362 | if (options_get_bool(&m_options, OPTION_LOG)) |
| 363 | 363 | { |
| 364 | file_error filerr = mame_fopen(SEARCHPATH_DEBUGLOG, "error.log", OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &m_logfile); | |
| 364 | m_logfile = auto_alloc(this, emu_file(m_options, SEARCHPATH_DEBUGLOG, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); | |
| 365 | file_error filerr = m_logfile->open("error.log"); | |
| 365 | 366 | assert_always(filerr == FILERR_NONE, "unable to open log file"); |
| 366 | 367 | add_logerror_callback(logfile_callback); |
| 367 | 368 | } |
| r10384 | r10385 | |
| 429 | 430 | |
| 430 | 431 | // call all exit callbacks registered |
| 431 | 432 | call_notifiers(MACHINE_NOTIFY_EXIT); |
| 433 | zip_file_cache_clear(); | |
| 432 | 434 | |
| 433 | 435 | // close the logfile |
| 434 | if (m_logfile != NULL) | |
| 435 | mame_fclose(m_logfile); | |
| 436 | auto_free(this, m_logfile); | |
| 436 | 437 | return error; |
| 437 | 438 | } |
| 438 | 439 | |
| r10384 | r10385 | |
| 770 | 771 | file_error filerr = FILERR_NONE; |
| 771 | 772 | |
| 772 | 773 | // if no name, bail |
| 774 | emu_file file(m_options, m_saveload_searchpath, openflags); | |
| 773 | 775 | if (!m_saveload_pending_file) |
| 774 | 776 | goto cancel; |
| 775 | 777 | |
| r10384 | r10385 | |
| 787 | 789 | } |
| 788 | 790 | |
| 789 | 791 | // open the file |
| 790 | mame_file *file; | |
| 791 | filerr = mame_fopen(m_saveload_searchpath, m_saveload_pending_file, openflags, &file); | |
| 792 | filerr = file.open(m_saveload_pending_file); | |
| 792 | 793 | if (filerr == FILERR_NONE) |
| 793 | 794 | { |
| 794 | astring fullname(mame_file_full_name(file)); | |
| 795 | ||
| 796 | 795 | // read/write the save state |
| 797 | 796 | state_save_error staterr = (m_saveload_schedule == SLS_LOAD) ? m_state.read_file(file) : m_state.write_file(file); |
| 798 | 797 | |
| r10384 | r10385 | |
| 828 | 827 | } |
| 829 | 828 | |
| 830 | 829 | // close and perhaps delete the file |
| 831 | mame_fclose(file); | |
| 832 | 830 | if (staterr != STATERR_NONE && m_saveload_schedule == SLS_SAVE) |
| 833 | | |
| 831 | | |
| 834 | 832 | } |
| 835 | 833 | else |
| 836 | 834 | popmessage("Error: Failed to open file for %s operation.", opname); |
| r10384 | r10385 | |
| 871 | 869 | void running_machine::logfile_callback(running_machine &machine, const char *buffer) |
| 872 | 870 | { |
| 873 | 871 | if (machine.m_logfile != NULL) |
| 874 | ma | |
| 872 | ma | |
| 875 | 873 | } |
| 876 | 874 | |
| 877 | 875 |
| r10384 | r10385 | |
|---|---|---|
| 295 | 295 | |
| 296 | 296 | /* variables that are only non-zero when an image is mounted */ |
| 297 | 297 | core_file *m_file; |
| 298 | | |
| 298 | | |
| 299 | 299 | astring m_name; |
| 300 | 300 | astring m_basename; |
| 301 | 301 | astring m_basename_noext; |
| r10384 | r10385 | |
|---|---|---|
| 18 | 18 | const device_type OKIM9810 = okim9810_device_config::static_alloc_device_config; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | // volume lookup table. The manual lists a full 16 steps, 2dB per step. | |
| 22 | // Given the dB values, that seems to map to a 7-bit volume control. | |
| 23 | const UINT8 okim9810_device::s_volume_table[16] = | |
| 24 | { | |
| 25 | 0x80, // 0 dB | |
| 26 | 0x65, // -2 dB | |
| 27 | 0x50, // -4 dB | |
| 28 | 0x40, // -6 dB | |
| 29 | 0x32, // -8.0 dB | |
| 30 | 0x28, // -10.5 dB | |
| 31 | 0x20, // -12.0 dB | |
| 32 | 0x19, // -14.5 dB | |
| 33 | 0x14, // -16.0 dB | |
| 34 | 0x10, // -18.0 dB | |
| 35 | 0x0c, // -20.0 dB | |
| 36 | 0x0a, // -22.0 dB | |
| 37 | 0x08, // -24.0 dB | |
| 38 | 0x06, // -26.0 dB | |
| 39 | 0x05, // -28.0 dB | |
| 40 | 0x04, // -30.0 dB | |
| 41 | }; | |
| 42 | ||
| 21 | 43 | // default address map |
| 22 | 44 | static ADDRESS_MAP_START( okim9810, 0, 8 ) |
| 23 | 45 | AM_RANGE(0x000000, 0xffffff) AM_ROM |
| r10384 | r10385 | |
| 293 | 315 | case 0x07: // CVOL (channel volume) |
| 294 | 316 | { |
| 295 | 317 | mame_printf_verbose("CVOL channel %d volume level %02x\n", channel, m_TMP_register); |
| 296 | mame_printf_verbose("\tChannel %d -> volume %d.\n", channel, m_TMP_register); | |
| 318 | mame_printf_verbose("\tChannel %d -> volume %d.\n", channel, s_volume_table[m_TMP_register & 0x0f]); | |
| 297 | 319 | |
| 298 | // TODO: Use the proper volume table p37 | |
| 299 | m_voice[channel].m_volume = m_TMP_register; | |
| 320 | m_voice[channel].m_volume = s_volume_table[m_TMP_register & 0x0f]; | |
| 300 | 321 | break; |
| 301 | 322 | } |
| 302 | 323 | case 0x08: // PAN |
| r10384 | r10385 | |
| 373 | 394 | int nibble = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); |
| 374 | 395 | |
| 375 | 396 | // output to the buffer, scaling by the volume |
| 376 | // signal in range -2048..2047, volume in range 2..32 => signal * volume / 2 in range -32768..32767 | |
| 377 | *buffer++ += m_adpcm.clock(nibble); //TODO * m_volume / 2; | |
| 397 | // signal in range -2048..2047, volume in range 2..128 => signal * volume / 8 in range -32768..32767 | |
| 398 | *buffer++ += (INT32)m_adpcm.clock(nibble) * (INT32)m_volume / 8; | |
| 378 | 399 | |
| 379 | 400 | // next! |
| 380 | 401 | if (++m_sample >= m_count) |
| r10384 | r10385 | |
|---|---|---|
| 153 | 153 | |
| 154 | 154 | static const int OKIM9810_VOICES = 8; |
| 155 | 155 | okim_voice m_voice[OKIM9810_VOICES]; |
| 156 | ||
| 157 | static const UINT8 s_volume_table[16]; | |
| 156 | 158 | }; |
| 157 | 159 | |
| 158 | 160 |
| r10384 | r10385 | |
|---|---|---|
| 24 | 24 | * (remember, 1 is the FIRST entry!) |
| 25 | 25 | * |
| 26 | 26 | * Instead, { 1, 8, 8, 8, 4, 4, 4, 2 } |
| 27 | * will calculate those coefficients and this has been used below. | |
| 28 | * LN: | |
| 29 | * The real chip uses shifters and not true division to achieve those factors, | |
| 30 | * so they have been replaced by the shifting coefficients: | |
| 31 | * { 0, 3, 3, 3, 2, 2, 2, 1 } | |
| 27 | * will calculate those coefficients. | |
| 28 | * Howeever, after simulating the actual circuit from the patent in pspice, | |
| 29 | * the { 1, 8, 8, 8, 4, 4, 2, 2 } pattern is revealed as the correct one. | |
| 30 | * Since the real chip uses shifters and not true division to achieve those | |
| 31 | * factors, they have been replaced by the shifting coefficients: | |
| 32 | * { 0, 3, 3, 3, 2, 2, 1, 1 } | |
| 32 | 33 | */ |
| 33 | 34 | |
| 34 | 35 | /* quick note on derivative analysis: |
| r10384 | r10385 | |
| 124 | 125 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 125 | 126 | 0, 0, 0, 0 }, |
| 126 | 127 | /* interpolation coefficients */ |
| 127 | { 3, 3, 3, 2, 2, | |
| 128 | { 3, 3, 3, 2, 2, 1, 1, 0 } | |
| 128 | 129 | }; |
| 129 | 130 | |
| 130 | 131 | /* The following CD2802 coefficients come from US Patents 4,403,965 and 4,946,391; They have not yet been verified using derivatives. The M58817 seems to work best with these coefficients, so its possible the engineers of that chip copied them from the TI patents. |
| r10384 | r10385 | |
| 188 | 189 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 189 | 190 | 0, 0, 0, 0 }, |
| 190 | 191 | /* interpolation coefficients */ |
| 191 | { 3, 3, 3, 2, 2, | |
| 192 | { 3, 3, 3, 2, 2, 1, 1, 0 } | |
| 192 | 193 | }; |
| 193 | 194 | |
| 194 | 195 | /* The following TMS5110A LPC coefficients were directly read from an actual TMS5110A chip by Jarek Burczynski using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it. |
| r10384 | r10385 | |
| 251 | 252 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 252 | 253 | 0, 0, 0, 0 }, |
| 253 | 254 | /* interpolation coefficients */ |
| 254 | { 3, 3, 3, 2, 2, | |
| 255 | { 3, 3, 3, 2, 2, 1, 1, 0 } | |
| 255 | 256 | }; |
| 256 | 257 | |
| 257 | 258 | /* The following coefficients come from US Patent 4,335,277 and 4,581,757. However, the K10 row of coefficients are entirely missing from both of those patents. |
| r10384 | r10385 | |
| 320 | 321 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 321 | 322 | 0, 0, 0, 0 }, |
| 322 | 323 | /* interpolation coefficients */ |
| 323 | { 3, 3, 3, 2, 2, | |
| 324 | { 3, 3, 3, 2, 2, 1, 1, 0 } | |
| 324 | 325 | }; |
| 325 | 326 | |
| 326 | 327 | /* The following TMS5200/TMC0285 coefficients were directly read from an actual TMS5200 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it. |
| r10384 | r10385 | |
| 388 | 389 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 389 | 390 | 0, 0, 0, 0 }, |
| 390 | 391 | /* interpolation coefficients */ |
| 391 | { 0, 3, 3, 3, 2, 2, | |
| 392 | { 0, 3, 3, 3, 2, 2, 1, 1 } | |
| 392 | 393 | }; |
| 393 | 394 | |
| 394 | 395 | /* The following TMS5220 coefficients were directly read from an actual TMS5220 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it. |
| r10384 | r10385 | |
| 457 | 458 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 458 | 459 | 0, 0, 0, 0 }, |
| 459 | 460 | /* interpolation coefficients */ |
| 460 | { 0, 3, 3, 3, 2, 2, | |
| 461 | { 0, 3, 3, 3, 2, 2, 1, 1 } | |
| 461 | 462 | }; |
| 462 | 463 | |
| 463 | 464 | /* The following TMS5220C coefficients come from the tables in QBOXPRO, a program written at least in part by George "Larry" Brantingham of Quadravox, formerly of Texas Instruments, who had laid out the silicon for the TMS5100/TMC0280/CD2801. It is the same as the TMS5220 but has a change in the energy table (is this actually correct? or is this one correct for both 5220s? or is this the wrong table and the TMS5220 one correct for both?) |
| r10384 | r10385 | |
| 530 | 531 | 1, 0, 0, 0, 0, 0, 0, 0, |
| 531 | 532 | 0, 0, 0, 0 }, |
| 532 | 533 | /* interpolation coefficients */ |
| 533 | { 0, 3, 3, 3, 2, 2, | |
| 534 | { 0, 3, 3, 3, 2, 2, 1, 1 } | |
| 534 | 535 | }; |
| r10384 | r10385 | |
|---|---|---|
| 48 | 48 | read_wav_sample - read a WAV file as a sample |
| 49 | 49 | -------------------------------------------------*/ |
| 50 | 50 | |
| 51 | static int read_wav_sample(running_machine *machine, | |
| 51 | static int read_wav_sample(running_machine *machine, | |
| 52 | 52 | { |
| 53 | 53 | unsigned long offset = 0; |
| 54 | 54 | UINT32 length, rate, filesize; |
| r10384 | r10385 | |
| 57 | 57 | UINT32 sindex; |
| 58 | 58 | |
| 59 | 59 | /* read the core header and make sure it's a WAVE file */ |
| 60 | offset += | |
| 60 | offset += | |
| 61 | 61 | if (offset < 4) |
| 62 | 62 | return 0; |
| 63 | 63 | if (memcmp(&buf[0], "RIFF", 4) != 0) |
| 64 | 64 | return 0; |
| 65 | 65 | |
| 66 | 66 | /* get the total size */ |
| 67 | offset += | |
| 67 | offset += | |
| 68 | 68 | if (offset < 8) |
| 69 | 69 | return 0; |
| 70 | 70 | filesize = LITTLE_ENDIANIZE_INT32(filesize); |
| 71 | 71 | |
| 72 | 72 | /* read the RIFF file type and make sure it's a WAVE file */ |
| 73 | offset += | |
| 73 | offset += | |
| 74 | 74 | if (offset < 12) |
| 75 | 75 | return 0; |
| 76 | 76 | if (memcmp(&buf[0], "WAVE", 4) != 0) |
| r10384 | r10385 | |
| 79 | 79 | /* seek until we find a format tag */ |
| 80 | 80 | while (1) |
| 81 | 81 | { |
| 82 | offset += mame_fread(f, buf, 4); | |
| 83 | offset += mame_fread(f, &length, 4); | |
| 82 | offset += file.read(buf, 4); | |
| 83 | offset += file.read(&length, 4); | |
| 84 | 84 | length = LITTLE_ENDIANIZE_INT32(length); |
| 85 | 85 | if (memcmp(&buf[0], "fmt ", 4) == 0) |
| 86 | 86 | break; |
| 87 | 87 | |
| 88 | 88 | /* seek to the next block */ |
| 89 | | |
| 89 | | |
| 90 | 90 | offset += length; |
| 91 | 91 | if (offset >= filesize) |
| 92 | 92 | return 0; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /* read the format -- make sure it is PCM */ |
| 96 | offset += | |
| 96 | offset += | |
| 97 | 97 | temp16 = LITTLE_ENDIANIZE_INT16(temp16); |
| 98 | 98 | if (temp16 != 1) |
| 99 | 99 | return 0; |
| 100 | 100 | |
| 101 | 101 | /* number of channels -- only mono is supported */ |
| 102 | offset += | |
| 102 | offset += | |
| 103 | 103 | temp16 = LITTLE_ENDIANIZE_INT16(temp16); |
| 104 | 104 | if (temp16 != 1) |
| 105 | 105 | return 0; |
| 106 | 106 | |
| 107 | 107 | /* sample rate */ |
| 108 | offset += | |
| 108 | offset += | |
| 109 | 109 | rate = LITTLE_ENDIANIZE_INT32(rate); |
| 110 | 110 | |
| 111 | 111 | /* bytes/second and block alignment are ignored */ |
| 112 | offset += | |
| 112 | offset += | |
| 113 | 113 | |
| 114 | 114 | /* bits/sample */ |
| 115 | offset += | |
| 115 | offset += | |
| 116 | 116 | bits = LITTLE_ENDIANIZE_INT16(bits); |
| 117 | 117 | if (bits != 8 && bits != 16) |
| 118 | 118 | return 0; |
| 119 | 119 | |
| 120 | 120 | /* seek past any extra data */ |
| 121 | | |
| 121 | | |
| 122 | 122 | offset += length - 16; |
| 123 | 123 | |
| 124 | 124 | /* seek until we find a data tag */ |
| 125 | 125 | while (1) |
| 126 | 126 | { |
| 127 | offset += mame_fread(f, buf, 4); | |
| 128 | offset += mame_fread(f, &length, 4); | |
| 127 | offset += file.read(buf, 4); | |
| 128 | offset += file.read(&length, 4); | |
| 129 | 129 | length = LITTLE_ENDIANIZE_INT32(length); |
| 130 | 130 | if (memcmp(&buf[0], "data", 4) == 0) |
| 131 | 131 | break; |
| 132 | 132 | |
| 133 | 133 | /* seek to the next block */ |
| 134 | | |
| 134 | | |
| 135 | 135 | offset += length; |
| 136 | 136 | if (offset >= filesize) |
| 137 | 137 | return 0; |
| r10384 | r10385 | |
| 152 | 152 | int sindex; |
| 153 | 153 | |
| 154 | 154 | sample->data = auto_alloc_array(machine, INT16, length); |
| 155 | | |
| 155 | | |
| 156 | 156 | |
| 157 | 157 | /* convert 8-bit data to signed samples */ |
| 158 | 158 | tempptr = (unsigned char *)sample->data; |
| r10384 | r10385 | |
| 163 | 163 | { |
| 164 | 164 | /* 16-bit data is fine as-is */ |
| 165 | 165 | sample->data = auto_alloc_array(machine, INT16, length/2); |
| 166 | | |
| 166 | | |
| 167 | 167 | sample->length /= 2; |
| 168 | 168 | if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE) |
| 169 | 169 | for (sindex = 0; sindex < sample->length; sindex++) |
| r10384 | r10385 | |
| 184 | 184 | int i; |
| 185 | 185 | |
| 186 | 186 | /* if the user doesn't want to use samples, bail */ |
| 187 | if (!options_get_bool(machine->options(), OPTION_SAMPLES)) | |
| 187 | if (!options_get_bool(&machine->options(), OPTION_SAMPLES)) | |
| 188 | 188 | return NULL; |
| 189 | 189 | if (samplenames == 0 || samplenames[0] == 0) |
| 190 | 190 | return NULL; |
| r10384 | r10385 | |
| 206 | 206 | for (i = 0; i < samples->total; i++) |
| 207 | 207 | if (samplenames[i+skipfirst][0]) |
| 208 | 208 | { |
| 209 | file_error filerr; | |
| 210 | mame_file *f; | |
| 209 | emu_file file(machine->options(), SEARCHPATH_SAMPLE, OPEN_FLAG_READ); | |
| 211 | 210 | |
| 212 | astring fname(basename, PATH_SEPARATOR, samplenames[i+skipfirst]); | |
| 213 | filerr = mame_fopen(SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ, &f); | |
| 214 | ||
| 211 | file_error filerr = file.open(basename, PATH_SEPARATOR, samplenames[i+skipfirst]); | |
| 215 | 212 | if (filerr != FILERR_NONE && skipfirst) |
| 216 | { | |
| 217 | astring fname(samplenames[0] + 1, PATH_SEPARATOR, samplenames[i+skipfirst]); | |
| 218 | filerr = mame_fopen(SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ, &f); | |
| 219 | } | |
| 213 | filerr = file.open(samplenames[0] + 1, PATH_SEPARATOR, samplenames[i+skipfirst]); | |
| 214 | ||
| 220 | 215 | if (filerr == FILERR_NONE) |
| 221 | { | |
| 222 | read_wav_sample(machine, f, &samples->sample[i]); | |
| 223 | mame_fclose(f); | |
| 224 | } | |
| 216 | read_wav_sample(machine, file, &samples->sample[i]); | |
| 225 | 217 | } |
| 226 | 218 | |
| 227 | 219 | return samples; |
| r10384 | r10385 | |
|---|---|---|
| 347 | 347 | |
| 348 | 348 | // getters |
| 349 | 349 | const char *basename() const { return m_basename; } |
| 350 | core_options | |
| 350 | core_options &options() const { return | |
| 351 | 351 | machine_phase phase() const { return m_current_phase; } |
| 352 | 352 | bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); } |
| 353 | 353 | bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; } |
| r10384 | r10385 | |
| 500 | 500 | bool m_exit_to_game_select; |
| 501 | 501 | const game_driver * m_new_driver_pending; |
| 502 | 502 | emu_timer * m_soft_reset_timer; |
| 503 | | |
| 503 | | |
| 504 | 504 | |
| 505 | 505 | // load/save |
| 506 | 506 | enum saveload_schedule |
| r10384 | r10385 | |
|---|---|---|
| 247 | 247 | single_step = FALSE; |
| 248 | 248 | ui_set_handler(handler_messagebox, 0); |
| 249 | 249 | /* retrieve options */ |
| 250 | ui_use_natural_keyboard = options_get_bool(machine->options(), OPTION_NATURAL_KEYBOARD); | |
| 250 | ui_use_natural_keyboard = options_get_bool(&machine->options(), OPTION_NATURAL_KEYBOARD); | |
| 251 | 251 | |
| 252 | 252 | return 0; |
| 253 | 253 | } |
| r10384 | r10385 | |
| 273 | 273 | int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer) |
| 274 | 274 | { |
| 275 | 275 | const int maxstate = 3; |
| 276 | int str = options_get_int(machine->options(), OPTION_SECONDS_TO_RUN); | |
| 277 | int show_gameinfo = !options_get_bool(machine->options(), OPTION_SKIP_GAMEINFO); | |
| 276 | int str = options_get_int(&machine->options(), OPTION_SECONDS_TO_RUN); | |
| 277 | int show_gameinfo = !options_get_bool(&machine->options(), OPTION_SKIP_GAMEINFO); | |
| 278 | 278 | int show_warnings = TRUE; |
| 279 | 279 | int state; |
| 280 | 280 | |
| r10384 | r10385 | |
| 375 | 375 | /* if we're paused, dim the whole screen */ |
| 376 | 376 | if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused())) |
| 377 | 377 | { |
| 378 | int alpha = (1.0f - options_get_float(machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f; | |
| 378 | int alpha = (1.0f - options_get_float(&machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f; | |
| 379 | 379 | if (ui_menu_is_force_game_select()) |
| 380 | 380 | alpha = 255; |
| 381 | 381 | if (alpha > 255) |
| r10384 | r10385 | |
| 412 | 412 | { |
| 413 | 413 | /* allocate the font and messagebox string */ |
| 414 | 414 | if (ui_font == NULL) |
| 415 | ui_font = machine.render().font_alloc(options_get_string(machine.options(), OPTION_UI_FONT)); | |
| 415 | ui_font = machine.render().font_alloc(options_get_string(&machine.options(), OPTION_UI_FONT)); | |
| 416 | 416 | return ui_font; |
| 417 | 417 | } |
| 418 | 418 | |
| r10384 | r10385 | |
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | /* add CPU overclocking (cheat only) */ |
| 1643 | if (options_get_bool(machine->options(), OPTION_CHEAT)) | |
| 1643 | if (options_get_bool(&machine->options(), OPTION_CHEAT)) | |
| 1644 | 1644 | { |
| 1645 | 1645 | device_execute_interface *exec = NULL; |
| 1646 | 1646 | for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) |
| r10384 | r10385 | |
| 1662 | 1662 | void *param = (void *)screen; |
| 1663 | 1663 | |
| 1664 | 1664 | /* add refresh rate tweaker */ |
| 1665 | if (options_get_bool(machine->options(), OPTION_CHEAT)) | |
| 1665 | if (options_get_bool(&machine->options(), OPTION_CHEAT)) | |
| 1666 | 1666 | { |
| 1667 | 1667 | string.printf("%s Refresh Rate", slider_get_screen_desc(*screen)); |
| 1668 | 1668 | *tailptr = slider_alloc(machine, string, -10000, 0, 10000, 1000, slider_refresh, param); |
| r10384 | r10385 | |
| 2214 | 2214 | void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard) |
| 2215 | 2215 | { |
| 2216 | 2216 | ui_use_natural_keyboard = use_natural_keyboard; |
| 2217 | options_set_bool(machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE); | |
| 2217 | options_set_bool(&machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE); | |
| 2218 | 2218 | } |
| 2219 | 2219 |
| r10384 | r10385 | |
|---|---|---|
| 158 | 158 | global_free(global.bitmap[player]); |
| 159 | 159 | machine->render().texture_free(global.texture[player]); |
| 160 | 160 | |
| 161 | emu_file crossfile(machine->options(), OPTION_CROSSHAIRPATH, OPEN_FLAG_READ); | |
| 161 | 162 | if (global.name[player][0] != 0) |
| 162 | 163 | { |
| 163 | 164 | /* look for user specified file */ |
| 164 | 165 | sprintf(filename, "%s.png", global.name[player]); |
| 165 | global.bitmap[player] = render_load_png( | |
| 166 | global.bitmap[player] = render_load_png(crossfile | |
| 166 | 167 | } |
| 167 | 168 | else |
| 168 | 169 | { |
| 169 | 170 | /* look for default cross?.png in crsshair\game dir */ |
| 170 | 171 | sprintf(filename, "cross%d.png", player + 1); |
| 171 | global.bitmap[player] = render_load_png( | |
| 172 | global.bitmap[player] = render_load_png(crossfile | |
| 172 | 173 | |
| 173 | 174 | /* look for default cross?.png in crsshair dir */ |
| 174 | 175 | if (global.bitmap[player] == NULL) |
| 175 | global.bitmap[player] = render_load_png( | |
| 176 | global.bitmap[player] = render_load_png(crossfile | |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | /* if that didn't work, use the built-in one */ |
| r10384 | r10385 | |
|---|---|---|
| 192 | 192 | // checks on a device configuration |
| 193 | 193 | //------------------------------------------------- |
| 194 | 194 | |
| 195 | bool legacy_device_config_base::device_validity_check(const game_driver &driver) const | |
| 195 | bool legacy_device_config_base::device_validity_check(core_options &options, const game_driver &driver) const | |
| 196 | 196 | { |
| 197 | 197 | device_validity_check_func validity_func = reinterpret_cast<device_validity_check_func>(get_legacy_config_fct(DEVINFO_FCT_VALIDITY_CHECK)); |
| 198 | 198 | if (validity_func != NULL) |
| 199 | return (*validity_func)(&driver, this); | |
| 199 | return (*validity_func)(&driver, this, options); | |
| 200 | 200 | return false; |
| 201 | 201 | } |
| 202 | 202 | |
| r10384 | r10385 | |
| 402 | 402 | // nvram_read - read NVRAM from the given file |
| 403 | 403 | //------------------------------------------------- |
| 404 | 404 | |
| 405 | void legacy_nvram_device_base::nvram_read( | |
| 405 | void legacy_nvram_device_base::nvram_read( | |
| 406 | 406 | { |
| 407 | 407 | device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_NVRAM)); |
| 408 | 408 | (*nvram_func)(this, &file, FALSE); |
| r10384 | r10385 | |
| 413 | 413 | // nvram_write - write NVRAM to the given file |
| 414 | 414 | //------------------------------------------------- |
| 415 | 415 | |
| 416 | void legacy_nvram_device_base::nvram_write( | |
| 416 | void legacy_nvram_device_base::nvram_write( | |
| 417 | 417 | { |
| 418 | 418 | device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_NVRAM)); |
| 419 | 419 | (*nvram_func)(this, &file, TRUE); |
| r10384 | r10385 | |
|---|---|---|
| 247 | 247 | #define DEVICE_GET_INFO_CALL(name) DEVICE_GET_INFO_NAME(name)(device, state, info) |
| 248 | 248 | |
| 249 | 249 | #define DEVICE_VALIDITY_CHECK_NAME(name) device_validity_check_##name |
| 250 | #define DEVICE_VALIDITY_CHECK(name) int DEVICE_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const device_config *device) | |
| 250 | #define DEVICE_VALIDITY_CHECK(name) int DEVICE_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const device_config *device, core_options &options) | |
| 251 | 251 | #define DEVICE_VALIDITY_CHECK_CALL(name) DEVICE_VALIDITY_CHECK_NAME(name)(driver, device) |
| 252 | 252 | |
| 253 | 253 | #define DEVICE_START_NAME(name) device_start_##name |
| r10384 | r10385 | |
| 267 | 267 | #define DEVICE_EXECUTE_CALL(name) DEVICE_EXECUTE_NAME(name)(device, clocks) |
| 268 | 268 | |
| 269 | 269 | #define DEVICE_NVRAM_NAME(name) device_nvram_##name |
| 270 | #define DEVICE_NVRAM(name) void DEVICE_NVRAM_NAME(name)(device_t *device, | |
| 270 | #define DEVICE_NVRAM(name) void DEVICE_NVRAM_NAME(name)(device_t *device, | |
| 271 | 271 | #define DEVICE_NVRAM_CALL(name) DEVICE_NVRAM_NAME(name)(device, file, read_or_write) |
| 272 | 272 | |
| 273 | 273 | |
| r10384 | r10385 | |
| 382 | 382 | |
| 383 | 383 | // device interface function types |
| 384 | 384 | typedef void (*device_get_config_func)(const device_config *device, UINT32 state, deviceinfo *info); |
| 385 | typedef int (*device_validity_check_func)(const game_driver *driver, const device_config *device); | |
| 385 | typedef int (*device_validity_check_func)(const game_driver *driver, const device_config *device, core_options &options); | |
| 386 | 386 | |
| 387 | 387 | typedef void (*device_start_func)(device_t *device); |
| 388 | 388 | typedef void (*device_stop_func)(device_t *device); |
| 389 | 389 | typedef INT32 (*device_execute_func)(device_t *device, INT32 clocks); |
| 390 | 390 | typedef void (*device_reset_func)(device_t *device); |
| 391 | typedef void (*device_nvram_func)(device_t *device, | |
| 391 | typedef void (*device_nvram_func)(device_t *device, | |
| 392 | 392 | |
| 393 | 393 | // the actual deviceinfo union |
| 394 | 394 | union deviceinfo |
| r10384 | r10385 | |
| 447 | 447 | |
| 448 | 448 | protected: |
| 449 | 449 | // overrides |
| 450 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 450 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 451 | 451 | |
| 452 | 452 | // access to legacy configuration info |
| 453 | 453 | INT64 get_legacy_config_int(UINT32 state) const; |
| r10384 | r10385 | |
| 577 | 577 | |
| 578 | 578 | // device_nvram_interface overrides |
| 579 | 579 | virtual void nvram_default(); |
| 580 | virtual void nvram_read(mame_file &file); | |
| 581 | virtual void nvram_write(mame_file &file); | |
| 580 | virtual void nvram_read(emu_file &file); | |
| 581 | virtual void nvram_write(emu_file &file); | |
| 582 | 582 | }; |
| 583 | 583 | |
| 584 | 584 | // ======================> legacy_image_device_config |
| r10384 | r10385 | |
|---|---|---|
| 721 | 721 | { |
| 722 | 722 | // set the initial orientation and brightness/contrast/gamma |
| 723 | 723 | m_user.m_orientation = manager.machine().gamedrv->flags & ORIENTATION_MASK; |
| 724 | m_user.m_brightness = options_get_float(manager.machine().options(), OPTION_BRIGHTNESS); | |
| 725 | m_user.m_contrast = options_get_float(manager.machine().options(), OPTION_CONTRAST); | |
| 726 | m_user.m_gamma = options_get_float(manager.machine().options(), OPTION_GAMMA); | |
| 724 | m_user.m_brightness = options_get_float(&manager.machine().options(), OPTION_BRIGHTNESS); | |
| 725 | m_user.m_contrast = options_get_float(&manager.machine().options(), OPTION_CONTRAST); | |
| 726 | m_user.m_gamma = options_get_float(&manager.machine().options(), OPTION_GAMMA); | |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // allocate a client to the main palette |
| r10384 | r10385 | |
| 1066 | 1066 | m_debug_containers(manager.machine().m_respool) |
| 1067 | 1067 | { |
| 1068 | 1068 | // determine the base layer configuration based on options |
| 1069 | m_base_layerconfig.set_backdrops_enabled(options_get_bool(manager.machine().options(), OPTION_USE_BACKDROPS)); | |
| 1070 | m_base_layerconfig.set_overlays_enabled(options_get_bool(manager.machine().options(), OPTION_USE_OVERLAYS)); | |
| 1071 | m_base_layerconfig.set_bezels_enabled(options_get_bool(manager.machine().options(), OPTION_USE_BEZELS)); | |
| 1072 | m_base_layerconfig.set_zoom_to_screen(options_get_bool(manager.machine().options(), OPTION_ARTWORK_CROP)); | |
| 1069 | m_base_layerconfig.set_backdrops_enabled(options_get_bool(&manager.machine().options(), OPTION_USE_BACKDROPS)); | |
| 1070 | m_base_layerconfig.set_overlays_enabled(options_get_bool(&manager.machine().options(), OPTION_USE_OVERLAYS)); | |
| 1071 | m_base_layerconfig.set_bezels_enabled(options_get_bool(&manager.machine().options(), OPTION_USE_BEZELS)); | |
| 1072 | m_base_layerconfig.set_zoom_to_screen(options_get_bool(&manager.machine().options(), OPTION_ARTWORK_CROP)); | |
| 1073 | 1073 | |
| 1074 | 1074 | // determine the base orientation based on options |
| 1075 | 1075 | m_orientation = ROT0; |
| 1076 | if (!options_get_bool(manager.machine().options(), OPTION_ROTATE)) | |
| 1076 | if (!options_get_bool(&manager.machine().options(), OPTION_ROTATE)) | |
| 1077 | 1077 | m_base_orientation = orientation_reverse(manager.machine().gamedrv->flags & ORIENTATION_MASK); |
| 1078 | 1078 | |
| 1079 | 1079 | // rotate left/right |
| 1080 | if (options_get_bool(manager.machine().options(), OPTION_ROR) || (options_get_bool(manager.machine().options(), OPTION_AUTOROR) && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) | |
| 1080 | if (options_get_bool(&manager.machine().options(), OPTION_ROR) || (options_get_bool(&manager.machine().options(), OPTION_AUTOROR) && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) | |
| 1081 | 1081 | m_base_orientation = orientation_add(ROT90, m_base_orientation); |
| 1082 | if (options_get_bool(manager.machine().options(), OPTION_ROL) || (options_get_bool(manager.machine().options(), OPTION_AUTOROL) && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) | |
| 1082 | if (options_get_bool(&manager.machine().options(), OPTION_ROL) || (options_get_bool(&manager.machine().options(), OPTION_AUTOROL) && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) | |
| 1083 | 1083 | m_base_orientation = orientation_add(ROT270, m_base_orientation); |
| 1084 | 1084 | |
| 1085 | 1085 | // flip X/Y |
| 1086 | if (options_get_bool(manager.machine().options(), OPTION_FLIPX)) | |
| 1086 | if (options_get_bool(&manager.machine().options(), OPTION_FLIPX)) | |
| 1087 | 1087 | m_base_orientation ^= ORIENTATION_FLIP_X; |
| 1088 | if (options_get_bool(manager.machine().options(), OPTION_FLIPY)) | |
| 1088 | if (options_get_bool(&manager.machine().options(), OPTION_FLIPY)) | |
| 1089 | 1089 | m_base_orientation ^= ORIENTATION_FLIP_Y; |
| 1090 | 1090 | |
| 1091 | 1091 | // set the orientation and layerconfig equal to the base |
| r10384 | r10385 | |
| 1680 | 1680 | fname.ins(0, PATH_SEPARATOR).ins(0, dirname); |
| 1681 | 1681 | |
| 1682 | 1682 | // attempt to open the file; bail if we can't |
| 1683 | mame_file *layoutfile; | |
| 1684 | file_error filerr = mame_fopen(SEARCHPATH_ARTWORK, fname, OPEN_FLAG_READ, &layoutfile); | |
| 1683 | emu_file layoutfile(manager().machine().options(), SEARCHPATH_ARTWORK, OPEN_FLAG_READ); | |
| 1684 | file_error filerr = layoutfile.open(fname); | |
| 1685 | 1685 | if (filerr != FILERR_NONE) |
| 1686 | 1686 | return false; |
| 1687 | 1687 | |
| 1688 | 1688 | // read the file |
| 1689 | rootnode = xml_file_read(mame_core_file(layoutfile), NULL); | |
| 1690 | mame_fclose(layoutfile); | |
| 1689 | rootnode = xml_file_read(layoutfile, NULL); | |
| 1691 | 1690 | } |
| 1692 | 1691 | |
| 1693 | 1692 | // if we didn't get a properly-formatted XML file, record a warning and exit |
| r10384 | r10385 | |
| 2797 | 2796 | container->get_user_settings(settings); |
| 2798 | 2797 | |
| 2799 | 2798 | // output the color controls |
| 2800 | if (settings.m_brightness != options_get_float(m_machine.options(), OPTION_BRIGHTNESS)) | |
| 2799 | if (settings.m_brightness != options_get_float(&m_machine.options(), OPTION_BRIGHTNESS)) | |
| 2801 | 2800 | { |
| 2802 | 2801 | xml_set_attribute_float(screennode, "brightness", settings.m_brightness); |
| 2803 | 2802 | changed = true; |
| 2804 | 2803 | } |
| 2805 | 2804 | |
| 2806 | if (settings.m_contrast != options_get_float(m_machine.options(), OPTION_CONTRAST)) | |
| 2805 | if (settings.m_contrast != options_get_float(&m_machine.options(), OPTION_CONTRAST)) | |
| 2807 | 2806 | { |
| 2808 | 2807 | xml_set_attribute_float(screennode, "contrast", settings.m_contrast); |
| 2809 | 2808 | changed = true; |
| 2810 | 2809 | } |
| 2811 | 2810 | |
| 2812 | if (settings.m_gamma != options_get_float(m_machine.options(), OPTION_GAMMA)) | |
| 2811 | if (settings.m_gamma != options_get_float(&m_machine.options(), OPTION_GAMMA)) | |
| 2813 | 2812 | { |
| 2814 | 2813 | xml_set_attribute_float(screennode, "gamma", settings.m_gamma); |
| 2815 | 2814 | changed = true; |
| r10384 | r10385 | |
|---|---|---|
| 237 | 237 | // state |
| 238 | 238 | //------------------------------------------------- |
| 239 | 239 | |
| 240 | state_save_error state_manager::check_file(running_machine *machine, | |
| 240 | state_save_error state_manager::check_file(running_machine *machine, | |
| 241 | 241 | { |
| 242 | 242 | // if we want to validate the signature, compute it |
| 243 | 243 | UINT32 sig = 0; |
| r10384 | r10385 | |
| 245 | 245 | sig = machine->state().signature(); |
| 246 | 246 | |
| 247 | 247 | // seek to the beginning and read the header |
| 248 | mame_fcompress(file, FCOMPRESS_NONE); | |
| 249 | mame_fseek(file, 0, SEEK_SET); | |
| 248 | file.compress(FCOMPRESS_NONE); | |
| 249 | file.seek(0, SEEK_SET); | |
| 250 | 250 | UINT8 header[HEADER_SIZE]; |
| 251 | if ( | |
| 251 | if ( | |
| 252 | 252 | { |
| 253 | 253 | if (errormsg != NULL) |
| 254 | 254 | (*errormsg)("Could not read " APPNAME " save file header"); |
| r10384 | r10385 | |
| 264 | 264 | // read_file - read the data from a file |
| 265 | 265 | //------------------------------------------------- |
| 266 | 266 | |
| 267 | state_save_error state_manager::read_file( | |
| 267 | state_save_error state_manager::read_file( | |
| 268 | 268 | { |
| 269 | 269 | // if we have illegal registrations, return an error |
| 270 | 270 | if (m_illegal_regs > 0) |
| 271 | 271 | return STATERR_ILLEGAL_REGISTRATIONS; |
| 272 | 272 | |
| 273 | 273 | // read the header and turn on compression for the rest of the file |
| 274 | mame_fcompress(file, FCOMPRESS_NONE); | |
| 275 | mame_fseek(file, 0, SEEK_SET); | |
| 274 | file.compress(FCOMPRESS_NONE); | |
| 275 | file.seek(0, SEEK_SET); | |
| 276 | 276 | UINT8 header[HEADER_SIZE]; |
| 277 | if ( | |
| 277 | if ( | |
| 278 | 278 | return STATERR_READ_ERROR; |
| 279 | | |
| 279 | | |
| 280 | 280 | |
| 281 | 281 | // verify the header and report an error if it doesn't match |
| 282 | 282 | UINT32 sig = signature(); |
| r10384 | r10385 | |
| 290 | 290 | for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) |
| 291 | 291 | { |
| 292 | 292 | UINT32 totalsize = entry->m_typesize * entry->m_typecount; |
| 293 | if ( | |
| 293 | if ( | |
| 294 | 294 | return STATERR_READ_ERROR; |
| 295 | 295 | |
| 296 | 296 | // handle flipping |
| r10384 | r10385 | |
| 310 | 310 | // write_file - writes the data to a file |
| 311 | 311 | //------------------------------------------------- |
| 312 | 312 | |
| 313 | state_save_error state_manager::write_file( | |
| 313 | state_save_error state_manager::write_file( | |
| 314 | 314 | { |
| 315 | 315 | // if we have illegal registrations, return an error |
| 316 | 316 | if (m_illegal_regs > 0) |
| r10384 | r10385 | |
| 326 | 326 | *(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig); |
| 327 | 327 | |
| 328 | 328 | // write the header and turn on compression for the rest of the file |
| 329 | mame_fcompress(file, FCOMPRESS_NONE); | |
| 330 | mame_fseek(file, 0, SEEK_SET); | |
| 331 | if (mame_fwrite(file, header, sizeof(header)) != sizeof(header)) | |
| 329 | file.compress(FCOMPRESS_NONE); | |
| 330 | file.seek(0, SEEK_SET); | |
| 331 | if (file.write(header, sizeof(header)) != sizeof(header)) | |
| 332 | 332 | return STATERR_WRITE_ERROR; |
| 333 | | |
| 333 | | |
| 334 | 334 | |
| 335 | 335 | // call the pre-save functions |
| 336 | 336 | for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next()) |
| r10384 | r10385 | |
| 340 | 340 | for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) |
| 341 | 341 | { |
| 342 | 342 | UINT32 totalsize = entry->m_typesize * entry->m_typecount; |
| 343 | if ( | |
| 343 | if ( | |
| 344 | 344 | return STATERR_WRITE_ERROR; |
| 345 | 345 | } |
| 346 | 346 | return STATERR_NONE; |
| r10384 | r10385 | |
|---|---|---|
| 251 | 251 | |
| 252 | 252 | /* validate? */ |
| 253 | 253 | if (options_get_bool(options, CLIOPTION_VALIDATE)) |
| 254 | { | |
| 255 | set_mame_options(options); | |
| 256 | return mame_validitychecks(NULL); | |
| 257 | } | |
| 254 | return mame_validitychecks(*options, NULL); | |
| 258 | 255 | |
| 259 | 256 | return -1; |
| 260 | 257 | } |
| r10384 | r10385 | |
| 293 | 290 | /* createconfig? */ |
| 294 | 291 | if (options_get_bool(options, CLIOPTION_CREATECONFIG)) |
| 295 | 292 | { |
| 296 | file_error filerr; | |
| 297 | mame_file *file; | |
| 293 | emu_file file(*options, NULL, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 298 | 294 | |
| 299 | 295 | /* parse any relevant INI files before proceeding */ |
| 300 | 296 | mame_parse_ini_files(options, driver); |
| 301 | 297 | |
| 302 | 298 | /* make the output filename */ |
| 303 | filerr = | |
| 299 | file_error filerr = | |
| 304 | 300 | |
| 305 | 301 | /* error if unable to create the file */ |
| 306 | 302 | if (filerr != FILERR_NONE) |
| r10384 | r10385 | |
| 310 | 306 | } |
| 311 | 307 | |
| 312 | 308 | /* output the configuration and exit cleanly */ |
| 313 | options_output_ini_file(options, mame_core_file(file)); | |
| 314 | mame_fclose(file); | |
| 309 | options_output_ini_file(options, file); | |
| 315 | 310 | return MAMERR_NONE; |
| 316 | 311 | } |
| 317 | 312 | |
| r10384 | r10385 | |
| 905 | 900 | { |
| 906 | 901 | if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) |
| 907 | 902 | { |
| 908 | software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); | |
| 903 | software_list *list = software_list_open( *options, swlist->list_name[i], FALSE, NULL ); | |
| 909 | 904 | |
| 910 | 905 | if ( list ) |
| 911 | 906 | { |
| r10384 | r10385 | |
| 1103 | 1098 | { |
| 1104 | 1099 | if ( swlist->list_name[i] ) |
| 1105 | 1100 | { |
| 1106 | software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); | |
| 1101 | software_list *list = software_list_open( *options, swlist->list_name[i], FALSE, NULL ); | |
| 1107 | 1102 | |
| 1108 | 1103 | for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) ) |
| 1109 | 1104 | { |
| r10384 | r10385 | |
|---|---|---|
| 230 | 230 | // save - save a single cheat parameter |
| 231 | 231 | //------------------------------------------------- |
| 232 | 232 | |
| 233 | void cheat_parameter::save( | |
| 233 | void cheat_parameter::save( | |
| 234 | 234 | { |
| 235 | 235 | // output the parameter tag |
| 236 | | |
| 236 | | |
| 237 | 237 | |
| 238 | 238 | // if no items, just output min/max/step |
| 239 | 239 | astring string; |
| 240 | 240 | if (!has_itemlist()) |
| 241 | 241 | { |
| 242 | 242 | if (m_minval != 0) |
| 243 | | |
| 243 | | |
| 244 | 244 | if (m_maxval != 0) |
| 245 | | |
| 245 | | |
| 246 | 246 | if (m_stepval != 1) |
| 247 | mame_fprintf(&cheatfile, " step=\"%s\"", m_stepval.format(string)); | |
| 248 | mame_fprintf(&cheatfile, "/>\n"); | |
| 247 | cheatfile.printf(" step=\"%s\"", m_stepval.format(string)); | |
| 248 | cheatfile.printf("/>\n"); | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // iterate over items |
| 252 | 252 | else |
| 253 | 253 | { |
| 254 | 254 | for (const item *curitem = m_itemlist.first(); curitem != NULL; curitem = curitem->next()) |
| 255 | mame_fprintf(&cheatfile, "\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format(string), curitem->text()); | |
| 256 | mame_fprintf(&cheatfile, "\t\t</parameter>\n"); | |
| 255 | cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format(string), curitem->text()); | |
| 256 | cheatfile.printf("\t\t</parameter>\n"); | |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| r10384 | r10385 | |
| 402 | 402 | // save - save a single cheat script |
| 403 | 403 | //------------------------------------------------- |
| 404 | 404 | |
| 405 | void cheat_script::save( | |
| 405 | void cheat_script::save( | |
| 406 | 406 | { |
| 407 | 407 | // output the script tag |
| 408 | | |
| 408 | | |
| 409 | 409 | switch (m_state) |
| 410 | 410 | { |
| 411 | case SCRIPT_STATE_OFF: mame_fprintf(&cheatfile, " state=\"off\""); break; | |
| 412 | case SCRIPT_STATE_ON: mame_fprintf(&cheatfile, " state=\"on\""); break; | |
| 411 | case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break; | |
| 412 | case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break; | |
| 413 | 413 | default: |
| 414 | case SCRIPT_STATE_RUN: mame_fprintf(&cheatfile, " state=\"run\""); break; | |
| 415 | case SCRIPT_STATE_CHANGE: mame_fprintf(&cheatfile, " state=\"change\""); break; | |
| 414 | case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break; | |
| 415 | case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break; | |
| 416 | 416 | } |
| 417 | | |
| 417 | | |
| 418 | 418 | |
| 419 | 419 | // output entries |
| 420 | 420 | for (const script_entry *entry = m_entrylist.first(); entry != NULL; entry = entry->next()) |
| 421 | 421 | entry->save(cheatfile); |
| 422 | 422 | |
| 423 | 423 | // close the tag |
| 424 | | |
| 424 | | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | |
| r10384 | r10385 | |
| 557 | 557 | // save - save a single action or output |
| 558 | 558 | //------------------------------------------------- |
| 559 | 559 | |
| 560 | void cheat_script::script_entry::save( | |
| 560 | void cheat_script::script_entry::save( | |
| 561 | 561 | { |
| 562 | 562 | astring tempstring; |
| 563 | 563 | |
| 564 | 564 | // output an action |
| 565 | 565 | if (!m_format) |
| 566 | 566 | { |
| 567 | | |
| 567 | | |
| 568 | 568 | if (!m_condition.is_empty()) |
| 569 | mame_fprintf(&cheatfile, " condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition)); | |
| 570 | mame_fprintf(&cheatfile, ">%s</action>\n", cheat_manager::quote_expression(tempstring, m_expression)); | |
| 569 | cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition)); | |
| 570 | cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(tempstring, m_expression)); | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | // output an output |
| 574 | 574 | else |
| 575 | 575 | { |
| 576 | | |
| 576 | | |
| 577 | 577 | if (!m_condition.is_empty()) |
| 578 | | |
| 578 | | |
| 579 | 579 | if (m_line != 0) |
| 580 | | |
| 580 | | |
| 581 | 581 | if (m_justify == JUSTIFY_CENTER) |
| 582 | | |
| 582 | | |
| 583 | 583 | else if (m_justify == JUSTIFY_RIGHT) |
| 584 | | |
| 584 | | |
| 585 | 585 | if (m_arglist.count() == 0) |
| 586 | | |
| 586 | | |
| 587 | 587 | |
| 588 | 588 | // output arguments |
| 589 | 589 | else |
| 590 | 590 | { |
| 591 | | |
| 591 | | |
| 592 | 592 | for (const output_argument *curarg = m_arglist.first(); curarg != NULL; curarg = curarg->next()) |
| 593 | 593 | curarg->save(cheatfile); |
| 594 | | |
| 594 | | |
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | } |
| r10384 | r10385 | |
| 691 | 691 | // save - save a single output argument |
| 692 | 692 | //------------------------------------------------- |
| 693 | 693 | |
| 694 | void cheat_script::script_entry::output_argument::save( | |
| 694 | void cheat_script::script_entry::output_argument::save( | |
| 695 | 695 | { |
| 696 | 696 | astring tempstring; |
| 697 | 697 | |
| 698 | | |
| 698 | | |
| 699 | 699 | if (m_count != 1) |
| 700 | mame_fprintf(&cheatfile, " count=\"%d\"", (int)m_count); | |
| 701 | mame_fprintf(&cheatfile, ">%s</argument>\n", cheat_manager::quote_expression(tempstring, m_expression)); | |
| 700 | cheatfile.printf(" count=\"%d\"", (int)m_count); | |
| 701 | cheatfile.printf(">%s</argument>\n", cheat_manager::quote_expression(tempstring, m_expression)); | |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | |
| r10384 | r10385 | |
| 815 | 815 | // save - save a single cheat entry |
| 816 | 816 | //------------------------------------------------- |
| 817 | 817 | |
| 818 | void cheat_entry::save( | |
| 818 | void cheat_entry::save( | |
| 819 | 819 | { |
| 820 | 820 | // determine if we have scripts |
| 821 | 821 | bool has_scripts = (m_off_script != NULL || m_on_script != NULL || m_run_script != NULL || m_change_script != NULL); |
| 822 | 822 | |
| 823 | 823 | // output the cheat tag |
| 824 | | |
| 824 | | |
| 825 | 825 | if (m_numtemp != DEFAULT_TEMP_VARIABLES) |
| 826 | | |
| 826 | | |
| 827 | 827 | if (!m_comment && m_parameter == NULL && !has_scripts) |
| 828 | | |
| 828 | | |
| 829 | 829 | else |
| 830 | 830 | { |
| 831 | | |
| 831 | | |
| 832 | 832 | |
| 833 | 833 | // save the comment |
| 834 | 834 | if (m_comment) |
| 835 | | |
| 835 | | |
| 836 | 836 | |
| 837 | 837 | // output the parameter, if present |
| 838 | 838 | if (m_parameter != NULL) |
| r10384 | r10385 | |
| 849 | 849 | m_run_script->save(cheatfile); |
| 850 | 850 | |
| 851 | 851 | // close the cheat tag |
| 852 | | |
| 852 | | |
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | |
| r10384 | r10385 | |
| 1093 | 1093 | m_symtable(&machine) |
| 1094 | 1094 | { |
| 1095 | 1095 | // if the cheat engine is disabled, we're done |
| 1096 | if (!options_get_bool(machine.options(), OPTION_CHEAT)) | |
| 1096 | if (!options_get_bool(&machine.options(), OPTION_CHEAT)) | |
| 1097 | 1097 | return; |
| 1098 | 1098 | |
| 1099 | 1099 | // request a callback |
| r10384 | r10385 | |
| 1125 | 1125 | void cheat_manager::set_enable(bool enable) |
| 1126 | 1126 | { |
| 1127 | 1127 | // if the cheat engine is disabled, we're done |
| 1128 | if (!options_get_bool(m_machine.options(), OPTION_CHEAT)) | |
| 1128 | if (!options_get_bool(&m_machine.options(), OPTION_CHEAT)) | |
| 1129 | 1129 | return; |
| 1130 | 1130 | |
| 1131 | 1131 | // if we're enabled currently and we don't want to be, turn things off |
| r10384 | r10385 | |
| 1160 | 1160 | void cheat_manager::reload() |
| 1161 | 1161 | { |
| 1162 | 1162 | // if the cheat engine is disabled, we're done |
| 1163 | if (!options_get_bool(m_machine.options(), OPTION_CHEAT)) | |
| 1163 | if (!options_get_bool(&m_machine.options(), OPTION_CHEAT)) | |
| 1164 | 1164 | return; |
| 1165 | 1165 | |
| 1166 | 1166 | // free everything |
| r10384 | r10385 | |
| 1215 | 1215 | bool cheat_manager::save_all(const char *filename) |
| 1216 | 1216 | { |
| 1217 | 1217 | // open the file with the proper name |
| 1218 | astring fname(filename, ".xml"); | |
| 1219 | mame_file *cheatfile; | |
| 1220 | file_error filerr = mame_fopen(SEARCHPATH_CHEAT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &cheatfile); | |
| 1218 | emu_file cheatfile(m_machine.options(), SEARCHPATH_CHEAT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 1219 | file_error filerr = cheatfile.open(filename, ".xml"); | |
| 1221 | 1220 | |
| 1222 | 1221 | // if that failed, return nothing |
| 1223 | 1222 | if (filerr != FILERR_NONE) |
| r10384 | r10385 | |
| 1227 | 1226 | try |
| 1228 | 1227 | { |
| 1229 | 1228 | // output the outer layers |
| 1230 | mame_fprintf(cheatfile, "<?xml version=\"1.0\"?>\n"); | |
| 1231 | mame_fprintf(cheatfile, "<!-- This file is autogenerated; comments and unknown tags will be stripped -->\n"); | |
| 1232 | mame_fprintf(cheatfile, "<mamecheat version=\"%d\">\n", CHEAT_VERSION); | |
| 1229 | cheatfile.printf("<?xml version=\"1.0\"?>\n"); | |
| 1230 | cheatfile.printf("<!-- This file is autogenerated; comments and unknown tags will be stripped -->\n"); | |
| 1231 | cheatfile.printf("<mamecheat version=\"%d\">\n", CHEAT_VERSION); | |
| 1233 | 1232 | |
| 1234 | 1233 | // iterate over cheats in the list and save them |
| 1235 | 1234 | for (cheat_entry *cheat = m_cheatlist.first(); cheat != NULL; cheat = cheat->next()) |
| 1236 | cheat->save( | |
| 1235 | cheat->save( | |
| 1237 | 1236 | |
| 1238 | 1237 | // close out the file |
| 1239 | mame_fprintf(cheatfile, "</mamecheat>\n"); | |
| 1240 | mame_fclose(cheatfile); | |
| 1238 | cheatfile.printf("</mamecheat>\n"); | |
| 1241 | 1239 | return true; |
| 1242 | 1240 | } |
| 1243 | 1241 | |
| r10384 | r10385 | |
| 1245 | 1243 | catch (emu_fatalerror &err) |
| 1246 | 1244 | { |
| 1247 | 1245 | mame_printf_error("%s\n", err.string()); |
| 1248 | mame_fclose(cheatfile); | |
| 1249 | osd_rmfile(filename); | |
| 1246 | cheatfile.remove_on_close(); | |
| 1250 | 1247 | } |
| 1251 | 1248 | return false; |
| 1252 | 1249 | } |
| r10384 | r10385 | |
| 1414 | 1411 | void cheat_manager::load_cheats(const char *filename) |
| 1415 | 1412 | { |
| 1416 | 1413 | xml_data_node *rootnode = NULL; |
| 1417 | | |
| 1414 | | |
| 1418 | 1415 | try |
| 1419 | 1416 | { |
| 1420 | 1417 | // open the file with the proper name |
| 1421 | astring fname(filename, ".xml"); | |
| 1422 | file_error filerr = mame_fopen(SEARCHPATH_CHEAT, fname, OPEN_FLAG_READ, &cheatfile); | |
| 1418 | file_error filerr = cheatfile.open(filename, ".xml"); | |
| 1423 | 1419 | |
| 1424 | 1420 | // loop over all instrances of the files found in our search paths |
| 1425 | 1421 | while (filerr == FILERR_NONE) |
| 1426 | 1422 | { |
| 1427 | mame_printf_verbose("Loading cheats file from %s\n", | |
| 1423 | mame_printf_verbose("Loading cheats file from %s\n", ch | |
| 1428 | 1424 | |
| 1429 | 1425 | // read the XML file into internal data structures |
| 1430 | 1426 | xml_parse_options options = { 0 }; |
| 1431 | 1427 | xml_parse_error error; |
| 1432 | 1428 | options.error = &error; |
| 1433 | rootnode = xml_file_read( | |
| 1429 | rootnode = xml_file_read( | |
| 1434 | 1430 | |
| 1435 | 1431 | // if unable to parse the file, just bail |
| 1436 | 1432 | if (rootnode == NULL) |
| r10384 | r10385 | |
| 1458 | 1454 | for (scannode = m_cheatlist.first(); scannode != NULL; scannode = scannode->next()) |
| 1459 | 1455 | if (strcmp(scannode->description(), curcheat->description()) == 0) |
| 1460 | 1456 | { |
| 1461 | mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), | |
| 1457 | mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), ch | |
| 1462 | 1458 | break; |
| 1463 | 1459 | } |
| 1464 | 1460 | |
| r10384 | r10385 | |
| 1473 | 1469 | xml_file_free(rootnode); |
| 1474 | 1470 | |
| 1475 | 1471 | // open the next file in sequence |
| 1476 | filerr = | |
| 1472 | filerr = ch | |
| 1477 | 1473 | } |
| 1478 | 1474 | } |
| 1479 | 1475 | |
| r10384 | r10385 | |
| 1484 | 1480 | m_cheatlist.reset(); |
| 1485 | 1481 | if (rootnode != NULL) |
| 1486 | 1482 | xml_file_free(rootnode); |
| 1487 | if (cheatfile != NULL) | |
| 1488 | mame_fclose(cheatfile); | |
| 1489 | 1483 | } |
| 1490 | 1484 | } |
| r10384 | r10385 | |
|---|---|---|
| 1077 | 1077 | checks |
| 1078 | 1078 | -------------------------------------------------*/ |
| 1079 | 1079 | |
| 1080 | static bool validate_devices(const machine_config &config, const ioport_list &portlist, region_array *rgninfo) | |
| 1080 | static bool validate_devices(const machine_config &config, const ioport_list &portlist, region_array *rgninfo, core_options &options) | |
| 1081 | 1081 | { |
| 1082 | 1082 | bool error = false; |
| 1083 | 1083 | const game_driver &driver = config.gamedrv(); |
| r10384 | r10385 | |
| 1100 | 1100 | mame_printf_warning("Device %s does not have short name defined\n", devconfig->name()); |
| 1101 | 1101 | } |
| 1102 | 1102 | /* check for device-specific validity check */ |
| 1103 | if (devconfig->validity_check(driver)) | |
| 1103 | if (devconfig->validity_check(options, driver)) | |
| 1104 | 1104 | error = true; |
| 1105 | 1105 | |
| 1106 | 1106 | } |
| r10384 | r10385 | |
| 1112 | 1112 | mame_validitychecks - master validity checker |
| 1113 | 1113 | -------------------------------------------------*/ |
| 1114 | 1114 | |
| 1115 | bool mame_validitychecks(const game_driver *curdriver) | |
| 1115 | bool mame_validitychecks(core_options &options, const game_driver *curdriver) | |
| 1116 | 1116 | { |
| 1117 | 1117 | osd_ticks_t prep = 0; |
| 1118 | 1118 | osd_ticks_t expansion = 0; |
| r10384 | r10385 | |
| 1219 | 1219 | |
| 1220 | 1220 | /* validate devices */ |
| 1221 | 1221 | device_checks -= get_profile_ticks(); |
| 1222 | error = validate_devices(config, portlist, &rgninfo) || error; | |
| 1222 | error = validate_devices(config, portlist, &rgninfo, options) || error; | |
| 1223 | 1223 | device_checks += get_profile_ticks(); |
| 1224 | 1224 | } |
| 1225 | 1225 | catch (emu_fatalerror &err) |
| r10384 | r10385 | |
|---|---|---|
| 202 | 202 | void save_pointer(T *value, const char *valname, UINT32 count, int index = 0) { save_pointer("global", NULL, index, value, valname, count); } |
| 203 | 203 | |
| 204 | 204 | // file processing |
| 205 | static state_save_error check_file(running_machine *machine, mame_file *file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); | |
| 206 | state_save_error write_file(mame_file *file); | |
| 207 | state_save_error read_file(mame_file *file); | |
| 205 | static state_save_error check_file(running_machine *machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); | |
| 206 | state_save_error write_file(emu_file &file); | |
| 207 | state_save_error read_file(emu_file &file); | |
| 208 | 208 | |
| 209 | 209 | private: |
| 210 | 210 | // internal helpers |
| r10384 | r10385 | |
|---|---|---|
| 115 | 115 | bool set_next_state(); |
| 116 | 116 | |
| 117 | 117 | // actions |
| 118 | void save( | |
| 118 | void save( | |
| 119 | 119 | |
| 120 | 120 | private: |
| 121 | 121 | // a single item in a parameter item list |
| r10384 | r10385 | |
| 168 | 168 | |
| 169 | 169 | // actions |
| 170 | 170 | void execute(cheat_manager &manager, UINT64 &argindex); |
| 171 | void save( | |
| 171 | void save( | |
| 172 | 172 | |
| 173 | 173 | private: |
| 174 | 174 | // an entry within the script |
| r10384 | r10385 | |
| 185 | 185 | |
| 186 | 186 | // actions |
| 187 | 187 | void execute(cheat_manager &manager, UINT64 &argindex); |
| 188 | void save( | |
| 188 | void save( | |
| 189 | 189 | |
| 190 | 190 | private: |
| 191 | 191 | // an argument for output |
| r10384 | r10385 | |
| 203 | 203 | int values(UINT64 &argindex, UINT64 *result); |
| 204 | 204 | |
| 205 | 205 | // actions |
| 206 | void save( | |
| 206 | void save( | |
| 207 | 207 | |
| 208 | 208 | private: |
| 209 | 209 | // internal state |
| r10384 | r10385 | |
| 278 | 278 | bool select_default_state(); |
| 279 | 279 | bool select_previous_state(); |
| 280 | 280 | bool select_next_state(); |
| 281 | void save( | |
| 281 | void save( | |
| 282 | 282 | |
| 283 | 283 | // UI helpers |
| 284 | 284 | void menu_text(astring &description, astring &state, UINT32 &flags); |
| r10384 | r10385 | |
|---|---|---|
| 14 | 14 | #ifndef __VALIDITY_H__ |
| 15 | 15 | #define __VALIDITY_H__ |
| 16 | 16 | |
| 17 | bool mame_validitychecks(const game_driver *driver); | |
| 17 | bool mame_validitychecks(core_options &options, const game_driver *driver); | |
| 18 | 18 | bool validate_tag(const game_driver &driver, const char *object, const char *tag); |
| 19 | 19 | |
| 20 | 20 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 40 | 40 | open_chd * next; /* pointer to next in the list */ |
| 41 | 41 | const char * region; /* disk region we came from */ |
| 42 | 42 | chd_file * origchd; /* handle to the original CHD */ |
| 43 | | |
| 43 | | |
| 44 | 44 | chd_file * diffchd; /* handle to the diff CHD */ |
| 45 | | |
| 45 | | |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | |
| r10384 | r10385 | |
| 61 | 61 | UINT32 romsloadedsize; /* total size of ROMs loaded so far */ |
| 62 | 62 | UINT32 romstotalsize; /* total size of ROMs to read */ |
| 63 | 63 | |
| 64 | | |
| 64 | | |
| 65 | 65 | open_chd * chd_list; /* disks */ |
| 66 | 66 | open_chd ** chd_list_tailptr; |
| 67 | 67 | |
| r10384 | r10385 | |
| 81 | 81 | HELPERS (also used by devimage.c) |
| 82 | 82 | ***************************************************************************/ |
| 83 | 83 | |
| 84 | file_error common_process_file | |
| 84 | file_error common_process_file | |
| 85 | 85 | { |
| 86 | *image_file = global_alloc(emu_file(options, SEARCHPATH_IMAGE, OPEN_FLAG_READ)); | |
| 87 | file_error filerr; | |
| 88 | ||
| 86 | 89 | if (location != NULL && strcmp(location, "") != 0) |
| 87 | { | |
| 88 | astring fname(location, PATH_SEPARATOR, ROM_GETNAME(romp)); | |
| 89 | fname.cat(ext); | |
| 90 | return mame_fopen_options(options, SEARCHPATH_IMAGE, fname, OPEN_FLAG_READ, image_file); | |
| 91 | } | |
| 90 | filerr = (*image_file)->open(location, PATH_SEPARATOR, ROM_GETNAME(romp), ext); | |
| 92 | 91 | else |
| 92 | filerr = (*image_file)->open(ROM_GETNAME(romp), ext); | |
| 93 | ||
| 94 | if (filerr != FILERR_NONE) | |
| 93 | 95 | { |
| 94 | astring fname(ROM_GETNAME(romp)); | |
| 95 | fname.cat(ext); | |
| 96 | return mame_fopen_options(options, SEARCHPATH_IMAGE, fname, OPEN_FLAG_READ, image_file); | |
| 96 | global_free(*image_file); | |
| 97 | *image_file = NULL; | |
| 97 | 98 | } |
| 98 | ||
| 99 | return FILERR_NOT_FOUND; | |
| 99 | return filerr; | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | file_error common_process_file(const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, | |
| 102 | file_error common_process_file(core_options &options, const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, | |
| 103 | 103 | { |
| 104 | *image_file = global_alloc(emu_file(options, SEARCHPATH_IMAGE, OPEN_FLAG_READ)); | |
| 104 | 105 | file_error filerr; |
| 105 | astring fname(location, PATH_SEPARATOR, ROM_GETNAME(romp)); | |
| 106 | 106 | |
| 107 | 107 | if (has_crc) |
| 108 | filerr = ma | |
| 108 | filerr = (*image_file)->open | |
| 109 | 109 | else |
| 110 | filerr = ma | |
| 110 | filerr = (*image_file)->open(location, PATH_SEPARATOR, R | |
| 111 | 111 | |
| 112 | if (filerr != FILERR_NONE) | |
| 113 | { | |
| 114 | global_free(*image_file); | |
| 115 | *image_file = NULL; | |
| 116 | } | |
| 112 | 117 | return filerr; |
| 113 | 118 | } |
| 114 | 119 | |
| r10384 | r10385 | |
| 153 | 158 | file associated with the given region |
| 154 | 159 | -------------------------------------------------*/ |
| 155 | 160 | |
| 156 | void set_disk_handle(running_machine | |
| 161 | void set_disk_handle(running_machine &machine, const char *region, | |
| 157 | 162 | { |
| 158 | 163 | open_chd chd = { 0 }; |
| 159 | 164 | |
| 160 | 165 | /* note the region we are in */ |
| 161 | 166 | chd.region = region; |
| 162 | chd.origchd = chdfile; | |
| 163 | chd.origfile = file; | |
| 167 | chd.origchd = &chdfile; | |
| 168 | chd.origfile = &file; | |
| 164 | 169 | |
| 165 | 170 | /* we're okay, add to the list of disks */ |
| 166 | add_disk_handle(machine, &chd); | |
| 171 | add_disk_handle(&machine, &chd); | |
| 167 | 172 | } |
| 168 | 173 | |
| 169 | 174 | |
| r10384 | r10385 | |
| 325 | 330 | |
| 326 | 331 | static void determine_bios_rom(rom_load_data *romdata) |
| 327 | 332 | { |
| 328 | const char *specbios = options_get_string(romdata->machine->options(), OPTION_BIOS); | |
| 333 | const char *specbios = options_get_string(&romdata->machine->options(), OPTION_BIOS); | |
| 329 | 334 | const char *defaultname = NULL; |
| 330 | 335 | const rom_entry *rom; |
| 331 | 336 | int default_no = 1; |
| r10384 | r10385 | |
| 508 | 513 | return; |
| 509 | 514 | |
| 510 | 515 | /* get the length and CRC from the file */ |
| 511 | actlength = mame_fsize(romdata->file); | |
| 512 | acthash = mame_fhash(romdata->file, hash_data_used_functions(hash)); | |
| 516 | actlength = romdata->file->size(); | |
| 517 | acthash = romdata->file->hash_string(hash_data_used_functions(hash)); | |
| 513 | 518 | |
| 514 | 519 | /* verify length */ |
| 515 | 520 | if (explength != actlength) |
| r10384 | r10385 | |
| 658 | 663 | romdata->file = NULL; |
| 659 | 664 | for (drv = romdata->machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) |
| 660 | 665 | if (drv->name != NULL && *drv->name != 0) |
| 661 | filerr = common_process_file(drv->name, has_crc, crc, romp, &romdata->file); | |
| 666 | filerr = common_process_file(romdata->machine->options(), drv->name, has_crc, crc, romp, &romdata->file); | |
| 662 | 667 | |
| 663 | 668 | /* if the region is load by name, load the ROM from there */ |
| 664 | 669 | if (romdata->file == NULL && regiontag != NULL) |
| r10384 | r10385 | |
| 708 | 713 | // - if we are not using lists, we have regiontag only; |
| 709 | 714 | // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname |
| 710 | 715 | if (!is_list) |
| 711 | filerr = common_process_file(tag1.cstr(), has_crc, crc, romp, &romdata->file); | |
| 716 | filerr = common_process_file(romdata->machine->options(), tag1.cstr(), has_crc, crc, romp, &romdata->file); | |
| 712 | 717 | else |
| 713 | 718 | { |
| 714 | 719 | // try to load from list/setname |
| 715 | 720 | if ((romdata->file == NULL) && (tag2.cstr() != NULL)) |
| 716 | filerr = common_process_file(tag2.cstr(), has_crc, crc, romp, &romdata->file); | |
| 721 | filerr = common_process_file(romdata->machine->options(), tag2.cstr(), has_crc, crc, romp, &romdata->file); | |
| 717 | 722 | // try to load from list/parentname |
| 718 | 723 | if ((romdata->file == NULL) && has_parent && (tag3.cstr() != NULL)) |
| 719 | filerr = common_process_file(tag3.cstr(), has_crc, crc, romp, &romdata->file); | |
| 724 | filerr = common_process_file(romdata->machine->options(), tag3.cstr(), has_crc, crc, romp, &romdata->file); | |
| 720 | 725 | // try to load from setname |
| 721 | 726 | if ((romdata->file == NULL) && (tag4.cstr() != NULL)) |
| 722 | filerr = common_process_file(tag4.cstr(), has_crc, crc, romp, &romdata->file); | |
| 727 | filerr = common_process_file(romdata->machine->options(), tag4.cstr(), has_crc, crc, romp, &romdata->file); | |
| 723 | 728 | // try to load from parentname |
| 724 | 729 | if ((romdata->file == NULL) && has_parent && (tag5.cstr() != NULL)) |
| 725 | filerr = common_process_file(tag5.cstr(), has_crc, crc, romp, &romdata->file); | |
| 730 | filerr = common_process_file(romdata->machine->options(), tag5.cstr(), has_crc, crc, romp, &romdata->file); | |
| 726 | 731 | } |
| 727 | 732 | } |
| 728 | 733 | |
| r10384 | r10385 | |
| 744 | 749 | { |
| 745 | 750 | /* files just pass through */ |
| 746 | 751 | if (romdata->file != NULL) |
| 747 | return | |
| 752 | return | |
| 748 | 753 | |
| 749 | 754 | /* otherwise, fill with randomness */ |
| 750 | 755 | else |
| r10384 | r10385 | |
| 1007 | 1012 | |
| 1008 | 1013 | /* reseek to the start and clear the baserom so we don't reverify */ |
| 1009 | 1014 | if (romdata->file != NULL) |
| 1010 | | |
| 1015 | | |
| 1011 | 1016 | baserom = NULL; |
| 1012 | 1017 | explength = 0; |
| 1013 | 1018 | } |
| r10384 | r10385 | |
| 1017 | 1022 | if (romdata->file != NULL) |
| 1018 | 1023 | { |
| 1019 | 1024 | LOG(("Closing ROM file\n")); |
| 1020 | | |
| 1025 | global | |
| 1021 | 1026 | romdata->file = NULL; |
| 1022 | 1027 | } |
| 1023 | 1028 | } |
| r10384 | r10385 | |
| 1030 | 1035 | |
| 1031 | 1036 | |
| 1032 | 1037 | /*------------------------------------------------- |
| 1033 | open_disk_image - open a disk image, searching | |
| 1034 | up the parent and loading by checksum | |
| 1035 | -------------------------------------------------*/ | |
| 1036 | ||
| 1037 | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd, const char *locationtag) | |
| 1038 | { | |
| 1039 | return open_disk_image_options(mame_options(), gamedrv, romp, image_file, image_chd, locationtag); | |
| 1040 | } | |
| 1041 | ||
| 1042 | ||
| 1043 | /*------------------------------------------------- | |
| 1044 | open_disk_image_options - open a disk image, | |
| 1038 | open_disk_image - open a disk image, | |
| 1045 | 1039 | searching up the parent and loading by |
| 1046 | 1040 | checksum |
| 1047 | 1041 | -------------------------------------------------*/ |
| 1048 | 1042 | |
| 1049 | chd_error open_disk_image | |
| 1043 | chd_error open_disk_image | |
| 1050 | 1044 | { |
| 1051 | 1045 | const game_driver *drv, *searchdrv; |
| 1052 | 1046 | const rom_entry *region, *rom; |
| r10384 | r10385 | |
| 1060 | 1054 | /* attempt to open the properly named file, scanning up through parent directories */ |
| 1061 | 1055 | filerr = FILERR_NOT_FOUND; |
| 1062 | 1056 | for (searchdrv = gamedrv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv)) |
| 1063 | filerr = common_process_file | |
| 1057 | filerr = common_process_file | |
| 1064 | 1058 | |
| 1065 | 1059 | if (filerr != FILERR_NONE) |
| 1066 | filerr = common_process_file | |
| 1060 | filerr = common_process_file | |
| 1067 | 1061 | |
| 1068 | 1062 | /* look for the disk in the locationtag too */ |
| 1069 | 1063 | if (filerr != FILERR_NONE && locationtag != NULL) |
| r10384 | r10385 | |
| 1113 | 1107 | // - if we are not using lists, we have locationtag only; |
| 1114 | 1108 | // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname |
| 1115 | 1109 | if (!is_list) |
| 1116 | filerr = common_process_file | |
| 1110 | filerr = common_process_file | |
| 1117 | 1111 | else |
| 1118 | 1112 | { |
| 1119 | 1113 | // try to load from list/setname |
| 1120 | 1114 | if ((filerr != FILERR_NONE) && (tag2.cstr() != NULL)) |
| 1121 | filerr = common_process_file | |
| 1115 | filerr = common_process_file | |
| 1122 | 1116 | // try to load from list/parentname (if any) |
| 1123 | 1117 | if ((filerr != FILERR_NONE) && has_parent && (tag3.cstr() != NULL)) |
| 1124 | filerr = common_process_file | |
| 1118 | filerr = common_process_file | |
| 1125 | 1119 | // try to load from setname |
| 1126 | 1120 | if ((filerr != FILERR_NONE) && (tag4.cstr() != NULL)) |
| 1127 | filerr = common_process_file | |
| 1121 | filerr = common_process_file | |
| 1128 | 1122 | // try to load from parentname (if any) |
| 1129 | 1123 | if ((filerr != FILERR_NONE) && has_parent && (tag5.cstr() != NULL)) |
| 1130 | filerr = common_process_file | |
| 1124 | filerr = common_process_file | |
| 1131 | 1125 | // only for CHD we also try to load from list/ |
| 1132 | 1126 | if ((filerr != FILERR_NONE) && (tag1.cstr() != NULL)) |
| 1133 | 1127 | { |
| 1134 | 1128 | tag1.del(tag1.len() - 1, 1); // remove the PATH_SEPARATOR |
| 1135 | filerr = common_process_file | |
| 1129 | filerr = common_process_file | |
| 1136 | 1130 | } |
| 1137 | 1131 | } |
| 1138 | 1132 | } |
| r10384 | r10385 | |
| 1141 | 1135 | if (filerr == FILERR_NONE) |
| 1142 | 1136 | { |
| 1143 | 1137 | /* try to open the CHD */ |
| 1144 | err = chd_open_file( | |
| 1138 | err = chd_open_file( | |
| 1145 | 1139 | if (err == CHDERR_NONE) |
| 1146 | 1140 | return err; |
| 1147 | 1141 | |
| 1148 | 1142 | /* close the file on failure */ |
| 1149 | | |
| 1143 | global | |
| 1150 | 1144 | *image_file = NULL; |
| 1151 | 1145 | } |
| 1152 | 1146 | else |
| r10384 | r10385 | |
| 1169 | 1163 | /* attempt to open the properly named file, scanning up through parent directories */ |
| 1170 | 1164 | filerr = FILERR_NOT_FOUND; |
| 1171 | 1165 | for (searchdrv = drv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv)) |
| 1172 | filerr = common_process_file | |
| 1166 | filerr = common_process_file | |
| 1173 | 1167 | |
| 1174 | 1168 | if (filerr != FILERR_NONE) |
| 1175 | filerr = common_process_file | |
| 1169 | filerr = common_process_file | |
| 1176 | 1170 | |
| 1177 | 1171 | /* did the file open succeed? */ |
| 1178 | 1172 | if (filerr == FILERR_NONE) |
| 1179 | 1173 | { |
| 1180 | 1174 | /* try to open the CHD */ |
| 1181 | err = chd_open_file( | |
| 1175 | err = chd_open_file( | |
| 1182 | 1176 | if (err == CHDERR_NONE) |
| 1183 | 1177 | return err; |
| 1184 | 1178 | |
| 1185 | 1179 | /* close the file on failure */ |
| 1186 | | |
| 1180 | global | |
| 1187 | 1181 | *image_file = NULL; |
| 1188 | 1182 | } |
| 1189 | 1183 | } |
| r10384 | r10385 | |
| 1197 | 1191 | open_disk_diff - open a DISK diff file |
| 1198 | 1192 | -------------------------------------------------*/ |
| 1199 | 1193 | |
| 1200 | static chd_error open_disk_diff(co | |
| 1194 | static chd_error open_disk_diff(cor | |
| 1201 | 1195 | { |
| 1202 | 1196 | astring fname(ROM_GETNAME(romp), ".dif"); |
| 1203 | file_error filerr; | |
| 1204 | 1197 | chd_error err; |
| 1205 | 1198 | |
| 1206 | 1199 | *diff_file = NULL; |
| r10384 | r10385 | |
| 1208 | 1201 | |
| 1209 | 1202 | /* try to open the diff */ |
| 1210 | 1203 | LOG(("Opening differencing image file: %s\n", fname.cstr())); |
| 1211 | filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, fname, OPEN_FLAG_READ | OPEN_FLAG_WRITE, diff_file); | |
| 1204 | *diff_file = global_alloc(emu_file(options, SEARCHPATH_IMAGE_DIFF, OPEN_FLAG_READ | OPEN_FLAG_WRITE)); | |
| 1205 | file_error filerr = (*diff_file)->open(fname); | |
| 1212 | 1206 | if (filerr != FILERR_NONE) |
| 1213 | 1207 | { |
| 1214 | 1208 | /* didn't work; try creating it instead */ |
| 1215 | 1209 | LOG(("Creating differencing image: %s\n", fname.cstr())); |
| 1216 | filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, fname, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, diff_file); | |
| 1210 | (*diff_file)->set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 1211 | filerr = (*diff_file)->open(fname); | |
| 1217 | 1212 | if (filerr != FILERR_NONE) |
| 1218 | 1213 | { |
| 1219 | 1214 | err = CHDERR_FILE_NOT_FOUND; |
| r10384 | r10385 | |
| 1221 | 1216 | } |
| 1222 | 1217 | |
| 1223 | 1218 | /* create the CHD */ |
| 1224 | err = chd_create_file( | |
| 1219 | err = chd_create_file( | |
| 1225 | 1220 | if (err != CHDERR_NONE) |
| 1226 | 1221 | goto done; |
| 1227 | 1222 | } |
| 1228 | 1223 | |
| 1229 | 1224 | LOG(("Opening differencing image file: %s\n", fname.cstr())); |
| 1230 | err = chd_open_file( | |
| 1225 | err = chd_open_file( | |
| 1231 | 1226 | if (err != CHDERR_NONE) |
| 1232 | 1227 | goto done; |
| 1233 | 1228 | |
| 1234 | 1229 | done: |
| 1235 | 1230 | if ((err != CHDERR_NONE) && (*diff_file != NULL)) |
| 1236 | 1231 | { |
| 1237 | | |
| 1232 | global | |
| 1238 | 1233 | *diff_file = NULL; |
| 1239 | 1234 | } |
| 1240 | 1235 | return err; |
| r10384 | r10385 | |
| 1267 | 1262 | |
| 1268 | 1263 | /* first open the source drive */ |
| 1269 | 1264 | LOG(("Opening disk image: %s\n", filename.cstr())); |
| 1270 | err = open_disk_image(romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd, locationtag); | |
| 1265 | err = open_disk_image(romdata->machine->options(), romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd, locationtag); | |
| 1271 | 1266 | if (err != CHDERR_NONE) |
| 1272 | 1267 | { |
| 1273 | 1268 | if (err == CHDERR_FILE_NOT_FOUND) |
| r10384 | r10385 | |
| 1307 | 1302 | if (!DISK_ISREADONLY(romp)) |
| 1308 | 1303 | { |
| 1309 | 1304 | /* try to open or create the diff */ |
| 1310 | err = open_disk_diff(romdata->machine-> | |
| 1305 | err = open_disk_diff(romdata->machine->options(), romp, chd.origchd, &chd.difffile, &chd.diffchd); | |
| 1311 | 1306 | if (err != CHDERR_NONE) |
| 1312 | 1307 | { |
| 1313 | 1308 | romdata->errorstring.catprintf("%s DIFF CHD ERROR: %s\n", filename.cstr(), chd_error_string(err)); |
| r10384 | r10385 | |
| 1384 | 1379 | // " swlist % clonename % parentname " |
| 1385 | 1380 | // open_rom_file contains the code to split the elements and to create paths to load from |
| 1386 | 1381 | |
| 1387 | software_list *software_list_ptr = software_list_open(ma | |
| 1382 | software_list *software_list_ptr = software_list_open(device->machine->options(), swlist, FALSE, NULL); | |
| 1388 | 1383 | if (software_list_ptr) |
| 1389 | 1384 | { |
| 1390 | 1385 | locationtag.cat(breakstr); |
| r10384 | r10385 | |
| 1398 | 1393 | locationtag.cat(breakstr); |
| 1399 | 1394 | // printf("%s\n", locationtag.cstr()); |
| 1400 | 1395 | } |
| 1401 | const char *parentname = software_get_clone(swlist, swinfo->shortname); | |
| 1396 | const char *parentname = software_get_clone(device->machine->options(), swlist, swinfo->shortname); | |
| 1402 | 1397 | if (parentname != NULL) |
| 1403 | 1398 | swinfo = software_list_find(software_list_ptr, parentname, NULL); |
| 1404 | 1399 | else |
| r10384 | r10385 | |
| 1414 | 1409 | |
| 1415 | 1410 | romdata->errorstring.reset(); |
| 1416 | 1411 | |
| 1417 | if (software_get_support(swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) | |
| 1412 | if (software_get_support(device->machine->options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) | |
| 1418 | 1413 | { |
| 1419 | 1414 | romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist); |
| 1420 | 1415 | romdata->warnings++; |
| 1421 | 1416 | } |
| 1422 | if (software_get_support(swlist, swname) == SOFTWARE_SUPPORTED_NO) | |
| 1417 | if (software_get_support(device->machine->options(), swlist, swname) == SOFTWARE_SUPPORTED_NO) | |
| 1423 | 1418 | { |
| 1424 | 1419 | romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist); |
| 1425 | 1420 | romdata->warnings++; |
| r10384 | r10385 | |
| 1593 | 1588 | if (curchd->diffchd != NULL) |
| 1594 | 1589 | chd_close(curchd->diffchd); |
| 1595 | 1590 | if (curchd->difffile != NULL) |
| 1596 | | |
| 1591 | global | |
| 1597 | 1592 | if (curchd->origchd != NULL) |
| 1598 | 1593 | chd_close(curchd->origchd); |
| 1599 | 1594 | if (curchd->origfile != NULL) |
| 1600 | | |
| 1595 | global | |
| 1601 | 1596 | } |
| 1602 | 1597 | } |
| 1603 | 1598 |
| r10384 | r10385 | |
|---|---|---|
| 92 | 92 | ***************************************************************************/ |
| 93 | 93 | |
| 94 | 94 | /* opens a multicart */ |
| 95 | multicart_open_error multicart_open(const char *filename, const char *drvname, multicart_load_flags load_flags, multicart_t **cart); | |
| 95 | multicart_open_error multicart_open(core_options &options, const char *filename, const char *drvname, multicart_load_flags load_flags, multicart_t **cart); | |
| 96 | 96 | |
| 97 | 97 | /* closes a multicart */ |
| 98 | void multicart_close(multicart_t *cart); | |
| 98 | void multicart_close(core_options &options, multicart_t *cart); | |
| 99 | 99 | |
| 100 | 100 | #endif /* __MULTCART_H__ */ |
| r10384 | r10385 | |
|---|---|---|
| 303 | 303 | return (*config->device_load)(image); |
| 304 | 304 | |
| 305 | 305 | /* try opening this as if it were a multicart */ |
| 306 | multicart_open(image.filename(), device->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 306 | multicart_open(device->machine->options(), image.filename(), device->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 307 | 307 | if (cart->mc == NULL) |
| 308 | 308 | { |
| 309 | 309 | |
| r10384 | r10385 | |
| 337 | 337 | |
| 338 | 338 | if (cart->mc != NULL) |
| 339 | 339 | { |
| 340 | multicart_close(cart->mc); | |
| 340 | multicart_close(device->machine->options(), cart->mc); | |
| 341 | 341 | cart->mc = NULL; |
| 342 | 342 | } |
| 343 | 343 | |
| r10384 | r10385 | |
| 360 | 360 | if (image.software_entry() == NULL && image.exists()) |
| 361 | 361 | { |
| 362 | 362 | /* try opening this as if it were a multicart */ |
| 363 | multicart_open_error me = multicart_open(image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc); | |
| 363 | multicart_open_error me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc); | |
| 364 | 364 | if (me == MCERR_NONE) |
| 365 | 365 | { |
| 366 | 366 | /* this was a multicart - read from it */ |
| 367 | 367 | astring_cpyc(&pcb_name, mc->pcb_type); |
| 368 | multicart_close(mc); | |
| 368 | multicart_close(image.device().machine->options(), mc); | |
| 369 | 369 | } |
| 370 | 370 | else |
| 371 | 371 | { |
| r10384 | r10385 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | #include "emu.h" | |
| 9 | 10 | #include "multcart.h" |
| 10 | 11 | #include "pool.h" |
| 11 | 12 | #include "unzip.h" |
| 12 | 13 | #include "corestr.h" |
| 13 | 14 | #include "xmlfile.h" |
| 14 | #include "emu.h" | |
| 15 | 15 | #include "hash.h" |
| 16 | 16 | #include "machine/ram.h" |
| 17 | 17 | |
| r10384 | r10385 | |
| 212 | 212 | load_ram_resource |
| 213 | 213 | -------------------------------------------------*/ |
| 214 | 214 | |
| 215 | static multicart_open_error load_ram_resource(multicart_load_state *state, xml_data_node *resource_node, | |
| 215 | static multicart_open_error load_ram_resource(core_options &options, multicart_load_state *state, xml_data_node *resource_node, | |
| 216 | 216 | multicart_resource *resource) |
| 217 | 217 | { |
| 218 | 218 | const char *length_string; |
| r10384 | r10385 | |
| 258 | 258 | if (resource->filename == NULL) |
| 259 | 259 | return MCERR_OUT_OF_MEMORY; |
| 260 | 260 | |
| 261 | image_battery_load_by_name(resource->filename, resource->ptr, resource->length, 0x00); | |
| 261 | image_battery_load_by_name(options, resource->filename, resource->ptr, resource->length, 0x00); | |
| 262 | 262 | } |
| 263 | 263 | /* else this type is volatile, in which case we just have |
| 264 | 264 | a memory expansion */ |
| r10384 | r10385 | |
| 271 | 271 | load_resource |
| 272 | 272 | -------------------------------------------------*/ |
| 273 | 273 | |
| 274 | static multicart_open_error load_resource(multicart_load_state *state, xml_data_node *resource_node, | |
| 274 | static multicart_open_error load_resource(core_options &options, multicart_load_state *state, xml_data_node *resource_node, | |
| 275 | 275 | multicart_resource_type resource_type) |
| 276 | 276 | { |
| 277 | 277 | const char *id; |
| r10384 | r10385 | |
| 305 | 305 | break; |
| 306 | 306 | |
| 307 | 307 | case MULTICART_RESOURCE_TYPE_RAM: |
| 308 | err = load_ram_resource(state, resource_node, resource); | |
| 308 | err = load_ram_resource(options, state, resource_node, resource); | |
| 309 | 309 | if (err != MCERR_NONE) |
| 310 | 310 | return err; |
| 311 | 311 | break; |
| r10384 | r10385 | |
| 327 | 327 | load_all_resources |
| 328 | 328 | -------------------------------------------------*/ |
| 329 | 329 | |
| 330 | static multicart_open_error load_all_resources(multicart_load_state *state) | |
| 330 | static multicart_open_error load_all_resources(core_options &options, multicart_load_state *state) | |
| 331 | 331 | { |
| 332 | 332 | multicart_open_error err; |
| 333 | 333 | xml_data_node *resource_node; |
| r10384 | r10385 | |
| 338 | 338 | resource_type = get_resource_type(resource_node->name); |
| 339 | 339 | if (resource_type != MULTICART_RESOURCE_TYPE_INVALID) |
| 340 | 340 | { |
| 341 | err = load_resource(state, resource_node, resource_type); | |
| 341 | err = load_resource(options, state, resource_node, resource_type); | |
| 342 | 342 | if (err != MCERR_NONE) |
| 343 | 343 | return err; |
| 344 | 344 | } |
| r10384 | r10385 | |
| 354 | 354 | be freed on multicart_close. |
| 355 | 355 | -------------------------------------------------*/ |
| 356 | 356 | |
| 357 | static multicart_open_error save_ram_resources(multicart_t *cart) | |
| 357 | static multicart_open_error save_ram_resources(core_options &options, multicart_t *cart) | |
| 358 | 358 | { |
| 359 | 359 | const multicart_resource *resource; |
| 360 | 360 | |
| r10384 | r10385 | |
| 362 | 362 | { |
| 363 | 363 | if ((resource->type == MULTICART_RESOURCE_TYPE_RAM) && (resource->filename != NULL)) |
| 364 | 364 | { |
| 365 | image_battery_save_by_name(resource->filename, resource->ptr, resource->length); | |
| 365 | image_battery_save_by_name(options, resource->filename, resource->ptr, resource->length); | |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | return MCERR_NONE; |
| r10384 | r10385 | |
| 460 | 460 | multicart_open - opens a multicart |
| 461 | 461 | -------------------------------------------------*/ |
| 462 | 462 | |
| 463 | multicart_open_error multicart_open(const char *filename, const char *gamedrv, multicart_load_flags load_flags, multicart_t **cart) | |
| 463 | multicart_open_error multicart_open(core_options &options, const char *filename, const char *gamedrv, multicart_load_flags load_flags, multicart_t **cart) | |
| 464 | 464 | { |
| 465 | 465 | multicart_open_error err; |
| 466 | 466 | zip_error ziperr; |
| r10384 | r10385 | |
| 565 | 565 | /* do we have to load resources? */ |
| 566 | 566 | if (load_flags & MULTICART_FLAGS_LOAD_RESOURCES) |
| 567 | 567 | { |
| 568 | err = load_all_resources(&state); | |
| 568 | err = load_all_resources(options, &state); | |
| 569 | 569 | if (err != MCERR_NONE) |
| 570 | 570 | goto done; |
| 571 | 571 | |
| r10384 | r10385 | |
| 588 | 588 | |
| 589 | 589 | if ((err != MCERR_NONE) && (state.multicart != NULL)) |
| 590 | 590 | { |
| 591 | multicart_close(state.multicart); | |
| 591 | multicart_close(options, state.multicart); | |
| 592 | 592 | state.multicart = NULL; |
| 593 | 593 | } |
| 594 | 594 | *cart = state.multicart; |
| r10384 | r10385 | |
| 600 | 600 | multicart_close - closes a multicart |
| 601 | 601 | -------------------------------------------------*/ |
| 602 | 602 | |
| 603 | void multicart_close(multicart_t *cart) | |
| 603 | void multicart_close(core_options &options, multicart_t *cart) | |
| 604 | 604 | { |
| 605 | save_ram_resources(cart); | |
| 605 | save_ram_resources(options, cart); | |
| 606 | 606 | pool_free_lib(cart->data->pool); |
| 607 | 607 | } |
| r10384 | r10385 | |
|---|---|---|
| 285 | 285 | |
| 286 | 286 | /* ----- Helpers ----- */ |
| 287 | 287 | |
| 288 | file_error common_process_file_options(core_options *options, const char *location, const char *ext, const rom_entry *romp, mame_file **image_file); | |
| 289 | file_error common_process_file(const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, mame_file **image_file); | |
| 288 | file_error common_process_file(core_options &options, const char *location, const char *ext, const rom_entry *romp, emu_file **image_file); | |
| 289 | file_error common_process_file(core_options &options, const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, emu_file **image_file); | |
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /* ----- ROM iteration ----- */ |
| r10384 | r10385 | |
| 323 | 323 | /* ----- disk handling ----- */ |
| 324 | 324 | |
| 325 | 325 | /* open a disk image, searching up the parent and loading by checksum */ |
| 326 | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, | |
| 326 | chd_error open_disk_image(core_options &options, const game_driver *gamedrv, const rom_entry *romp, | |
| 327 | 327 | |
| 328 | /* open a disk image, searching up the parent and loading by checksum */ | |
| 329 | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd,const char *locationtag); | |
| 330 | ||
| 331 | 328 | /* return a pointer to the CHD file associated with the given region */ |
| 332 | 329 | chd_file *get_disk_handle(running_machine *machine, const char *region); |
| 333 | 330 | |
| 334 | 331 | /* set a pointer to the CHD file associated with the given region */ |
| 335 | void set_disk_handle(running_machine | |
| 332 | void set_disk_handle(running_machine &machine, const char *region, | |
| 336 | 333 | |
| 337 | 334 | void load_software_part_region(device_t *device, char *swlist, char *swname, rom_entry *start_region); |
| 338 | 335 |
| r10384 | r10385 | |
|---|---|---|
| 104 | 104 | // constructed |
| 105 | 105 | //------------------------------------------------- |
| 106 | 106 | |
| 107 | bool device_config_sound_interface::interface_validity_check(const game_driver &driver) const | |
| 107 | bool device_config_sound_interface::interface_validity_check(core_options &options, const game_driver &driver) const | |
| 108 | 108 | { |
| 109 | 109 | bool error = false; |
| 110 | 110 |
| r10384 | r10385 | |
|---|---|---|
| 46 | 46 | FUNCTION PROTOTYPES |
| 47 | 47 | ***************************************************************************/ |
| 48 | 48 | |
| 49 | static int config_load_xml(running_machine *machine, mame_file *file, int type); | |
| 50 | static int config_save_xml(running_machine *machine, mame_file *file, int type); | |
| 49 | static int config_load_xml(running_machine *machine, emu_file &file, int type); | |
| 50 | static int config_save_xml(running_machine *machine, emu_file &file, int type); | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | |
| r10384 | r10385 | |
| 102 | 102 | |
| 103 | 103 | int config_load_settings(running_machine *machine) |
| 104 | 104 | { |
| 105 | const char *controller = options_get_string(machine->options(), OPTION_CTRLR); | |
| 106 | file_error filerr; | |
| 105 | const char *controller = options_get_string(&machine->options(), OPTION_CTRLR); | |
| 107 | 106 | config_type *type; |
| 108 | mame_file *file; | |
| 109 | 107 | int loaded = 0; |
| 110 | 108 | |
| 111 | 109 | /* loop over all registrants and call their init function */ |
| r10384 | r10385 | |
| 116 | 114 | if (controller[0] != 0) |
| 117 | 115 | { |
| 118 | 116 | /* open the config file */ |
| 119 | astring fname(controller, ".cfg"); | |
| 120 | filerr = mame_fopen(SEARCHPATH_CTRLR, fname, OPEN_FLAG_READ, &file); | |
| 117 | emu_file file(machine->options(), SEARCHPATH_CTRLR, OPEN_FLAG_READ); | |
| 118 | file_error filerr = file.open(controller, ".cfg"); | |
| 121 | 119 | |
| 122 | 120 | if (filerr != FILERR_NONE) |
| 123 | 121 | throw emu_fatalerror("Could not load controller file %s.cfg", controller); |
| r10384 | r10385 | |
| 125 | 123 | /* load the XML */ |
| 126 | 124 | if (!config_load_xml(machine, file, CONFIG_TYPE_CONTROLLER)) |
| 127 | 125 | throw emu_fatalerror("Could not load controller file %s.cfg", controller); |
| 128 | mame_fclose(file); | |
| 129 | 126 | } |
| 130 | 127 | |
| 131 | 128 | /* next load the defaults file */ |
| 132 | filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_READ, &file); | |
| 129 | emu_file file(machine->options(), SEARCHPATH_CONFIG, OPEN_FLAG_READ); | |
| 130 | file_error filerr = file.open("default.cfg"); | |
| 133 | 131 | if (filerr == FILERR_NONE) |
| 134 | { | |
| 135 | 132 | config_load_xml(machine, file, CONFIG_TYPE_DEFAULT); |
| 136 | mame_fclose(file); | |
| 137 | } | |
| 138 | 133 | |
| 139 | 134 | /* finally, load the game-specific file */ |
| 140 | astring fname(machine->basename(), ".cfg"); | |
| 141 | filerr = mame_fopen(SEARCHPATH_CONFIG, fname, OPEN_FLAG_READ, &file); | |
| 142 | ||
| 135 | filerr = file.open(machine->basename(), ".cfg"); | |
| 143 | 136 | if (filerr == FILERR_NONE) |
| 144 | { | |
| 145 | 137 | loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME); |
| 146 | mame_fclose(file); | |
| 147 | } | |
| 148 | 138 | |
| 149 | 139 | /* loop over all registrants and call their final function */ |
| 150 | 140 | for (type = typelist; type; type = type->next) |
| r10384 | r10385 | |
| 158 | 148 | |
| 159 | 149 | void config_save_settings(running_machine *machine) |
| 160 | 150 | { |
| 161 | file_error filerr; | |
| 162 | 151 | config_type *type; |
| 163 | mame_file *file; | |
| 164 | 152 | |
| 165 | 153 | /* loop over all registrants and call their init function */ |
| 166 | 154 | for (type = typelist; type; type = type->next) |
| 167 | 155 | (*type->save)(machine, CONFIG_TYPE_INIT, NULL); |
| 168 | 156 | |
| 169 | 157 | /* save the defaults file */ |
| 170 | filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 158 | emu_file file(machine->options(), SEARCHPATH_CONFIG, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 159 | file_error filerr = file.open("default.cfg"); | |
| 171 | 160 | if (filerr == FILERR_NONE) |
| 172 | { | |
| 173 | 161 | config_save_xml(machine, file, CONFIG_TYPE_DEFAULT); |
| 174 | mame_fclose(file); | |
| 175 | } | |
| 176 | 162 | |
| 177 | 163 | /* finally, save the game-specific file */ |
| 178 | astring fname(machine->basename(), ".cfg"); | |
| 179 | filerr = mame_fopen(SEARCHPATH_CONFIG, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 180 | ||
| 164 | filerr = file.open(machine->basename(), ".cfg"); | |
| 181 | 165 | if (filerr == FILERR_NONE) |
| 182 | { | |
| 183 | 166 | config_save_xml(machine, file, CONFIG_TYPE_GAME); |
| 184 | mame_fclose(file); | |
| 185 | } | |
| 186 | 167 | |
| 187 | 168 | /* loop over all registrants and call their final function */ |
| 188 | 169 | for (type = typelist; type; type = type->next) |
| r10384 | r10385 | |
| 197 | 178 | * |
| 198 | 179 | *************************************/ |
| 199 | 180 | |
| 200 | static int config_load_xml(running_machine *machine, | |
| 181 | static int config_load_xml(running_machine *machine, | |
| 201 | 182 | { |
| 202 | 183 | xml_data_node *root, *confignode, *systemnode; |
| 203 | 184 | config_type *type; |
| r10384 | r10385 | |
| 205 | 186 | int version, count; |
| 206 | 187 | |
| 207 | 188 | /* read the file */ |
| 208 | root = xml_file_read( | |
| 189 | root = xml_file_read( | |
| 209 | 190 | if (!root) |
| 210 | 191 | goto error; |
| 211 | 192 | |
| r10384 | r10385 | |
| 298 | 279 | * |
| 299 | 280 | *************************************/ |
| 300 | 281 | |
| 301 | static int config_save_xml(running_machine *machine, | |
| 282 | static int config_save_xml(running_machine *machine, | |
| 302 | 283 | { |
| 303 | 284 | xml_data_node *root = xml_file_create(); |
| 304 | 285 | xml_data_node *confignode, *systemnode; |
| r10384 | r10385 | |
| 335 | 316 | } |
| 336 | 317 | |
| 337 | 318 | /* flush the file */ |
| 338 | xml_file_write(root, | |
| 319 | xml_file_write(root, | |
| 339 | 320 | |
| 340 | 321 | /* free and get out of here */ |
| 341 | 322 | xml_file_free(root); |
| r10384 | r10385 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | struct _software_list |
| 43 | 43 | { |
| 44 | | |
| 44 | | |
| 45 | 45 | object_pool *pool; |
| 46 | 46 | parse_state state; |
| 47 | 47 | const char *description; |
| r10384 | r10385 | |
| 824 | 824 | parent software, if any |
| 825 | 825 | -------------------------------------------------*/ |
| 826 | 826 | |
| 827 | const char *software_get_clone(char *swlist, const char *swname) | |
| 827 | const char *software_get_clone(core_options &options, char *swlist, const char *swname) | |
| 828 | 828 | { |
| 829 | software_list *software_list_ptr = software_list_open( | |
| 829 | software_list *software_list_ptr = software_list_open( | |
| 830 | 830 | const char *retval = NULL; |
| 831 | 831 | if (software_list_ptr) |
| 832 | 832 | { |
| r10384 | r10385 | |
| 844 | 844 | the software |
| 845 | 845 | -------------------------------------------------*/ |
| 846 | 846 | |
| 847 | UINT32 software_get_support(char *swlist, const char *swname) | |
| 847 | UINT32 software_get_support(core_options &options, char *swlist, const char *swname) | |
| 848 | 848 | { |
| 849 | software_list *software_list_ptr = software_list_open( | |
| 849 | software_list *software_list_ptr = software_list_open( | |
| 850 | 850 | UINT32 retval = 0; |
| 851 | 851 | |
| 852 | 852 | if (software_list_ptr) |
| r10384 | r10385 | |
| 872 | 872 | UINT32 len; |
| 873 | 873 | XML_Memory_Handling_Suite memcallbacks; |
| 874 | 874 | |
| 875 | | |
| 875 | | |
| 876 | 876 | |
| 877 | 877 | memset(&swlist->state, 0, sizeof(swlist->state)); |
| 878 | 878 | swlist->state.error_proc = error_proc; |
| r10384 | r10385 | |
| 892 | 892 | |
| 893 | 893 | while(!swlist->state.done) |
| 894 | 894 | { |
| 895 | len = mame_fread(swlist->file, buf, sizeof(buf)); | |
| 896 | swlist->state.done = mame_feof(swlist->file); | |
| 895 | len = swlist->file->read(buf, sizeof(buf)); | |
| 896 | swlist->state.done = swlist->file->eof(); | |
| 897 | 897 | if (XML_Parse(swlist->state.parser, buf, len, swlist->state.done) == XML_STATUS_ERROR) |
| 898 | 898 | { |
| 899 | 899 | parse_error(&swlist->state, "[%lu:%lu]: %s\n", |
| r10384 | r10385 | |
| 917 | 917 | software_list_open |
| 918 | 918 | -------------------------------------------------*/ |
| 919 | 919 | |
| 920 | software_list *software_list_open(core_options | |
| 920 | software_list *software_list_open(core_options &options, const char *listname, int is_preload, | |
| 921 | 921 | void (*error_proc)(const char *message)) |
| 922 | 922 | { |
| 923 | file_error filerr; | |
| 924 | astring *fname; | |
| 925 | 923 | software_list *swlist = NULL; |
| 926 | 924 | object_pool *pool = NULL; |
| 925 | file_error filerr; | |
| 927 | 926 | |
| 928 | 927 | /* create a pool for this software list file */ |
| 929 | 928 | pool = pool_alloc_lib(error_proc); |
| r10384 | r10385 | |
| 941 | 940 | swlist->error_proc = error_proc; |
| 942 | 941 | |
| 943 | 942 | /* open a file */ |
| 944 | fname = astring_assemble_2(astring_alloc(), listname, ".xml"); | |
| 945 | filerr = mame_fopen_options(options, SEARCHPATH_HASH, astring_c(fname), OPEN_FLAG_READ, &swlist->file); | |
| 946 | astring_free(fname); | |
| 947 | ||
| 943 | swlist->file = global_alloc(emu_file(options, SEARCHPATH_HASH, OPEN_FLAG_READ)); | |
| 944 | filerr = swlist->file->open(listname, ".xml"); | |
| 948 | 945 | if (filerr != FILERR_NONE) |
| 949 | 946 | goto error; |
| 950 | 947 | |
| r10384 | r10385 | |
| 972 | 969 | if (swlist == NULL) |
| 973 | 970 | return; |
| 974 | 971 | |
| 975 | if (swlist->file) | |
| 976 | mame_fclose(swlist->file); | |
| 972 | if (swlist->file != NULL) | |
| 973 | global_free(swlist->file); | |
| 977 | 974 | pool_free_lib(swlist->pool); |
| 978 | 975 | } |
| 979 | 976 | |
| r10384 | r10385 | |
| 1290 | 1287 | if ( swlist_name ) |
| 1291 | 1288 | { |
| 1292 | 1289 | /* Try to open the software list xml file explicitly named by the user */ |
| 1293 | software_list_ptr = software_list_open( mame | |
| 1290 | software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL ); | |
| 1294 | 1291 | |
| 1295 | 1292 | if ( software_list_ptr ) |
| 1296 | 1293 | { |
| r10384 | r10385 | |
| 1562 | 1559 | { |
| 1563 | 1560 | if (swlist->list_name[i]) |
| 1564 | 1561 | { |
| 1565 | if (mame_options() == NULL) | |
| 1566 | return FALSE; | |
| 1562 | software_list *list = software_list_open(options, swlist->list_name[i], FALSE, NULL); | |
| 1567 | 1563 | |
| 1568 | software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL); | |
| 1569 | ||
| 1570 | 1564 | /* if no .xml list is found, then return (this happens e.g. if you moved/renamed the xml list) */ |
| 1571 | 1565 | if (list == NULL) |
| 1572 | 1566 | return FALSE; |
| r10384 | r10385 | |
| 1904 | 1898 | { |
| 1905 | 1899 | device_image_interface *image = sw_state->image; |
| 1906 | 1900 | software_entry_state *entry = (software_entry_state *) event->itemref; |
| 1907 | software_list *tmp_list = software_list_open(ma | |
| 1901 | software_list *tmp_list = software_list_open(machine->options(), sw_state->list_name, FALSE, NULL); | |
| 1908 | 1902 | software_info *tmp_info = software_list_find(tmp_list, entry->short_name, NULL); |
| 1909 | 1903 | |
| 1910 | 1904 | // if the selected software has multiple parts that can be loaded, open the submenu |
| r10384 | r10385 | |
| 1944 | 1938 | { |
| 1945 | 1939 | if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) |
| 1946 | 1940 | { |
| 1947 | software_list *list = software_list_open(ma | |
| 1941 | software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL); | |
| 1948 | 1942 | |
| 1949 | 1943 | if (list) |
| 1950 | 1944 | { |
| r10384 | r10385 | |
| 1974 | 1968 | { |
| 1975 | 1969 | if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_COMPATIBLE_SYSTEM)) |
| 1976 | 1970 | { |
| 1977 | software_list *list = software_list_open(ma | |
| 1971 | software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL); | |
| 1978 | 1972 | |
| 1979 | 1973 | if (list) |
| 1980 | 1974 | { |
| r10384 | r10385 | |
|---|---|---|
| 127 | 127 | |
| 128 | 128 | protected: |
| 129 | 129 | // optional operation overrides |
| 130 | virtual bool interface_validity_check(const game_driver &driver) const; | |
| 130 | virtual bool interface_validity_check(core_options &options, const game_driver &driver) const; | |
| 131 | 131 | |
| 132 | 132 | // internal state |
| 133 | 133 | simple_list<sound_route> m_route_list; // list of sound routes |
| r10384 | r10385 | |
|---|---|---|
| 55 | 55 | typedef struct _software_list software_list; |
| 56 | 56 | |
| 57 | 57 | /* Handling a software list */ |
| 58 | software_list *software_list_open(core_options | |
| 58 | software_list *software_list_open(core_options &options, const char *listname, int is_preload, void (*error_proc)(const char *message)); | |
| 59 | 59 | void software_list_close(software_list *swlist); |
| 60 | 60 | software_info *software_list_find(software_list *swlist, const char *look_for, software_info *prev); |
| 61 | 61 | const char *software_list_get_description(software_list *swlist); |
| r10384 | r10385 | |
| 65 | 65 | software_part *software_part_next(software_part *part); |
| 66 | 66 | |
| 67 | 67 | /* helpers */ |
| 68 | const char *software_get_clone(char *swlist, const char *swname); | |
| 69 | UINT32 software_get_support(char *swlist, const char *swname); | |
| 68 | const char *software_get_clone(core_options &options, char *swlist, const char *swname); | |
| 69 | UINT32 software_get_support(core_options &options, char *swlist, const char *swname); | |
| 70 | 70 | const char *software_part_get_feature(software_part *part, const char *feature_name); |
| 71 | 71 | |
| 72 | 72 | bool load_software_part(device_image_interface *image, const char *path, software_info **sw_info, software_part **sw_part, char **full_sw_name); |
| r10384 | r10385 | |
|---|---|---|
| 325 | 325 | // " swlist % clonename % parentname " |
| 326 | 326 | // below, we have the code to split the elements and to create paths to load from |
| 327 | 327 | |
| 328 | software_list *software_list_ptr = software_list_open(m | |
| 328 | software_list *software_list_ptr = software_list_open(m_machine.options(), swlist, FALSE, NULL); | |
| 329 | 329 | if (software_list_ptr) |
| 330 | 330 | { |
| 331 | 331 | for (software_info *swinfo = software_list_find(software_list_ptr, swname, NULL); swinfo != NULL; ) |
| r10384 | r10385 | |
| 337 | 337 | locationtag.cat(breakstr); |
| 338 | 338 | //printf("%s\n", locationtag.cstr()); |
| 339 | 339 | } |
| 340 | const char *parentname = software_get_clone(swlist, swinfo->shortname); | |
| 340 | const char *parentname = software_get_clone(m_machine.options(), swlist, swinfo->shortname); | |
| 341 | 341 | if (parentname != NULL) |
| 342 | 342 | swinfo = software_list_find(software_list_ptr, parentname, NULL); |
| 343 | 343 | else |
| r10384 | r10385 | |
| 348 | 348 | software_list_close(software_list_ptr); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | if (software_get_support(swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) | |
| 351 | if (software_get_support(m_machine.options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) | |
| 352 | 352 | mame_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist); |
| 353 | 353 | |
| 354 | if (software_get_support(swlist, swname) == SOFTWARE_SUPPORTED_NO) | |
| 354 | if (software_get_support(m_machine.options(), swlist, swname) == SOFTWARE_SUPPORTED_NO) | |
| 355 | 355 | mame_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist); |
| 356 | 356 | |
| 357 | 357 | // check if locationtag actually contains two locations separated by '%' |
| r10384 | r10385 | |
| 381 | 381 | // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname |
| 382 | 382 | // try to load from list/setname |
| 383 | 383 | if ((m_mame_file == NULL) && (tag2.cstr() != NULL)) |
| 384 | filerr = common_process_file(tag2.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 384 | filerr = common_process_file(m_machine.options(), tag2.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 385 | 385 | // try to load from list/parentname |
| 386 | 386 | if ((m_mame_file == NULL) && (tag3.cstr() != NULL)) |
| 387 | filerr = common_process_file(tag3.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 387 | filerr = common_process_file(m_machine.options(), tag3.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 388 | 388 | // try to load from setname |
| 389 | 389 | if ((m_mame_file == NULL) && (tag4.cstr() != NULL)) |
| 390 | filerr = common_process_file(tag4.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 390 | filerr = common_process_file(m_machine.options(), tag4.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 391 | 391 | // try to load from parentname |
| 392 | 392 | if ((m_mame_file == NULL) && (tag5.cstr() != NULL)) |
| 393 | filerr = common_process_file(tag5.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 393 | filerr = common_process_file(m_machine.options(), tag5.cstr(), has_crc, crc, romp, &m_mame_file); | |
| 394 | 394 | |
| 395 | 395 | if (filerr == FILERR_NONE) |
| 396 | 396 | { |
| 397 | m_file = m | |
| 397 | m_file = *m | |
| 398 | 398 | retVal = TRUE; |
| 399 | 399 | } |
| 400 | 400 | |
| r10384 | r10385 | |
| 588 | 588 | { |
| 589 | 589 | if (m_mame_file) |
| 590 | 590 | { |
| 591 | | |
| 591 | global | |
| 592 | 592 | m_mame_file = NULL; |
| 593 | 593 | m_file = NULL; |
| 594 | 594 | } else { |
| r10384 | r10385 | |
|---|---|---|
| 125 | 125 | INI files |
| 126 | 126 | -------------------------------------------------*/ |
| 127 | 127 | |
| 128 | static int write_config(const char *filename, const game_driver *gamedrv) | |
| 128 | static int write_config(core_options &options, const char *filename, const game_driver *gamedrv) | |
| 129 | 129 | { |
| 130 | file_error filerr; | |
| 131 | mame_file *f; | |
| 132 | 130 | char buffer[128]; |
| 133 | 131 | int retval = 1; |
| 134 | 132 | |
| r10384 | r10385 | |
| 138 | 136 | filename = buffer; |
| 139 | 137 | } |
| 140 | 138 | |
| 141 | filerr = mame_fopen(SEARCHPATH_INI, buffer, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &f); | |
| 142 | if (filerr != FILERR_NONE) | |
| 143 | goto done; | |
| 144 | ||
| 145 | options_output_ini_file(mame_options(), mame_core_file(f)); | |
| 146 | retval = 0; | |
| 147 | ||
| 148 | done: | |
| 149 | if (f != NULL) | |
| 150 | mame_fclose(f); | |
| 139 | emu_file file(options, SEARCHPATH_INI, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 140 | file_error filerr = file.open(filename); | |
| 141 | if (filerr == FILERR_NONE) | |
| 142 | { | |
| 143 | options_output_ini_file(&options, file); | |
| 144 | retval = 0; | |
| 145 | } | |
| 151 | 146 | return retval; |
| 152 | 147 | } |
| 153 | 148 | |
| r10384 | r10385 | |
| 159 | 154 | static void image_options_extract(running_machine *machine) |
| 160 | 155 | { |
| 161 | 156 | /* only extract the device options if we've added them */ |
| 162 | if (options_get_bool(machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) { | |
| 157 | if (options_get_bool(&machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) { | |
| 163 | 158 | int index = 0; |
| 164 | 159 | device_image_interface *image = NULL; |
| 165 | 160 | |
| r10384 | r10385 | |
| 168 | 163 | const char *filename = image->filename(); |
| 169 | 164 | |
| 170 | 165 | /* and set the option */ |
| 171 | options_set_string(machine->options(), image->image_config().instance_name() , filename ? filename : "", OPTION_PRIORITY_CMDLINE); | |
| 166 | options_set_string(&machine->options(), image->image_config().instance_name() , filename ? filename : "", OPTION_PRIORITY_CMDLINE); | |
| 172 | 167 | |
| 173 | 168 | index++; |
| 174 | 169 | } |
| 175 | 170 | } |
| 176 | 171 | |
| 177 | 172 | /* write the config, if appropriate */ |
| 178 | if (options_get_bool(machine->options(), OPTION_WRITECONFIG)) | |
| 179 | write_config(NULL, machine->gamedrv); | |
| 173 | if (options_get_bool(&machine->options(), OPTION_WRITECONFIG)) | |
| 174 | write_config(machine->options(), NULL, machine->gamedrv); | |
| 180 | 175 | } |
| 181 | 176 | |
| 182 | 177 | /*------------------------------------------------- |
| r10384 | r10385 | |
| 303 | 298 | image; typically for cartridges. |
| 304 | 299 | ****************************************************************************/ |
| 305 | 300 | |
| 306 | /*------------------------------------------------- | |
| 307 | open_battery_file_by_name - opens the battery backed | |
| 308 | NVRAM file for an image | |
| 309 | -------------------------------------------------*/ | |
| 310 | ||
| 311 | static file_error open_battery_file_by_name(const char *filename, UINT32 openflags, mame_file **file) | |
| 312 | { | |
| 313 | file_error filerr; | |
| 314 | filerr = mame_fopen(SEARCHPATH_NVRAM, filename, openflags, file); | |
| 315 | return filerr; | |
| 316 | } | |
| 317 | ||
| 318 | 301 | static char *stripspace(const char *src) |
| 319 | 302 | { |
| 320 | 303 | static char buff[512]; |
| r10384 | r10385 | |
| 444 | 427 | to the function. |
| 445 | 428 | -------------------------------------------------*/ |
| 446 | 429 | |
| 447 | void image_battery_load_by_name(const char *filename, void *buffer, int length, int fill) | |
| 430 | void image_battery_load_by_name(core_options &options, const char *filename, void *buffer, int length, int fill) | |
| 448 | 431 | { |
| 449 | 432 | file_error filerr; |
| 450 | mame_file *file; | |
| 451 | 433 | int bytes_read = 0; |
| 452 | 434 | |
| 453 | 435 | assert_always(buffer && (length > 0), "Must specify sensical buffer/length"); |
| 454 | 436 | |
| 455 | 437 | /* try to open the battery file and read it in, if possible */ |
| 456 | filerr = open_battery_file_by_name(filename, OPEN_FLAG_READ, &file); | |
| 438 | emu_file file(options, SEARCHPATH_NVRAM, OPEN_FLAG_READ); | |
| 439 | filerr = file.open(filename); | |
| 457 | 440 | if (filerr == FILERR_NONE) |
| 458 | { | |
| 459 | bytes_read = mame_fread(file, buffer, length); | |
| 460 | mame_fclose(file); | |
| 461 | } | |
| 441 | bytes_read = file.read(buffer, length); | |
| 462 | 442 | |
| 463 | 443 | /* fill remaining bytes (if necessary) */ |
| 464 | 444 | memset(((char *) buffer) + bytes_read, fill, length - bytes_read); |
| r10384 | r10385 | |
| 469 | 449 | backed RAM for an image. A filename may be supplied |
| 470 | 450 | to the function. |
| 471 | 451 | -------------------------------------------------*/ |
| 472 | void image_battery_save_by_name(const char *filename, const void *buffer, int length) | |
| 452 | void image_battery_save_by_name(core_options &options, const char *filename, const void *buffer, int length) | |
| 473 | 453 | { |
| 474 | file_error filerr; | |
| 475 | mame_file *file; | |
| 476 | ||
| 477 | 454 | assert_always(buffer && (length > 0), "Must specify sensical buffer/length"); |
| 478 | 455 | |
| 479 | 456 | /* try to open the battery file and write it out, if possible */ |
| 480 | filerr = open_battery_file_by_name(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 457 | emu_file file(options, SEARCHPATH_NVRAM, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 458 | file_error filerr = file.open(filename); | |
| 481 | 459 | if (filerr == FILERR_NONE) |
| 482 | { | |
| 483 | mame_fwrite(file, buffer, length); | |
| 484 | mame_fclose(file); | |
| 485 | } | |
| 460 | file.write(buffer, length); | |
| 486 | 461 | } |
| 487 | 462 | |
| 488 | 463 | /*------------------------------------------------- |
| r10384 | r10385 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | extern struct io_procs image_ioprocs; |
| 27 | 27 | |
| 28 | void image_battery_load_by_name(const char *filename, void *buffer, int length, int fill); | |
| 29 | void image_battery_save_by_name(const char *filename, const void *buffer, int length); | |
| 28 | void image_battery_load_by_name(core_options &options, const char *filename, void *buffer, int length, int fill); | |
| 29 | void image_battery_save_by_name(core_options &options, const char *filename, const void *buffer, int length); | |
| 30 | 30 | |
| 31 | 31 | astring *image_info_astring(running_machine *machine, astring *string); |
| 32 | 32 |
| r10384 | r10385 | |
|---|---|---|
| 192 | 192 | sharedname = &intf->samplenames[sampnum][1]; |
| 193 | 193 | else |
| 194 | 194 | { |
| 195 | file_error filerr; | |
| 196 | mame_file *file; | |
| 197 | ||
| 198 | 195 | /* attempt to access the file from the game driver name */ |
| 199 | astring fname(gamedrv->name, PATH_SEPARATOR, intf->samplenames[sampnum]); | |
| 200 | filerr = mame_fopen_options(options, SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 196 | emu_file file(*options, SEARCHPATH_SAMPLE, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); | |
| 197 | file_error filerr = file.open(gamedrv->name, PATH_SEPARATOR, intf->samplenames[sampnum]); | |
| 201 | 198 | |
| 202 | 199 | /* attempt to access the file from the shared driver name */ |
| 203 | 200 | if (filerr != FILERR_NONE && sharedname != NULL) |
| 204 | { | |
| 205 | fname.cpy(sharedname).cat(PATH_SEPARATOR).cat(intf->samplenames[sampnum]); | |
| 206 | filerr = mame_fopen_options(options, SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 207 | } | |
| 201 | filerr = file.open(sharedname, PATH_SEPARATOR, intf->samplenames[sampnum]); | |
| 208 | 202 | |
| 209 | 203 | /* fill in the record */ |
| 210 | 204 | record->type = AUDIT_FILE_SAMPLE; |
| 211 | 205 | record->name = intf->samplenames[sampnum]; |
| 212 | 206 | if (filerr == FILERR_NONE) |
| 213 | { | |
| 214 | 207 | set_status(record++, AUDIT_STATUS_GOOD, SUBSTATUS_GOOD); |
| 215 | mame_fclose(file); | |
| 216 | } | |
| 217 | 208 | else |
| 218 | 209 | set_status(record++, AUDIT_STATUS_NOT_FOUND, SUBSTATUS_NOT_FOUND); |
| 219 | 210 | } |
| r10384 | r10385 | |
| 350 | 341 | /* find the file and checksum it, getting the file length along the way */ |
| 351 | 342 | for (drv = gamedrv; drv != NULL; drv = driver_get_clone(drv)) |
| 352 | 343 | { |
| 353 | file_error filerr; | |
| 354 | mame_file *file; | |
| 344 | emu_file file(*options, SEARCHPATH_ROM, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); | |
| 355 | 345 | |
| 356 | 346 | /* open the file if we can */ |
| 357 | astring fname(drv->name, PATH_SEPARATOR, ROM_GETNAME(rom)); | |
| 358 | if (has_crc) | |
| 359 | filerr = mame_fopen_crc_options(options, SEARCHPATH_ROM, fname, crc, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 347 | file_error filerr; | |
| 348 | if (has_crc) | |
| 349 | filerr = file.open(drv->name, PATH_SEPARATOR, ROM_GETNAME(rom), crc); | |
| 360 | 350 | else |
| 361 | filerr = mame_fopen_options(options, SEARCHPATH_ROM, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 362 | ||
| 363 | /* if we got it, extract the hash and length */ | |
| 351 | filerr = file.open(drv->name, PATH_SEPARATOR, ROM_GETNAME(rom)); | |
| 364 | 352 | if (filerr == FILERR_NONE) |
| 365 | 353 | { |
| 366 | hash_data_copy(record->hash, mame_fhash(file, validation)); | |
| 367 | record->length = (UINT32)mame_fsize(file); | |
| 368 | mame_fclose(file); | |
| 354 | hash_data_copy(record->hash, file.hash_string(validation)); | |
| 355 | record->length = (UINT32)file.size(); | |
| 369 | 356 | break; |
| 370 | 357 | } |
| 371 | 358 | } |
| r10384 | r10385 | |
| 373 | 360 | /* if not found, check the region as a backup */ |
| 374 | 361 | if (record->length == 0 && regiontag != NULL) |
| 375 | 362 | { |
| 376 | file_error filerr; | |
| 377 | mame_file *file; | |
| 363 | emu_file file(*options, SEARCHPATH_ROM, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); | |
| 378 | 364 | |
| 379 | 365 | /* open the file if we can */ |
| 380 | | |
| 366 | | |
| 381 | 367 | if (has_crc) |
| 382 | filerr = mame_fopen_crc_options(options, SEARCHPATH_ROM, fname, crc, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 383 | else | |
| 384 | filerr = mame_fopen_options(options, SEARCHPATH_ROM, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); | |
| 385 | ||
| 386 | /* if we got it, extract the hash and length */ | |
| 368 | filerr = file.open(regiontag, PATH_SEPARATOR, ROM_GETNAME(rom), crc); | |
| 369 | else | |
| 370 | filerr = file.open(regiontag, PATH_SEPARATOR, ROM_GETNAME(rom)); | |
| 387 | 371 | if (filerr == FILERR_NONE) |
| 388 | 372 | { |
| 389 | hash_data_copy(record->hash, mame_fhash(file, validation)); | |
| 390 | record->length = (UINT32)mame_fsize(file); | |
| 391 | mame_fclose(file); | |
| 373 | hash_data_copy(record->hash, file.hash_string(validation)); | |
| 374 | record->length = (UINT32)file.size(); | |
| 392 | 375 | } |
| 393 | 376 | } |
| 394 | 377 | |
| r10384 | r10385 | |
| 446 | 429 | |
| 447 | 430 | static void audit_one_disk(core_options *options, const rom_entry *rom, const game_driver *gamedrv, UINT32 validation, audit_record *record) |
| 448 | 431 | { |
| 449 | | |
| 432 | | |
| 450 | 433 | chd_file *source; |
| 451 | 434 | chd_error err; |
| 452 | 435 | |
| r10384 | r10385 | |
| 456 | 439 | record->exphash = ROM_GETHASHDATA(rom); |
| 457 | 440 | |
| 458 | 441 | /* open the disk */ |
| 459 | err = open_disk_image | |
| 442 | err = open_disk_image | |
| 460 | 443 | |
| 461 | 444 | /* if we failed, report the error */ |
| 462 | 445 | if (err != CHDERR_NONE) |
| r10384 | r10385 | |
| 507 | 490 | set_status(record, AUDIT_STATUS_GOOD, SUBSTATUS_GOOD); |
| 508 | 491 | |
| 509 | 492 | chd_close(source); |
| 510 | | |
| 493 | global | |
| 511 | 494 | } |
| 512 | 495 | } |
| 513 | 496 |
| r10384 | r10385 | |
|---|---|---|
| 135 | 135 | |
| 136 | 136 | EMUMACHINEOBJS = \ |
| 137 | 137 | $(EMUMACHINE)/53c810.o \ |
| 138 | $(EMUMACHINE)/6532riot.o \ | |
| 139 | 138 | $(EMUMACHINE)/6522via.o \ |
| 140 | 139 | $(EMUMACHINE)/6526cia.o \ |
| 140 | $(EMUMACHINE)/6532riot.o \ | |
| 141 | 141 | $(EMUMACHINE)/6821pia.o \ |
| 142 | 142 | $(EMUMACHINE)/6840ptm.o \ |
| 143 | 143 | $(EMUMACHINE)/6850acia.o \ |
| 144 | 144 | $(EMUMACHINE)/68681.o \ |
| 145 | $(EMUMACHINE)/7474.o \ | |
| 146 | 145 | $(EMUMACHINE)/74123.o \ |
| 147 | 146 | $(EMUMACHINE)/74148.o \ |
| 148 | 147 | $(EMUMACHINE)/74153.o \ |
| 149 | 148 | $(EMUMACHINE)/74181.o \ |
| 149 | $(EMUMACHINE)/7474.o \ | |
| 150 | 150 | $(EMUMACHINE)/8042kbdc.o \ |
| 151 | 151 | $(EMUMACHINE)/8237dma.o \ |
| 152 | $(EMUMACHINE)/8255ppi.o \ | |
| 152 | 153 | $(EMUMACHINE)/8257dma.o \ |
| 153 | $(EMUMACHINE)/8255ppi.o \ | |
| 154 | 154 | $(EMUMACHINE)/adc083x.o \ |
| 155 | 155 | $(EMUMACHINE)/adc1038.o \ |
| 156 | 156 | $(EMUMACHINE)/adc1213x.o \ |
| 157 | 157 | $(EMUMACHINE)/am53cf96.o \ |
| 158 | 158 | $(EMUMACHINE)/at28c16.o \ |
| 159 | 159 | $(EMUMACHINE)/cdp1852.o \ |
| 160 | $(EMUMACHINE)/cr589.o \ | |
| 160 | 161 | $(EMUMACHINE)/ds1302.o \ |
| 161 | 162 | $(EMUMACHINE)/ds2401.o \ |
| 162 | 163 | $(EMUMACHINE)/ds2404.o \ |
| r10384 | r10385 | |
| 164 | 165 | $(EMUMACHINE)/er2055.o \ |
| 165 | 166 | $(EMUMACHINE)/f3853.o \ |
| 166 | 167 | $(EMUMACHINE)/generic.o \ |
| 168 | $(EMUMACHINE)/i2cmem.o \ | |
| 167 | 169 | $(EMUMACHINE)/i8243.o \ |
| 168 | 170 | $(EMUMACHINE)/i8255a.o \ |
| 169 | $(EMUMACHINE)/i2cmem.o \ | |
| 170 | 171 | $(EMUMACHINE)/idectrl.o \ |
| 171 | 172 | $(EMUMACHINE)/ins8154.o \ |
| 172 | 173 | $(EMUMACHINE)/ins8250.o \ |
| r10384 | r10385 | |
| 188 | 189 | $(EMUMACHINE)/nvram.o \ |
| 189 | 190 | $(EMUMACHINE)/pc16552d.o \ |
| 190 | 191 | $(EMUMACHINE)/pci.o \ |
| 192 | $(EMUMACHINE)/pd4990a.o \ | |
| 191 | 193 | $(EMUMACHINE)/pic8259.o \ |
| 192 | 194 | $(EMUMACHINE)/pit8253.o \ |
| 193 | $(EMUMACHINE)/pd4990a.o \ | |
| 194 | 195 | $(EMUMACHINE)/ram.o \ |
| 195 | 196 | $(EMUMACHINE)/roc10937.o \ |
| 196 | 197 | $(EMUMACHINE)/rp5h01.o \ |
| r10384 | r10385 | |
| 202 | 203 | $(EMUMACHINE)/scsicd.o \ |
| 203 | 204 | $(EMUMACHINE)/scsidev.o \ |
| 204 | 205 | $(EMUMACHINE)/scsihd.o \ |
| 205 | $(EMUMACHINE)/c | |
| 206 | $(EMUMACHINE)/secflash.o \ | |
| 206 | 207 | $(EMUMACHINE)/smc91c9x.o \ |
| 207 | 208 | $(EMUMACHINE)/timekpr.o \ |
| 208 | 209 | $(EMUMACHINE)/tmp68301.o \ |
| r10384 | r10385 | |
|---|---|---|
| 96 | 96 | GLOBAL VARIABLES |
| 97 | 97 | ***************************************************************************/ |
| 98 | 98 | |
| 99 | /* the current options */ | |
| 100 | static core_options *mame_opts; | |
| 101 | ||
| 102 | 99 | /* started empty? */ |
| 103 | 100 | static bool started_empty; |
| 104 | 101 | |
| 102 | static bool print_verbose = false; | |
| 103 | ||
| 105 | 104 | static running_machine *global_machine; |
| 106 | 105 | |
| 107 | 106 | /* output channels */ |
| r10384 | r10385 | |
| 153 | 152 | bool firstgame = true; |
| 154 | 153 | bool firstrun = true; |
| 155 | 154 | |
| 155 | // extract the verbose printing option | |
| 156 | if (options_get_bool(options, OPTION_VERBOSE)) | |
| 157 | print_verbose = true; | |
| 158 | ||
| 156 | 159 | // loop across multiple hard resets |
| 157 | 160 | bool exit_pending = false; |
| 158 | 161 | int error = MAMERR_NONE; |
| 159 | 162 | while (error == MAMERR_NONE && !exit_pending) |
| 160 | 163 | { |
| 161 | // specify the global mame_options | |
| 162 | mame_opts = options; | |
| 163 | ||
| 164 | 164 | // convert the specified gamename to a driver |
| 165 | 165 | astring gamename; |
| 166 | 166 | core_filename_extract_base(&gamename, options_get_string(options, OPTION_GAMENAME), true); |
| r10384 | r10385 | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // otherwise, perform validity checks before anything else |
| 178 | else if (mame_validitychecks(driver) != 0) | |
| 178 | else if (mame_validitychecks(*options, driver) != 0) | |
| 179 | 179 | return MAMERR_FAILED_VALIDITY; |
| 180 | 180 | |
| 181 | 181 | firstgame = false; |
| r10384 | r10385 | |
| 217 | 217 | // clear flag for added devices |
| 218 | 218 | options_set_bool(options, OPTION_ADDED_DEVICE_OPTIONS, FALSE, OPTION_PRIORITY_CMDLINE); |
| 219 | 219 | } |
| 220 | ||
| 221 | // reset the options | |
| 222 | mame_opts = NULL; | |
| 223 | 220 | } |
| 224 | 221 | |
| 225 | 222 | // return an error |
| r10384 | r10385 | |
| 227 | 224 | } |
| 228 | 225 | |
| 229 | 226 | |
| 230 | /*------------------------------------------------- | |
| 231 | mame_options - accesses the options for the | |
| 232 | currently running emulation | |
| 233 | -------------------------------------------------*/ | |
| 234 | ||
| 235 | core_options *mame_options(void) | |
| 236 | { | |
| 237 | assert(mame_opts != NULL); | |
| 238 | return mame_opts; | |
| 239 | } | |
| 240 | ||
| 241 | ||
| 242 | ||
| 243 | /*------------------------------------------------- | |
| 244 | set_mame_options - set mame options, used by | |
| 245 | validate option | |
| 246 | -------------------------------------------------*/ | |
| 247 | ||
| 248 | void set_mame_options(core_options *options) | |
| 249 | { | |
| 250 | mame_opts = options; | |
| 251 | } | |
| 252 | ||
| 253 | ||
| 254 | 227 | /*************************************************************************** |
| 255 | 228 | OUTPUT MANAGEMENT |
| 256 | 229 | ***************************************************************************/ |
| r10384 | r10385 | |
| 377 | 350 | va_list argptr; |
| 378 | 351 | |
| 379 | 352 | /* if we're not verbose, skip it */ |
| 380 | if ( | |
| 353 | if ( | |
| 381 | 354 | return; |
| 382 | 355 | |
| 383 | 356 | /* by default, we go to stdout */ |
| r10384 | r10385 | |
| 567 | 540 | |
| 568 | 541 | static int parse_ini_file(core_options *options, const char *name, int priority) |
| 569 | 542 | { |
| 570 | file_error filerr; | |
| 571 | mame_file *file; | |
| 572 | ||
| 573 | 543 | /* update game name so depending callback options could be added */ |
| 574 | if (priority==OPTION_PRIORITY_DRIVER_INI || priority==OPTION_PRIORITY_SOURCE_INI) | |
| 544 | if (priority == OPTION_PRIORITY_DRIVER_INI || priority == OPTION_PRIORITY_SOURCE_INI) | |
| 575 | 545 | options_force_option_callback(options, OPTION_GAMENAME, name, priority); |
| 576 | } | |
| 577 | 546 | |
| 578 | 547 | /* don't parse if it has been disabled */ |
| 579 | 548 | if (!options_get_bool(options, OPTION_READCONFIG)) |
| 580 | 549 | return FALSE; |
| 581 | 550 | |
| 582 | 551 | /* open the file; if we fail, that's ok */ |
| 583 | astring fname(name, ".ini"); | |
| 584 | filerr = mame_fopen_options(options, SEARCHPATH_INI, fname, OPEN_FLAG_READ, &file); | |
| 552 | emu_file file(*options, SEARCHPATH_INI, OPEN_FLAG_READ); | |
| 553 | file_error filerr = file.open(name, ".ini"); | |
| 585 | 554 | if (filerr != FILERR_NONE) |
| 586 | 555 | return FALSE; |
| 587 | 556 | |
| 588 | 557 | /* parse the file and close it */ |
| 589 | 558 | mame_printf_verbose("Parsing %s.ini\n", name); |
| 590 | options_parse_ini_file(options, mame_core_file(file), priority, OPTION_PRIORITY_DRIVER_INI); | |
| 591 | mame_fclose(file); | |
| 559 | options_parse_ini_file(options, file, priority, OPTION_PRIORITY_DRIVER_INI); | |
| 592 | 560 | return TRUE; |
| 593 | 561 | } |
| r10384 | r10385 | |
|---|---|---|
| 139 | 139 | return; |
| 140 | 140 | |
| 141 | 141 | // load the raw data instead |
| 142 | mame_file *ramfile; | |
| 143 | file_error filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile); | |
| 142 | emu_file ramfile(manager.machine().options(), NULL, OPEN_FLAG_READ); | |
| 143 | file_error filerr = ramfile.open_ram(font_uismall, sizeof(font_uismall)); | |
| 144 | 144 | if (filerr == FILERR_NONE) |
| 145 | { | |
| 146 | 145 | load_cached(ramfile, 0); |
| 147 | mame_fclose(ramfile); | |
| 148 | } | |
| 149 | 146 | } |
| 150 | 147 | |
| 151 | 148 | |
| r10384 | r10385 | |
| 415 | 412 | bool render_font::load_cached_bdf(const char *filename) |
| 416 | 413 | { |
| 417 | 414 | // first try to open the BDF itself |
| 418 | mame_file *file; | |
| 419 | file_error filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_READ, &file); | |
| 415 | emu_file file(manager().machine().options(), SEARCHPATH_FONT, OPEN_FLAG_READ); | |
| 416 | file_error filerr = file.open(filename); | |
| 420 | 417 | if (filerr != FILERR_NONE) |
| 421 | 418 | return false; |
| 422 | 419 | |
| 423 | 420 | // determine the file size and allocate memory |
| 424 | m_rawsize = | |
| 421 | m_rawsize = | |
| 425 | 422 | char *data = auto_alloc_array_clear(&m_manager.machine(), char, m_rawsize + 1); |
| 426 | 423 | |
| 427 | 424 | // read the first chunk |
| 428 | UINT32 bytes = | |
| 425 | UINT32 bytes = | |
| 429 | 426 | if (bytes != MIN(CACHED_BDF_HASH_SIZE, m_rawsize)) |
| 430 | { | |
| 431 | mame_fclose(file); | |
| 432 | 427 | return false; |
| 433 | } | |
| 434 | 428 | |
| 435 | 429 | // has the chunk |
| 436 | 430 | UINT32 hash = crc32(0, (const UINT8 *)data, bytes) ^ (UINT32)m_rawsize; |
| r10384 | r10385 | |
| 440 | 434 | cachedname.del(cachedname.len() - 3, 3).cat("bdc"); |
| 441 | 435 | |
| 442 | 436 | // attempt to open the cached version of the font |
| 443 | mame_file *cachefile; | |
| 444 | filerr = mame_fopen(SEARCHPATH_FONT, cachedname, OPEN_FLAG_READ, &cachefile); | |
| 445 | if (filerr == FILERR_NONE) | |
| 446 | 437 | { |
| 447 | // if we have a cached version, load it | |
| 448 | bool result = load_cached(cachefile, hash); | |
| 449 | mame_fclose(cachefile); | |
| 450 | ||
| 451 | // if that worked, we're done | |
| 452 | if (result) | |
| 438 | emu_file cachefile(manager().machine().options(), SEARCHPATH_FONT, OPEN_FLAG_READ); | |
| 439 | filerr = cachefile.open(cachedname); | |
| 440 | if (filerr == FILERR_NONE) | |
| 453 | 441 | { |
| 454 | mame_fclose(file); | |
| 455 | auto_free(&m_manager.machine(), data); | |
| 456 | return true; | |
| 442 | // if we have a cached version, load it | |
| 443 | bool result = load_cached(cachefile, hash); | |
| 444 | ||
| 445 | // if that worked, we're done | |
| 446 | if (result) | |
| 447 | { | |
| 448 | auto_free(&m_manager.machine(), data); | |
| 449 | return true; | |
| 450 | } | |
| 457 | 451 | } |
| 458 | 452 | } |
| 459 | 453 | |
| 460 | 454 | // read in the rest of the font |
| 461 | 455 | if (bytes < m_rawsize) |
| 462 | 456 | { |
| 463 | UINT32 read = | |
| 457 | UINT32 read = | |
| 464 | 458 | if (read != m_rawsize - bytes) |
| 465 | 459 | { |
| 466 | mame_fclose(file); | |
| 467 | 460 | auto_free(&m_manager.machine(), data); |
| 468 | 461 | return false; |
| 469 | 462 | } |
| r10384 | r10385 | |
| 481 | 474 | save_cached(cachedname, hash); |
| 482 | 475 | |
| 483 | 476 | // close the file |
| 484 | mame_fclose(file); | |
| 485 | 477 | return result; |
| 486 | 478 | } |
| 487 | 479 | |
| r10384 | r10385 | |
| 604 | 596 | // load_cached - load a font in cached format |
| 605 | 597 | //------------------------------------------------- |
| 606 | 598 | |
| 607 | bool render_font::load_cached( | |
| 599 | bool render_font::load_cached( | |
| 608 | 600 | { |
| 609 | 601 | // get the file size |
| 610 | UINT64 filesize = | |
| 602 | UINT64 filesize = | |
| 611 | 603 | |
| 612 | 604 | // first read the header |
| 613 | 605 | UINT8 header[CACHED_HEADER_SIZE]; |
| 614 | UINT32 bytes_read = | |
| 606 | UINT32 bytes_read = | |
| 615 | 607 | if (bytes_read != CACHED_HEADER_SIZE) |
| 616 | 608 | return false; |
| 617 | 609 | |
| r10384 | r10385 | |
| 629 | 621 | |
| 630 | 622 | // now read the rest of the data |
| 631 | 623 | UINT8 *data = auto_alloc_array(&m_manager.machine(), UINT8, filesize - CACHED_HEADER_SIZE); |
| 632 | bytes_read = | |
| 624 | bytes_read = | |
| 633 | 625 | if (bytes_read != filesize - CACHED_HEADER_SIZE) |
| 634 | 626 | { |
| 635 | 627 | auto_free(&m_manager.machine(), data); |
| r10384 | r10385 | |
| 681 | 673 | mame_printf_warning("Generating cached BDF font...\n"); |
| 682 | 674 | |
| 683 | 675 | // attempt to open the file |
| 684 | mame_file *file; | |
| 685 | file_error filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); | |
| 676 | emu_file file(manager().machine().options(), SEARCHPATH_FONT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 677 | file_error filerr = file.open(filename); | |
| 686 | 678 | if (filerr != FILERR_NONE) |
| 687 | 679 | return false; |
| 688 | 680 | |
| r10384 | r10385 | |
| 728 | 720 | *dest++ = numchars >> 8; |
| 729 | 721 | *dest++ = numchars & 0xff; |
| 730 | 722 | assert(dest - tempbuffer == CACHED_HEADER_SIZE); |
| 731 | UINT32 bytes_written = | |
| 723 | UINT32 bytes_written = | |
| 732 | 724 | if (bytes_written != dest - tempbuffer) |
| 733 | 725 | throw emu_fatalerror("Error writing cached file"); |
| 734 | 726 | |
| 735 | 727 | // write the empty table to the beginning of the file |
| 736 | bytes_written = | |
| 728 | bytes_written = | |
| 737 | 729 | if (bytes_written != numchars * CACHED_CHAR_SIZE) |
| 738 | 730 | throw emu_fatalerror("Error writing cached file"); |
| 739 | 731 | |
| r10384 | r10385 | |
| 775 | 767 | *dest++ = accum; |
| 776 | 768 | |
| 777 | 769 | // write the data |
| 778 | bytes_written = | |
| 770 | bytes_written = | |
| 779 | 771 | if (bytes_written != dest - tempbuffer) |
| 780 | 772 | throw emu_fatalerror("Error writing cached file"); |
| 781 | 773 | |
| r10384 | r10385 | |
| 804 | 796 | } |
| 805 | 797 | |
| 806 | 798 | // seek back to the beginning and rewrite the table |
| 807 | mame_fseek(file, CACHED_HEADER_SIZE, SEEK_SET); | |
| 808 | bytes_written = mame_fwrite(file, chartable, numchars * CACHED_CHAR_SIZE); | |
| 799 | file.seek(CACHED_HEADER_SIZE, SEEK_SET); | |
| 800 | bytes_written = file.write(chartable, numchars * CACHED_CHAR_SIZE); | |
| 809 | 801 | if (bytes_written != numchars * CACHED_CHAR_SIZE) |
| 810 | 802 | throw emu_fatalerror("Error writing cached file"); |
| 811 | 803 | |
| 812 | 804 | // all done |
| 813 | mame_fclose(file); | |
| 814 | 805 | auto_free(&m_manager.machine(), tempbuffer); |
| 815 | 806 | auto_free(&m_manager.machine(), chartable); |
| 816 | 807 | return true; |
| 817 | 808 | } |
| 818 | 809 | catch (...) |
| 819 | 810 | { |
| 820 | mame_fclose(file); | |
| 821 | osd_rmfile(filename); | |
| 811 | file.remove_on_close(); | |
| 822 | 812 | auto_free(&m_manager.machine(), tempbuffer); |
| 823 | 813 | auto_free(&m_manager.machine(), chartable); |
| 824 | 814 | return false; |
| r10384 | r10385 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | // device_mc146818_interface overrides |
| 89 | 89 | virtual void nvram_default(); |
| 90 | virtual void nvram_read(mame_file &file); | |
| 91 | virtual void nvram_write(mame_file &file); | |
| 90 | virtual void nvram_read(emu_file &file); | |
| 91 | virtual void nvram_write(emu_file &file); | |
| 92 | 92 | |
| 93 | 93 | // internal helpers |
| 94 | 94 | int dec_2_local(int a); |
| r10384 | r10385 | |
|---|---|---|
| 471 | 471 | // .nv file |
| 472 | 472 | //------------------------------------------------- |
| 473 | 473 | |
| 474 | void timekeeper_device::nvram_read( | |
| 474 | void timekeeper_device::nvram_read( | |
| 475 | 475 | { |
| 476 | | |
| 476 | | |
| 477 | 477 | |
| 478 | 478 | counters_to_ram(); |
| 479 | 479 | } |
| r10384 | r10385 | |
| 484 | 484 | // .nv file |
| 485 | 485 | //------------------------------------------------- |
| 486 | 486 | |
| 487 | void timekeeper_device::nvram_write( | |
| 487 | void timekeeper_device::nvram_write( | |
| 488 | 488 | { |
| 489 | | |
| 489 | | |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 |
| r10384 | r10385 | |
|---|---|---|
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "machine/x76f100.h" |
| 14 | 14 | |
| 15 | #define VERBOSE_LEVEL | |
| 15 | #define VERBOSE_LEVEL | |
| 16 | 16 | |
| 17 | ||
| 17 | inline void ATTR_PRINTF(3,4) x76f100_device::verboselog( | |
| 18 | 18 | { |
| 19 | if( | |
| 19 | if( | |
| 20 | 20 | { |
| 21 | 21 | va_list v; |
| 22 | char buf[ 32768 ]; | |
| 23 | va_start( v, s_fmt ); | |
| 24 | vsprintf( buf, s_fmt, v ); | |
| 25 | va_end( v ); | |
| 26 | logerror( "%s: %s", machine->describe_context(), buf ); | |
| 22 | char buf[32768]; | |
| 23 | va_start(v, s_fmt); | |
| 24 | vsprintf(buf, s_fmt, v); | |
| 25 | va_end(v); | |
| 26 | logerror("x76f100 %s %s: %s", config.tag(), machine->describe_context(), buf); | |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | ||
| 30 | const device | |
| 31 | 31 | |
| 32 | struct x76f100_chip | |
| 32 | x76f100_device_config::x76f100_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 33 | : device_secure_serial_flash_config(mconfig, static_alloc_device_config, "X76F100", tag, owner, clock) | |
| 33 | 34 | { |
| 34 | int cs; | |
| 35 | int rst; | |
| 36 | int scl; | |
| 37 | int sdaw; | |
| 38 | int sdar; | |
| 39 | int state; | |
| 40 | int shift; | |
| 41 | int bit; | |
| 42 | int byte; | |
| 43 | int command; | |
| 44 | UINT8 write_buffer[ SIZE_WRITE_BUFFER ]; | |
| 45 | UINT8 *response_to_reset; | |
| 46 | UINT8 *write_password; | |
| 47 | UINT8 *read_password; | |
| 48 | UINT8 *data; | |
| 49 | }; | |
| 35 | } | |
| 50 | 36 | |
| 51 | #define SIZE_RESPONSE_TO_RESET ( 4 ) | |
| 52 | #define SIZE_WRITE_PASSWORD ( SIZE_WRITE_BUFFER ) | |
| 53 | #define SIZE_READ_PASSWORD ( SIZE_WRITE_BUFFER ) | |
| 54 | #define SIZE_DATA ( 112 ) | |
| 37 | device_config *x76f100_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 38 | { | |
| 39 | return global_alloc(x76f100_device_config(mconfig, tag, owner, clock)); | |
| 40 | } | |
| 55 | 41 | |
| 56 | static struct x76f100_chip x76f100[ X76F100_MAXCHIP ]; | |
| 42 | device_t *x76f100_device_config::alloc_device(running_machine &machine) const | |
| 43 | { | |
| 44 | return auto_alloc(&machine, x76f100_device(machine, *this)); | |
| 45 | } | |
| 57 | 46 | |
| 58 | #define COMMAND_WRITE ( 0x80 ) | |
| 59 | #define COMMAND_READ ( 0x81 ) | |
| 60 | #define COMMAND_CHANGE_WRITE_PASSWORD ( 0xfc ) | |
| 61 | #define COMMAND_CHANGE_READ_PASSWORD ( 0xfe ) | |
| 62 | #define COMMAND_ACK_PASSWORD ( 0x55 ) | |
| 47 | x76f100_device::x76f100_device(running_machine &_machine, const x76f100_device_config &_config) | |
| 48 | : device_secure_serial_flash(_machine, _config), | |
| 49 | config(_config) | |
| 50 | { | |
| 51 | } | |
| 63 | 52 | |
| 64 | #define STATE_STOP ( 0 ) | |
| 65 | #define STATE_RESPONSE_TO_RESET ( 1 ) | |
| 66 | #define STATE_LOAD_COMMAND ( 2 ) | |
| 67 | #define STATE_LOAD_PASSWORD ( 4 ) | |
| 68 | #define STATE_VERIFY_PASSWORD ( 5 ) | |
| 69 | #define STATE_READ_DATA ( 6 ) | |
| 70 | #define STATE_WRITE_DATA ( 7 ) | |
| 53 | void x76f100_device::device_start() | |
| 54 | { | |
| 55 | device_secure_serial_flash::device_start(); | |
| 56 | save_item(NAME(state)); | |
| 57 | save_item(NAME(shift)); | |
| 58 | save_item(NAME(bit)); | |
| 59 | save_item(NAME(byte)); | |
| 60 | save_item(NAME(command)); | |
| 61 | save_item(NAME(write_buffer)); | |
| 62 | save_item(NAME(response_to_reset)); | |
| 63 | save_item(NAME(write_password)); | |
| 64 | save_item(NAME(read_password)); | |
| 65 | save_item(NAME(data)); | |
| 66 | } | |
| 71 | 67 | |
| 72 | void x76f100_i | |
| 68 | void x76f100_devi | |
| 73 | 69 | { |
| 74 | int offset; | |
| 75 | struct x76f100_chip *c; | |
| 70 | device_secure_serial_flash::device_reset(); | |
| 71 | state = STATE_STOP; | |
| 72 | shift = 0; | |
| 73 | bit = 0; | |
| 74 | byte = 0; | |
| 75 | command = 0; | |
| 76 | memset(write_buffer, 0, SIZE_WRITE_BUFFER); | |
| 77 | } | |
| 76 | 78 | |
| 77 | if( chip >= X76F100_MAXCHIP ) | |
| 79 | void x76f100_device::nvram_default() | |
| 80 | { | |
| 81 | // region always wins | |
| 82 | if(m_region) | |
| 78 | 83 | { |
| 79 | verboselog( machine, 0, "x76f100_init( %d ) chip out of range\n", chip ); | |
| 80 | return; | |
| 84 | // Ensure the size is correct though | |
| 85 | if(m_region->bytes() != SIZE_RESPONSE_TO_RESET+SIZE_WRITE_PASSWORD+SIZE_READ_PASSWORD+SIZE_DATA) | |
| 86 | logerror("x76f100 %s: Wrong region length for initialization data, expected 0x%x, got 0x%x\n", | |
| 87 | config.tag(), | |
| 88 | SIZE_RESPONSE_TO_RESET+SIZE_WRITE_PASSWORD+SIZE_READ_PASSWORD+SIZE_DATA, | |
| 89 | m_region->bytes()); | |
| 90 | else { | |
| 91 | UINT8 *rb = m_region->base(); | |
| 92 | int offset = 0; | |
| 93 | memcpy(response_to_reset, rb + offset, SIZE_RESPONSE_TO_RESET); offset += SIZE_RESPONSE_TO_RESET; | |
| 94 | memcpy(write_password, rb + offset, SIZE_WRITE_PASSWORD); offset += SIZE_WRITE_PASSWORD; | |
| 95 | memcpy(read_password, rb + offset, SIZE_READ_PASSWORD); offset += SIZE_READ_PASSWORD; | |
| 96 | memcpy(data, rb + offset, SIZE_DATA); offset += SIZE_DATA; | |
| 97 | return; | |
| 98 | } | |
| 81 | 99 | } |
| 82 | 100 | |
| 83 | c = &x76f100[ chip ]; | |
| 84 | ||
| 85 | if( data == NULL ) | |
| 86 | { | |
| 87 | data = auto_alloc_array( machine, UINT8, | |
| 88 | SIZE_RESPONSE_TO_RESET + | |
| 89 | SIZE_READ_PASSWORD + | |
| 90 | SIZE_WRITE_PASSWORD + | |
| 91 | SIZE_DATA ); | |
| 92 | } | |
| 93 | ||
| 94 | c->cs = 0; | |
| 95 | c->rst = 0; | |
| 96 | c->scl = 0; | |
| 97 | c->sdaw = 0; | |
| 98 | c->sdar = 0; | |
| 99 | c->state = STATE_STOP; | |
| 100 | c->shift = 0; | |
| 101 | c->bit = 0; | |
| 102 | c->byte = 0; | |
| 103 | c->command = 0; | |
| 104 | memset( c->write_buffer, 0, SIZE_WRITE_BUFFER ); | |
| 105 | ||
| 106 | offset = 0; | |
| 107 | c->response_to_reset = &data[ offset ]; offset += SIZE_RESPONSE_TO_RESET; | |
| 108 | c->write_password = &data[ offset ]; offset += SIZE_WRITE_PASSWORD; | |
| 109 | c->read_password = &data[ offset ]; offset += SIZE_READ_PASSWORD; | |
| 110 | c->data = &data[ offset ]; offset += SIZE_DATA; | |
| 111 | ||
| 112 | state_save_register_item( machine, "x76f100", NULL, chip, c->cs ); | |
| 113 | state_save_register_item( machine, "x76f100", NULL, chip, c->rst ); | |
| 114 | state_save_register_item( machine, "x76f100", NULL, chip, c->scl ); | |
| 115 | state_save_register_item( machine, "x76f100", NULL, chip, c->sdaw ); | |
| 116 | state_save_register_item( machine, "x76f100", NULL, chip, c->sdar ); | |
| 117 | state_save_register_item( machine, "x76f100", NULL, chip, c->state ); | |
| 118 | state_save_register_item( machine, "x76f100", NULL, chip, c->shift ); | |
| 119 | state_save_register_item( machine, "x76f100", NULL, chip, c->bit ); | |
| 120 | state_save_register_item( machine, "x76f100", NULL, chip, c->byte ); | |
| 121 | state_save_register_item( machine, "x76f100", NULL, chip, c->command ); | |
| 122 | state_save_register_item_array( machine, "x76f100", NULL, chip, c->write_buffer ); | |
| 123 | state_save_register_item_pointer( machine, "x76f100", NULL, chip, c->response_to_reset, SIZE_RESPONSE_TO_RESET ); | |
| 124 | state_save_register_item_pointer( machine, "x76f100", NULL, chip, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 125 | state_save_register_item_pointer( machine, "x76f100", NULL, chip, c->read_password, SIZE_READ_PASSWORD ); | |
| 126 | state_save_register_item_pointer( machine, "x76f100", NULL, chip, c->data, SIZE_DATA ); | |
| 101 | // That chip isn't really usable without the passwords, so bitch | |
| 102 | // if there's no region | |
| 103 | logerror("x76f100 %s: Warning, no default data provided, chip is unusable.\n", config.tag()); | |
| 104 | memset(response_to_reset, 0, SIZE_RESPONSE_TO_RESET); | |
| 105 | memset(write_password, 0, SIZE_WRITE_PASSWORD); | |
| 106 | memset(read_password, 0, SIZE_READ_PASSWORD); | |
| 107 | memset(data, 0, SIZE_DATA); | |
| 127 | 108 | } |
| 128 | 109 | |
| 129 | void x76f100_ | |
| 110 | void x76f100_d | |
| 130 | 111 | { |
| 131 | struct x76f100_chip *c; | |
| 112 | /* enable chip */ | |
| 113 | state = STATE_STOP; | |
| 114 | } | |
| 132 | 115 | |
| 133 | if( chip >= X76F100_MAXCHIP ) | |
| 134 | { | |
| 135 | verboselog( machine, 0, "x76f100_cs_write( %d ) chip out of range\n", chip ); | |
| 136 | return; | |
| 137 | } | |
| 138 | ||
| 139 | c = &x76f100[ chip ]; | |
| 140 | ||
| 141 | if( c->cs != cs ) | |
| 142 | { | |
| 143 | verboselog( machine, 2, "x76f100(%d) cs=%d\n", chip, cs ); | |
| 144 | } | |
| 145 | if( c->cs != 0 && cs == 0 ) | |
| 146 | { | |
| 147 | /* enable chip */ | |
| 148 | c->state = STATE_STOP; | |
| 149 | } | |
| 150 | if( c->cs == 0 && cs != 0 ) | |
| 151 | { | |
| 152 | /* disable chip */ | |
| 153 | c->state = STATE_STOP; | |
| 154 | /* high impendence? */ | |
| 155 | c->sdar = 0; | |
| 156 | } | |
| 157 | c->cs = cs; | |
| 116 | void x76f100_device::cs_1() | |
| 117 | { | |
| 118 | /* disable chip */ | |
| 119 | state = STATE_STOP; | |
| 120 | /* high impendence? */ | |
| 121 | sdar = 0; | |
| 158 | 122 | } |
| 159 | 123 | |
| 160 | void x76f100_ | |
| 124 | void x76f100_d | |
| 161 | 125 | { |
| 162 | ||
| 126 | } | |
| 163 | 127 | |
| 164 | if( chip >= X76F100_MAXCHIP ) | |
| 165 | { | |
| 166 | verboselog( machine, 0, "x76f100_rst_write( %d ) chip out of range\n", chip ); | |
| 167 | return; | |
| 128 | void x76f100_device::rst_1() | |
| 129 | { | |
| 130 | if(!cs) { | |
| 131 | verboselog(1, "goto response to reset\n"); | |
| 132 | state = STATE_RESPONSE_TO_RESET; | |
| 133 | bit = 0; | |
| 134 | byte = 0; | |
| 168 | 135 | } |
| 169 | ||
| 170 | c = &x76f100[ chip ]; | |
| 171 | ||
| 172 | if( c->rst != rst ) | |
| 173 | { | |
| 174 | verboselog( machine, 2, "x76f100(%d) rst=%d\n", chip, rst ); | |
| 175 | } | |
| 176 | if( c->rst == 0 && rst != 0 && c->cs == 0 ) | |
| 177 | { | |
| 178 | verboselog( machine, 1, "x76f100(%d) goto response to reset\n", chip ); | |
| 179 | c->state = STATE_RESPONSE_TO_RESET; | |
| 180 | c->bit = 0; | |
| 181 | c->byte = 0; | |
| 182 | } | |
| 183 | c->rst = rst; | |
| 184 | 136 | } |
| 185 | 137 | |
| 186 | ||
| 138 | ||
| 187 | 139 | { |
| 188 | if( | |
| 140 | if( | |
| 189 | 141 | { |
| 190 | return | |
| 142 | return | |
| 191 | 143 | } |
| 192 | 144 | |
| 193 | return | |
| 145 | return | |
| 194 | 146 | } |
| 195 | 147 | |
| 196 | ||
| 148 | ||
| 197 | 149 | { |
| 198 | if( | |
| 150 | if( | |
| 199 | 151 | { |
| 200 | | |
| 152 | | |
| 201 | 153 | } |
| 202 | else if( | |
| 154 | else if( | |
| 203 | 155 | { |
| 204 | | |
| 156 | | |
| 205 | 157 | } |
| 206 | 158 | else |
| 207 | 159 | { |
| r10384 | r10385 | |
| 209 | 161 | } |
| 210 | 162 | } |
| 211 | 163 | |
| 212 | ||
| 164 | ||
| 213 | 165 | { |
| 214 | int block_offset = ( | |
| 166 | int block_offset = ( | |
| 215 | 167 | |
| 216 | return | |
| 168 | return | |
| 217 | 169 | } |
| 218 | 170 | |
| 219 | void x76f100_ | |
| 171 | void x76f100_d | |
| 220 | 172 | { |
| 221 | struct x76f100_chip *c; | |
| 222 | ||
| 223 | if( chip >= X76F100_MAXCHIP ) | |
| 224 | { | |
| 225 | verboselog( machine, 0, "x76f100_scl_write( %d ) chip out of range\n", chip ); | |
| 173 | if(cs) | |
| 226 | 174 | return; |
| 227 | } | |
| 228 | 175 | |
| 229 | c = &x76f100[ chip ]; | |
| 176 | switch(state) { | |
| 177 | case STATE_RESPONSE_TO_RESET: | |
| 178 | if(bit == 0) { | |
| 179 | shift = response_to_reset[byte]; | |
| 180 | verboselog(1, "<- response_to_reset[%d]: %02x\n", byte, shift); | |
| 181 | } | |
| 230 | 182 | |
| 231 | if( c->scl != scl ) | |
| 232 | { | |
| 233 | verboselog( machine, 2, "x76f100(%d) scl=%d\n", chip, scl ); | |
| 234 | } | |
| 235 | if( c->cs == 0 ) | |
| 236 | { | |
| 237 | switch( c->state ) | |
| 238 | { | |
| 239 | case STATE_STOP: | |
| 240 | break; | |
| 241 | ||
| 242 | case STATE_RESPONSE_TO_RESET: | |
| 243 | if( c->scl != 0 && scl == 0 ) | |
| 244 | { | |
| 245 | if( c->bit == 0 ) | |
| 246 | { | |
| 247 | c->shift = c->response_to_reset[ c->byte ]; | |
| 248 | verboselog( machine, 1, "x76f100(%d) <- response_to_reset[%d]: %02x\n", chip, c->byte, c->shift ); | |
| 249 | } | |
| 250 | ||
| 251 | c->sdar = c->shift & 1; | |
| 252 | c->shift >>= 1; | |
| 253 | c->bit++; | |
| 254 | ||
| 255 | if( c->bit == 8 ) | |
| 256 | { | |
| 257 | c->bit = 0; | |
| 258 | c->byte++; | |
| 259 | if( c->byte == 4 ) | |
| 260 | { | |
| 261 | c->byte = 0; | |
| 262 | } | |
| 263 | } | |
| 264 | } | |
| 265 | break; | |
| 266 | ||
| 267 | case STATE_LOAD_COMMAND: | |
| 268 | case STATE_LOAD_PASSWORD: | |
| 269 | case STATE_VERIFY_PASSWORD: | |
| 270 | case STATE_WRITE_DATA: | |
| 271 | if( c->scl == 0 && scl != 0 ) | |
| 272 | { | |
| 273 | if( c->bit < 8 ) | |
| 274 | { | |
| 275 | verboselog( machine, 2, "x76f100(%d) clock\n", chip ); | |
| 276 | c->shift <<= 1; | |
| 277 | if( c->sdaw != 0 ) | |
| 278 | { | |
| 279 | c->shift |= 1; | |
| 280 | } | |
| 281 | c->bit++; | |
| 282 | } | |
| 283 | else | |
| 284 | { | |
| 285 | c->sdar = 0; | |
| 286 | ||
| 287 | switch( c->state ) | |
| 288 | { | |
| 289 | case STATE_LOAD_COMMAND: | |
| 290 | c->command = c->shift; | |
| 291 | verboselog( machine, 1, "x76f100(%d) -> command: %02x\n", chip, c->command ); | |
| 292 | /* todo: verify command is valid? */ | |
| 293 | c->state = STATE_LOAD_PASSWORD; | |
| 294 | break; | |
| 295 | ||
| 296 | case STATE_LOAD_PASSWORD: | |
| 297 | verboselog( machine, 1, "x76f100(%d) -> password: %02x\n", chip, c->shift ); | |
| 298 | c->write_buffer[ c->byte++ ] = c->shift; | |
| 299 | if( c->byte == SIZE_WRITE_BUFFER ) | |
| 300 | { | |
| 301 | c->state = STATE_VERIFY_PASSWORD; | |
| 302 | } | |
| 303 | break; | |
| 304 | ||
| 305 | case STATE_VERIFY_PASSWORD: | |
| 306 | verboselog( machine, 1, "x76f100(%d) -> verify password: %02x\n", chip, c->shift ); | |
| 307 | /* todo: this should probably be handled as a command */ | |
| 308 | if( c->shift == COMMAND_ACK_PASSWORD ) | |
| 309 | { | |
| 310 | /* todo: this should take 10ms before it returns ok. */ | |
| 311 | if( memcmp( x76f100_password( c ), c->write_buffer, SIZE_WRITE_BUFFER ) == 0 ) | |
| 312 | { | |
| 313 | x76f100_password_ok( c ); | |
| 314 | } | |
| 315 | else | |
| 316 | { | |
| 317 | c->sdar = 1; | |
| 318 | } | |
| 319 | } | |
| 320 | break; | |
| 321 | ||
| 322 | case STATE_WRITE_DATA: | |
| 323 | verboselog( machine, 1, "x76f100(%d) -> data: %02x\n", chip, c->shift ); | |
| 324 | c->write_buffer[ c->byte++ ] = c->shift; | |
| 325 | if( c->byte == SIZE_WRITE_BUFFER ) | |
| 326 | { | |
| 327 | for( c->byte = 0; c->byte < SIZE_WRITE_BUFFER; c->byte++ ) | |
| 328 | { | |
| 329 | c->data[ x76f100_data_offset( c ) ] = c->write_buffer[ c->byte ]; | |
| 330 | } | |
| 331 | c->byte = 0; | |
| 332 | ||
| 333 | verboselog( machine, 1, "x76f100(%d) data flushed\n", chip ); | |
| 334 | } | |
| 335 | break; | |
| 336 | } | |
| 337 | ||
| 338 | c->bit = 0; | |
| 339 | c->shift = 0; | |
| 340 | } | |
| 341 | } | |
| 342 | break; | |
| 343 | ||
| 344 | case STATE_READ_DATA: | |
| 345 | if( c->scl == 0 && scl != 0 ) | |
| 346 | { | |
| 347 | if( c->bit < 8 ) | |
| 348 | { | |
| 349 | if( c->bit == 0 ) | |
| 350 | { | |
| 351 | switch( c->state ) | |
| 352 | { | |
| 353 | case STATE_READ_DATA: | |
| 354 | c->shift = c->data[ x76f100_data_offset( c ) ]; | |
| 355 | verboselog( machine, 1, "x76f100(%d) <- data: %02x\n", chip, c->shift ); | |
| 356 | break; | |
| 357 | } | |
| 358 | } | |
| 359 | c->sdar = ( c->shift >> 7 ) & 1; | |
| 360 | c->shift <<= 1; | |
| 361 | c->bit++; | |
| 362 | } | |
| 363 | else | |
| 364 | { | |
| 365 | c->bit = 0; | |
| 366 | c->sdar = 0; | |
| 367 | if( c->sdaw == 0 ) | |
| 368 | { | |
| 369 | verboselog( machine, 2, "x76f100(%d) ack <-\n", chip ); | |
| 370 | c->byte++; | |
| 371 | } | |
| 372 | else | |
| 373 | { | |
| 374 | verboselog( machine, 2, "x76f100(%d) nak <-\n", chip ); | |
| 375 | } | |
| 376 | } | |
| 377 | } | |
| 378 | break; | |
| 183 | sdar = shift & 1; | |
| 184 | shift >>= 1; | |
| 185 | bit++; | |
| 186 | ||
| 187 | if(bit == 8) { | |
| 188 | bit = 0; | |
| 189 | byte++; | |
| 190 | if(byte == 4) | |
| 191 | byte = 0; | |
| 379 | 192 | } |
| 193 | break; | |
| 380 | 194 | } |
| 381 | c->scl = scl; | |
| 382 | 195 | } |
| 383 | 196 | |
| 384 | void x76f100_ | |
| 197 | void x76f100_ | |
| 385 | 198 | { |
| 386 | struct x76f100_chip *c; | |
| 387 | ||
| 388 | if( chip >= X76F100_MAXCHIP ) | |
| 389 | { | |
| 390 | verboselog( machine, 0, "x76f100_sda_write( %d ) chip out of range\n", chip ); | |
| 199 | if(cs) | |
| 391 | 200 | return; |
| 392 | } | |
| 393 | 201 | |
| 394 | c = &x76f100[ chip ]; | |
| 202 | switch(state) { | |
| 203 | case STATE_RESPONSE_TO_RESET: | |
| 204 | break; | |
| 395 | 205 | |
| 396 | if( c->sdaw != sda ) | |
| 397 | { | |
| 398 | verboselog( machine, 2, "x76f100(%d) sdaw=%d\n", chip, sda ); | |
| 399 | } | |
| 400 | if( c->cs == 0 && c->scl != 0 ) | |
| 401 | { | |
| 402 | if( c->sdaw == 0 && sda != 0 ) | |
| 403 | { | |
| 404 | verboselog( machine, 1, "x76f100(%d) goto stop\n", chip ); | |
| 405 | c->state = STATE_STOP; | |
| 406 | c->sdar = 0; | |
| 407 | } | |
| 408 | if( c->sdaw != 0 && sda == 0 ) | |
| 409 | { | |
| 410 | switch( c->state ) | |
| 411 | { | |
| 412 | case STATE_STOP: | |
| 413 | verboselog( machine, 1, "x76f100(%d) goto start\n", chip ); | |
| 414 | c->state = STATE_LOAD_COMMAND; | |
| 206 | case STATE_LOAD_COMMAND: | |
| 207 | case STATE_LOAD_PASSWORD: | |
| 208 | case STATE_VERIFY_PASSWORD: | |
| 209 | case STATE_WRITE_DATA: | |
| 210 | if(bit < 8) { | |
| 211 | verboselog(2, "clock\n"); | |
| 212 | shift <<= 1; | |
| 213 | if(sdaw) | |
| 214 | shift |= 1; | |
| 215 | bit++; | |
| 216 | } else { | |
| 217 | switch(state) { | |
| 218 | case STATE_LOAD_COMMAND: | |
| 219 | verboselog(1, "-> command: %02x\n", command); | |
| 220 | sdar = false; | |
| 221 | command = shift; | |
| 222 | /* todo: verify command is valid? */ | |
| 223 | state = STATE_LOAD_PASSWORD; | |
| 224 | bit = 0; | |
| 225 | shift = 0; | |
| 415 | 226 | break; |
| 416 | 227 | |
| 417 | 228 | case STATE_LOAD_PASSWORD: |
| 418 | /* todo: this will be the 0xc0 command, but it's not handled as a command yet. */ | |
| 419 | verboselog( machine, 1, "x76f100(%d) goto start\n", chip ); | |
| 229 | verboselog(1, "-> password: %02x\n", shift); | |
| 230 | sdar = false; | |
| 231 | write_buffer[byte++] = shift; | |
| 232 | if(byte == SIZE_WRITE_BUFFER) | |
| 233 | state = STATE_VERIFY_PASSWORD; | |
| 234 | bit = 0; | |
| 235 | shift = 0; | |
| 420 | 236 | break; |
| 421 | 237 | |
| 422 | case STATE_READ_DATA: | |
| 423 | verboselog( machine, 1, "x76f100(%d) continue reading??\n", chip ); | |
| 424 | // verboselog( machine, 1, "x76f100(%d) goto load address\n", chip ); | |
| 425 | // c->state = STATE_LOAD_ADDRESS; | |
| 238 | case STATE_VERIFY_PASSWORD: | |
| 239 | verboselog(1, "-> verify password: %02x\n", shift); | |
| 240 | sdar = false; | |
| 241 | /* todo: this should probably be handled as a command */ | |
| 242 | if(shift == COMMAND_ACK_PASSWORD) { | |
| 243 | /* todo: this should take 10ms before it returns ok. */ | |
| 244 | if(!memcmp(password(), write_buffer, SIZE_WRITE_BUFFER)) | |
| 245 | password_ok(); | |
| 246 | else | |
| 247 | sdar = true; | |
| 248 | } | |
| 249 | bit = 0; | |
| 250 | shift = 0; | |
| 426 | 251 | break; |
| 427 | 252 | |
| 428 | default: | |
| 429 | verboselog( machine, 1, "x76f100(%d) skipped start (default)\n", chip ); | |
| 253 | case STATE_WRITE_DATA: | |
| 254 | verboselog(1, "-> data: %02x\n", shift ); | |
| 255 | sdar = false; | |
| 256 | write_buffer[byte++] = shift; | |
| 257 | if(byte == SIZE_WRITE_BUFFER) { | |
| 258 | for(byte = 0; byte < SIZE_WRITE_BUFFER; byte++) | |
| 259 | data[data_offset()] = write_buffer[byte]; | |
| 260 | byte = 0; | |
| 261 | } | |
| 262 | bit = 0; | |
| 263 | shift = 0; | |
| 430 | 264 | break; |
| 431 | 265 | } |
| 432 | ||
| 433 | c->bit = 0; | |
| 434 | c->byte = 0; | |
| 435 | c->shift = 0; | |
| 436 | c->sdar = 0; | |
| 437 | 266 | } |
| 267 | break; | |
| 268 | ||
| 269 | case STATE_READ_DATA: | |
| 270 | if(bit < 8) { | |
| 271 | if(bit == 0) { | |
| 272 | shift = data[data_offset()]; | |
| 273 | verboselog(1, "<- data: %02x\n", shift ); | |
| 274 | } | |
| 275 | sdar = (shift >> 7) & 1; | |
| 276 | shift <<= 1; | |
| 277 | bit++; | |
| 278 | } else { | |
| 279 | bit = 0; | |
| 280 | sdar = false; | |
| 281 | if(!sdaw) { | |
| 282 | verboselog(2, "ack <-\n"); | |
| 283 | byte++; | |
| 284 | } else { | |
| 285 | verboselog(2, "nak <-\n"); | |
| 286 | } | |
| 287 | } | |
| 288 | break; | |
| 438 | 289 | } |
| 439 | c->sdaw = sda; | |
| 440 | 290 | } |
| 441 | 291 | |
| 442 | i | |
| 292 | void | |
| 443 | 293 | { |
| 444 | struct x76f100_chip *c; | |
| 294 | if(cs || !scl) | |
| 295 | return; | |
| 445 | 296 | |
| 446 | if( chip >= X76F100_MAXCHIP ) | |
| 447 | { | |
| 448 | verboselog( machine, 0, "x76f100_sda_read( %d ) chip out of range\n", chip ); | |
| 449 | return 1; | |
| 450 | } | |
| 297 | switch(state) { | |
| 298 | case STATE_STOP: | |
| 299 | state = STATE_LOAD_COMMAND; | |
| 300 | break; | |
| 451 | 301 | |
| 452 | c = &x76f100[ chip ]; | |
| 302 | case STATE_LOAD_PASSWORD: | |
| 303 | /* todo: this will be the 0xc0 command, but it's not handled as a command yet. */ | |
| 304 | break; | |
| 453 | 305 | |
| 454 | if( c->cs != 0 ) | |
| 455 | { | |
| 456 | verboselog( machine, 2, "x76f100(%d) not selected\n", chip ); | |
| 457 | return 1; | |
| 306 | case STATE_READ_DATA: | |
| 307 | // c->state = STATE_LOAD_ADDRESS; | |
| 308 | break; | |
| 309 | ||
| 310 | default: | |
| 311 | break; | |
| 458 | 312 | } |
| 459 | verboselog( machine, 2, "x76f100(%d) sdar=%d\n", chip, c->sdar ); | |
| 460 | return c->sdar; | |
| 313 | ||
| 314 | bit = 0; | |
| 315 | byte = 0; | |
| 316 | shift = 0; | |
| 317 | sdar = false; | |
| 461 | 318 | } |
| 462 | 319 | |
| 463 | ||
| 320 | ||
| 464 | 321 | { |
| 465 | struct x76f100_chip *c; | |
| 466 | ||
| 467 | if( chip >= X76F100_MAXCHIP ) | |
| 468 | { | |
| 469 | verboselog( machine, 0, "nvram_handler_x76f100( %d ) chip out of range\n", chip ); | |
| 322 | if(cs || !scl) | |
| 470 | 323 | return; |
| 471 | } | |
| 472 | 324 | |
| 473 | c = &x76f100[ chip ]; | |
| 325 | state = STATE_STOP; | |
| 326 | sdar = false; | |
| 327 | } | |
| 474 | 328 | |
| 475 | if( read_or_write ) | |
| 476 | { | |
| 477 | mame_fwrite( file, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 478 | mame_fwrite( file, c->read_password, SIZE_READ_PASSWORD ); | |
| 479 | mame_fwrite( file, c->data, SIZE_DATA ); | |
| 480 | } | |
| 481 | else if( file ) | |
| 482 | { | |
| 483 | mame_fread( file, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 484 | mame_fread( file, c->read_password, SIZE_READ_PASSWORD ); | |
| 485 | mame_fread( file, c->data, SIZE_DATA ); | |
| 486 | } | |
| 329 | void x76f100_device::nvram_read(emu_file &file) | |
| 330 | { | |
| 331 | file.read(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 332 | file.read(write_password, SIZE_WRITE_PASSWORD); | |
| 333 | file.read(read_password, SIZE_READ_PASSWORD); | |
| 334 | file.read(data, SIZE_DATA); | |
| 487 | 335 | } |
| 488 | 336 | |
| 489 | NVRAM_HANDLER( x76f100_0 ) { nvram_handler_x76f100( machine, file, read_or_write, 0 ); } | |
| 490 | NVRAM_HANDLER( x76f100_1 ) { nvram_handler_x76f100( machine, file, read_or_write, 1 ); } | |
| 337 | void x76f100_device::nvram_write(emu_file &file) | |
| 338 | { | |
| 339 | file.write(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 340 | file.write(write_password, SIZE_WRITE_PASSWORD); | |
| 341 | file.write(read_password, SIZE_READ_PASSWORD); | |
| 342 | file.write(data, SIZE_DATA); | |
| 343 | } |
| r10384 | r10385 | |
|---|---|---|
| 100 | 100 | |
| 101 | 101 | // device_nvram_interface overrides |
| 102 | 102 | virtual void nvram_default(); |
| 103 | virtual void nvram_read(mame_file &file); | |
| 104 | virtual void nvram_write(mame_file &file); | |
| 103 | virtual void nvram_read(emu_file &file); | |
| 104 | virtual void nvram_write(emu_file &file); | |
| 105 | 105 | |
| 106 | 106 | // internal state |
| 107 | 107 | const timekeeper_device_config &m_config; |
| r10384 | r10385 | |
|---|---|---|
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | #if !defined( X76F100_H ) | |
| 8 | #ifndef __X76F100_H__ | |
| 9 | #define __X76F100_H__ | |
| 9 | 10 | |
| 10 | #define X76F100_MAXCHIP ( 2 ) | |
| 11 | #define MCFG_X76F100_ADD(_tag) \ | |
| 12 | MCFG_DEVICE_ADD(_tag, X76F100, 0) | |
| 11 | 13 | |
| 12 | extern void x76f100_init( running_machine *machine, int chip, UINT8 *data ); | |
| 13 | extern void x76f100_cs_write( running_machine *machine, int chip, int cs ); | |
| 14 | extern void x76f100_rst_write( running_machine *machine, int chip, int rst ); | |
| 15 | extern void x76f100_scl_write( running_machine *machine, int chip, int scl ); | |
| 16 | extern void x76f100_sda_write( running_machine *machine, int chip, int sda ); | |
| 17 | extern int x76f100_sda_read( running_machine *machine, int chip ); | |
| 18 | extern NVRAM_HANDLER( x76f100_0 ); | |
| 19 | extern NVRAM_HANDLER( x76f100_1 ); | |
| 14 | #include "machine/secflash.h" | |
| 20 | 15 | |
| 21 | #define X76F100_H | |
| 16 | class x76f100_device_config : public device_secure_serial_flash_config | |
| 17 | { | |
| 18 | friend class x76f100_device; | |
| 19 | ||
| 20 | // construction/destruction | |
| 21 | x76f100_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 22 | ||
| 23 | public: | |
| 24 | // allocators | |
| 25 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 26 | virtual device_t *alloc_device(running_machine &machine) const; | |
| 27 | }; | |
| 28 | ||
| 29 | class x76f100_device : public device_secure_serial_flash | |
| 30 | { | |
| 31 | friend class x76f100_device_config; | |
| 32 | ||
| 33 | // construction/destruction | |
| 34 | x76f100_device(running_machine &_machine, const x76f100_device_config &config); | |
| 35 | ||
| 36 | protected: | |
| 37 | // device-level overrides | |
| 38 | virtual void device_start(); | |
| 39 | virtual void device_reset(); | |
| 40 | ||
| 41 | // device_nvram_interface overrides | |
| 42 | virtual void nvram_default(); | |
| 43 | virtual void nvram_read(emu_file &file); | |
| 44 | virtual void nvram_write(emu_file &file); | |
| 45 | ||
| 46 | // device_secure_serial_flash implementations | |
| 47 | virtual void cs_0(); | |
| 48 | virtual void cs_1(); | |
| 49 | virtual void rst_0(); | |
| 50 | virtual void rst_1(); | |
| 51 | virtual void scl_0(); | |
| 52 | virtual void scl_1(); | |
| 53 | virtual void sda_0(); | |
| 54 | virtual void sda_1(); | |
| 55 | ||
| 56 | // internal state | |
| 57 | const x76f100_device_config &config; | |
| 58 | ||
| 59 | enum { | |
| 60 | SIZE_WRITE_BUFFER = 8, | |
| 61 | SIZE_RESPONSE_TO_RESET = 4, | |
| 62 | SIZE_WRITE_PASSWORD = 8, | |
| 63 | SIZE_READ_PASSWORD = 8, | |
| 64 | SIZE_DATA = 112, | |
| 65 | ||
| 66 | COMMAND_WRITE = 0x80, | |
| 67 | COMMAND_READ = 0x81, | |
| 68 | COMMAND_CHANGE_WRITE_PASSWORD = 0xfc, | |
| 69 | COMMAND_CHANGE_READ_PASSWORD = 0xfe, | |
| 70 | COMMAND_ACK_PASSWORD = 0x55 | |
| 71 | }; | |
| 72 | ||
| 73 | enum { | |
| 74 | STATE_STOP, | |
| 75 | STATE_RESPONSE_TO_RESET, | |
| 76 | STATE_LOAD_COMMAND, | |
| 77 | STATE_LOAD_PASSWORD, | |
| 78 | STATE_VERIFY_PASSWORD, | |
| 79 | STATE_READ_DATA, | |
| 80 | STATE_WRITE_DATA | |
| 81 | }; | |
| 82 | ||
| 83 | int state, bit, byte; | |
| 84 | UINT8 command, shift; | |
| 85 | UINT8 write_buffer[SIZE_WRITE_BUFFER]; | |
| 86 | UINT8 response_to_reset[SIZE_RESPONSE_TO_RESET]; | |
| 87 | UINT8 write_password[SIZE_WRITE_PASSWORD]; | |
| 88 | UINT8 read_password[SIZE_READ_PASSWORD]; | |
| 89 | UINT8 data[SIZE_DATA]; | |
| 90 | ||
| 91 | UINT8 *password(); | |
| 92 | void password_ok(); | |
| 93 | int data_offset(); | |
| 94 | ||
| 95 | private: | |
| 96 | inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ...); | |
| 97 | }; | |
| 98 | ||
| 99 | ||
| 100 | // device type definition | |
| 101 | extern const device_type X76F100; | |
| 102 | ||
| 22 | 103 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 9 | 9 | #include "emu.h" |
| 10 | 10 | #include "machine/ds2401.h" |
| 11 | 11 | |
| 12 | #define VERBOSE_LEVEL | |
| 12 | #define VERBOSE_LEVEL | |
| 13 | 13 | |
| 14 | ||
| 14 | inline void ATTR_PRINTF(3,4) ds2401_device::verboselog( | |
| 15 | 15 | { |
| 16 | if( | |
| 16 | if( | |
| 17 | 17 | { |
| 18 | 18 | va_list v; |
| 19 | char buf[ 32768 ]; | |
| 20 | va_start( v, s_fmt ); | |
| 21 | vsprintf( buf, s_fmt, v ); | |
| 22 | va_end( v ); | |
| 23 | logerror( "%s: %s", machine->describe_context(), buf ); | |
| 19 | char buf[32768]; | |
| 20 | va_start(v, s_fmt); | |
| 21 | vsprintf(buf, s_fmt, v); | |
| 22 | va_end(v); | |
| 23 | logerror("ds2401 %s %s: %s", config.tag(), machine->describe_context(), buf); | |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | struct ds2401_chip | |
| 27 | const device_type DS2401 = ds2401_device_config::static_alloc_device_config; | |
| 28 | ||
| 29 | ds2401_device_config::ds2401_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 30 | : device_config(mconfig, static_alloc_device_config, "DS2401", tag, owner, clock) | |
| 28 | 31 | { |
| 29 | int state; | |
| 30 | int bit; | |
| 31 | int byte; | |
| 32 | int shift; | |
| 33 | int rx; | |
| 34 | int tx; | |
| 35 | const UINT8 *data; | |
| 36 | emu_timer *timer; | |
| 37 | emu_timer *reset_timer; | |
| 38 | attotime t_samp; | |
| 39 | attotime t_rdv; | |
| 40 | attotime t_rstl; | |
| 41 | attotime t_pdh; | |
| 42 | attotime t_pdl; | |
| 43 | }; | |
| 32 | } | |
| 44 | 33 | |
| 45 | #define SIZE_DATA ( 8 ) | |
| 34 | device_config *ds2401_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 35 | { | |
| 36 | return global_alloc(ds2401_device_config(mconfig, tag, owner, clock)); | |
| 37 | } | |
| 46 | 38 | |
| 47 | #define STATE_IDLE ( 0 ) | |
| 48 | #define STATE_RESET ( 1 ) | |
| 49 | #define STATE_RESET1 ( 2 ) | |
| 50 | #define STATE_RESET2 ( 3 ) | |
| 51 | #define STATE_COMMAND ( 4 ) | |
| 52 | #define STATE_READROM ( 5 ) | |
| 39 | device_t *ds2401_device_config::alloc_device(running_machine &machine) const | |
| 40 | { | |
| 41 | return auto_alloc(&machine, ds2401_device(machine, *this)); | |
| 42 | } | |
| 53 | 43 | |
| 54 | #define COMMAND_READROM ( 0x33 ) | |
| 44 | ds2401_device::ds2401_device(running_machine &_machine, const ds2401_device_config &_config) | |
| 45 | : device_t(_machine, _config), | |
| 46 | config(_config) | |
| 47 | { | |
| 48 | } | |
| 55 | 49 | |
| 56 | static struct ds2401_chip ds2401[ DS2401_MAXCHIP ]; | |
| 57 | ||
| 58 | static TIMER_CALLBACK( ds2401_reset ) | |
| 50 | void ds2401_device::device_start() | |
| 59 | 51 | { |
| 60 | int which = param; | |
| 61 | struct ds2401_chip *c = &ds2401[ which ]; | |
| 52 | t_samp = attotime::from_usec( 15); | |
| 53 | t_rdv = attotime::from_usec( 15); | |
| 54 | t_rstl = attotime::from_usec(480); | |
| 55 | t_pdh = attotime::from_usec( 15); | |
| 56 | t_pdl = attotime::from_usec( 60); | |
| 62 | 57 | |
| 63 | verboselog( machine, 1, "ds2401_reset(%d)\n", which ); | |
| 58 | save_item(NAME(state)); | |
| 59 | save_item(NAME(bit)); | |
| 60 | save_item(NAME(byte)); | |
| 61 | save_item(NAME(shift)); | |
| 62 | save_item(NAME(rx)); | |
| 63 | save_item(NAME(tx)); | |
| 64 | 64 | |
| 65 | c->state = STATE_RESET; | |
| 66 | c->timer->adjust( attotime::never, which ); | |
| 65 | timer_main = timer_alloc(TIMER_MAIN); | |
| 66 | timer_reset = timer_alloc(TIMER_RESET); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | ||
| 69 | vo | |
| 70 | 70 | { |
| 71 | int which = param; | |
| 72 | struct ds2401_chip *c = &ds2401[ which ]; | |
| 71 | state = STATE_IDLE; | |
| 72 | bit = 0; | |
| 73 | byte = 0; | |
| 74 | shift = 0; | |
| 75 | rx = true; | |
| 76 | tx = true; | |
| 73 | 77 | |
| 74 | | |
| 78 | | |
| 75 | 79 | { |
| 76 | case STATE_RESET1: | |
| 77 | verboselog( machine, 2, "ds2401_tick(%d) state_reset1 %d\n", which, c->rx ); | |
| 78 | c->tx = 0; | |
| 79 | c->state = STATE_RESET2; | |
| 80 | c->timer->adjust( c->t_pdl, which ); | |
| 81 | break; | |
| 82 | case STATE_RESET2: | |
| 83 | verboselog( machine, 2, "ds2401_tick(%d) state_reset2 %d\n", which, c->rx ); | |
| 84 | c->tx = 1; | |
| 85 | c->bit = 0; | |
| 86 | c->shift = 0; | |
| 87 | c->state = STATE_COMMAND; | |
| 88 | break; | |
| 89 | case STATE_COMMAND: | |
| 90 | verboselog( machine, 2, "ds2401_tick(%d) state_command %d\n", which, c->rx ); | |
| 91 | c->shift >>= 1; | |
| 92 | if( c->rx != 0 ) | |
| 93 | { | |
| 94 | c->shift |= 0x80; | |
| 80 | // Ensure the size is correct though | |
| 81 | if(m_region->bytes() != SIZE_DATA) | |
| 82 | logerror("ds2401 %s: Wrong region length for id data, expected 0x%x, got 0x%x\n", | |
| 83 | config.tag(), | |
| 84 | SIZE_DATA, | |
| 85 | m_region->bytes()); | |
| 86 | else { | |
| 87 | UINT8 *rb = m_region->base(); | |
| 88 | memcpy(data, rb, SIZE_DATA); | |
| 89 | return; | |
| 95 | 90 | } |
| 96 | c->bit++; | |
| 97 | if( c->bit == 8 ) | |
| 98 | { | |
| 99 | switch( c->shift ) | |
| 100 | { | |
| 101 | case COMMAND_READROM: | |
| 102 | verboselog( machine, 1, "ds2401_tick(%d) readrom\n", which ); | |
| 103 | c->bit = 0; | |
| 104 | c->byte = 0; | |
| 105 | c->state = STATE_READROM; | |
| 106 | break; | |
| 107 | default: | |
| 108 | verboselog( machine, 0, "ds2401_tick(%d) command not handled %02x\n", which, c->shift ); | |
| 109 | c->state = STATE_IDLE; | |
| 110 | break; | |
| 111 | } | |
| 112 | } | |
| 113 | break; | |
| 114 | case STATE_READROM: | |
| 115 | c->tx = 1; | |
| 116 | if( c->byte == 8 ) | |
| 117 | { | |
| 118 | verboselog( machine, 1, "ds2401_tick(%d) readrom finished\n", which ); | |
| 119 | c->state = STATE_IDLE; | |
| 120 | } | |
| 121 | else | |
| 122 | { | |
| 123 | verboselog( machine, 2, "ds2401_tick(%d) readrom window closed\n", which ); | |
| 124 | } | |
| 125 | break; | |
| 126 | default: | |
| 127 | verboselog( machine, 0, "ds2401_tick(%d) state not handled: %d\n", which, c->state ); | |
| 128 | break; | |
| 129 | 91 | } |
| 92 | ||
| 93 | // That chip is useless without an id, so bitch if there | |
| 94 | // isn't one | |
| 95 | logerror("ds2401 %s: Warning, no id provided, answer will be all zeroes.\n", config.tag()); | |
| 96 | memset(data, 0, SIZE_DATA); | |
| 130 | 97 | } |
| 131 | 98 | |
| 132 | void ds2401_i | |
| 99 | void ds2401_device::device_timer(emu | |
| 133 | 100 | { |
| 134 | struct ds2401_chip *c = &ds2401[ which ]; | |
| 101 | switch(id) { | |
| 102 | case TIMER_RESET: | |
| 103 | verboselog(1, "timer_reset\n"); | |
| 104 | state = STATE_RESET; | |
| 105 | timer_reset->adjust(attotime::never); | |
| 106 | break; | |
| 135 | 107 | |
| 136 | c->state = STATE_IDLE; | |
| 137 | c->bit = 0; | |
| 138 | c->byte = 0; | |
| 139 | c->shift = 0; | |
| 140 | c->rx = 1; | |
| 141 | c->tx = 1; | |
| 142 | c->data = data; | |
| 143 | c->t_samp = attotime::from_usec( 15 ); | |
| 144 | c->t_rdv = attotime::from_usec( 15 ); | |
| 145 | c->t_rstl = attotime::from_usec( 480 ); | |
| 146 | c->t_pdh = attotime::from_usec( 15 ); | |
| 147 | c->t_pdl = attotime::from_usec( 60 ); | |
| 108 | case TIMER_MAIN: | |
| 109 | switch(state) { | |
| 110 | case STATE_RESET1: | |
| 111 | verboselog(2, "timer_main state_reset1 %d\n", rx); | |
| 112 | tx = false; | |
| 113 | state = STATE_RESET2; | |
| 114 | timer_main->adjust(t_pdl); | |
| 115 | break; | |
| 148 | 116 | |
| 149 | state_save_register_item(machine, "ds2401", NULL, which, c->state ); | |
| 150 | state_save_register_item(machine, "ds2401", NULL, which, c->bit ); | |
| 151 | state_save_register_item(machine, "ds2401", NULL, which, c->byte ); | |
| 152 | state_save_register_item(machine, "ds2401", NULL, which, c->shift ); | |
| 153 | state_save_register_item(machine, "ds2401", NULL, which, c->rx ); | |
| 154 | state_save_register_item(machine, "ds2401", NULL, which, c->tx ); | |
| 117 | case STATE_RESET2: | |
| 118 | verboselog(2, "timer_main state_reset2 %d\n", rx); | |
| 119 | tx = true; | |
| 120 | bit = 0; | |
| 121 | shift = 0; | |
| 122 | state = STATE_COMMAND; | |
| 123 | break; | |
| 155 | 124 | |
| 156 | c->timer = machine->scheduler().timer_alloc(FUNC(ds2401_tick )); | |
| 157 | c->reset_timer = machine->scheduler().timer_alloc(FUNC(ds2401_reset )); | |
| 125 | case STATE_COMMAND: | |
| 126 | verboselog(2, "timer_main state_command %d\n", rx); | |
| 127 | shift >>= 1; | |
| 128 | if(rx) | |
| 129 | shift |= 0x80; | |
| 130 | bit++; | |
| 131 | if(bit == 8) { | |
| 132 | switch(shift) { | |
| 133 | case COMMAND_READROM: | |
| 134 | verboselog(1, "timer_main readrom\n"); | |
| 135 | bit = 0; | |
| 136 | byte = 0; | |
| 137 | state = STATE_READROM; | |
| 138 | break; | |
| 139 | default: | |
| 140 | verboselog(0, "timer_main command not handled %02x\n", shift); | |
| 141 | state = STATE_IDLE; | |
| 142 | break; | |
| 143 | } | |
| 144 | } | |
| 145 | break; | |
| 146 | ||
| 147 | case STATE_READROM: | |
| 148 | tx = true; | |
| 149 | if(byte == SIZE_DATA) { | |
| 150 | verboselog(1, "timer_main readrom finished\n"); | |
| 151 | state = STATE_IDLE; | |
| 152 | } else { | |
| 153 | verboselog(2, "timer_main readrom window closed\n"); | |
| 154 | } | |
| 155 | break; | |
| 156 | default: | |
| 157 | verboselog(0, "timer_main state not handled: %d\n", state); | |
| 158 | break; | |
| 159 | } | |
| 160 | } | |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | void ds2401_write( | |
| 163 | void ds2401_device::write(bool l | |
| 161 | 164 | { |
| 162 | | |
| 165 | verbo | |
| 163 | 166 | |
| 164 | verboselog( machine, 1, "ds2401_write( %d, %d )\n", which, data ); | |
| 165 | ||
| 166 | if( data == 0 && c->rx != 0 ) | |
| 167 | { | |
| 168 | switch( c->state ) | |
| 169 | { | |
| 167 | if(!line && rx) { | |
| 168 | switch(state) { | |
| 170 | 169 | case STATE_IDLE: |
| 171 | 170 | break; |
| 172 | 171 | case STATE_COMMAND: |
| 173 | verboselog( machine, 2, "ds2401_write(%d) state_command\n", which ); | |
| 174 | c->timer->adjust( c->t_samp, which ); | |
| 172 | verboselog(2, "state_command\n"); | |
| 173 | timer_main->adjust(t_samp); | |
| 175 | 174 | break; |
| 176 | 175 | case STATE_READROM: |
| 177 | if( c->bit == 0 ) | |
| 178 | { | |
| 179 | c->shift = c->data[ 7 - c->byte ]; | |
| 180 | verboselog( machine, 1, "ds2401_write(%d) <- data %02x\n", which, c->shift ); | |
| 176 | if(!bit) { | |
| 177 | shift = data[7 - byte]; | |
| 178 | verboselog(1, "<- data %02x\n", shift); | |
| 181 | 179 | } |
| 182 | c->tx = c->shift & 1; | |
| 183 | c->shift >>= 1; | |
| 184 | c->bit++; | |
| 185 | if( c->bit == 8 ) | |
| 186 | { | |
| 187 | c->bit = 0; | |
| 188 | c->byte++; | |
| 180 | tx = shift & 1; | |
| 181 | shift >>= 1; | |
| 182 | bit++; | |
| 183 | if(bit == 8) { | |
| 184 | bit = 0; | |
| 185 | byte++; | |
| 189 | 186 | } |
| 190 | verboselog( machine, 2, "ds2401_write(%d) state_readrom %d\n", which, c->tx ); | |
| 191 | c->timer->adjust( c->t_rdv, which ); | |
| 187 | verboselog(2, "state_readrom %d\n", tx); | |
| 188 | timer_main->adjust(t_rdv); | |
| 192 | 189 | break; |
| 193 | 190 | default: |
| 194 | verboselog( | |
| 191 | verboselog( | |
| 195 | 192 | break; |
| 196 | 193 | } |
| 197 | c->reset_timer->adjust( c->t_rstl, which ); | |
| 198 | } | |
| 199 | else if( data == 1 && c->rx == 0 ) | |
| 200 | { | |
| 201 | switch( c->state ) | |
| 202 | { | |
| 194 | timer_reset->adjust(t_rstl); | |
| 195 | } else if(line && !rx) { | |
| 196 | switch(state) { | |
| 203 | 197 | case STATE_RESET: |
| 204 | c->state = STATE_RESET1; | |
| 205 | c->timer->adjust( c->t_pdh, which ); | |
| 198 | state = STATE_RESET1; | |
| 199 | timer_main->adjust(t_pdh); | |
| 206 | 200 | break; |
| 207 | 201 | } |
| 208 | | |
| 202 | | |
| 209 | 203 | } |
| 210 | | |
| 204 | | |
| 211 | 205 | } |
| 212 | 206 | |
| 213 | ||
| 207 | bool ds2401_ | |
| 214 | 208 | { |
| 215 | struct ds2401_chip *c = &ds2401[ which ]; | |
| 209 | verboselog(2, "read %d\n", tx && rx); | |
| 210 | return tx && rx; | |
| 211 | } | |
| 216 | 212 | |
| 217 | verboselog( machine, 2, "ds2401_read( %d ) %d\n", which, c->tx & c->rx ); | |
| 218 | return c->tx & c->rx; | |
| 213 | UINT8 ds2401_device::direct_read(int index) | |
| 214 | { | |
| 215 | return data[index]; | |
| 219 | 216 | } |
| 220 | 217 | |
| 221 | 218 | /* |
| r10384 | r10385 | |
|---|---|---|
| 100 | 100 | /* the device named 'ram' can get ram options from command line */ |
| 101 | 101 | if (strcmp(device->tag(), RAM_TAG) == 0) |
| 102 | 102 | { |
| 103 | const char *ramsize_string = options_get_string(ma | |
| 103 | const char *ramsize_string = options_get_string(&device->machine->options(), OPTION_RAMSIZE); | |
| 104 | 104 | |
| 105 | 105 | if ((ramsize_string != NULL) && (ramsize_string[0] != '\0')) |
| 106 | 106 | ram->size = ram_parse_string(ramsize_string); |
| r10384 | r10385 | |
| 140 | 140 | /* command line options are only parsed for the device named RAM_TAG */ |
| 141 | 141 | if (device->tag()!=NULL && strcmp(device->tag(), RAM_TAG) == 0) |
| 142 | 142 | { |
| 143 | if (mame_options()==NULL) return FALSE; | |
| 144 | 143 | /* verify command line ram option */ |
| 145 | ramsize_string = options_get_string(mame_options(), OPTION_RAMSIZE); | |
| 146 | gamename_option = options_get_string(mame_options(), OPTION_GAMENAME); | |
| 144 | ramsize_string = options_get_string(&options, OPTION_RAMSIZE); | |
| 145 | gamename_option = options_get_string(&options, OPTION_GAMENAME); | |
| 147 | 146 | |
| 148 | 147 | if ((ramsize_string != NULL) && (ramsize_string[0] != '\0')) |
| 149 | 148 | { |
| r10384 | r10385 | |
|---|---|---|
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | #if !defined( DS2401_H ) | |
| 10 | #define DS2401_H ( 1 ) | |
| 9 | #ifndef __DS2401_H__ | |
| 10 | #define __DS2401_H__ | |
| 11 | 11 | |
| 12 | #define DS2401_MAXCHIP ( 3 ) | |
| 12 | #define MCFG_DS2401_ADD(_tag) \ | |
| 13 | MCFG_DEVICE_ADD(_tag, DS2401, 0) | |
| 13 | 14 | |
| 14 | extern void ds2401_init( running_machine *machine, int which, const UINT8 *data ); | |
| 15 | extern void ds2401_write( running_machine *machine, int which, int data ); | |
| 16 | extern int ds2401_read( running_machine *machine, int which ); | |
| 15 | #include "emu.h" | |
| 17 | 16 | |
| 17 | class ds2401_device_config : public device_config | |
| 18 | { | |
| 19 | friend class ds2401_device; | |
| 20 | ||
| 21 | // construction/destruction | |
| 22 | ds2401_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 23 | ||
| 24 | public: | |
| 25 | // allocators | |
| 26 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 27 | virtual device_t *alloc_device(running_machine &machine) const; | |
| 28 | }; | |
| 29 | ||
| 30 | class ds2401_device : public device_t | |
| 31 | { | |
| 32 | friend class ds2401_device_config; | |
| 33 | ||
| 34 | // construction/destruction | |
| 35 | ds2401_device(running_machine &_machine, const ds2401_device_config &config); | |
| 36 | ||
| 37 | public: | |
| 38 | void write(bool line); | |
| 39 | bool read(); | |
| 40 | UINT8 direct_read(int index); | |
| 41 | ||
| 42 | protected: | |
| 43 | enum { | |
| 44 | SIZE_DATA = 8, | |
| 45 | ||
| 46 | COMMAND_READROM = 0x33 | |
| 47 | }; | |
| 48 | ||
| 49 | enum { | |
| 50 | STATE_IDLE, | |
| 51 | STATE_RESET, | |
| 52 | STATE_RESET1, | |
| 53 | STATE_RESET2, | |
| 54 | STATE_COMMAND, | |
| 55 | STATE_READROM | |
| 56 | }; | |
| 57 | ||
| 58 | enum { | |
| 59 | TIMER_MAIN, | |
| 60 | TIMER_RESET | |
| 61 | }; | |
| 62 | ||
| 63 | // device-level overrides | |
| 64 | virtual void device_start(); | |
| 65 | virtual void device_reset(); | |
| 66 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); | |
| 67 | ||
| 68 | // internal state | |
| 69 | const ds2401_device_config &config; | |
| 70 | ||
| 71 | int state, bit, shift; | |
| 72 | UINT8 byte; | |
| 73 | bool rx, tx; | |
| 74 | UINT8 data[SIZE_DATA]; | |
| 75 | emu_timer *timer_main, *timer_reset; | |
| 76 | attotime t_samp, t_rdv, t_rstl, t_pdh, t_pdl; | |
| 77 | ||
| 78 | private: | |
| 79 | inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ...); | |
| 80 | }; | |
| 81 | ||
| 82 | ||
| 83 | // device type definition | |
| 84 | extern const device_type DS2401; | |
| 85 | ||
| 18 | 86 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 167 | 167 | // .nv file |
| 168 | 168 | //------------------------------------------------- |
| 169 | 169 | |
| 170 | void er2055_device::nvram_read( | |
| 170 | void er2055_device::nvram_read( | |
| 171 | 171 | { |
| 172 | 172 | UINT8 buffer[SIZE_DATA]; |
| 173 | | |
| 173 | | |
| 174 | 174 | for (int byte = 0; byte < SIZE_DATA; byte++) |
| 175 | 175 | m_addrspace[0]->write_byte(byte, buffer[byte]); |
| 176 | 176 | } |
| r10384 | r10385 | |
| 181 | 181 | // .nv file |
| 182 | 182 | //------------------------------------------------- |
| 183 | 183 | |
| 184 | void er2055_device::nvram_write( | |
| 184 | void er2055_device::nvram_write( | |
| 185 | 185 | { |
| 186 | 186 | UINT8 buffer[SIZE_DATA]; |
| 187 | 187 | for (int byte = 0; byte < SIZE_DATA; byte++) |
| 188 | 188 | buffer[byte] = m_addrspace[0]->read_byte(byte); |
| 189 | | |
| 189 | | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 |
| r10384 | r10385 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | // device_nvram_interface overrides |
| 111 | 111 | virtual void nvram_default(); |
| 112 | virtual void nvram_read(mame_file &file); | |
| 113 | virtual void nvram_write(mame_file &file); | |
| 112 | virtual void nvram_read(emu_file &file); | |
| 113 | virtual void nvram_write(emu_file &file); | |
| 114 | 114 | |
| 115 | 115 | static const int SIZE_DATA = 0x40; |
| 116 | 116 |
| r0 | r10385 | |
|---|---|---|
| 1 | #include "emu.h" | |
| 2 | #include "machine/secflash.h" | |
| 3 | ||
| 4 | device_secure_serial_flash_config::device_secure_serial_flash_config(const machine_config &mconfig, | |
| 5 | device_type type, | |
| 6 | const char *name, const char *tag, | |
| 7 | const device_config *owner, UINT32 clock, UINT32 param) | |
| 8 | : device_config(mconfig, type, name, tag, owner, clock, param), | |
| 9 | device_config_nvram_interface(mconfig, *this) | |
| 10 | { | |
| 11 | } | |
| 12 | ||
| 13 | device_secure_serial_flash::device_secure_serial_flash(running_machine &_machine, const device_secure_serial_flash_config &config) : device_t(_machine, config), | |
| 14 | device_nvram_interface(_machine, config, *this) | |
| 15 | { | |
| 16 | } | |
| 17 | ||
| 18 | void device_secure_serial_flash::device_start() | |
| 19 | { | |
| 20 | save_item(NAME(cs)); | |
| 21 | save_item(NAME(rst)); | |
| 22 | save_item(NAME(scl)); | |
| 23 | save_item(NAME(sdaw)); | |
| 24 | save_item(NAME(sdar)); | |
| 25 | } | |
| 26 | ||
| 27 | void device_secure_serial_flash::device_reset() | |
| 28 | { | |
| 29 | cs = rst = scl = sdaw = sdar = false; | |
| 30 | } | |
| 31 | ||
| 32 | void device_secure_serial_flash::cs_w(bool _cs) | |
| 33 | { | |
| 34 | if(cs == _cs) | |
| 35 | return; | |
| 36 | cs = _cs; | |
| 37 | if(cs) | |
| 38 | cs_1(); | |
| 39 | else | |
| 40 | cs_0(); | |
| 41 | } | |
| 42 | ||
| 43 | void device_secure_serial_flash::rst_w(bool _rst) | |
| 44 | { | |
| 45 | if(rst == _rst) | |
| 46 | return; | |
| 47 | rst = _rst; | |
| 48 | if(rst) | |
| 49 | rst_1(); | |
| 50 | else | |
| 51 | rst_0(); | |
| 52 | } | |
| 53 | ||
| 54 | void device_secure_serial_flash::scl_w(bool _scl) | |
| 55 | { | |
| 56 | if(scl == _scl) | |
| 57 | return; | |
| 58 | scl = _scl; | |
| 59 | if(scl) | |
| 60 | scl_1(); | |
| 61 | else | |
| 62 | scl_0(); | |
| 63 | } | |
| 64 | ||
| 65 | void device_secure_serial_flash::sda_w(bool _sda) | |
| 66 | { | |
| 67 | if(sdaw == _sda) | |
| 68 | return; | |
| 69 | sdaw = _sda; | |
| 70 | if(sdaw) | |
| 71 | sda_1(); | |
| 72 | else | |
| 73 | sda_0(); | |
| 74 | } | |
| 75 | ||
| 76 | bool device_secure_serial_flash::sda_r() | |
| 77 | { | |
| 78 | return cs ? true : sdar; | |
| 79 | } |
| r0 | r10385 | |
|---|---|---|
| 1 | // Common interface for all secure serial flashes | |
| 2 | ||
| 3 | #ifndef __SECFLASH_H__ | |
| 4 | #define __SECFLASH_H__ | |
| 5 | ||
| 6 | #include "emu.h" | |
| 7 | ||
| 8 | class device_secure_serial_flash_config : public device_config, | |
| 9 | public device_config_nvram_interface | |
| 10 | { | |
| 11 | public: | |
| 12 | device_secure_serial_flash_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 param = 0); | |
| 13 | }; | |
| 14 | ||
| 15 | class device_secure_serial_flash : public device_t, | |
| 16 | public device_nvram_interface | |
| 17 | { | |
| 18 | public: | |
| 19 | void cs_w(bool cs); | |
| 20 | void rst_w(bool rst); | |
| 21 | void scl_w(bool scl); | |
| 22 | void sda_w(bool sda); | |
| 23 | bool sda_r(); | |
| 24 | ||
| 25 | protected: | |
| 26 | bool cs, rst, scl, sdaw, sdar; | |
| 27 | ||
| 28 | virtual void cs_0() = 0; | |
| 29 | virtual void cs_1() = 0; | |
| 30 | virtual void rst_0() = 0; | |
| 31 | virtual void rst_1() = 0; | |
| 32 | virtual void scl_0() = 0; | |
| 33 | virtual void scl_1() = 0; | |
| 34 | virtual void sda_0() = 0; | |
| 35 | virtual void sda_1() = 0; | |
| 36 | ||
| 37 | device_secure_serial_flash(running_machine &_machine, const device_secure_serial_flash_config &config); | |
| 38 | virtual void device_start(); | |
| 39 | virtual void device_reset(); | |
| 40 | }; | |
| 41 | ||
| 42 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 312 | 312 | ***************************************************************************/ |
| 313 | 313 | |
| 314 | 314 | /*------------------------------------------------- |
| 315 | nvram_fopen - open an NVRAM file directly | |
| 316 | -------------------------------------------------*/ | |
| 317 | ||
| 318 | mame_file *nvram_fopen(running_machine *machine, UINT32 openflags) | |
| 319 | { | |
| 320 | file_error filerr; | |
| 321 | mame_file *file; | |
| 322 | ||
| 323 | astring fname(machine->basename(), ".nv"); | |
| 324 | filerr = mame_fopen(SEARCHPATH_NVRAM, fname, openflags, &file); | |
| 325 | ||
| 326 | return (filerr == FILERR_NONE) ? file : NULL; | |
| 327 | } | |
| 328 | ||
| 329 | ||
| 330 | /*------------------------------------------------- | |
| 331 | 315 | nvram_load - load a system's NVRAM |
| 332 | 316 | -------------------------------------------------*/ |
| 333 | 317 | |
| r10384 | r10385 | |
| 339 | 323 | return; |
| 340 | 324 | |
| 341 | 325 | // open the file; if it exists, call everyone to read from it |
| 342 | mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_READ); | |
| 343 | if (nvram_file != NULL) | |
| 326 | emu_file file(machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_READ); | |
| 327 | if (file.open(machine->basename(), ".nv") == FILERR_NONE) | |
| 344 | 328 | { |
| 345 | 329 | // read data from general NVRAM handler first |
| 346 | 330 | if (machine->config->m_nvram_handler != NULL) |
| 347 | (*machine->config->m_nvram_handler)(machine, | |
| 331 | (*machine->config->m_nvram_handler)(machine, & | |
| 348 | 332 | |
| 349 | 333 | // find all devices with NVRAM handlers, and read from them next |
| 350 | 334 | for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) |
| 351 | nvram->nvram_load(*nvram_file); | |
| 352 | ||
| 353 | // close the file | |
| 354 | mame_fclose(nvram_file); | |
| 335 | nvram->nvram_load(file); | |
| 355 | 336 | } |
| 356 | 337 | |
| 357 | 338 | // otherwise, tell everyone to initialize their NVRAM areas |
| r10384 | r10385 | |
| 380 | 361 | return; |
| 381 | 362 | |
| 382 | 363 | // open the file; if it exists, call everyone to read from it |
| 383 | mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 384 | if (nvram_file != NULL) | |
| 364 | emu_file file(machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 365 | if (file.open(machine->basename(), ".nv") == FILERR_NONE) | |
| 385 | 366 | { |
| 386 | 367 | // write data via general NVRAM handler first |
| 387 | 368 | if (machine->config->m_nvram_handler != NULL) |
| 388 | (*machine->config->m_nvram_handler)(machine, | |
| 369 | (*machine->config->m_nvram_handler)(machine, & | |
| 389 | 370 | |
| 390 | 371 | // find all devices with NVRAM handlers, and tell them to write next |
| 391 | 372 | for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) |
| 392 | nvram->nvram_save(*nvram_file); | |
| 393 | ||
| 394 | // close the file | |
| 395 | mame_fclose(nvram_file); | |
| 373 | nvram->nvram_save(file); | |
| 396 | 374 | } |
| 397 | 375 | } |
| 398 | 376 | |
| r10384 | r10385 | |
| 420 | 398 | |
| 421 | 399 | int memcard_create(running_machine *machine, int index, int overwrite) |
| 422 | 400 | { |
| 423 | file_error filerr; | |
| 424 | mame_file *file; | |
| 425 | 401 | char name[16]; |
| 426 | 402 | |
| 427 | 403 | /* create a name */ |
| r10384 | r10385 | |
| 431 | 407 | astring fname(machine->basename(), PATH_SEPARATOR, name); |
| 432 | 408 | if (!overwrite) |
| 433 | 409 | { |
| 434 | filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_READ, &file); | |
| 435 | if (filerr == FILERR_NONE) | |
| 436 | { | |
| 437 | mame_fclose(file); | |
| 410 | emu_file testfile(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 411 | if (testfile.open(fname) == FILERR_NONE) | |
| 438 | 412 | return 1; |
| 439 | } | |
| 440 | 413 | } |
| 441 | 414 | |
| 442 | 415 | /* create a new file */ |
| 443 | filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 416 | emu_file file(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 417 | file_error filerr = file.open(fname); | |
| 444 | 418 | if (filerr != FILERR_NONE) |
| 445 | 419 | return 1; |
| 446 | 420 | |
| r10384 | r10385 | |
| 449 | 423 | (*machine->config->m_memcard_handler)(machine, file, MEMCARD_CREATE); |
| 450 | 424 | |
| 451 | 425 | /* close the file */ |
| 452 | mame_fclose(file); | |
| 453 | 426 | return 0; |
| 454 | 427 | } |
| 455 | 428 | |
| r10384 | r10385 | |
| 462 | 435 | int memcard_insert(running_machine *machine, int index) |
| 463 | 436 | { |
| 464 | 437 | generic_machine_private *state = machine->generic_machine_data; |
| 465 | file_error filerr; | |
| 466 | mame_file *file; | |
| 467 | 438 | char name[16]; |
| 468 | 439 | |
| 469 | 440 | /* if a card is already inserted, eject it first */ |
| r10384 | r10385 | |
| 473 | 444 | |
| 474 | 445 | /* create a name */ |
| 475 | 446 | memcard_name(index, name); |
| 476 | astring fname(machine->basename(), PATH_SEPARATOR, name); | |
| 477 | 447 | |
| 478 | 448 | /* open the file; if we can't, it's an error */ |
| 479 | filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_READ, &file); | |
| 449 | emu_file file(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 450 | file_error filerr = file.open(machine->basename(), PATH_SEPARATOR, name); | |
| 480 | 451 | if (filerr != FILERR_NONE) |
| 481 | 452 | return 1; |
| 482 | 453 | |
| r10384 | r10385 | |
| 485 | 456 | (*machine->config->m_memcard_handler)(machine, file, MEMCARD_INSERT); |
| 486 | 457 | |
| 487 | 458 | /* close the file */ |
| 488 | mame_fclose(file); | |
| 489 | 459 | state->memcard_inserted = index; |
| 490 | 460 | return 0; |
| 491 | 461 | } |
| r10384 | r10385 | |
| 499 | 469 | void memcard_eject(running_machine &machine) |
| 500 | 470 | { |
| 501 | 471 | generic_machine_private *state = machine.generic_machine_data; |
| 502 | file_error filerr; | |
| 503 | mame_file *file; | |
| 504 | 472 | char name[16]; |
| 505 | 473 | |
| 506 | 474 | /* if no card is preset, just ignore */ |
| r10384 | r10385 | |
| 509 | 477 | |
| 510 | 478 | /* create a name */ |
| 511 | 479 | memcard_name(state->memcard_inserted, name); |
| 512 | astring fname(machine.basename(), PATH_SEPARATOR, name); | |
| 513 | 480 | |
| 514 | 481 | /* open the file; if we can't, it's an error */ |
| 515 | filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 482 | emu_file file(machine.options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 483 | file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name); | |
| 516 | 484 | if (filerr != FILERR_NONE) |
| 517 | { | |
| 518 | mame_fclose(file); | |
| 519 | 485 | return; |
| 520 | } | |
| 521 | 486 | |
| 522 | 487 | /* initialize and then load the card */ |
| 523 | 488 | if (machine.m_config.m_memcard_handler) |
| 524 | 489 | (*machine.m_config.m_memcard_handler)(&machine, file, MEMCARD_EJECT); |
| 525 | 490 | |
| 526 | 491 | /* close the file */ |
| 527 | mame_fclose(file); | |
| 528 | 492 | state->memcard_inserted = -1; |
| 529 | 493 | } |
| 530 | 494 |
| r10384 | r10385 | |
|---|---|---|
| 14 | 14 | #include "emu.h" |
| 15 | 15 | #include "machine/x76f041.h" |
| 16 | 16 | |
| 17 | #define VERBOSE_LEVEL | |
| 17 | #define VERBOSE_LEVEL | |
| 18 | 18 | |
| 19 | ||
| 19 | inline void ATTR_PRINTF(3,4) x76f041_device::verboselog( | |
| 20 | 20 | { |
| 21 | if( | |
| 21 | if( | |
| 22 | 22 | { |
| 23 | 23 | va_list v; |
| 24 | char buf[ 32768 ]; | |
| 25 | va_start( v, s_fmt ); | |
| 26 | vsprintf( buf, s_fmt, v ); | |
| 27 | va_end( v ); | |
| 28 | logerror( "%s: %s", machine->describe_context(), buf ); | |
| 24 | char buf[32768]; | |
| 25 | va_start(v, s_fmt); | |
| 26 | vsprintf(buf, s_fmt, v); | |
| 27 | va_end(v); | |
| 28 | logerror("x76f041 %s %s: %s", config.tag(), machine->describe_context(), buf); | |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | ||
| 32 | const device | |
| 33 | 33 | |
| 34 | struct x76f041_chip | |
| 34 | x76f041_device_config::x76f041_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 35 | : device_secure_serial_flash_config(mconfig, static_alloc_device_config, "X76F041", tag, owner, clock) | |
| 35 | 36 | { |
| 36 | int cs; | |
| 37 | int rst; | |
| 38 | int scl; | |
| 39 | int sdaw; | |
| 40 | int sdar; | |
| 41 | int state; | |
| 42 | int shift; | |
| 43 | int bit; | |
| 44 | int byte; | |
| 45 | int command; | |
| 46 | int address; | |
| 47 | UINT8 write_buffer[ SIZE_WRITE_BUFFER ]; | |
| 48 | UINT8 *response_to_reset; | |
| 49 | UINT8 *write_password; | |
| 50 | UINT8 *read_password; | |
| 51 | UINT8 *configuration_password; | |
| 52 | UINT8 *configuration_registers; | |
| 53 | UINT8 *data; | |
| 54 | }; | |
| 37 | } | |
| 55 | 38 | |
| 56 | #define SIZE_RESPONSE_TO_RESET ( 4 ) | |
| 57 | #define SIZE_WRITE_PASSWORD ( SIZE_WRITE_BUFFER ) | |
| 58 | #define SIZE_READ_PASSWORD ( SIZE_WRITE_BUFFER ) | |
| 59 | #define SIZE_CONFIGURATION_PASSWORD ( SIZE_WRITE_BUFFER ) | |
| 60 | #define SIZE_CONFIGURATION_REGISTERS ( SIZE_WRITE_BUFFER ) | |
| 61 | #define SIZE_DATA ( 512 ) | |
| 39 | device_config *x76f041_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) | |
| 40 | { | |
| 41 | return global_alloc(x76f041_device_config(mconfig, tag, owner, clock)); | |
| 42 | } | |
| 62 | 43 | |
| 63 | #define CONFIG_BCR1 ( 0 ) | |
| 64 | #define CONFIG_BCR2 ( 1 ) | |
| 65 | #define CONFIG_CR ( 2 ) | |
| 66 | #define CONFIG_RR ( 3 ) | |
| 67 | #define CONFIG_RC ( 4 ) | |
| 44 | device_t *x76f041_device_config::alloc_device(running_machine &machine) const | |
| 45 | { | |
| 46 | return auto_alloc(&machine, x76f041_device(machine, *this)); | |
| 47 | } | |
| 68 | 48 | |
| 69 | #define BCR_X ( 8 ) | |
| 70 | #define BCR_Y ( 4 ) | |
| 71 | #define BCR_Z ( 2 ) | |
| 72 | #define BCR_T ( 1 ) | |
| 49 | x76f041_device::x76f041_device(running_machine &_machine, const x76f041_device_config &_config) | |
| 50 | : device_secure_serial_flash(_machine, _config), | |
| 51 | config(_config) | |
| 52 | { | |
| 53 | } | |
| 73 | 54 | |
| 74 | static struct x76f041_chip x76f041[ X76F041_MAXCHIP ]; | |
| 55 | void x76f041_device::device_start() | |
| 56 | { | |
| 57 | device_secure_serial_flash::device_start(); | |
| 58 | save_item(NAME(state)); | |
| 59 | save_item(NAME(shift)); | |
| 60 | save_item(NAME(bit)); | |
| 61 | save_item(NAME(byte)); | |
| 62 | save_item(NAME(command)); | |
| 63 | save_item(NAME(address)); | |
| 64 | save_item(NAME(write_buffer)); | |
| 65 | save_item(NAME(response_to_reset)); | |
| 66 | save_item(NAME(write_password)); | |
| 67 | save_item(NAME(read_password)); | |
| 68 | save_item(NAME(configuration_password)); | |
| 69 | save_item(NAME(configuration_registers)); | |
| 70 | save_item(NAME(data)); | |
| 71 | } | |
| 75 | 72 | |
| 76 | #define COMMAND_WRITE ( 0x00 ) | |
| 77 | #define COMMAND_READ ( 0x20 ) | |
| 78 | #define COMMAND_WRITE_USE_CONFIGURATION_PASSWORD ( 0x40 ) | |
| 79 | #define COMMAND_READ_USE_CONFIGURATION_PASSWORD ( 0x60 ) | |
| 80 | #define COMMAND_CONFIGURATION ( 0x80 ) | |
| 81 | ||
| 82 | #define CONFIGURATION_PROGRAM_WRITE_PASSWORD ( 0x00 ) | |
| 83 | #define CONFIGURATION_PROGRAM_READ_PASSWORD ( 0x10 ) | |
| 84 | #define CONFIGURATION_PROGRAM_CONFIGURATION_PASSWORD ( 0x20 ) | |
| 85 | #define CONFIGURATION_RESET_WRITE_PASSWORD ( 0x30 ) | |
| 86 | #define CONFIGURATION_RESET_READ_PASSWORD ( 0x40 ) | |
| 87 | #define CONFIGURATION_PROGRAM_CONFIGURATION_REGISTERS ( 0x50 ) | |
| 88 | #define CONFIGURATION_READ_CONFIGURATION_REGISTERS ( 0x60 ) | |
| 89 | #define CONFIGURATION_MASS_PROGRAM ( 0x70 ) | |
| 90 | #define CONFIGURATION_MASS_ERASE ( 0x80 ) | |
| 91 | ||
| 92 | #define STATE_STOP ( 0 ) | |
| 93 | #define STATE_RESPONSE_TO_RESET ( 1 ) | |
| 94 | #define STATE_LOAD_COMMAND ( 2 ) | |
| 95 | #define STATE_LOAD_ADDRESS ( 3 ) | |
| 96 | #define STATE_LOAD_PASSWORD ( 4 ) | |
| 97 | #define STATE_VERIFY_PASSWORD ( 5 ) | |
| 98 | #define STATE_READ_DATA ( 6 ) | |
| 99 | #define STATE_WRITE_DATA ( 7 ) | |
| 100 | #define STATE_READ_CONFIGURATION_REGISTERS ( 8 ) | |
| 101 | #define STATE_WRITE_CONFIGURATION_REGISTERS ( 9 ) | |
| 102 | ||
| 103 | void x76f041_init( running_machine *machine, int chip, UINT8 *data ) | |
| 73 | void x76f041_device::device_reset() | |
| 104 | 74 | { |
| 105 | int offset; | |
| 106 | struct x76f041_chip *c; | |
| 75 | device_secure_serial_flash::device_reset(); | |
| 76 | state = STATE_STOP; | |
| 77 | shift = 0; | |
| 78 | bit = 0; | |
| 79 | byte = 0; | |
| 80 | command = 0; | |
| 81 | address = 0; | |
| 82 | memset(write_buffer, 0, SIZE_WRITE_BUFFER); | |
| 83 | } | |
| 107 | 84 | |
| 108 | if( chip >= X76F041_MAXCHIP ) | |
| 85 | void x76f041_device::nvram_default() | |
| 86 | { | |
| 87 | // region always wins | |
| 88 | if(m_region) | |
| 109 | 89 | { |
| 110 | verboselog( machine, 0, "x76f041_init( %d ) chip out of range\n", chip ); | |
| 111 | return; | |
| 90 | // Ensure the size is correct though | |
| 91 | if(m_region->bytes() != SIZE_RESPONSE_TO_RESET+SIZE_WRITE_PASSWORD+ | |
| 92 | SIZE_READ_PASSWORD+SIZE_CONFIGURATION_PASSWORD+SIZE_CONFIGURATION_REGISTERS+SIZE_DATA) | |
| 93 | logerror("X76F041: Wrong region length for initialization data, expected 0x%x, got 0x%x\n", | |
| 94 | SIZE_RESPONSE_TO_RESET+SIZE_WRITE_PASSWORD+ | |
| 95 | SIZE_READ_PASSWORD+SIZE_CONFIGURATION_PASSWORD+SIZE_CONFIGURATION_REGISTERS+SIZE_DATA, | |
| 96 | m_region->bytes()); | |
| 97 | else { | |
| 98 | UINT8 *rb = m_region->base(); | |
| 99 | int offset = 0; | |
| 100 | memcpy(response_to_reset, rb + offset, SIZE_RESPONSE_TO_RESET); offset += SIZE_RESPONSE_TO_RESET; | |
| 101 | memcpy(write_password, rb + offset, SIZE_WRITE_PASSWORD); offset += SIZE_WRITE_PASSWORD; | |
| 102 | memcpy(read_password, rb + offset, SIZE_READ_PASSWORD); offset += SIZE_READ_PASSWORD; | |
| 103 | memcpy(configuration_password, rb + offset, SIZE_CONFIGURATION_PASSWORD); offset += SIZE_CONFIGURATION_PASSWORD; | |
| 104 | memcpy(configuration_registers, rb + offset, SIZE_CONFIGURATION_REGISTERS); offset += SIZE_CONFIGURATION_REGISTERS; | |
| 105 | memcpy(data, rb + offset, SIZE_DATA); offset += SIZE_DATA; | |
| 106 | return; | |
| 107 | } | |
| 112 | 108 | } |
| 113 | 109 | |
| 114 | c = &x76f041[ chip ]; | |
| 115 | ||
| 116 | if( data == NULL ) | |
| 117 | { | |
| 118 | data = auto_alloc_array( machine, UINT8, | |
| 119 | SIZE_RESPONSE_TO_RESET + | |
| 120 | SIZE_READ_PASSWORD + | |
| 121 | SIZE_WRITE_PASSWORD + | |
| 122 | SIZE_CONFIGURATION_PASSWORD + | |
| 123 | SIZE_CONFIGURATION_REGISTERS + | |
| 124 | SIZE_DATA ); | |
| 125 | } | |
| 126 | ||
| 127 | c->cs = 0; | |
| 128 | c->rst = 0; | |
| 129 | c->scl = 0; | |
| 130 | c->sdaw = 0; | |
| 131 | c->sdar = 0; | |
| 132 | c->state = STATE_STOP; | |
| 133 | c->shift = 0; | |
| 134 | c->bit = 0; | |
| 135 | c->byte = 0; | |
| 136 | c->command = 0; | |
| 137 | c->address = 0; | |
| 138 | memset( c->write_buffer, 0, SIZE_WRITE_BUFFER ); | |
| 139 | ||
| 140 | offset = 0; | |
| 141 | c->response_to_reset = &data[ offset ]; offset += SIZE_RESPONSE_TO_RESET; | |
| 142 | c->write_password = &data[ offset ]; offset += SIZE_WRITE_PASSWORD; | |
| 143 | c->read_password = &data[ offset ]; offset += SIZE_READ_PASSWORD; | |
| 144 | c->configuration_password = &data[ offset ]; offset += SIZE_CONFIGURATION_PASSWORD; | |
| 145 | c->configuration_registers = &data[ offset ]; offset += SIZE_CONFIGURATION_REGISTERS; | |
| 146 | c->data = &data[ offset ]; offset += SIZE_DATA; | |
| 147 | ||
| 148 | state_save_register_item( machine, "x76f041", NULL, chip, c->cs ); | |
| 149 | state_save_register_item( machine, "x76f041", NULL, chip, c->rst ); | |
| 150 | state_save_register_item( machine, "x76f041", NULL, chip, c->scl ); | |
| 151 | state_save_register_item( machine, "x76f041", NULL, chip, c->sdaw ); | |
| 152 | state_save_register_item( machine, "x76f041", NULL, chip, c->sdar ); | |
| 153 | state_save_register_item( machine, "x76f041", NULL, chip, c->state ); | |
| 154 | state_save_register_item( machine, "x76f041", NULL, chip, c->shift ); | |
| 155 | state_save_register_item( machine, "x76f041", NULL, chip, c->bit ); | |
| 156 | state_save_register_item( machine, "x76f041", NULL, chip, c->byte ); | |
| 157 | state_save_register_item( machine, "x76f041", NULL, chip, c->command ); | |
| 158 | state_save_register_item( machine, "x76f041", NULL, chip, c->address ); | |
| 159 | state_save_register_item_array( machine, "x76f041", NULL, chip, c->write_buffer ); | |
| 160 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->response_to_reset, SIZE_RESPONSE_TO_RESET ); | |
| 161 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 162 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->read_password, SIZE_READ_PASSWORD ); | |
| 163 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->configuration_password, SIZE_CONFIGURATION_PASSWORD ); | |
| 164 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->configuration_registers, SIZE_CONFIGURATION_REGISTERS ); | |
| 165 | state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->data, SIZE_DATA ); | |
| 110 | // That chip isn't really usable without the passwords, so bitch | |
| 111 | // if there's no region | |
| 112 | logerror("X76F041: Warning, no default data provided, chip is unusable.\n"); | |
| 113 | memset(response_to_reset, 0, SIZE_RESPONSE_TO_RESET); | |
| 114 | memset(write_password, 0, SIZE_WRITE_PASSWORD); | |
| 115 | memset(read_password, 0, SIZE_READ_PASSWORD); | |
| 116 | memset(configuration_password, 0, SIZE_CONFIGURATION_PASSWORD); | |
| 117 | memset(configuration_registers, 0, SIZE_CONFIGURATION_REGISTERS); | |
| 118 | memset(data, 0, SIZE_DATA); | |
| 166 | 119 | } |
| 167 | 120 | |
| 168 | void x76f041_ | |
| 121 | void x76f041_d | |
| 169 | 122 | { |
| 170 | struct x76f041_chip *c; | |
| 123 | /* enable chip */ | |
| 124 | state = STATE_STOP; | |
| 125 | } | |
| 171 | 126 | |
| 172 | if( chip >= X76F041_MAXCHIP ) | |
| 173 | { | |
| 174 | verboselog( machine, 0, "x76f041_cs_write( %d ) chip out of range\n", chip ); | |
| 175 | return; | |
| 176 | } | |
| 177 | ||
| 178 | c = &x76f041[ chip ]; | |
| 179 | ||
| 180 | if( c->cs != cs ) | |
| 181 | { | |
| 182 | verboselog( machine, 2, "x76f041(%d) cs=%d\n", chip, cs ); | |
| 183 | } | |
| 184 | if( c->cs != 0 && cs == 0 ) | |
| 185 | { | |
| 186 | /* enable chip */ | |
| 187 | c->state = STATE_STOP; | |
| 188 | } | |
| 189 | if( c->cs == 0 && cs != 0 ) | |
| 190 | { | |
| 191 | /* disable chip */ | |
| 192 | c->state = STATE_STOP; | |
| 193 | /* high impendence? */ | |
| 194 | c->sdar = 0; | |
| 195 | } | |
| 196 | c->cs = cs; | |
| 127 | void x76f041_device::cs_1() | |
| 128 | { | |
| 129 | /* disable chip */ | |
| 130 | state = STATE_STOP; | |
| 131 | /* high impendence? */ | |
| 132 | sdar = false; | |
| 197 | 133 | } |
| 198 | 134 | |
| 199 | void x76f041_ | |
| 135 | void x76f041_d | |
| 200 | 136 | { |
| 201 | ||
| 137 | } | |
| 202 | 138 | |
| 203 | if( chip >= X76F041_MAXCHIP ) | |
| 204 | { | |
| 205 | verboselog( machine, 0, "x76f041_rst_write( %d ) chip out of range\n", chip ); | |
| 206 | return; | |
| 139 | void x76f041_device::rst_1() | |
| 140 | { | |
| 141 | if(!cs) { | |
| 142 | verboselog(1, "goto response to reset\n"); | |
| 143 | state = STATE_RESPONSE_TO_RESET; | |
| 144 | bit = 0; | |
| 145 | byte = 0; | |
| 207 | 146 | } |
| 208 | ||
| 209 | c = &x76f041[ chip ]; | |
| 210 | ||
| 211 | if( c->rst != rst ) | |
| 212 | { | |
| 213 | verboselog( machine, 2, "x76f041(%d) rst=%d\n", chip, rst ); | |
| 214 | } | |
| 215 | if( c->rst == 0 && rst != 0 && c->cs == 0 ) | |
| 216 | { | |
| 217 | verboselog( machine, 1, "x76f041(%d) goto response to reset\n", chip ); | |
| 218 | c->state = STATE_RESPONSE_TO_RESET; | |
| 219 | c->bit = 0; | |
| 220 | c->byte = 0; | |
| 221 | } | |
| 222 | c->rst = rst; | |
| 223 | 147 | } |
| 224 | 148 | |
| 225 | ||
| 149 | ||
| 226 | 150 | { |
| 227 | switch( c->command & 0xe0 ) | |
| 228 | { | |
| 151 | switch(command & 0xe0) { | |
| 229 | 152 | case COMMAND_WRITE: |
| 230 | return | |
| 153 | return | |
| 231 | 154 | case COMMAND_READ: |
| 232 | return | |
| 155 | return | |
| 233 | 156 | default: |
| 234 | return c | |
| 157 | return c | |
| 235 | 158 | } |
| 236 | 159 | } |
| 237 | 160 | |
| 238 | ||
| 161 | ||
| 239 | 162 | { |
| 240 | switch( c->command & 0xe0 ) | |
| 241 | { | |
| 163 | switch(command & 0xe0) { | |
| 242 | 164 | case COMMAND_WRITE: |
| 243 | | |
| 165 | | |
| 244 | 166 | break; |
| 245 | 167 | case COMMAND_READ: |
| 246 | | |
| 168 | | |
| 247 | 169 | break; |
| 248 | 170 | case COMMAND_WRITE_USE_CONFIGURATION_PASSWORD: |
| 249 | | |
| 171 | | |
| 250 | 172 | break; |
| 251 | 173 | case COMMAND_READ_USE_CONFIGURATION_PASSWORD: |
| 252 | | |
| 174 | | |
| 253 | 175 | break; |
| 254 | 176 | case COMMAND_CONFIGURATION: |
| 255 | switch( c->address ) | |
| 256 | { | |
| 177 | switch( address ) { | |
| 257 | 178 | case CONFIGURATION_PROGRAM_WRITE_PASSWORD: |
| 258 | 179 | break; |
| 259 | 180 | case CONFIGURATION_PROGRAM_READ_PASSWORD: |
| r10384 | r10385 | |
| 265 | 186 | case CONFIGURATION_RESET_READ_PASSWORD: |
| 266 | 187 | break; |
| 267 | 188 | case CONFIGURATION_PROGRAM_CONFIGURATION_REGISTERS: |
| 268 | c->state = STATE_WRITE_CONFIGURATION_REGISTERS; | |
| 269 | c->byte = 0; | |
| 189 | state = STATE_WRITE_CONFIGURATION_REGISTERS; | |
| 190 | byte = 0; | |
| 270 | 191 | break; |
| 271 | 192 | case CONFIGURATION_READ_CONFIGURATION_REGISTERS: |
| 272 | c->state = STATE_READ_CONFIGURATION_REGISTERS; | |
| 273 | c->byte = 0; | |
| 193 | state = STATE_READ_CONFIGURATION_REGISTERS; | |
| 194 | byte = 0; | |
| 274 | 195 | break; |
| 275 | 196 | case CONFIGURATION_MASS_PROGRAM: |
| 276 | 197 | break; |
| r10384 | r10385 | |
| 282 | 203 | } |
| 283 | 204 | } |
| 284 | 205 | |
| 285 | ||
| 206 | ||
| 286 | 207 | { |
| 287 | 208 | /* todo: handle other bcr bits */ |
| 288 | struct x76f041_chip *c = &x76f041[ chip ]; | |
| 289 | 209 | int bcr; |
| 290 | 210 | |
| 291 | | |
| 211 | | |
| 292 | 212 | |
| 293 | verboselog( | |
| 213 | verboselog( | |
| 294 | 214 | |
| 295 | if( ( c->command & 1 ) == 0 ) | |
| 296 | { | |
| 297 | bcr = c->configuration_registers[ CONFIG_BCR1 ]; | |
| 298 | } | |
| 215 | if(!(command & 1 )) | |
| 216 | bcr = configuration_registers[CONFIG_BCR1]; | |
| 299 | 217 | else |
| 300 | { | |
| 301 | bcr = c->configuration_registers[ CONFIG_BCR2 ]; | |
| 302 | } | |
| 303 | if( ( c->address & 0x80 ) != 0 ) | |
| 304 | { | |
| 218 | bcr = configuration_registers[CONFIG_BCR2]; | |
| 219 | ||
| 220 | if(address & 0x80) | |
| 305 | 221 | bcr >>= 4; |
| 306 | } | |
| 307 | 222 | |
| 308 | if( ( ( c->command & 0xe0 ) == COMMAND_READ && ( bcr & BCR_Z ) != 0 && ( bcr & BCR_T ) != 0 ) || | |
| 309 | ( ( c->command & 0xe0 ) == COMMAND_WRITE && ( bcr & BCR_Z ) != 0 ) ) | |
| 310 | { | |
| 223 | if(((command & 0xe0) == COMMAND_READ && (bcr & BCR_Z) && (bcr & BCR_T)) || | |
| 224 | ((command & 0xe0) == COMMAND_WRITE && (bcr & BCR_Z))) { | |
| 311 | 225 | /* todo: find out when this is really checked. */ |
| 312 | verboselog( machine, 1, "x76f041(%d) command not allowed\n", chip ); | |
| 313 | c->state = STATE_STOP; | |
| 314 | c->sdar = 0; | |
| 226 | verboselog(1, "command not allowed\n"); | |
| 227 | state = STATE_STOP; | |
| 228 | sdar = false; | |
| 229 | ||
| 230 | } else if(((command & 0xe0) == COMMAND_WRITE && !(bcr & BCR_X)) || | |
| 231 | ((command & 0xe0) == COMMAND_READ && !(bcr & BCR_Y))) { | |
| 232 | verboselog(1, "password not required\n"); | |
| 233 | password_ok(); | |
| 234 | ||
| 235 | } else { | |
| 236 | verboselog(1, "send password\n"); | |
| 237 | state = STATE_LOAD_PASSWORD; | |
| 238 | byte = 0; | |
| 315 | 239 | } |
| 316 | else if( ( ( c->command & 0xe0 ) == COMMAND_WRITE && ( bcr & BCR_X ) == 0 ) || | |
| 317 | ( ( c->command & 0xe0 ) == COMMAND_READ && ( bcr & BCR_Y ) == 0 ) ) | |
| 318 | { | |
| 319 | verboselog( machine, 1, "x76f041(%d) password not required\n", chip ); | |
| 320 | x76f041_password_ok( c ); | |
| 321 | } | |
| 322 | else | |
| 323 | { | |
| 324 | verboselog( machine, 1, "x76f041(%d) send password\n", chip ); | |
| 325 | c->state = STATE_LOAD_PASSWORD; | |
| 326 | c->byte = 0; | |
| 327 | } | |
| 328 | 240 | } |
| 329 | 241 | |
| 330 | ||
| 242 | ||
| 331 | 243 | { |
| 332 | int block_offset = ( | |
| 244 | int block_offset = ( | |
| 333 | 245 | |
| 334 | 246 | // TODO: confirm block_start doesn't wrap. |
| 335 | 247 | |
| 336 | return ( | |
| 248 | return ( | |
| 337 | 249 | } |
| 338 | 250 | |
| 339 | void x76f041_ | |
| 251 | void x76f041_d | |
| 340 | 252 | { |
| 341 | struct x76f041_chip *c; | |
| 342 | ||
| 343 | if( chip >= X76F041_MAXCHIP ) | |
| 344 | { | |
| 345 | verboselog( machine, 0, "x76f041_scl_write( %d ) chip out of range\n", chip ); | |
| 346 | return; | |
| 253 | if(!cs) { | |
| 254 | switch(state) { | |
| 255 | case STATE_RESPONSE_TO_RESET: | |
| 256 | sdar = (response_to_reset[byte] >> bit) & 1; | |
| 257 | verboselog(2, "in response to reset %d (%d/%d)\n", sdar, byte, bit); | |
| 258 | bit++; | |
| 259 | if(bit == 8) { | |
| 260 | bit = 0; | |
| 261 | byte++; | |
| 262 | if( byte == 4 ) | |
| 263 | byte = 0; | |
| 264 | } | |
| 265 | break; | |
| 266 | } | |
| 347 | 267 | } |
| 268 | } | |
| 348 | 269 | |
| 349 | c = &x76f041[ chip ]; | |
| 350 | ||
| 351 | if( c->scl != scl ) | |
| 352 | { | |
| 353 | verboselog( machine, 2, "x76f041(%d) scl=%d\n", chip, scl ); | |
| 354 | } | |
| 355 | if( c->cs == 0 ) | |
| 356 | { | |
| 357 | switch( c->state ) | |
| 358 | { | |
| 270 | void x76f041_device::scl_1() | |
| 271 | { | |
| 272 | if(!cs) { | |
| 273 | switch(state) { | |
| 359 | 274 | case STATE_STOP: |
| 360 | 275 | break; |
| 361 | 276 | case STATE_RESPONSE_TO_RESET: |
| 362 | if( c->scl != 0 && scl == 0 ) | |
| 363 | { | |
| 364 | c->sdar = ( c->response_to_reset[ c->byte ] >> c->bit ) & 1; | |
| 365 | verboselog( machine, 2, "x76f041(%d) in response to reset %d (%d/%d)\n", chip, c->sdar, c->byte, c->bit ); | |
| 366 | c->bit++; | |
| 367 | if( c->bit == 8 ) | |
| 368 | { | |
| 369 | c->bit = 0; | |
| 370 | c->byte++; | |
| 371 | if( c->byte == 4 ) | |
| 372 | { | |
| 373 | c->byte = 0; | |
| 374 | } | |
| 375 | } | |
| 376 | } | |
| 377 | 277 | break; |
| 378 | 278 | case STATE_LOAD_COMMAND: |
| 379 | 279 | case STATE_LOAD_ADDRESS: |
| r10384 | r10385 | |
| 381 | 281 | case STATE_VERIFY_PASSWORD: |
| 382 | 282 | case STATE_WRITE_DATA: |
| 383 | 283 | case STATE_WRITE_CONFIGURATION_REGISTERS: |
| 384 | if( c->scl == 0 && scl != 0 ) | |
| 385 | { | |
| 386 | if( c->bit < 8 ) | |
| 387 | { | |
| 388 | verboselog( machine, 2, "x76f041(%d) clock\n", chip ); | |
| 389 | c->shift <<= 1; | |
| 390 | if( c->sdaw != 0 ) | |
| 391 | { | |
| 392 | c->shift |= 1; | |
| 393 | } | |
| 394 | c->bit++; | |
| 395 | } | |
| 396 | else | |
| 397 | { | |
| 398 | c->sdar = 0; | |
| 284 | if(bit < 8) { | |
| 285 | verboselog(2, "clock\n"); | |
| 286 | shift <<= 1; | |
| 287 | if(sdaw) | |
| 288 | shift |= 1; | |
| 289 | bit++; | |
| 290 | } else { | |
| 291 | sdar = false; | |
| 399 | 292 | |
| 400 | switch( c->state ) | |
| 401 | { | |
| 402 | case STATE_LOAD_COMMAND: | |
| 403 | c->command = c->shift; | |
| 404 | verboselog( machine, 1, "x76f041(%d) -> command: %02x\n", chip, c->command ); | |
| 405 | /* todo: verify command is valid? */ | |
| 406 | c->state = STATE_LOAD_ADDRESS; | |
| 407 | break; | |
| 408 | case STATE_LOAD_ADDRESS: | |
| 409 | x76f041_load_address( machine, chip ); | |
| 410 | break; | |
| 411 | case STATE_LOAD_PASSWORD: | |
| 412 | verboselog( machine, 1, "x76f041(%d) -> password: %02x\n", chip, c->shift ); | |
| 413 | c->write_buffer[ c->byte++ ] = c->shift; | |
| 414 | if( c->byte == SIZE_WRITE_BUFFER ) | |
| 415 | { | |
| 416 | c->state = STATE_VERIFY_PASSWORD; | |
| 417 | } | |
| 418 | break; | |
| 419 | case STATE_VERIFY_PASSWORD: | |
| 420 | verboselog( machine, 1, "x76f041(%d) -> verify password: %02x\n", chip, c->shift ); | |
| 421 | /* todo: this should probably be handled as a command */ | |
| 422 | if( c->shift == 0xc0 ) | |
| 423 | { | |
| 424 | /* todo: this should take 10ms before it returns ok. */ | |
| 425 | if( memcmp( x76f041_password( c ), c->write_buffer, SIZE_WRITE_BUFFER ) == 0 ) | |
| 426 | { | |
| 427 | x76f041_password_ok( c ); | |
| 428 | } | |
| 429 | else | |
| 430 | { | |
| 431 | c->sdar = 1; | |
| 432 | } | |
| 433 | } | |
| 434 | break; | |
| 435 | case STATE_WRITE_DATA: | |
| 436 | verboselog( machine, 1, "x76f041(%d) -> data: %02x\n", chip, c->shift ); | |
| 437 | c->write_buffer[ c->byte++ ] = c->shift; | |
| 438 | if( c->byte == SIZE_WRITE_BUFFER ) | |
| 439 | { | |
| 440 | for( c->byte = 0; c->byte < SIZE_WRITE_BUFFER; c->byte++ ) | |
| 441 | { | |
| 442 | c->data[ x76f041_data_offset( c ) ] = c->write_buffer[ c->byte ]; | |
| 443 | } | |
| 444 | c->byte = 0; | |
| 445 | ||
| 446 | verboselog( machine, 1, "x76f041(%d) data flushed\n", chip ); | |
| 447 | } | |
| 448 | break; | |
| 449 | case STATE_WRITE_CONFIGURATION_REGISTERS: | |
| 450 | verboselog( machine, 1, "x76f041(%d) -> configuration register: %02x\n", chip, c->shift ); | |
| 451 | /* todo: write after all bytes received? */ | |
| 452 | c->configuration_registers[ c->byte++ ] = c->shift; | |
| 453 | if( c->byte == SIZE_CONFIGURATION_REGISTERS ) | |
| 454 | { | |
| 455 | c->byte = 0; | |
| 456 | } | |
| 457 | break; | |
| 293 | switch(state) { | |
| 294 | case STATE_LOAD_COMMAND: | |
| 295 | command = shift; | |
| 296 | verboselog(1, "-> command: %02x\n", command); | |
| 297 | /* todo: verify command is valid? */ | |
| 298 | state = STATE_LOAD_ADDRESS; | |
| 299 | break; | |
| 300 | case STATE_LOAD_ADDRESS: | |
| 301 | load_address(); | |
| 302 | break; | |
| 303 | case STATE_LOAD_PASSWORD: | |
| 304 | verboselog(1, "-> password: %02x\n", shift ); | |
| 305 | write_buffer[byte++] = shift; | |
| 306 | if(byte == SIZE_WRITE_BUFFER) | |
| 307 | state = STATE_VERIFY_PASSWORD; | |
| 308 | break; | |
| 309 | case STATE_VERIFY_PASSWORD: | |
| 310 | verboselog(1, "-> verify password: %02x\n", shift); | |
| 311 | /* todo: this should probably be handled as a command */ | |
| 312 | if(shift == 0xc0) { | |
| 313 | /* todo: this should take 10ms before it returns ok. */ | |
| 314 | if(!memcmp(password(), write_buffer, SIZE_WRITE_BUFFER)) | |
| 315 | password_ok(); | |
| 316 | else | |
| 317 | sdar = true; | |
| 458 | 318 | } |
| 459 | ||
| 460 | c->bit = 0; | |
| 461 | c->shift = 0; | |
| 319 | break; | |
| 320 | case STATE_WRITE_DATA: | |
| 321 | verboselog(1, "-> data: %02x\n", shift); | |
| 322 | write_buffer[byte++] = shift; | |
| 323 | if(byte == SIZE_WRITE_BUFFER) { | |
| 324 | for(byte = 0; byte < SIZE_WRITE_BUFFER; byte++) | |
| 325 | data[data_offset()] = write_buffer[byte]; | |
| 326 | byte = 0; | |
| 327 | verboselog(1, "data flushed\n"); | |
| 328 | } | |
| 329 | break; | |
| 330 | case STATE_WRITE_CONFIGURATION_REGISTERS: | |
| 331 | verboselog(1, "-> configuration register: %02x\n", shift); | |
| 332 | /* todo: write after all bytes received? */ | |
| 333 | configuration_registers[byte++] = shift; | |
| 334 | if(byte == SIZE_CONFIGURATION_REGISTERS) | |
| 335 | byte = 0; | |
| 336 | break; | |
| 462 | 337 | } |
| 338 | ||
| 339 | bit = 0; | |
| 340 | shift = 0; | |
| 463 | 341 | } |
| 464 | 342 | break; |
| 465 | 343 | case STATE_READ_DATA: |
| 466 | 344 | case STATE_READ_CONFIGURATION_REGISTERS: |
| 467 | if( c->scl == 0 && scl != 0 ) | |
| 468 | { | |
| 469 | if( c->bit < 8 ) | |
| 470 | { | |
| 471 | if( c->bit == 0 ) | |
| 472 | { | |
| 473 | switch( c->state ) | |
| 474 | { | |
| 475 | case STATE_READ_DATA: | |
| 476 | c->shift = c->data[ x76f041_data_offset( c ) ]; | |
| 477 | verboselog( machine, 1, "x76f041(%d) <- data: %02x\n", chip, c->shift ); | |
| 478 | break; | |
| 479 | case STATE_READ_CONFIGURATION_REGISTERS: | |
| 480 | c->shift = c->configuration_registers[ c->byte & 7 ]; | |
| 481 | verboselog( machine, 1, "x76f041(%d) <- configuration register: %02x\n", chip, c->shift ); | |
| 482 | break; | |
| 483 | } | |
| 345 | if(bit < 8) { | |
| 346 | if(bit == 0) { | |
| 347 | switch(state) { | |
| 348 | case STATE_READ_DATA: | |
| 349 | shift = data[data_offset()]; | |
| 350 | verboselog(1, "<- data: %02x\n", shift); | |
| 351 | break; | |
| 352 | case STATE_READ_CONFIGURATION_REGISTERS: | |
| 353 | shift = configuration_registers[byte & 7]; | |
| 354 | verboselog(1, "<- configuration register: %02x\n", shift ); | |
| 355 | break; | |
| 484 | 356 | } |
| 485 | c->sdar = ( c->shift >> 7 ) & 1; | |
| 486 | c->shift <<= 1; | |
| 487 | c->bit++; | |
| 488 | 357 | } |
| 489 | else | |
| 490 | { | |
| 491 | c->bit = 0; | |
| 492 | c->sdar = 0; | |
| 493 | if( c->sdaw == 0 ) | |
| 494 | { | |
| 495 | verboselog( machine, 2, "x76f041(%d) ack <-\n", chip ); | |
| 496 | c->byte++; | |
| 497 | } | |
| 498 | else | |
| 499 | { | |
| 500 | verboselog( machine, 2, "x76f041(%d) nak <-\n", chip ); | |
| 501 | } | |
| 358 | sdar = ( shift >> 7 ) & 1; | |
| 359 | shift <<= 1; | |
| 360 | bit++; | |
| 361 | } else { | |
| 362 | bit = 0; | |
| 363 | sdar = false; | |
| 364 | if(!sdaw) { | |
| 365 | verboselog(2, "ack <-\n"); | |
| 366 | byte++; | |
| 367 | } else { | |
| 368 | verboselog(2, "nak <-\n"); | |
| 502 | 369 | } |
| 503 | 370 | } |
| 504 | 371 | break; |
| 505 | 372 | } |
| 506 | 373 | } |
| 507 | c->scl = scl; | |
| 508 | 374 | } |
| 509 | 375 | |
| 510 | void x76f041_ | |
| 376 | void x76f041_ | |
| 511 | 377 | { |
| 512 | struct x76f041_chip *c; | |
| 513 | ||
| 514 | if( chip >= X76F041_MAXCHIP ) | |
| 515 | { | |
| 516 | verboselog( machine, 0, "x76f041_sda_write( %d ) chip out of range\n", chip ); | |
| 517 | return; | |
| 518 | } | |
| 519 | ||
| 520 | c = &x76f041[ chip ]; | |
| 521 | ||
| 522 | if( c->sdaw != sda ) | |
| 523 | { | |
| 524 | verboselog( machine, 2, "x76f041(%d) sdaw=%d\n", chip, sda ); | |
| 525 | } | |
| 526 | if( c->cs == 0 && c->scl != 0 ) | |
| 527 | { | |
| 528 | if( c->sdaw == 0 && sda != 0 ) | |
| 529 | { | |
| 530 | verboselog( machine, 1, "x76f041(%d) goto stop\n", chip ); | |
| 531 | c->state = STATE_STOP; | |
| 532 | c->sdar = 0; | |
| 378 | if(!cs && scl) { | |
| 379 | switch(state) { | |
| 380 | case STATE_STOP: | |
| 381 | verboselog(1, "goto start (1)\n"); | |
| 382 | state = STATE_LOAD_COMMAND; | |
| 383 | break; | |
| 384 | case STATE_LOAD_PASSWORD: | |
| 385 | /* todo: this will be the 0xc0 command, but it's not handled as a command yet. */ | |
| 386 | verboselog(1, "goto start (2)\n"); | |
| 387 | break; | |
| 388 | case STATE_READ_DATA: | |
| 389 | verboselog(1, "goto load address\n"); | |
| 390 | state = STATE_LOAD_ADDRESS; | |
| 391 | break; | |
| 392 | default: | |
| 393 | verboselog(1, "skipped start (default)\n"); | |
| 394 | break; | |
| 533 | 395 | } |
| 534 | if( c->sdaw != 0 && sda == 0 ) | |
| 535 | { | |
| 536 | switch( c->state ) | |
| 537 | { | |
| 538 | case STATE_STOP: | |
| 539 | verboselog( machine, 1, "x76f041(%d) goto start\n", chip ); | |
| 540 | c->state = STATE_LOAD_COMMAND; | |
| 541 | break; | |
| 542 | case STATE_LOAD_PASSWORD: | |
| 543 | /* todo: this will be the 0xc0 command, but it's not handled as a command yet. */ | |
| 544 | verboselog( machine, 1, "x76f041(%d) goto start\n", chip ); | |
| 545 | break; | |
| 546 | case STATE_READ_DATA: | |
| 547 | verboselog( machine, 1, "x76f041(%d) goto load address\n", chip ); | |
| 548 | c->state = STATE_LOAD_ADDRESS; | |
| 549 | break; | |
| 550 | default: | |
| 551 | verboselog( machine, 1, "x76f041(%d) skipped start (default)\n", chip ); | |
| 552 | break; | |
| 553 | } | |
| 554 | 396 | |
| 555 | c->bit = 0; | |
| 556 | c->byte = 0; | |
| 557 | c->shift = 0; | |
| 558 | c->sdar = 0; | |
| 559 | } | |
| 397 | bit = 0; | |
| 398 | byte = 0; | |
| 399 | shift = 0; | |
| 400 | sdar = false; | |
| 560 | 401 | } |
| 561 | c->sdaw = sda; | |
| 562 | 402 | } |
| 563 | 403 | |
| 564 | i | |
| 404 | void | |
| 565 | 405 | { |
| 566 | struct x76f041_chip *c; | |
| 567 | ||
| 568 | if( chip >= X76F041_MAXCHIP ) | |
| 569 | { | |
| 570 | verboselog( machine, 0, "x76f041_sda_read( %d ) chip out of range\n", chip ); | |
| 571 | return 1; | |
| 406 | if(!cs && scl) { | |
| 407 | verboselog(1, "goto stop\n"); | |
| 408 | state = STATE_STOP; | |
| 409 | sdar = false; | |
| 572 | 410 | } |
| 573 | ||
| 574 | c = &x76f041[ chip ]; | |
| 575 | ||
| 576 | if( c->cs != 0 ) | |
| 577 | { | |
| 578 | verboselog( machine, 2, "x76f041(%d) not selected\n", chip ); | |
| 579 | return 1; | |
| 580 | } | |
| 581 | verboselog( machine, 2, "x76f041(%d) sdar=%d\n", chip, c->sdar ); | |
| 582 | return c->sdar; | |
| 583 | 411 | } |
| 584 | 412 | |
| 585 | ||
| 413 | ||
| 586 | 414 | { |
| 587 | struct x76f041_chip *c; | |
| 588 | ||
| 589 | if( chip >= X76F041_MAXCHIP ) | |
| 590 | { | |
| 591 | verboselog( machine, 0, "nvram_handler_x76f041( %d ) chip out of range\n", chip ); | |
| 592 | return; | |
| 593 | } | |
| 594 | ||
| 595 | c = &x76f041[ chip ]; | |
| 596 | ||
| 597 | if( read_or_write ) | |
| 598 | { | |
| 599 | mame_fwrite( file, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 600 | mame_fwrite( file, c->read_password, SIZE_READ_PASSWORD ); | |
| 601 | mame_fwrite( file, c->configuration_password, SIZE_CONFIGURATION_PASSWORD ); | |
| 602 | mame_fwrite( file, c->configuration_registers, SIZE_CONFIGURATION_REGISTERS ); | |
| 603 | mame_fwrite( file, c->data, SIZE_DATA ); | |
| 604 | } | |
| 605 | else if( file ) | |
| 606 | { | |
| 607 | mame_fread( file, c->write_password, SIZE_WRITE_PASSWORD ); | |
| 608 | mame_fread( file, c->read_password, SIZE_READ_PASSWORD ); | |
| 609 | mame_fread( file, c->configuration_password, SIZE_CONFIGURATION_PASSWORD ); | |
| 610 | mame_fread( file, c->configuration_registers, SIZE_CONFIGURATION_REGISTERS ); | |
| 611 | mame_fread( file, c->data, SIZE_DATA ); | |
| 612 | } | |
| 415 | file.read(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 416 | file.read(write_password, SIZE_WRITE_PASSWORD); | |
| 417 | file.read(read_password, SIZE_READ_PASSWORD); | |
| 418 | file.read(configuration_password, SIZE_CONFIGURATION_PASSWORD); | |
| 419 | file.read(configuration_registers, SIZE_CONFIGURATION_REGISTERS); | |
| 420 | file.read(data, SIZE_DATA); | |
| 613 | 421 | } |
| 614 | 422 | |
| 615 | NVRAM_HANDLER( x76f041_0 ) { nvram_handler_x76f041( machine, file, read_or_write, 0 ); } | |
| 616 | NVRAM_HANDLER( x76f041_1 ) { nvram_handler_x76f041( machine, file, read_or_write, 1 ); } | |
| 423 | void x76f041_device::nvram_write(emu_file &file) | |
| 424 | { | |
| 425 | file.write(response_to_reset, SIZE_RESPONSE_TO_RESET); | |
| 426 | file.write(write_password, SIZE_WRITE_PASSWORD); | |
| 427 | file.write(read_password, SIZE_READ_PASSWORD); | |
| 428 | file.write(configuration_password, SIZE_CONFIGURATION_PASSWORD); | |
| 429 | file.write(configuration_registers, SIZE_CONFIGURATION_REGISTERS); | |
| 430 | file.write(data, SIZE_DATA); | |
| 431 | } |
| r10384 | r10385 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | /* ----- NVRAM management ----- */ |
| 75 | 75 | |
| 76 | /* open an NVRAM file directly */ | |
| 77 | mame_file *nvram_fopen(running_machine *machine, UINT32 openflags); | |
| 78 | ||
| 79 | 76 | /* load NVRAM from a file */ |
| 80 | 77 | void nvram_load(running_machine *machine); |
| 81 | 78 |
| r10384 | r10385 | |
|---|---|---|
| 196 | 196 | // .nv file |
| 197 | 197 | //------------------------------------------------- |
| 198 | 198 | |
| 199 | void nvram_device::nvram_read( | |
| 199 | void nvram_device::nvram_read( | |
| 200 | 200 | { |
| 201 | 201 | // make sure we have a valid base pointer |
| 202 | 202 | determine_final_base(); |
| 203 | 203 | |
| 204 | | |
| 204 | | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| r10384 | r10385 | |
| 210 | 210 | // .nv file |
| 211 | 211 | //------------------------------------------------- |
| 212 | 212 | |
| 213 | void nvram_device::nvram_write( | |
| 213 | void nvram_device::nvram_write( | |
| 214 | 214 | { |
| 215 | | |
| 215 | | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 |
| r10384 | r10385 | |
|---|---|---|
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | #if !defined( X76F041_H ) | |
| 8 | #ifndef __X76F041_H__ | |
| 9 | #define __X76F041_H__ | |
| 9 | 10 | |
| 10 | #define X76F041_MAXCHIP ( 2 ) | |
| 11 | #define MCFG_X76F041_ADD(_tag) \ | |
| 12 | MCFG_DEVICE_ADD(_tag, X76F041, 0) | |
| 11 | 13 | |
| 12 | extern void x76f041_init( running_machine *machine, int chip, UINT8 *data ); | |
| 13 | extern void x76f041_cs_write( running_machine *machine, int chip, int cs ); | |
| 14 | extern void x76f041_rst_write( running_machine *machine, int chip, int rst ); | |
| 15 | extern void x76f041_scl_write( running_machine *machine, int chip, int scl ); | |
| 16 | extern void x76f041_sda_write( running_machine *machine, int chip, int sda ); | |
| 17 | extern int x76f041_sda_read( running_machine *machine, int chip ); | |
| 18 | extern NVRAM_HANDLER( x76f041_0 ); | |
| 19 | extern NVRAM_HANDLER( x76f041_1 ); | |
| 14 | #include "machine/secflash.h" | |
| 20 | 15 | |
| 21 | #define X76F041_H | |
| 16 | class x76f041_device_config : public device_secure_serial_flash_config | |
| 17 | { | |
| 18 | friend class x76f041_device; | |
| 19 | ||
| 20 | // construction/destruction | |
| 21 | x76f041_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 22 | ||
| 23 | public: | |
| 24 | // allocators | |
| 25 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); | |
| 26 | virtual device_t *alloc_device(running_machine &machine) const; | |
| 27 | }; | |
| 28 | ||
| 29 | class x76f041_device : public device_secure_serial_flash | |
| 30 | { | |
| 31 | friend class x76f041_device_config; | |
| 32 | ||
| 33 | // construction/destruction | |
| 34 | x76f041_device(running_machine &_machine, const x76f041_device_config &config); | |
| 35 | ||
| 36 | protected: | |
| 37 | // device-level overrides | |
| 38 | virtual void device_start(); | |
| 39 | virtual void device_reset(); | |
| 40 | ||
| 41 | // device_nvram_interface overrides | |
| 42 | virtual void nvram_default(); | |
| 43 | virtual void nvram_read(emu_file &file); | |
| 44 | virtual void nvram_write(emu_file &file); | |
| 45 | ||
| 46 | // device_secure_serial_flash implementations | |
| 47 | virtual void cs_0(); | |
| 48 | virtual void cs_1(); | |
| 49 | virtual void rst_0(); | |
| 50 | virtual void rst_1(); | |
| 51 | virtual void scl_0(); | |
| 52 | virtual void scl_1(); | |
| 53 | virtual void sda_0(); | |
| 54 | virtual void sda_1(); | |
| 55 | ||
| 56 | // internal state | |
| 57 | const x76f041_device_config &config; | |
| 58 | ||
| 59 | enum { | |
| 60 | SIZE_WRITE_BUFFER = 8, | |
| 61 | SIZE_RESPONSE_TO_RESET = 4, | |
| 62 | SIZE_WRITE_PASSWORD = 8, | |
| 63 | SIZE_READ_PASSWORD = 8, | |
| 64 | SIZE_CONFIGURATION_PASSWORD = 8, | |
| 65 | SIZE_CONFIGURATION_REGISTERS = 8, | |
| 66 | SIZE_DATA = 512, | |
| 67 | ||
| 68 | CONFIG_BCR1 = 0, | |
| 69 | CONFIG_BCR2 = 1, | |
| 70 | CONFIG_CR = 2, | |
| 71 | CONFIG_RR = 3, | |
| 72 | CONFIG_RC = 4, | |
| 73 | ||
| 74 | BCR_X = 8, | |
| 75 | BCR_Y = 4, | |
| 76 | BCR_Z = 2, | |
| 77 | BCR_T = 1, | |
| 78 | ||
| 79 | COMMAND_WRITE = 0x00, | |
| 80 | COMMAND_READ = 0x20, | |
| 81 | COMMAND_WRITE_USE_CONFIGURATION_PASSWORD = 0x40, | |
| 82 | COMMAND_READ_USE_CONFIGURATION_PASSWORD = 0x60, | |
| 83 | COMMAND_CONFIGURATION = 0x80, | |
| 84 | ||
| 85 | CONFIGURATION_PROGRAM_WRITE_PASSWORD = 0x00, | |
| 86 | CONFIGURATION_PROGRAM_READ_PASSWORD = 0x10, | |
| 87 | CONFIGURATION_PROGRAM_CONFIGURATION_PASSWORD = 0x20, | |
| 88 | CONFIGURATION_RESET_WRITE_PASSWORD = 0x30, | |
| 89 | CONFIGURATION_RESET_READ_PASSWORD = 0x40, | |
| 90 | CONFIGURATION_PROGRAM_CONFIGURATION_REGISTERS = 0x50, | |
| 91 | CONFIGURATION_READ_CONFIGURATION_REGISTERS = 0x60, | |
| 92 | CONFIGURATION_MASS_PROGRAM = 0x70, | |
| 93 | CONFIGURATION_MASS_ERASE = 0x80 | |
| 94 | }; | |
| 95 | ||
| 96 | enum { | |
| 97 | STATE_STOP, | |
| 98 | STATE_RESPONSE_TO_RESET, | |
| 99 | STATE_LOAD_COMMAND, | |
| 100 | STATE_LOAD_ADDRESS, | |
| 101 | STATE_LOAD_PASSWORD, | |
| 102 | STATE_VERIFY_PASSWORD, | |
| 103 | STATE_READ_DATA, | |
| 104 | STATE_WRITE_DATA, | |
| 105 | STATE_READ_CONFIGURATION_REGISTERS, | |
| 106 | STATE_WRITE_CONFIGURATION_REGISTERS | |
| 107 | }; | |
| 108 | ||
| 109 | int state, bit, byte, address; | |
| 110 | UINT8 command, shift; | |
| 111 | UINT8 write_buffer[SIZE_WRITE_BUFFER]; | |
| 112 | UINT8 response_to_reset[SIZE_RESPONSE_TO_RESET]; | |
| 113 | UINT8 write_password[SIZE_WRITE_PASSWORD]; | |
| 114 | UINT8 read_password[SIZE_READ_PASSWORD]; | |
| 115 | UINT8 configuration_password[SIZE_CONFIGURATION_PASSWORD]; | |
| 116 | UINT8 configuration_registers[SIZE_CONFIGURATION_REGISTERS]; | |
| 117 | UINT8 data[SIZE_DATA]; | |
| 118 | ||
| 119 | UINT8 *password(); | |
| 120 | void password_ok(); | |
| 121 | void load_address(); | |
| 122 | int data_offset(); | |
| 123 | ||
| 124 | private: | |
| 125 | inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ...); | |
| 126 | }; | |
| 127 | ||
| 128 | ||
| 129 | // device type definition | |
| 130 | extern const device_type X76F041; | |
| 131 | ||
| 22 | 132 | #endif |
| r10384 | r10385 | |
|---|---|---|
| 150 | 150 | |
| 151 | 151 | // device_nvram_interface overrides |
| 152 | 152 | virtual void nvram_default(); |
| 153 | virtual void nvram_read(mame_file &file); | |
| 154 | virtual void nvram_write(mame_file &file); | |
| 153 | virtual void nvram_read(emu_file &file); | |
| 154 | virtual void nvram_write(emu_file &file); | |
| 155 | 155 | |
| 156 | 156 | // internal helpers |
| 157 | 157 | void determine_final_base(); |
| r10384 | r10385 | |
|---|---|---|
| 139 | 139 | // on this device |
| 140 | 140 | //------------------------------------------------- |
| 141 | 141 | |
| 142 | bool i2cmem_device_config::device_validity_check( const game_driver &driver ) const | |
| 142 | bool i2cmem_device_config::device_validity_check( core_options &options, const game_driver &driver ) const | |
| 143 | 143 | { |
| 144 | 144 | bool error = false; |
| 145 | 145 | return error; |
| r10384 | r10385 | |
| 259 | 259 | // .nv file |
| 260 | 260 | //------------------------------------------------- |
| 261 | 261 | |
| 262 | void i2cmem_device::nvram_read( | |
| 262 | void i2cmem_device::nvram_read( | |
| 263 | 263 | { |
| 264 | 264 | int i2cmem_bytes = m_config.m_data_size; |
| 265 | 265 | UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, i2cmem_bytes ); |
| 266 | 266 | |
| 267 | | |
| 267 | | |
| 268 | 268 | |
| 269 | 269 | for( offs_t offs = 0; offs < i2cmem_bytes; offs++ ) |
| 270 | 270 | { |
| r10384 | r10385 | |
| 279 | 279 | // .nv file |
| 280 | 280 | //------------------------------------------------- |
| 281 | 281 | |
| 282 | void i2cmem_device::nvram_write( | |
| 282 | void i2cmem_device::nvram_write( | |
| 283 | 283 | { |
| 284 | 284 | int i2cmem_bytes = m_config.m_data_size; |
| 285 | 285 | UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, i2cmem_bytes ); |
| r10384 | r10385 | |
| 289 | 289 | buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs ); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | | |
| 292 | | |
| 293 | 293 | |
| 294 | 294 | auto_free( &m_machine, buffer ); |
| 295 | 295 | } |
| r10384 | r10385 | |
|---|---|---|
| 67 | 67 | protected: |
| 68 | 68 | // device_config overrides |
| 69 | 69 | virtual void device_config_complete(); |
| 70 | virtual bool device_validity_check( const game_driver &driver ) const; | |
| 70 | virtual bool device_validity_check( core_options &options, const game_driver &driver ) const; | |
| 71 | 71 | |
| 72 | 72 | // device_config_memory_interface overrides |
| 73 | 73 | virtual const address_space_config *memory_space_config( int spacenum = 0 ) const; |
| r10384 | r10385 | |
| 107 | 107 | |
| 108 | 108 | // device_nvram_interface overrides |
| 109 | 109 | virtual void nvram_default(); |
| 110 | virtual void nvram_read( mame_file &file ); | |
| 111 | virtual void nvram_write( mame_file &file ); | |
| 110 | virtual void nvram_read( emu_file &file ); | |
| 111 | virtual void nvram_write( emu_file &file ); | |
| 112 | 112 | |
| 113 | 113 | // internal helpers |
| 114 | 114 | int address_mask(); |
| r10384 | r10385 | |
|---|---|---|
| 76 | 76 | // on this device |
| 77 | 77 | //------------------------------------------------- |
| 78 | 78 | |
| 79 | bool mb3773_device_config::device_validity_check( const game_driver &driver ) const | |
| 79 | bool mb3773_device_config::device_validity_check( core_options &options, const game_driver &driver ) const | |
| 80 | 80 | { |
| 81 | 81 | return false; |
| 82 | 82 | } |
| r10384 | r10385 | |
|---|---|---|
| 38 | 38 | protected: |
| 39 | 39 | // device_config overrides |
| 40 | 40 | virtual void device_config_complete(); |
| 41 | virtual bool device_validity_check( const game_driver &driver ) const; | |
| 41 | virtual bool device_validity_check( core_options &options, const game_driver &driver ) const; | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 |
| r10384 | r10385 | |
|---|---|---|
| 333 | 333 | // .nv file |
| 334 | 334 | //------------------------------------------------- |
| 335 | 335 | |
| 336 | void intelfsh_device::nvram_read( | |
| 336 | void intelfsh_device::nvram_read( | |
| 337 | 337 | { |
| 338 | 338 | UINT8 *buffer = global_alloc_array(UINT8, m_config.m_size); |
| 339 | | |
| 339 | | |
| 340 | 340 | for (int byte = 0; byte < m_config.m_size; byte++) |
| 341 | 341 | m_addrspace[0]->write_byte(byte, buffer[byte]); |
| 342 | 342 | global_free(buffer); |
| r10384 | r10385 | |
| 348 | 348 | // .nv file |
| 349 | 349 | //------------------------------------------------- |
| 350 | 350 | |
| 351 | void intelfsh_device::nvram_write( | |
| 351 | void intelfsh_device::nvram_write( | |
| 352 | 352 | { |
| 353 | 353 | UINT8 *buffer = global_alloc_array(UINT8, m_config.m_size); |
| 354 | 354 | for (int byte = 0; byte < m_config.m_size; byte++) |
| 355 | 355 | buffer[byte] = m_addrspace[0]->read_byte(byte); |
| 356 | | |
| 356 | | |
| 357 | 357 | global_free(buffer); |
| 358 | 358 | } |
| 359 | 359 |
| r10384 | r10385 | |
|---|---|---|
| 155 | 155 | // .nv file |
| 156 | 156 | //------------------------------------------------- |
| 157 | 157 | |
| 158 | void x2212_device::nvram_read( | |
| 158 | void x2212_device::nvram_read( | |
| 159 | 159 | { |
| 160 | 160 | UINT8 buffer[SIZE_DATA]; |
| 161 | | |
| 161 | | |
| 162 | 162 | for (int byte = 0; byte < SIZE_DATA; byte++) |
| 163 | 163 | { |
| 164 | 164 | m_sram->write_byte(byte, 0xff); |
| r10384 | r10385 | |
| 172 | 172 | // .nv file |
| 173 | 173 | //------------------------------------------------- |
| 174 | 174 | |
| 175 | void x2212_device::nvram_write( | |
| 175 | void x2212_device::nvram_write( | |
| 176 | 176 | { |
| 177 | 177 | // auto-save causes an implicit store prior to exiting (writing) |
| 178 | 178 | if (m_config.m_auto_save) |
| r10384 | r10385 | |
| 181 | 181 | UINT8 buffer[SIZE_DATA]; |
| 182 | 182 | for (int byte = 0; byte < SIZE_DATA; byte++) |
| 183 | 183 | buffer[byte] = m_e2prom->read_byte(byte); |
| 184 | | |
| 184 | | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 |
| r10384 | r10385 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | // device_config_nvram_interface overrides |
| 118 | 118 | virtual void nvram_default(); |
| 119 | virtual void nvram_read(mame_file &file); | |
| 120 | virtual void nvram_write(mame_file &file); | |
| 119 | virtual void nvram_read(emu_file &file); | |
| 120 | virtual void nvram_write(emu_file &file); | |
| 121 | 121 | |
| 122 | 122 | // derived helpers |
| 123 | 123 | UINT32 read_full(UINT32 offset); |
| r10384 | r10385 | |
|---|---|---|
| 94 | 94 | |
| 95 | 95 | // device_nvram_interface overrides |
| 96 | 96 | virtual void nvram_default(); |
| 97 | virtual void nvram_read(mame_file &file); | |
| 98 | virtual void nvram_write(mame_file &file); | |
| 97 | virtual void nvram_read(emu_file &file); | |
| 98 | virtual void nvram_write(emu_file &file); | |
| 99 | 99 | |
| 100 | 100 | static const int SIZE_DATA = 0x100; |
| 101 | 101 |
| r10384 | r10385 | |
|---|---|---|
| 84 | 84 | // on this device |
| 85 | 85 | //------------------------------------------------- |
| 86 | 86 | |
| 87 | bool at28c16_device_config::device_validity_check( const game_driver &driver ) const | |
| 87 | bool at28c16_device_config::device_validity_check( core_options &options, const game_driver &driver ) const | |
| 88 | 88 | { |
| 89 | 89 | return false; |
| 90 | 90 | } |
| r10384 | r10385 | |
| 185 | 185 | // .nv file |
| 186 | 186 | //------------------------------------------------- |
| 187 | 187 | |
| 188 | void at28c16_device::nvram_read( | |
| 188 | void at28c16_device::nvram_read( | |
| 189 | 189 | { |
| 190 | 190 | UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES ); |
| 191 | 191 | |
| 192 | | |
| 192 | | |
| 193 | 193 | |
| 194 | 194 | for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) |
| 195 | 195 | { |
| r10384 | r10385 | |
| 204 | 204 | // .nv file |
| 205 | 205 | //------------------------------------------------- |
| 206 | 206 | |
| 207 | void at28c16_device::nvram_write( | |
| 207 | void at28c16_device::nvram_write( | |
| 208 | 208 | { |
| 209 | 209 | UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES ); |
| 210 | 210 | |
| r10384 | r10385 | |
| 213 | 213 | buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs ); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | | |
| 216 | | |
| 217 | 217 | |
| 218 | 218 | auto_free( &m_machine, buffer ); |
| 219 | 219 | } |
| r10384 | r10385 | |
|---|---|---|
| 58 | 58 | protected: |
| 59 | 59 | // device_config overrides |
| 60 | 60 | virtual void device_config_complete(); |
| 61 | virtual bool device_validity_check( const game_driver &driver ) const; | |
| 61 | virtual bool device_validity_check( core_options &options, const game_driver &driver ) const; | |
| 62 | 62 | |
| 63 | 63 | // device_config_memory_interface overrides |
| 64 | 64 | virtual const address_space_config *memory_space_config( int spacenum = 0 ) const; |
| r10384 | r10385 | |
| 94 | 94 | |
| 95 | 95 | // device_nvram_interface overrides |
| 96 | 96 | virtual void nvram_default(); |
| 97 | virtual void nvram_read( mame_file &file ); | |
| 98 | virtual void nvram_write( mame_file &file ); | |
| 97 | virtual void nvram_read( emu_file &file ); | |
| 98 | virtual void nvram_write( emu_file &file ); | |
| 99 | 99 | |
| 100 | 100 | // internal helpers |
| 101 | 101 | static TIMER_CALLBACK( write_finished ); |
| r10384 | r10385 | |
|---|---|---|
| 164 | 164 | // on this device |
| 165 | 165 | //------------------------------------------------- |
| 166 | 166 | |
| 167 | bool eeprom_device_config::device_validity_check(const game_driver &driver) const | |
| 167 | bool eeprom_device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 168 | 168 | { |
| 169 | 169 | bool error = false; |
| 170 | 170 | |
| r10384 | r10385 | |
| 297 | 297 | // .nv file |
| 298 | 298 | //------------------------------------------------- |
| 299 | 299 | |
| 300 | void eeprom_device::nvram_read( | |
| 300 | void eeprom_device::nvram_read( | |
| 301 | 301 | { |
| 302 | 302 | UINT32 eeprom_length = 1 << m_config.m_address_bits; |
| 303 | 303 | UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; |
| 304 | 304 | |
| 305 | 305 | UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes); |
| 306 | | |
| 306 | | |
| 307 | 307 | for (offs_t offs = 0; offs < eeprom_bytes; offs++) |
| 308 | 308 | m_addrspace[0]->write_byte(offs, buffer[offs]); |
| 309 | 309 | auto_free(&m_machine, buffer); |
| r10384 | r10385 | |
| 315 | 315 | // .nv file |
| 316 | 316 | //------------------------------------------------- |
| 317 | 317 | |
| 318 | void eeprom_device::nvram_write( | |
| 318 | void eeprom_device::nvram_write( | |
| 319 | 319 | { |
| 320 | 320 | UINT32 eeprom_length = 1 << m_config.m_address_bits; |
| 321 | 321 | UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; |
| r10384 | r10385 | |
| 323 | 323 | UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes); |
| 324 | 324 | for (offs_t offs = 0; offs < eeprom_bytes; offs++) |
| 325 | 325 | buffer[offs] = m_addrspace[0]->read_byte(offs); |
| 326 | | |
| 326 | | |
| 327 | 327 | auto_free(&m_machine, buffer); |
| 328 | 328 | } |
| 329 | 329 |
| r10384 | r10385 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | protected: |
| 85 | 85 | // device_config overrides |
| 86 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 86 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 87 | 87 | |
| 88 | 88 | // device_config_memory_interface overrides |
| 89 | 89 | virtual const address_space_config *memory_space_config(int spacenum = 0) const; |
| r10384 | r10385 | |
| 123 | 123 | |
| 124 | 124 | // device_nvram_interface overrides |
| 125 | 125 | virtual void nvram_default(); |
| 126 | virtual void nvram_read(mame_file &file); | |
| 127 | virtual void nvram_write(mame_file &file); | |
| 126 | virtual void nvram_read(emu_file &file); | |
| 127 | virtual void nvram_write(emu_file &file); | |
| 128 | 128 | |
| 129 | 129 | // internal helpers |
| 130 | 130 | void write(int bit); |
| r10384 | r10385 | |
|---|---|---|
| 409 | 409 | // .nv file |
| 410 | 410 | //------------------------------------------------- |
| 411 | 411 | |
| 412 | void ds2404_device::nvram_read( | |
| 412 | void ds2404_device::nvram_read( | |
| 413 | 413 | { |
| 414 | | |
| 414 | | |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | |
| r10384 | r10385 | |
| 420 | 420 | // .nv file |
| 421 | 421 | //------------------------------------------------- |
| 422 | 422 | |
| 423 | void ds2404_device::nvram_write( | |
| 423 | void ds2404_device::nvram_write( | |
| 424 | 424 | { |
| 425 | | |
| 425 | | |
| 426 | 426 | } |
| r10384 | r10385 | |
|---|---|---|
| 102 | 102 | |
| 103 | 103 | // device_nvram_interface overrides |
| 104 | 104 | virtual void nvram_default(); |
| 105 | virtual void nvram_read(mame_file &file); | |
| 106 | virtual void nvram_write(mame_file &file); | |
| 105 | virtual void nvram_read(emu_file &file); | |
| 106 | virtual void nvram_write(emu_file &file); | |
| 107 | 107 | |
| 108 | 108 | static TIMER_CALLBACK( ds2404_tick_callback ); |
| 109 | 109 |
| r10384 | r10385 | |
|---|---|---|
| 348 | 348 | // .nv file |
| 349 | 349 | //------------------------------------------------- |
| 350 | 350 | |
| 351 | void mc146818_device::nvram_read( | |
| 351 | void mc146818_device::nvram_read( | |
| 352 | 352 | { |
| 353 | | |
| 353 | | |
| 354 | 354 | set_base_datetime(); |
| 355 | 355 | } |
| 356 | 356 | |
| r10384 | r10385 | |
| 360 | 360 | // .nv file |
| 361 | 361 | //------------------------------------------------- |
| 362 | 362 | |
| 363 | void mc146818_device::nvram_write( | |
| 363 | void mc146818_device::nvram_write( | |
| 364 | 364 | { |
| 365 | | |
| 365 | | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 |
| r10384 | r10385 | |
|---|---|---|
| 193 | 193 | /* |
| 194 | 194 | load the SRAM and register contents from file |
| 195 | 195 | */ |
| 196 | static int rtc65271_file_load(device_t *device, | |
| 196 | static int rtc65271_file_load(device_t *device, | |
| 197 | 197 | { |
| 198 | 198 | rtc65271_state *state = get_safe_token(device); |
| 199 | 199 | UINT8 buf; |
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | /* version flag */ |
| 203 | if ( | |
| 203 | if ( | |
| 204 | 204 | return 1; |
| 205 | 205 | if (buf != 0) |
| 206 | 206 | return 1; |
| 207 | 207 | |
| 208 | 208 | /* control registers */ |
| 209 | if ( | |
| 209 | if ( | |
| 210 | 210 | return 1; |
| 211 | 211 | state->regs[reg_A] = buf & (reg_A_DV /*| reg_A_RS*/); |
| 212 | if ( | |
| 212 | if ( | |
| 213 | 213 | return 1; |
| 214 | 214 | state->regs[reg_B] = buf & (reg_B_SET | reg_B_DM | reg_B_24h | reg_B_DSE); |
| 215 | 215 | |
| 216 | 216 | /* alarm registers */ |
| 217 | if ( | |
| 217 | if ( | |
| 218 | 218 | return 1; |
| 219 | if ( | |
| 219 | if ( | |
| 220 | 220 | return 1; |
| 221 | if ( | |
| 221 | if ( | |
| 222 | 222 | return 1; |
| 223 | 223 | |
| 224 | 224 | /* user RAM */ |
| 225 | if ( | |
| 225 | if ( | |
| 226 | 226 | return 1; |
| 227 | 227 | |
| 228 | 228 | /* extended RAM */ |
| 229 | if ( | |
| 229 | if ( | |
| 230 | 230 | return 1; |
| 231 | 231 | |
| 232 | 232 | state->regs[reg_D] |= reg_D_VRT; /* the data was backed up successfully */ |
| r10384 | r10385 | |
| 277 | 277 | /* |
| 278 | 278 | save the SRAM and register contents to file |
| 279 | 279 | */ |
| 280 | static int rtc65271_file_save(device_t *device, | |
| 280 | static int rtc65271_file_save(device_t *device, | |
| 281 | 281 | { |
| 282 | 282 | rtc65271_state *state = get_safe_token(device); |
| 283 | 283 | UINT8 buf; |
| r10384 | r10385 | |
| 285 | 285 | |
| 286 | 286 | /* version flag */ |
| 287 | 287 | buf = 0; |
| 288 | if ( | |
| 288 | if ( | |
| 289 | 289 | return 1; |
| 290 | 290 | |
| 291 | 291 | /* control registers */ |
| 292 | 292 | buf = state->regs[reg_A] & (reg_A_DV | reg_A_RS); |
| 293 | if ( | |
| 293 | if ( | |
| 294 | 294 | return 1; |
| 295 | 295 | buf = state->regs[reg_B] & (reg_B_SET | reg_B_DM | reg_B_24h | reg_B_DSE); |
| 296 | if ( | |
| 296 | if ( | |
| 297 | 297 | return 1; |
| 298 | 298 | |
| 299 | 299 | /* alarm registers */ |
| 300 | if ( | |
| 300 | if ( | |
| 301 | 301 | return 1; |
| 302 | if ( | |
| 302 | if ( | |
| 303 | 303 | return 1; |
| 304 | if ( | |
| 304 | if ( | |
| 305 | 305 | return 1; |
| 306 | 306 | |
| 307 | 307 | /* user RAM */ |
| 308 | if ( | |
| 308 | if ( | |
| 309 | 309 | return 1; |
| 310 | 310 | |
| 311 | 311 | /* extended RAM */ |
| 312 | if ( | |
| 312 | if ( | |
| 313 | 313 | return 1; |
| 314 | 314 | |
| 315 | 315 | return 0; |
| r10384 | r10385 | |
| 704 | 704 | static DEVICE_NVRAM( rtc65271 ) |
| 705 | 705 | { |
| 706 | 706 | if (read_or_write) |
| 707 | rtc65271_file_save(device, file); | |
| 707 | rtc65271_file_save(device, *file); | |
| 708 | 708 | else if (file) |
| 709 | rtc65271_file_load(device, file); | |
| 709 | rtc65271_file_load(device, *file); | |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 |
| r10384 | r10385 | |
|---|---|---|
| 98 | 98 | /* execute as configured by the OPTION_GAMENAME option on the specified options */ |
| 99 | 99 | int mame_execute(osd_interface &osd, core_options *options); |
| 100 | 100 | |
| 101 | /* accesses the core_options for the currently running emulation */ | |
| 102 | core_options *mame_options(void); | |
| 103 | ||
| 104 | /* set mame options, used by validate option */ | |
| 105 | void set_mame_options(core_options *options); | |
| 106 | ||
| 107 | 101 | /* return true if the given machine is valid */ |
| 108 | 102 | int mame_is_valid_machine(running_machine *machine); |
| 109 | 103 |
| r10384 | r10385 | |
|---|---|---|
| 101 | 101 | void char_expand(unicode_char chnum, glyph &ch); |
| 102 | 102 | bool load_cached_bdf(const char *filename); |
| 103 | 103 | bool load_bdf(); |
| 104 | bool load_cached( | |
| 104 | bool load_cached( | |
| 105 | 105 | bool save_cached(const char *filename, UINT32 hash); |
| 106 | 106 | |
| 107 | 107 | // internal state |
| r10384 | r10385 | |
|---|---|---|
| 560 | 560 | bitmap_t |
| 561 | 561 | -------------------------------------------------*/ |
| 562 | 562 | |
| 563 | bitmap_t *render_load_png( | |
| 563 | bitmap_t *render_load_png(emu_file &file | |
| 564 | 564 | { |
| 565 | 565 | bitmap_t *bitmap = NULL; |
| 566 | file_error filerr; | |
| 567 | mame_file *file; | |
| 568 | 566 | png_info png; |
| 569 | 567 | png_error result; |
| 570 | 568 | |
| r10384 | r10385 | |
| 574 | 572 | fname.cpy(filename); |
| 575 | 573 | else |
| 576 | 574 | fname.cpy(dirname).cat(PATH_SEPARATOR).cat(filename); |
| 577 | filerr = | |
| 575 | file_error filerr = | |
| 578 | 576 | if (filerr != FILERR_NONE) |
| 579 | 577 | return NULL; |
| 580 | 578 | |
| 581 | 579 | /* read the PNG data */ |
| 582 | result = png_read_file(mame_core_file(file), &png); | |
| 583 | mame_fclose(file); | |
| 580 | result = png_read_file(file, &png); | |
| 581 | file.close(); | |
| 584 | 582 | if (result != PNGERR_NONE) |
| 585 | 583 | return NULL; |
| 586 | 584 |
| r10384 | r10385 | |
|---|---|---|
| 28 | 28 | int render_clip_line(render_bounds *bounds, const render_bounds *clip); |
| 29 | 29 | int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); |
| 30 | 30 | void render_line_to_quad(const render_bounds *bounds, float width, render_bounds *bounds0, render_bounds *bounds1); |
| 31 | bitmap_t *render_load_png( | |
| 31 | bitmap_t *render_load_png(emu_file &file | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 |
| r10384 | r10385 | |
|---|---|---|
| 211 | 211 | // constructed |
| 212 | 212 | //------------------------------------------------- |
| 213 | 213 | |
| 214 | bool device_config_execute_interface::interface_validity_check(const game_driver &driver) const | |
| 214 | bool device_config_execute_interface::interface_validity_check(core_options &options, const game_driver &driver) const | |
| 215 | 215 | { |
| 216 | 216 | const device_config *devconfig = crosscast<const device_config *>(this); |
| 217 | 217 | bool error = false; |
| r10384 | r10385 | |
|---|---|---|
| 177 | 177 | virtual UINT32 execute_default_irq_vector() const; |
| 178 | 178 | |
| 179 | 179 | // optional operation overrides |
| 180 | virtual bool interface_validity_check(const game_driver &driver) const; | |
| 180 | virtual bool interface_validity_check(core_options &options, const game_driver &driver) const; | |
| 181 | 181 | |
| 182 | 182 | bool m_disabled; |
| 183 | 183 | device_interrupt_func m_vblank_interrupt; // for interrupts tied to VBLANK |
| r10384 | r10385 | |
|---|---|---|
| 226 | 226 | // configuration |
| 227 | 227 | //------------------------------------------------- |
| 228 | 228 | |
| 229 | bool screen_device_config::device_validity_check(const game_driver &driver) const | |
| 229 | bool screen_device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 230 | 230 | { |
| 231 | 231 | bool error = false; |
| 232 | 232 | |
| r10384 | r10385 | |
| 363 | 363 | m_scanline_timer->adjust(time_until_pos(0)); |
| 364 | 364 | |
| 365 | 365 | // create burn-in bitmap |
| 366 | if (options_get_int(machine->options(), OPTION_BURNIN) > 0) | |
| 366 | if (options_get_int(&machine->options(), OPTION_BURNIN) > 0) | |
| 367 | 367 | { |
| 368 | 368 | int width, height; |
| 369 | if (sscanf(options_get_string(machine->options(), OPTION_SNAPSIZE), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) | |
| 369 | if (sscanf(options_get_string(&machine->options(), OPTION_SNAPSIZE), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) | |
| 370 | 370 | width = height = 300; |
| 371 | 371 | m_burnin = auto_alloc(machine, bitmap_t(width, height, BITMAP_FORMAT_INDEXED64)); |
| 372 | 372 | if (m_burnin == NULL) |
| r10384 | r10385 | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // load the effect overlay |
| 378 | const char *overname = options_get_string(machine->options(), OPTION_EFFECT); | |
| 378 | const char *overname = options_get_string(&machine->options(), OPTION_EFFECT); | |
| 379 | 379 | if (overname != NULL && strcmp(overname, "none") != 0) |
| 380 | 380 | load_effect_overlay(overname); |
| 381 | 381 | |
| r10384 | r10385 | |
| 1027 | 1027 | // write the final PNG |
| 1028 | 1028 | |
| 1029 | 1029 | // compute the name and create the file |
| 1030 | astring fname; | |
| 1031 | fname.printf("%s" PATH_SEPARATOR "burnin-%s.png", machine->basename(), tag()); | |
| 1032 | mame_file *file; | |
| 1033 | file_error filerr = mame_fopen(SEARCHPATH_SCREENSHOT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); | |
| 1030 | emu_file file(m_machine.options(), SEARCHPATH_SCREENSHOT, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 1031 | file_error filerr = file.open(machine->basename(), PATH_SEPARATOR "burnin-", tag()); | |
| 1034 | 1032 | if (filerr == FILERR_NONE) |
| 1035 | 1033 | { |
| 1036 | 1034 | png_info pnginfo = { 0 }; |
| r10384 | r10385 | |
| 1044 | 1042 | png_add_text(&pnginfo, "System", text); |
| 1045 | 1043 | |
| 1046 | 1044 | // now do the actual work |
| 1047 | pngerr = png_write_bitmap( | |
| 1045 | pngerr = png_write_bitmap( | |
| 1048 | 1046 | |
| 1049 | 1047 | // free any data allocated |
| 1050 | 1048 | png_free(&pnginfo); |
| 1051 | mame_fclose(file); | |
| 1052 | 1049 | } |
| 1053 | 1050 | } |
| 1054 | 1051 | |
| r10384 | r10385 | |
| 1067 | 1064 | fullname.cat(".png"); |
| 1068 | 1065 | |
| 1069 | 1066 | // load the file |
| 1070 | m_screen_overlay_bitmap = render_load_png(OPTION_ARTPATH, NULL, fullname, NULL, NULL); | |
| 1067 | emu_file file(m_machine.options(), OPTION_ARTPATH, OPEN_FLAG_READ); | |
| 1068 | m_screen_overlay_bitmap = render_load_png(file, NULL, fullname, NULL, NULL); | |
| 1071 | 1069 | if (m_screen_overlay_bitmap != NULL) |
| 1072 | 1070 | m_container->set_overlay(m_screen_overlay_bitmap); |
| 1073 | 1071 | else |
| r10384 | r10385 | |
|---|---|---|
| 120 | 120 | |
| 121 | 121 | private: |
| 122 | 122 | // device_config overrides |
| 123 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 123 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 124 | 124 | |
| 125 | 125 | // inline configuration data |
| 126 | 126 | screen_type_enum m_type; // type of screen |
| r10384 | r10385 | |
|---|---|---|
| 773 | 773 | m_rightmix(NULL), |
| 774 | 774 | m_muted(0), |
| 775 | 775 | m_attenuation(0), |
| 776 | m_nosound_mode(!options_get_bool(machine.options(), OPTION_SOUND)), | |
| 776 | m_nosound_mode(!options_get_bool(&machine.options(), OPTION_SOUND)), | |
| 777 | 777 | m_wavfile(NULL), |
| 778 | 778 | m_stream_list(machine.m_respool), |
| 779 | 779 | m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds), |
| 780 | 780 | m_last_update(attotime::zero) |
| 781 | 781 | { |
| 782 | 782 | // get filename for WAV file or AVI file if specified |
| 783 | const char *wavfile = options_get_string(machine.options(), OPTION_WAVWRITE); | |
| 784 | const char *avifile = options_get_string(machine.options(), OPTION_AVIWRITE); | |
| 783 | const char *wavfile = options_get_string(&machine.options(), OPTION_WAVWRITE); | |
| 784 | const char *avifile = options_get_string(&machine.options(), OPTION_AVIWRITE); | |
| 785 | 785 | |
| 786 | 786 | // handle -nosound and lower sample rate if not recording WAV or AVI |
| 787 | 787 | if (m_nosound_mode && wavfile[0] == 0 && avifile[0] == 0) |
| r10384 | r10385 | |
| 809 | 809 | state_save_register_global(&machine, m_last_update); |
| 810 | 810 | |
| 811 | 811 | // set the starting attenuation |
| 812 | set_attenuation(options_get_int(machine.options(), OPTION_VOLUME)); | |
| 812 | set_attenuation(options_get_int(&machine.options(), OPTION_VOLUME)); | |
| 813 | 813 | |
| 814 | 814 | // start the periodic update flushing timer |
| 815 | 815 | m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); |
| r10384 | r10385 | |
|---|---|---|
| 591 | 591 | |
| 592 | 592 | /* read input enable options */ |
| 593 | 593 | device_list[DEVICE_CLASS_KEYBOARD].enabled = TRUE; |
| 594 | device_list[DEVICE_CLASS_MOUSE].enabled = options_get_bool(machine->options(), OPTION_MOUSE); | |
| 595 | device_list[DEVICE_CLASS_LIGHTGUN].enabled = options_get_bool(machine->options(), OPTION_LIGHTGUN); | |
| 596 | device_list[DEVICE_CLASS_JOYSTICK].enabled = options_get_bool(machine->options(), OPTION_JOYSTICK); | |
| 594 | device_list[DEVICE_CLASS_MOUSE].enabled = options_get_bool(&machine->options(), OPTION_MOUSE); | |
| 595 | device_list[DEVICE_CLASS_LIGHTGUN].enabled = options_get_bool(&machine->options(), OPTION_LIGHTGUN); | |
| 596 | device_list[DEVICE_CLASS_JOYSTICK].enabled = options_get_bool(&machine->options(), OPTION_JOYSTICK); | |
| 597 | 597 | |
| 598 | 598 | /* read input device multi options */ |
| 599 | device_list[DEVICE_CLASS_KEYBOARD].multi = options_get_bool(machine->options(), OPTION_MULTIKEYBOARD); | |
| 600 | device_list[DEVICE_CLASS_MOUSE].multi = options_get_bool(machine->options(), OPTION_MULTIMOUSE); | |
| 599 | device_list[DEVICE_CLASS_KEYBOARD].multi = options_get_bool(&machine->options(), OPTION_MULTIKEYBOARD); | |
| 600 | device_list[DEVICE_CLASS_MOUSE].multi = options_get_bool(&machine->options(), OPTION_MULTIMOUSE); | |
| 601 | 601 | device_list[DEVICE_CLASS_LIGHTGUN].multi = TRUE; |
| 602 | 602 | device_list[DEVICE_CLASS_JOYSTICK].multi = TRUE; |
| 603 | 603 | |
| 604 | 604 | /* read other input options */ |
| 605 | state->steadykey_enabled = options_get_bool(machine->options(), OPTION_STEADYKEY); | |
| 606 | state->lightgun_reload_button = options_get_bool(machine->options(), OPTION_OFFSCREEN_RELOAD); | |
| 607 | state->joystick_deadzone = (INT32)(options_get_float(machine->options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX); | |
| 608 | state->joystick_saturation = (INT32)(options_get_float(machine->options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX); | |
| 605 | state->steadykey_enabled = options_get_bool(&machine->options(), OPTION_STEADYKEY); | |
| 606 | state->lightgun_reload_button = options_get_bool(&machine->options(), OPTION_OFFSCREEN_RELOAD); | |
| 607 | state->joystick_deadzone = (INT32)(options_get_float(&machine->options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX); | |
| 608 | state->joystick_saturation = (INT32)(options_get_float(&machine->options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX); | |
| 609 | 609 | |
| 610 | 610 | /* get the default joystick map */ |
| 611 | state->joystick_map_default = options_get_string(machine->options(), OPTION_JOYSTICK_MAP); | |
| 611 | state->joystick_map_default = options_get_string(&machine->options(), OPTION_JOYSTICK_MAP); | |
| 612 | 612 | if (state->joystick_map_default[0] == 0 || strcmp(state->joystick_map_default, "auto") == 0) |
| 613 | 613 | state->joystick_map_default = joystick_map_8way; |
| 614 | 614 | if (!joystick_map_parse(state->joystick_map_default, &map)) |
| r10384 | r10385 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | File access functions. |
| 6 | 6 | |
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 7 | **************************************************************************** | |
| 9 | 8 | |
| 9 | Copyright Aaron Giles | |
| 10 | All rights reserved. | |
| 11 | ||
| 12 | Redistribution and use in source and binary forms, with or without | |
| 13 | modification, are permitted provided that the following conditions are | |
| 14 | met: | |
| 15 | ||
| 16 | * Redistributions of source code must retain the above copyright | |
| 17 | notice, this list of conditions and the following disclaimer. | |
| 18 | * Redistributions in binary form must reproduce the above copyright | |
| 19 | notice, this list of conditions and the following disclaimer in | |
| 20 | the documentation and/or other materials provided with the | |
| 21 | distribution. | |
| 22 | * Neither the name 'MAME' nor the names of its contributors may be | |
| 23 | used to endorse or promote products derived from this software | |
| 24 | without specific prior written permission. | |
| 25 | ||
| 26 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR | |
| 27 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 29 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, | |
| 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 32 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 33 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 35 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 36 | POSSIBILITY OF SUCH DAMAGE. | |
| 37 | ||
| 10 | 38 | ***************************************************************************/ |
| 11 | 39 | |
| 12 | 40 | #include "emu.h" |
| r10384 | r10385 | |
| 16 | 44 | #include "fileio.h" |
| 17 | 45 | |
| 18 | 46 | |
| 19 | /*************************************************************************** | |
| 20 | CONSTANTS | |
| 21 | ***************************************************************************/ | |
| 47 | const UINT32 OPEN_FLAG_HAS_CRC = 0x10000; | |
| 22 | 48 | |
| 23 | #define PLAIN_FILE 0 | |
| 24 | #define ZIPPED_FILE 1 | |
| 25 | 49 | |
| 26 | #define OPEN_FLAG_HAS_CRC 0x10000 | |
| 27 | 50 | |
| 28 | #ifdef MAME_DEBUG | |
| 29 | #define DEBUG_COOKIE 0xbaadf00d | |
| 30 | #endif | |
| 51 | //************************************************************************** | |
| 52 | // PATH ITERATOR | |
| 53 | //************************************************************************** | |
| 31 | 54 | |
| 55 | //------------------------------------------------- | |
| 56 | // path_iterator - constructor | |
| 57 | //------------------------------------------------- | |
| 32 | 58 | |
| 33 | ||
| 34 | /*************************************************************************** | |
| 35 | TYPE DEFINITIONS | |
| 36 | ***************************************************************************/ | |
| 37 | ||
| 38 | typedef struct _path_iterator path_iterator; | |
| 39 | struct _path_iterator | |
| 59 | path_iterator::path_iterator(core_options &opts, const char *searchpath) | |
| 60 | : m_base((searchpath != NULL && !osd_is_absolute_path(searchpath)) ? options_get_string(&opts, searchpath) : ""), | |
| 61 | m_current(m_base), | |
| 62 | m_index(0) | |
| 40 | 63 | { |
| 41 | const char * base; | |
| 42 | const char * cur; | |
| 43 | int index; | |
| 44 | }; | |
| 64 | } | |
| 45 | 65 | |
| 46 | 66 | |
| 47 | /* typedef struct _mame_file mame_file -- declared in fileio.h */ | |
| 48 | struct _mame_file | |
| 49 | { | |
| 50 | #ifdef DEBUG_COOKIE | |
| 51 | UINT32 debug_cookie; /* sanity checking for debugging */ | |
| 52 | #endif | |
| 53 | astring filename; /* full filename */ | |
| 54 | core_file * file; /* core file pointer */ | |
| 55 | path_iterator iterator; /* iterator for paths */ | |
| 56 | UINT32 openflags; /* flags we used for the open */ | |
| 57 | char hash[HASH_BUF_SIZE]; /* hash data for the file */ | |
| 58 | zip_file * zipfile; /* ZIP file pointer */ | |
| 59 | UINT8 * zipdata; /* ZIP file data */ | |
| 60 | UINT64 ziplength; /* ZIP file length */ | |
| 61 | }; | |
| 67 | //------------------------------------------------- | |
| 68 | // path_iterator_get_next - get the next entry | |
| 69 | // in a multipath sequence | |
| 70 | //------------------------------------------------- | |
| 62 | 71 | |
| 63 | ||
| 64 | /* typedef struct _mame_path mame_path -- declared in fileio.h */ | |
| 65 | struct _mame_path | |
| 72 | bool path_iterator::next(astring &buffer) | |
| 66 | 73 | { |
| 67 | path_iterator iterator; | |
| 68 | osd_directory * curdir; | |
| 69 | astring pathbuffer; | |
| 70 | int buflen; | |
| 71 | }; | |
| 74 | // if none left, return FALSE to indicate we are done | |
| 75 | if (m_index != 0 && *m_current == 0) | |
| 76 | return false; | |
| 72 | 77 | |
| 78 | // copy up to the next semicolon | |
| 79 | const char *semi = strchr(m_current, ';'); | |
| 80 | if (semi == NULL) | |
| 81 | semi = m_current + strlen(m_current); | |
| 82 | buffer.cpy(m_current, semi - m_current); | |
| 83 | m_current = (*semi == 0) ? semi : semi + 1; | |
| 73 | 84 | |
| 85 | // bump the index and return TRUE | |
| 86 | m_index++; | |
| 87 | return true; | |
| 88 | } | |
| 74 | 89 | |
| 75 | /*************************************************************************** | |
| 76 | FUNCTION PROTOTYPES | |
| 77 | ***************************************************************************/ | |
| 78 | 90 | |
| 79 | /* core functions */ | |
| 80 | static void fileio_exit(running_machine &machine); | |
| 81 | 91 | |
| 82 | /* file open/close */ | |
| 83 | static file_error fopen_internal(core_options *opts, path_iterator *iterator, const char *filename, UINT32 crc, UINT32 flags, mame_file **file); | |
| 84 | static file_error fopen_attempt_zipped(astring &fullname, UINT32 crc, UINT32 openflags, mame_file *file); | |
| 92 | //************************************************************************** | |
| 93 | // FILE ENUMERATOR | |
| 94 | //************************************************************************** | |
| 85 | 95 | |
| 86 | /* path iteration */ | |
| 87 | static void path_iterator_init(path_iterator *iterator, core_options *opts, const char *searchpath); | |
| 88 | static int path_iterator_get_next(path_iterator *iterator, astring &buffer); | |
| 96 | //------------------------------------------------- | |
| 97 | // file_enumerator - constructor | |
| 98 | //------------------------------------------------- | |
| 89 | 99 | |
| 90 | /* misc helpers */ | |
| 91 | static file_error load_zipped_file(mame_file *file); | |
| 92 | static int zip_filename_match(const zip_file_header *header, const astring &afilename); | |
| 93 | static int zip_header_is_path(const zip_file_header *header); | |
| 100 | file_enumerator::file_enumerator(core_options &options, const char *searchpath) | |
| 101 | : m_iterator(options, searchpath), | |
| 102 | m_curdir(NULL), | |
| 103 | m_buflen(0) | |
| 104 | { | |
| 105 | } | |
| 94 | 106 | |
| 95 | 107 | |
| 108 | //------------------------------------------------- | |
| 109 | // ~file_enumerator - destructor | |
| 110 | //------------------------------------------------- | |
| 96 | 111 | |
| 97 | /*************************************************************************** | |
| 98 | CORE FUNCTIONS | |
| 99 | ***************************************************************************/ | |
| 100 | ||
| 101 | /*------------------------------------------------- | |
| 102 | fileio_init - initialize the internal file | |
| 103 | I/O system; note that the OS layer is free to | |
| 104 | call mame_fopen before fileio_init | |
| 105 | -------------------------------------------------*/ | |
| 106 | ||
| 107 | void fileio_init(running_machine *machine) | |
| 112 | file_enumerator::~file_enumerator() | |
| 108 | 113 | { |
| 109 | machine->add_notifier(MACHINE_NOTIFY_EXIT, fileio_exit); | |
| 114 | // close anything open | |
| 115 | if (m_curdir != NULL) | |
| 116 | osd_closedir(m_curdir); | |
| 110 | 117 | } |
| 111 | 118 | |
| 112 | 119 | |
| 113 | /*------------------------------------------------- | |
| 114 | fileio_exit - clean up behind ourselves | |
| 115 | -------------------------------------------------*/ | |
| 120 | //------------------------------------------------- | |
| 121 | // next - return information about the next file | |
| 122 | // in the search path | |
| 123 | //------------------------------------------------- | |
| 116 | 124 | |
| 117 | st | |
| 125 | const | |
| 118 | 126 | { |
| 119 | zip_file_cache_clear(); | |
| 127 | // loop over potentially empty directories | |
| 128 | while (1) | |
| 129 | { | |
| 130 | // if no open directory, get the next path | |
| 131 | while (m_curdir == NULL) | |
| 132 | { | |
| 133 | // if we fail to get anything more, we're done | |
| 134 | if (!m_iterator.next(m_pathbuffer)) | |
| 135 | return NULL; | |
| 136 | ||
| 137 | // open the path | |
| 138 | m_curdir = osd_opendir(m_pathbuffer); | |
| 139 | } | |
| 140 | ||
| 141 | // get the next entry from the current directory | |
| 142 | const osd_directory_entry *result = osd_readdir(m_curdir); | |
| 143 | if (result != NULL) | |
| 144 | return result; | |
| 145 | ||
| 146 | // we're done; close this directory | |
| 147 | osd_closedir(m_curdir); | |
| 148 | m_curdir = NULL; | |
| 149 | } | |
| 120 | 150 | } |
| 121 | 151 | |
| 122 | 152 | |
| 123 | 153 | |
| 124 | /*************************************************************************** | |
| 125 | FILE OPEN/CLOSE | |
| 126 | ***************************************************************************/ | |
| 154 | //************************************************************************** | |
| 155 | // EMU FILE | |
| 156 | //************************************************************************** | |
| 127 | 157 | |
| 128 | /*------------------------------------------------- | |
| 129 | mame_fopen - open a file for access and | |
| 130 | return an error code | |
| 131 | -------------------------------------------------*/ | |
| 158 | //------------------------------------------------- | |
| 159 | // emu_file - constructor | |
| 160 | //------------------------------------------------- | |
| 132 | 161 | |
| 133 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, mame_file **file) | |
| 162 | emu_file::emu_file(core_options &options, const char *searchpath, UINT32 openflags) | |
| 163 | : m_file(NULL), | |
| 164 | m_iterator(options, searchpath), | |
| 165 | m_crc(0), | |
| 166 | m_openflags(openflags), | |
| 167 | m_zipfile(NULL), | |
| 168 | m_zipdata(NULL), | |
| 169 | m_ziplength(0), | |
| 170 | m_remove_on_close(false) | |
| 134 | 171 | { |
| 135 | path_iterator iterator; | |
| 136 | path_iterator_init(&iterator, mame_options(), searchpath); | |
| 137 | return fopen_internal(mame_options(), &iterator, filename, 0, openflags, file); | |
| 172 | // sanity check the open flags | |
| 173 | if ((m_openflags & OPEN_FLAG_HAS_CRC) && (m_openflags & OPEN_FLAG_WRITE)) | |
| 174 | throw emu_fatalerror("Attempted to open a file for write with OPEN_FLAG_HAS_CRC"); | |
| 138 | 175 | } |
| 139 | 176 | |
| 140 | 177 | |
| 141 | /*------------------------------------------------- | |
| 142 | mame_fopen_crc - open a file by name or CRC | |
| 143 | and return an error code | |
| 144 | -------------------------------------------------*/ | |
| 178 | //------------------------------------------------- | |
| 179 | // ~emu_file - destructor | |
| 180 | //------------------------------------------------- | |
| 145 | 181 | |
| 146 | ||
| 182 | ||
| 147 | 183 | { |
| 148 | path_iterator iterator; | |
| 149 | path_iterator_init(&iterator, mame_options(), searchpath); | |
| 150 | return mame_fopen_crc_options(mame_options(), searchpath, filename, crc, openflags, file); | |
| 184 | // close in the standard way | |
| 185 | close(); | |
| 151 | 186 | } |
| 152 | 187 | |
| 153 | 188 | |
| 154 | /*------------------------------------------------- | |
| 155 | mame_fopen_options - open a file for access and | |
| 156 | return an error code | |
| 157 | -------------------------------------------------*/ | |
| 189 | //------------------------------------------------- | |
| 190 | // operator core_file - automatically convert | |
| 191 | // ourselves to a core_file pointer | |
| 192 | //------------------------------------------------- | |
| 158 | 193 | |
| 159 | ||
| 194 | ||
| 160 | 195 | { |
| 161 | path_iterator iterator; | |
| 162 | path_iterator_init(&iterator, opts, searchpath); | |
| 163 | return fopen_internal(opts, &iterator, filename, 0, openflags, file); | |
| 196 | // load the ZIP file now if we haven't yet | |
| 197 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 198 | return NULL; | |
| 199 | ||
| 200 | // return the core file | |
| 201 | return m_file; | |
| 164 | 202 | } |
| 165 | 203 | |
| 166 | 204 | |
| 167 | /*------------------------------------------------- | |
| 168 | mame_fopen_crc_options - open a file by name | |
| 169 | or CRC and return an error code | |
| 170 | -------------------------------------------------*/ | |
| 205 | //------------------------------------------------- | |
| 206 | // hash - returns the hash for a file | |
| 207 | //------------------------------------------------- | |
| 171 | 208 | |
| 172 | ||
| 209 | ||
| 173 | 210 | { |
| 174 | path_iterator iterator; | |
| 175 | path_iterator_init(&iterator, opts, searchpath); | |
| 176 | return fopen_internal(opts, &iterator, filename, crc, openflags | OPEN_FLAG_HAS_CRC, file); | |
| 211 | // if we already have the functions we need, just return | |
| 212 | UINT32 wehave = hash_data_used_functions(m_hash); | |
| 213 | if ((wehave & functions) == functions) | |
| 214 | return m_hash; | |
| 215 | ||
| 216 | // load the ZIP file now if we haven't yet | |
| 217 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 218 | return m_hash; | |
| 219 | if (m_file == NULL) | |
| 220 | return m_hash; | |
| 221 | ||
| 222 | // read the data if we can | |
| 223 | const UINT8 *filedata = (const UINT8 *)core_fbuffer(m_file); | |
| 224 | if (filedata == NULL) | |
| 225 | return m_hash; | |
| 226 | ||
| 227 | // compute the hash | |
| 228 | hash_compute(m_hash, filedata, core_fsize(m_file), wehave | functions); | |
| 229 | return m_hash; | |
| 177 | 230 | } |
| 178 | 231 | |
| 179 | 232 | |
| 180 | /*------------------------------------------------- | |
| 181 | mame_fopen_ram - open a "file" which is | |
| 182 | actually just an array of data in RAM | |
| 183 | -------------------------------------------------*/ | |
| 233 | //------------------------------------------------- | |
| 234 | // open - open a file by searching paths | |
| 235 | //------------------------------------------------- | |
| 184 | 236 | |
| 185 | file_error | |
| 237 | file_error | |
| 186 | 238 | { |
| 187 | file_error filerr; | |
| 239 | // remember the filename and CRC info | |
| 240 | m_filename = name; | |
| 241 | m_crc = 0; | |
| 242 | m_openflags &= ~OPEN_FLAG_HAS_CRC; | |
| 188 | 243 | |
| 189 | /* allocate the file itself */ | |
| 190 | *file = global_alloc_clear(mame_file); | |
| 244 | // reset the iterator and open_next | |
| 245 | m_iterator.reset(); | |
| 246 | return open_next(); | |
| 247 | } | |
| 191 | 248 | |
| 192 | /* reset the file handle */ | |
| 193 | (*file)->openflags = openflags; | |
| 194 | #ifdef DEBUG_COOKIE | |
| 195 | (*file)->debug_cookie = DEBUG_COOKIE; | |
| 196 | #endif | |
| 249 | file_error emu_file::open(const char *name1, const char *name2) | |
| 250 | { | |
| 251 | // concatenate the strings and do a standard open | |
| 252 | astring name(name1, name2); | |
| 253 | return open(name); | |
| 254 | } | |
| 197 | 255 | |
| 198 | /* attempt to open the file directly */ | |
| 199 | filerr = core_fopen_ram(data, length, openflags, &(*file)->file); | |
| 200 | if (filerr == FILERR_NONE) | |
| 201 | goto error; | |
| 256 | file_error emu_file::open(const char *name1, const char *name2, const char *name3) | |
| 257 | { | |
| 258 | // concatenate the strings and do a standard open | |
| 259 | astring name(name1, name2, name3); | |
| 260 | return open(name); | |
| 261 | } | |
| 202 | 262 | |
| 203 | /* handle errors and return */ | |
| 204 | error: | |
| 205 | if (filerr != FILERR_NONE) | |
| 206 | { | |
| 207 | mame_fclose(*file); | |
| 208 | *file = NULL; | |
| 209 | } | |
| 210 | return filerr; | |
| 263 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4) | |
| 264 | { | |
| 265 | // concatenate the strings and do a standard open | |
| 266 | astring name(name1, name2, name3, name4); | |
| 267 | return open(name); | |
| 211 | 268 | } |
| 212 | 269 | |
| 270 | file_error emu_file::open(const char *name, UINT32 crc) | |
| 271 | { | |
| 272 | // remember the filename and CRC info | |
| 273 | m_filename = name; | |
| 274 | m_crc = crc; | |
| 275 | m_openflags |= OPEN_FLAG_HAS_CRC; | |
| 213 | 276 | |
| 214 | /*------------------------------------------------- | |
| 215 | fopen_internal - open a file | |
| 216 | -------------------------------------------------*/ | |
| 277 | // reset the iterator and open_next | |
| 278 | m_iterator.reset(); | |
| 279 | return open_next(); | |
| 280 | } | |
| 217 | 281 | |
| 218 | ||
| 282 | ||
| 219 | 283 | { |
| 220 | file_error filerr = FILERR_NOT_FOUND; | |
| 284 | // concatenate the strings and do a standard open | |
| 285 | astring name(name1, name2); | |
| 286 | return open(name, crc); | |
| 287 | } | |
| 221 | 288 | |
| 222 | /* can either have a hash or open for write, but not both */ | |
| 223 | if ((openflags & OPEN_FLAG_HAS_CRC) && (openflags & OPEN_FLAG_WRITE)) | |
| 224 | return FILERR_INVALID_ACCESS; | |
| 289 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc) | |
| 290 | { | |
| 291 | // concatenate the strings and do a standard open | |
| 292 | astring name(name1, name2, name3); | |
| 293 | return open(name, crc); | |
| 294 | } | |
| 225 | 295 | |
| 226 | /* allocate the file itself */ | |
| 227 | *file = global_alloc_clear(mame_file); | |
| 296 | file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc) | |
| 297 | { | |
| 298 | // concatenate the strings and do a standard open | |
| 299 | astring name(name1, name2, name3, name4); | |
| 300 | return open(name, crc); | |
| 301 | } | |
| 228 | 302 | |
| 229 | /* reset the file handle */ | |
| 230 | (*file)->openflags = openflags; | |
| 231 | #ifdef DEBUG_COOKIE | |
| 232 | (*file)->debug_cookie = DEBUG_COOKIE; | |
| 233 | #endif | |
| 234 | 303 | |
| 235 | /* loop over paths */ | |
| 236 | while (path_iterator_get_next(iterator, (*file)->filename)) | |
| 304 | //------------------------------------------------- | |
| 305 | // open_next - open the next file that matches | |
| 306 | // the filename by iterating over paths | |
| 307 | //------------------------------------------------- | |
| 308 | ||
| 309 | file_error emu_file::open_next() | |
| 310 | { | |
| 311 | // if we're open from a previous attempt, close up now | |
| 312 | if (m_file != NULL) | |
| 313 | close(); | |
| 314 | ||
| 315 | // loop over paths | |
| 316 | file_error filerr = FILERR_NOT_FOUND; | |
| 317 | while (m_iterator.next(m_fullpath)) | |
| 237 | 318 | { |
| 238 | /* compute the full pathname */ | |
| 239 | if ((*file)->filename.len() > 0) | |
| 240 | (*file)->filename.cat(PATH_SEPARATOR); | |
| 241 | (*file)->filename.cat(filename); | |
| 319 | // compute the full pathname | |
| 320 | if (m_fullpath.len() > 0) | |
| 321 | m_fullpath.cat(PATH_SEPARATOR); | |
| 322 | m_fullpath.cat(m_filename); | |
| 242 | 323 | |
| 243 | /* attempt to open the file directly */ | |
| 244 | filerr = core_fopen((*file)->filename, openflags, &(*file)->file); | |
| 324 | // attempt to open the file directly | |
| 325 | filerr = core_fopen(m_fullpath, m_openflags, &m_file); | |
| 245 | 326 | if (filerr == FILERR_NONE) |
| 246 | 327 | break; |
| 247 | 328 | |
| 248 | /* if we're opening for read-only we have other options */ | |
| 249 | if ((openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ) | |
| 329 | // if we're opening for read-only we have other options | |
| 330 | if ((m_openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ) | |
| 250 | 331 | { |
| 251 | filerr = | |
| 332 | filerr = | |
| 252 | 333 | if (filerr == FILERR_NONE) |
| 253 | 334 | break; |
| 254 | 335 | } |
| 255 | 336 | } |
| 256 | ||
| 257 | /* if we succeeded, save the iterator */ | |
| 258 | if (filerr == FILERR_NONE) | |
| 259 | (*file)->iterator = *iterator; | |
| 260 | ||
| 261 | /* handle errors and return */ | |
| 262 | else | |
| 263 | { | |
| 264 | mame_fclose(*file); | |
| 265 | *file = NULL; | |
| 266 | } | |
| 267 | 337 | return filerr; |
| 268 | 338 | } |
| 269 | 339 | |
| 270 | 340 | |
| 271 | /*------------------------------------------------- | |
| 272 | fopen_attempt_zipped - attempt to open a | |
| 273 | ZIPped file | |
| 274 | -------------------------------------------------*/ | |
| 341 | //------------------------------------------------- | |
| 342 | // open_ram - open a "file" which is actually | |
| 343 | // just an array of data in RAM | |
| 344 | //------------------------------------------------- | |
| 275 | 345 | |
| 276 | ||
| 346 | ||
| 277 | 347 | { |
| 278 | astring filename; | |
| 279 | zip_error ziperr; | |
| 280 | zip_file *zip; | |
| 281 | ||
| 282 | /* loop over directory parts up to the start of filename */ | |
| 283 | while (1) | |
| 284 | { | |
| 285 | const zip_file_header *header; | |
| 286 | int dirsep; | |
| 287 | ||
| 288 | /* find the final path separator */ | |
| 289 | dirsep = fullname.rchr(0, PATH_SEPARATOR[0]); | |
| 290 | if (dirsep == -1) | |
| 291 | return FILERR_NOT_FOUND; | |
| 292 | ||
| 293 | /* insert the part from the right of the separator into the head of the filename */ | |
| 294 | if (filename.len() > 0) | |
| 295 | filename.ins(0, "/"); | |
| 296 | filename.inssubstr(0, fullname, dirsep + 1, -1); | |
| 297 | ||
| 298 | /* remove this part of the filename and append a .zip extension */ | |
| 299 | fullname.substr(0, dirsep).cat(".zip"); | |
| 300 | ||
| 301 | /* attempt to open the ZIP file */ | |
| 302 | ziperr = zip_file_open(fullname, &zip); | |
| 303 | ||
| 304 | /* chop the .zip back off the filename before continuing */ | |
| 305 | fullname.substr(0, dirsep); | |
| 306 | ||
| 307 | /* if we failed to open this file, continue scanning */ | |
| 308 | if (ziperr != ZIPERR_NONE) | |
| 309 | continue; | |
| 310 | ||
| 311 | /* see if we can find a file with the right name and (if available) crc */ | |
| 312 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 313 | if (zip_filename_match(header, filename) && (!(openflags & OPEN_FLAG_HAS_CRC) || header->crc == crc)) | |
| 314 | break; | |
| 315 | ||
| 316 | /* if that failed, look for a file with the right crc, but the wrong filename */ | |
| 317 | if (header == NULL && (openflags & OPEN_FLAG_HAS_CRC)) | |
| 318 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 319 | if (header->crc == crc && (!zip_header_is_path(header))) | |
| 320 | break; | |
| 321 | ||
| 322 | /* if that failed, look for a file with the right name; reporting a bad checksum */ | |
| 323 | /* is more helpful and less confusing than reporting "rom not found" */ | |
| 324 | if (header == NULL) | |
| 325 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 326 | if (zip_filename_match(header, filename)) | |
| 327 | break; | |
| 328 | ||
| 329 | /* if we got it, read the data */ | |
| 330 | if (header != NULL) | |
| 331 | { | |
| 332 | UINT8 crcs[4]; | |
| 333 | ||
| 334 | file->zipfile = zip; | |
| 335 | file->ziplength = header->uncompressed_length; | |
| 336 | ||
| 337 | /* build a hash with just the CRC */ | |
| 338 | hash_data_clear(file->hash); | |
| 339 | crcs[0] = header->crc >> 24; | |
| 340 | crcs[1] = header->crc >> 16; | |
| 341 | crcs[2] = header->crc >> 8; | |
| 342 | crcs[3] = header->crc >> 0; | |
| 343 | hash_data_insert_binary_checksum(file->hash, HASH_CRC, crcs); | |
| 344 | ||
| 345 | if (openflags & OPEN_FLAG_NO_PRELOAD) | |
| 346 | return FILERR_NONE; | |
| 347 | else | |
| 348 | return load_zipped_file(file); | |
| 349 | } | |
| 350 | ||
| 351 | /* close up the ZIP file and try the next level */ | |
| 352 | zip_file_close(zip); | |
| 353 | } | |
| 348 | // set a fake filename and CRC | |
| 349 | m_filename = "RAM"; | |
| 350 | m_crc = 0; | |
| 351 | ||
| 352 | // use the core_file's built-in RAM support | |
| 353 | return core_fopen_ram(data, length, m_openflags, &m_file); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
| 357 | /*------------------------------------------------- | |
| 358 | mame_fclose - closes a file | |
| 359 | -------------------------------------------------*/ | |
| 357 | //------------------------------------------------- | |
| 358 | // close - close a file and free all data; also | |
| 359 | // remove the file if requested | |
| 360 | //------------------------------------------------- | |
| 360 | 361 | |
| 361 | void | |
| 362 | void | |
| 362 | 363 | { |
| 363 | #ifdef DEBUG_COOKIE | |
| 364 | assert(file->debug_cookie == DEBUG_COOKIE); | |
| 365 | file->debug_cookie = 0; | |
| 366 | #endif | |
| 367 | ||
| 368 | /* close files and free memory */ | |
| 369 | if (file->zipfile != NULL) | |
| 370 | zip_file_close(file->zipfile); | |
| 371 | if (file->file != NULL) | |
| 372 | core_fclose(file->file); | |
| 373 | if (file->zipdata != NULL) | |
| 374 | global_free(file->zipdata); | |
| 375 | global_free(file); | |
| 364 | // close files and free memory | |
| 365 | if (m_zipfile != NULL) | |
| 366 | zip_file_close(m_zipfile); | |
| 367 | m_zipfile = NULL; | |
| 368 | ||
| 369 | if (m_file != NULL) | |
| 370 | core_fclose(m_file); | |
| 371 | m_file = NULL; | |
| 372 | ||
| 373 | if (m_zipdata != NULL) | |
| 374 | global_free(m_zipdata); | |
| 375 | m_zipdata = NULL; | |
| 376 | ||
| 377 | if (m_remove_on_close) | |
| 378 | osd_rmfile(m_fullpath); | |
| 379 | m_remove_on_close = false; | |
| 376 | 380 | } |
| 377 | 381 | |
| 378 | 382 | |
| 379 | /*------------------------------------------------- | |
| 380 | mame_fclose_and_open_next - close an open | |
| 381 | file, and open the next entry in the original | |
| 382 | searchpath | |
| 383 | -------------------------------------------------*/ | |
| 383 | //------------------------------------------------- | |
| 384 | // compress - enable/disable streaming file | |
| 385 | // compression via zlib; level is 0 to disable | |
| 386 | // compression, or up to 9 for max compression | |
| 387 | //------------------------------------------------- | |
| 384 | 388 | |
| 385 | file_error | |
| 389 | file_error | |
| 386 | 390 | { |
| 387 | path_iterator iterator = (*file)->iterator; | |
| 388 | mame_fclose(*file); | |
| 389 | *file = NULL; | |
| 390 | return fopen_internal(mame_options(), &iterator, filename, 0, openflags, file); | |
| 391 | return core_fcompress(m_file, level); | |
| 391 | 392 | } |
| 392 | 393 | |
| 393 | 394 | |
| 394 | /*------------------------------------------------- | |
| 395 | mame_fcompress - enable/disable streaming file | |
| 396 | compression via zlib; level is 0 to disable | |
| 397 | compression, or up to 9 for max compression | |
| 398 | -------------------------------------------------*/ | |
| 395 | //------------------------------------------------- | |
| 396 | // seek - seek within a file | |
| 397 | //------------------------------------------------- | |
| 399 | 398 | |
| 400 | ||
| 399 | ||
| 401 | 400 | { |
| 402 | return core_fcompress(file->file, level); | |
| 403 | } | |
| 401 | // load the ZIP file now if we haven't yet | |
| 402 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 403 | return 1; | |
| 404 | 404 | |
| 405 | // seek if we can | |
| 406 | if (m_file != NULL) | |
| 407 | return core_fseek(m_file, offset, whence); | |
| 405 | 408 | |
| 406 | ||
| 407 | /*************************************************************************** | |
| 408 | FILE POSITIONING | |
| 409 | ***************************************************************************/ | |
| 410 | ||
| 411 | /*------------------------------------------------- | |
| 412 | mame_fseek - seek within a file | |
| 413 | -------------------------------------------------*/ | |
| 414 | ||
| 415 | int mame_fseek(mame_file *file, INT64 offset, int whence) | |
| 416 | { | |
| 417 | /* load the ZIP file now if we haven't yet */ | |
| 418 | if (file->zipfile != NULL) | |
| 419 | { | |
| 420 | if (load_zipped_file(file) != FILERR_NONE) | |
| 421 | return 1; | |
| 422 | } | |
| 423 | ||
| 424 | /* seek if we can */ | |
| 425 | if (file->file != NULL) | |
| 426 | return core_fseek(file->file, offset, whence); | |
| 427 | ||
| 428 | 409 | return 1; |
| 429 | 410 | } |
| 430 | 411 | |
| 431 | 412 | |
| 432 | /*------------------------------------------------- | |
| 433 | mame_ftell - return the current file position | |
| 434 | -------------------------------------------------*/ | |
| 413 | //------------------------------------------------- | |
| 414 | // tell - return the current file position | |
| 415 | //------------------------------------------------- | |
| 435 | 416 | |
| 436 | UINT64 | |
| 417 | UINT64 | |
| 437 | 418 | { |
| 438 | /* load the ZIP file now if we haven't yet */ | |
| 439 | if (file->zipfile != NULL) | |
| 440 | { | |
| 441 | if (load_zipped_file(file) != FILERR_NONE) | |
| 442 | return 0; | |
| 443 | } | |
| 419 | // load the ZIP file now if we haven't yet | |
| 420 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 421 | return 0; | |
| 444 | 422 | |
| 445 | /* tell if we can */ | |
| 446 | if (file->file != NULL) | |
| 447 | return core_ftell(file->file); | |
| 423 | // tell if we can | |
| 424 | if (m_file != NULL) | |
| 425 | return core_ftell(m_file); | |
| 448 | 426 | |
| 449 | 427 | return 0; |
| 450 | 428 | } |
| 451 | 429 | |
| 452 | 430 | |
| 453 | /*------------------------------------------------- | |
| 454 | mame_feof - return 1 if we're at the end | |
| 455 | of file | |
| 456 | -------------------------------------------------*/ | |
| 431 | //------------------------------------------------- | |
| 432 | // eof - return true if we're at the end of file | |
| 433 | //------------------------------------------------- | |
| 457 | 434 | |
| 458 | ||
| 435 | bool | |
| 459 | 436 | { |
| 460 | /* load the ZIP file now if we haven't yet */ | |
| 461 | if (file->zipfile != NULL) | |
| 462 | { | |
| 463 | if (load_zipped_file(file) != FILERR_NONE) | |
| 464 | return 0; | |
| 465 | } | |
| 437 | // load the ZIP file now if we haven't yet | |
| 438 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 439 | return 0; | |
| 466 | 440 | |
| 467 | /* return EOF if we can */ | |
| 468 | if (file->file != NULL) | |
| 469 | return core_feof(file->file); | |
| 441 | // return EOF if we can | |
| 442 | if (m_file != NULL) | |
| 443 | return core_feof(m_file); | |
| 470 | 444 | |
| 471 | 445 | return 0; |
| 472 | 446 | } |
| 473 | 447 | |
| 474 | 448 | |
| 475 | /*------------------------------------------------- | |
| 476 | mame_fsize - returns the size of a file | |
| 477 | -------------------------------------------------*/ | |
| 449 | //------------------------------------------------- | |
| 450 | // size - returns the size of a file | |
| 451 | //------------------------------------------------- | |
| 478 | 452 | |
| 479 | UINT64 | |
| 453 | UINT64 | |
| 480 | 454 | { |
| 481 | /* use the ZIP length if present */ | |
| 482 | if (file->zipfile != NULL) | |
| 483 | return file->ziplength; | |
| 455 | // use the ZIP length if present | |
| 456 | if (m_zipfile != NULL) | |
| 457 | return m_ziplength; | |
| 484 | 458 | |
| 485 | /* return length if we can */ | |
| 486 | if (file->file != NULL) | |
| 487 | return core_fsize(file->file); | |
| 459 | // return length if we can | |
| 460 | if (m_file != NULL) | |
| 461 | return core_fsize(m_file); | |
| 488 | 462 | |
| 489 | 463 | return 0; |
| 490 | 464 | } |
| 491 | 465 | |
| 492 | 466 | |
| 467 | //------------------------------------------------- | |
| 468 | // read - read from a file | |
| 469 | //------------------------------------------------- | |
| 493 | 470 | |
| 494 | /*************************************************************************** | |
| 495 | FILE READ | |
| 496 | ***************************************************************************/ | |
| 497 | ||
| 498 | /*------------------------------------------------- | |
| 499 | mame_fread - read from a file | |
| 500 | -------------------------------------------------*/ | |
| 501 | ||
| 502 | UINT32 mame_fread(mame_file *file, void *buffer, UINT32 length) | |
| 471 | UINT32 emu_file::read(void *buffer, UINT32 length) | |
| 503 | 472 | { |
| 504 | /* load the ZIP file now if we haven't yet */ | |
| 505 | if (file->zipfile != NULL) | |
| 506 | { | |
| 507 | if (load_zipped_file(file) != FILERR_NONE) | |
| 508 | return 0; | |
| 509 | } | |
| 473 | // load the ZIP file now if we haven't yet | |
| 474 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 475 | return 0; | |
| 510 | 476 | |
| 511 | /* read the data if we can */ | |
| 512 | if (file->file != NULL) | |
| 513 | return core_fread(file->file, buffer, length); | |
| 477 | // read the data if we can | |
| 478 | if (m_file != NULL) | |
| 479 | return core_fread(m_file, buffer, length); | |
| 514 | 480 | |
| 515 | 481 | return 0; |
| 516 | 482 | } |
| 517 | 483 | |
| 518 | 484 | |
| 519 | /*------------------------------------------------- | |
| 520 | mame_fgetc - read a character from a file | |
| 521 | -------------------------------------------------*/ | |
| 485 | //------------------------------------------------- | |
| 486 | // getc - read a character from a file | |
| 487 | //------------------------------------------------- | |
| 522 | 488 | |
| 523 | int | |
| 489 | int | |
| 524 | 490 | { |
| 525 | /* load the ZIP file now if we haven't yet */ | |
| 526 | if (file->zipfile != NULL) | |
| 527 | { | |
| 528 | if (load_zipped_file(file) != FILERR_NONE) | |
| 529 | return EOF; | |
| 530 | } | |
| 491 | // load the ZIP file now if we haven't yet | |
| 492 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 493 | return EOF; | |
| 531 | 494 | |
| 532 | /* read the data if we can */ | |
| 533 | if (file->file != NULL) | |
| 534 | return core_fgetc(file->file); | |
| 495 | // read the data if we can | |
| 496 | if (m_file != NULL) | |
| 497 | return core_fgetc(m_file); | |
| 535 | 498 | |
| 536 | 499 | return EOF; |
| 537 | 500 | } |
| 538 | 501 | |
| 539 | 502 | |
| 540 | /*------------------------------------------------- | |
| 541 | mame_ungetc - put back a character read from | |
| 542 | a file | |
| 543 | -------------------------------------------------*/ | |
| 503 | //------------------------------------------------- | |
| 504 | // ungetc - put back a character read from a file | |
| 505 | //------------------------------------------------- | |
| 544 | 506 | |
| 545 | int | |
| 507 | int | |
| 546 | 508 | { |
| 547 | /* load the ZIP file now if we haven't yet */ | |
| 548 | if (file->zipfile != NULL) | |
| 549 | { | |
| 550 | if (load_zipped_file(file) != FILERR_NONE) | |
| 551 | return 1; | |
| 552 | } | |
| 509 | // load the ZIP file now if we haven't yet | |
| 510 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 511 | return 1; | |
| 553 | 512 | |
| 554 | /* read the data if we can */ | |
| 555 | if (file->file != NULL) | |
| 556 | return core_ungetc(c, file->file); | |
| 513 | // read the data if we can | |
| 514 | if (m_file != NULL) | |
| 515 | return core_ungetc(c, m_file); | |
| 557 | 516 | |
| 558 | 517 | return 1; |
| 559 | 518 | } |
| 560 | 519 | |
| 561 | 520 | |
| 562 | /*------------------------------------------------- | |
| 563 | mame_fgets - read a line from a text file | |
| 564 | -------------------------------------------------*/ | |
| 521 | //------------------------------------------------- | |
| 522 | // gets - read a line from a text file | |
| 523 | //------------------------------------------------- | |
| 565 | 524 | |
| 566 | char * | |
| 525 | char * | |
| 567 | 526 | { |
| 568 | /* load the ZIP file now if we haven't yet */ | |
| 569 | if (file->zipfile != NULL) | |
| 570 | { | |
| 571 | if (load_zipped_file(file) != FILERR_NONE) | |
| 572 | return NULL; | |
| 573 | } | |
| 527 | // load the ZIP file now if we haven't yet | |
| 528 | if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE) | |
| 529 | return NULL; | |
| 574 | 530 | |
| 575 | /* read the data if we can */ | |
| 576 | if (file->file != NULL) | |
| 577 | return core_fgets(s, n, file->file); | |
| 531 | // read the data if we can | |
| 532 | if (m_file != NULL) | |
| 533 | return core_fgets(s, n, m_file); | |
| 578 | 534 | |
| 579 | 535 | return NULL; |
| 580 | 536 | } |
| 581 | 537 | |
| 582 | 538 | |
| 539 | //------------------------------------------------- | |
| 540 | // write - write to a file | |
| 541 | //------------------------------------------------- | |
| 583 | 542 | |
| 584 | /*************************************************************************** | |
| 585 | FILE WRITE | |
| 586 | ***************************************************************************/ | |
| 587 | ||
| 588 | /*------------------------------------------------- | |
| 589 | mame_fwrite - write to a file | |
| 590 | -------------------------------------------------*/ | |
| 591 | ||
| 592 | UINT32 mame_fwrite(mame_file *file, const void *buffer, UINT32 length) | |
| 543 | UINT32 emu_file::write(const void *buffer, UINT32 length) | |
| 593 | 544 | { |
| 594 | /* write the data if we can */ | |
| 595 | if (file->file != NULL) | |
| 596 | return core_fwrite(file->file, buffer, length); | |
| 545 | // write the data if we can | |
| 546 | if (m_file != NULL) | |
| 547 | return core_fwrite(m_file, buffer, length); | |
| 597 | 548 | |
| 598 | 549 | return 0; |
| 599 | 550 | } |
| 600 | 551 | |
| 601 | 552 | |
| 602 | /*------------------------------------------------- | |
| 603 | mame_fputs - write a line to a text file | |
| 604 | -------------------------------------------------*/ | |
| 553 | //------------------------------------------------- | |
| 554 | // puts - write a line to a text file | |
| 555 | //------------------------------------------------- | |
| 605 | 556 | |
| 606 | int | |
| 557 | int | |
| 607 | 558 | { |
| 608 | /* write the data if we can */ | |
| 609 | if (file->file != NULL) | |
| 610 | return core_fputs(file->file, s); | |
| 559 | // write the data if we can | |
| 560 | if (m_file != NULL) | |
| 561 | return core_fputs(m_file, s); | |
| 611 | 562 | |
| 612 | 563 | return 0; |
| 613 | 564 | } |
| 614 | 565 | |
| 615 | 566 | |
| 616 | /*------------------------------------------------- | |
| 617 | mame_vfprintf - vfprintf to a text file | |
| 618 | -------------------------------------------------*/ | |
| 567 | //------------------------------------------------- | |
| 568 | // printf - vfprintf to a text file | |
| 569 | //------------------------------------------------- | |
| 619 | 570 | |
| 620 | ||
| 571 | ||
| 621 | 572 | { |
| 622 | /* write the data if we can */ | |
| 623 | return (file->file != NULL) ? core_vfprintf(file->file, fmt, va) : 0; | |
| 624 | } | |
| 625 | ||
| 626 | ||
| 627 | /*------------------------------------------------- | |
| 628 | mame_fprintf - vfprintf to a text file | |
| 629 | -------------------------------------------------*/ | |
| 630 | ||
| 631 | int CLIB_DECL mame_fprintf(mame_file *file, const char *fmt, ...) | |
| 632 | { | |
| 633 | 573 | int rc; |
| 634 | 574 | va_list va; |
| 635 | 575 | va_start(va, fmt); |
| 636 | rc = | |
| 576 | rc = | |
| 637 | 577 | va_end(va); |
| 638 | 578 | return rc; |
| 639 | 579 | } |
| 640 | 580 | |
| 641 | 581 | |
| 582 | //------------------------------------------------- | |
| 583 | // mame_vfprintf - vfprintf to a text file | |
| 584 | //------------------------------------------------- | |
| 642 | 585 | |
| 643 | /*************************************************************************** | |
| 644 | FILE ENUMERATION | |
| 645 | ***************************************************************************/ | |
| 646 | ||
| 647 | /*------------------------------------------------- | |
| 648 | mame_openpath - open a search path (multiple | |
| 649 | directories) for iteration | |
| 650 | -------------------------------------------------*/ | |
| 651 | ||
| 652 | mame_path *mame_openpath(core_options *opts, const char *searchpath) | |
| 586 | int emu_file::vprintf(const char *fmt, va_list va) | |
| 653 | 587 | { |
| 654 | mame_path *path; | |
| 655 | ||
| 656 | /* allocate a new mame_path */ | |
| 657 | path = global_alloc_clear(mame_path); | |
| 658 | ||
| 659 | /* initialize the iterator */ | |
| 660 | path_iterator_init(&path->iterator, opts, searchpath); | |
| 661 | ||
| 662 | return path; | |
| 588 | // write the data if we can | |
| 589 | return (m_file != NULL) ? core_vfprintf(m_file, fmt, va) : 0; | |
| 663 | 590 | } |
| 664 | 591 | |
| 665 | 592 | |
| 666 | /*------------------------------------------------- | |
| 667 | mame_readpath - return information about the | |
| 668 | next file in the search path | |
| 669 | -------------------------------------------------*/ | |
| 670 | 593 | |
| 671 | const osd_directory_entry *mame_readpath(mame_path *path) | |
| 594 | //------------------------------------------------- | |
| 595 | // attempt_zipped - attempt to open a ZIPped file | |
| 596 | //------------------------------------------------- | |
| 597 | ||
| 598 | file_error emu_file::attempt_zipped() | |
| 672 | 599 | { |
| 673 | | |
| 600 | a | |
| 674 | 601 | |
| 675 | / | |
| 602 | // loop over director | |
| 676 | 603 | while (1) |
| 677 | 604 | { |
| 678 | /* if no open directory, get the next path */ | |
| 679 | while (path->curdir == NULL) | |
| 680 | { | |
| 681 | /* if we fail to get anything more, we're done */ | |
| 682 | if (!path_iterator_get_next(&path->iterator, path->pathbuffer)) | |
| 683 | return NULL; | |
| 605 | // find the final path separator | |
| 606 | int dirsep = m_fullpath.rchr(0, PATH_SEPARATOR[0]); | |
| 607 | if (dirsep == -1) | |
| 608 | return FILERR_NOT_FOUND; | |
| 684 | 609 | |
| 685 | /* open the path */ | |
| 686 | path->curdir = osd_opendir(path->pathbuffer); | |
| 687 | } | |
| 610 | // insert the part from the right of the separator into the head of the filename | |
| 611 | if (filename.len() > 0) | |
| 612 | filename.ins(0, "/"); | |
| 613 | filename.inssubstr(0, m_fullpath, dirsep + 1, -1); | |
| 688 | 614 | |
| 689 | /* get the next entry from the current directory */ | |
| 690 | result = osd_readdir(path->curdir); | |
| 691 | if (result != NULL) | |
| 692 | return result; | |
| 615 | // remove this part of the filename and append a .zip extension | |
| 616 | m_fullpath.substr(0, dirsep).cat(".zip"); | |
| 693 | 617 | |
| 694 | /* we're done; close this directory */ | |
| 695 | osd_closedir(path->curdir); | |
| 696 | path->curdir = NULL; | |
| 697 | } | |
| 698 | } | |
| 618 | // attempt to open the ZIP file | |
| 619 | zip_file *zip; | |
| 620 | zip_error ziperr = zip_file_open(m_fullpath, &zip); | |
| 699 | 621 | |
| 622 | // chop the .zip back off the filename before continuing | |
| 623 | m_fullpath.substr(0, dirsep); | |
| 700 | 624 | |
| 701 | /*------------------------------------------------- | |
| 702 | mame_closepath - close an open seach path | |
| 703 | -------------------------------------------------*/ | |
| 625 | // if we failed to open this file, continue scanning | |
| 626 | if (ziperr != ZIPERR_NONE) | |
| 627 | continue; | |
| 704 | 628 | |
| 705 | void mame_closepath(mame_path *path) | |
| 706 | { | |
| 707 | /* close anything open */ | |
| 708 | if (path->curdir != NULL) | |
| 709 | osd_closedir(path->curdir); | |
| 629 | // see if we can find a file with the right name and (if available) crc | |
| 630 | const zip_file_header *header; | |
| 631 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 632 | if (zip_filename_match(*header, filename) && (!(m_openflags & OPEN_FLAG_HAS_CRC) || header->crc == m_crc)) | |
| 633 | break; | |
| 710 | 634 | |
| 711 | /* free memory */ | |
| 712 | global_free(path); | |
| 713 | } | |
| 635 | // if that failed, look for a file with the right crc, but the wrong filename | |
| 636 | if (header == NULL && (m_openflags & OPEN_FLAG_HAS_CRC)) | |
| 637 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 638 | if (header->crc == m_crc && !zip_header_is_path(*header)) | |
| 639 | break; | |
| 714 | 640 | |
| 641 | // if that failed, look for a file with the right name; reporting a bad checksum | |
| 642 | // is more helpful and less confusing than reporting "rom not found" | |
| 643 | if (header == NULL) | |
| 644 | for (header = zip_file_first_file(zip); header != NULL; header = zip_file_next_file(zip)) | |
| 645 | if (zip_filename_match(*header, filename)) | |
| 646 | break; | |
| 715 | 647 | |
| 648 | // if we got it, read the data | |
| 649 | if (header != NULL) | |
| 650 | { | |
| 651 | m_zipfile = zip; | |
| 652 | m_ziplength = header->uncompressed_length; | |
| 716 | 653 | |
| 717 | /*************************************************************************** | |
| 718 | MISCELLANEOUS | |
| 719 | ***************************************************************************/ | |
| 654 | // build a hash with just the CRC | |
| 655 | hash_data_clear(m_hash); | |
| 656 | UINT8 crcs[4]; | |
| 657 | crcs[0] = header->crc >> 24; | |
| 658 | crcs[1] = header->crc >> 16; | |
| 659 | crcs[2] = header->crc >> 8; | |
| 660 | crcs[3] = header->crc >> 0; | |
| 661 | hash_data_insert_binary_checksum(m_hash, HASH_CRC, crcs); | |
| 720 | 662 | |
| 721 | /*------------------------------------------------- | |
| 722 | mame_core_file - return the core_file | |
| 723 | underneath the mame_file | |
| 724 | -------------------------------------------------*/ | |
| 663 | return (m_openflags & OPEN_FLAG_NO_PRELOAD) ? FILERR_NONE : load_zipped_file(); | |
| 664 | } | |
| 725 | 665 | |
| 726 | core_file *mame_core_file(mame_file *file) | |
| 727 | { | |
| 728 | /* load the ZIP file now if we haven't yet */ | |
| 729 | if (file->zipfile != NULL) | |
| 730 | { | |
| 731 | if (load_zipped_file(file) != FILERR_NONE) | |
| 732 | return NULL; | |
| 666 | // close up the ZIP file and try the next level | |
| 667 | zip_file_close(zip); | |
| 733 | 668 | } |
| 734 | ||
| 735 | /* return the core file */ | |
| 736 | return file->file; | |
| 737 | 669 | } |
| 738 | 670 | |
| 739 | 671 | |
| 740 | /*------------------------------------------------- | |
| 741 | mame_file_full_name - return the full filename | |
| 742 | for a given mame_file | |
| 743 | -------------------------------------------------*/ | |
| 672 | //------------------------------------------------- | |
| 673 | // load_zipped_file - load a ZIPped file | |
| 674 | //------------------------------------------------- | |
| 744 | 675 | |
| 745 | ||
| 676 | file_erro | |
| 746 | 677 | { |
| 747 | return file->filename; | |
| 748 | } | |
| 678 | assert(m_file == NULL); | |
| 679 | assert(m_zipdata == NULL); | |
| 680 | assert(m_zipfile != NULL); | |
| 749 | 681 | |
| 682 | // allocate some memory | |
| 683 | m_zipdata = global_alloc_array(UINT8, m_ziplength); | |
| 750 | 684 | |
| 751 | /*------------------------------------------------- | |
| 752 | mame_fhash - returns the hash for a file | |
| 753 | -------------------------------------------------*/ | |
| 754 | ||
| 755 | const char *mame_fhash(mame_file *file, UINT32 functions) | |
| 756 | { | |
| 757 | const UINT8 *filedata; | |
| 758 | UINT32 wehave; | |
| 759 | ||
| 760 | /* if we already have the functions we need, just return */ | |
| 761 | wehave = hash_data_used_functions(file->hash); | |
| 762 | if ((wehave & functions) == functions) | |
| 763 | return file->hash; | |
| 764 | ||
| 765 | /* load the ZIP file now if we haven't yet */ | |
| 766 | if (file->zipfile != NULL) | |
| 767 | { | |
| 768 | if (load_zipped_file(file) != FILERR_NONE) | |
| 769 | return file->hash; | |
| 770 | } | |
| 771 | if (file->file == NULL) | |
| 772 | return file->hash; | |
| 773 | ||
| 774 | /* read the data if we can */ | |
| 775 | filedata = (const UINT8 *)core_fbuffer(file->file); | |
| 776 | if (filedata == NULL) | |
| 777 | return file->hash; | |
| 778 | ||
| 779 | /* compute the hash */ | |
| 780 | hash_compute(file->hash, filedata, core_fsize(file->file), wehave | functions); | |
| 781 | return file->hash; | |
| 782 | } | |
| 783 | ||
| 784 | ||
| 785 | ||
| 786 | /*************************************************************************** | |
| 787 | PATH ITERATION | |
| 788 | ***************************************************************************/ | |
| 789 | ||
| 790 | /*------------------------------------------------- | |
| 791 | path_iterator_init - prepare to iterate over | |
| 792 | a given path type | |
| 793 | -------------------------------------------------*/ | |
| 794 | ||
| 795 | static void path_iterator_init(path_iterator *iterator, core_options *opts, const char *searchpath) | |
| 796 | { | |
| 797 | /* reset the structure */ | |
| 798 | iterator->base = (searchpath != NULL && !osd_is_absolute_path(searchpath)) ? options_get_string(opts, searchpath) : ""; | |
| 799 | iterator->cur = iterator->base; | |
| 800 | iterator->index = 0; | |
| 801 | } | |
| 802 | ||
| 803 | ||
| 804 | /*------------------------------------------------- | |
| 805 | path_iterator_get_next - get the next entry | |
| 806 | in a multipath sequence | |
| 807 | -------------------------------------------------*/ | |
| 808 | ||
| 809 | static int path_iterator_get_next(path_iterator *iterator, astring &buffer) | |
| 810 | { | |
| 811 | const char *semi; | |
| 812 | ||
| 813 | /* if none left, return FALSE to indicate we are done */ | |
| 814 | if (iterator->index != 0 && *iterator->cur == 0) | |
| 815 | return FALSE; | |
| 816 | ||
| 817 | /* copy up to the next semicolon */ | |
| 818 | semi = strchr(iterator->cur, ';'); | |
| 819 | if (semi == NULL) | |
| 820 | semi = iterator->cur + strlen(iterator->cur); | |
| 821 | buffer.cpy(iterator->cur, semi - iterator->cur); | |
| 822 | iterator->cur = (*semi == 0) ? semi : semi + 1; | |
| 823 | ||
| 824 | /* bump the index and return TRUE */ | |
| 825 | iterator->index++; | |
| 826 | return TRUE; | |
| 827 | } | |
| 828 | ||
| 829 | ||
| 830 | ||
| 831 | /*************************************************************************** | |
| 832 | MISC HELPERS | |
| 833 | ***************************************************************************/ | |
| 834 | ||
| 835 | /*------------------------------------------------- | |
| 836 | load_zipped_file - load a ZIPped file | |
| 837 | -------------------------------------------------*/ | |
| 838 | ||
| 839 | static file_error load_zipped_file(mame_file *file) | |
| 840 | { | |
| 841 | file_error filerr; | |
| 842 | zip_error ziperr; | |
| 843 | ||
| 844 | assert(file->file == NULL); | |
| 845 | assert(file->zipdata == NULL); | |
| 846 | assert(file->zipfile != NULL); | |
| 847 | ||
| 848 | /* allocate some memory */ | |
| 849 | file->zipdata = global_alloc_array(UINT8, file->ziplength); | |
| 850 | ||
| 851 | /* read the data into our buffer and return */ | |
| 852 | ziperr = zip_file_decompress(file->zipfile, file->zipdata, file->ziplength); | |
| 685 | // read the data into our buffer and return | |
| 686 | zip_error ziperr = zip_file_decompress(m_zipfile, m_zipdata, m_ziplength); | |
| 853 | 687 | if (ziperr != ZIPERR_NONE) |
| 854 | 688 | { |
| 855 | global_free(file->zipdata); | |
| 856 | file->zipdata = NULL; | |
| 689 | global_free(m_zipdata); | |
| 690 | m_zipdata = NULL; | |
| 857 | 691 | return FILERR_FAILURE; |
| 858 | 692 | } |
| 859 | 693 | |
| 860 | /* convert to RAM file */ | |
| 861 | filerr = core_fopen_ram(file->zipdata, file->ziplength, file->openflags, &file->file); | |
| 694 | // convert to RAM file | |
| 695 | file_error filerr = core_fopen_ram(m_zipdata, m_ziplength, m_openflags, &m_file); | |
| 862 | 696 | if (filerr != FILERR_NONE) |
| 863 | 697 | { |
| 864 | global_free(file->zipdata); | |
| 865 | file->zipdata = NULL; | |
| 698 | global_free(m_zipdata); | |
| 699 | m_zipdata = NULL; | |
| 866 | 700 | return FILERR_FAILURE; |
| 867 | 701 | } |
| 868 | 702 | |
| 869 | /* close out the ZIP file */ | |
| 870 | zip_file_close(file->zipfile); | |
| 871 | file->zipfile = NULL; | |
| 703 | // close out the ZIP file | |
| 704 | zip_file_close(m_zipfile); | |
| 705 | m_zipfile = NULL; | |
| 872 | 706 | return FILERR_NONE; |
| 873 | 707 | } |
| 874 | 708 | |
| 875 | 709 | |
| 876 | /*------------------------------------------------- | |
| 877 | zip_filename_match - compare zip filename | |
| 878 | to expected filename, ignoring any directory | |
| 879 | -------------------------------------------------*/ | |
| 710 | //------------------------------------------------- | |
| 711 | // zip_filename_match - compare zip filename | |
| 712 | // to expected filename, ignoring any directory | |
| 713 | //------------------------------------------------- | |
| 880 | 714 | |
| 881 | ||
| 715 | bool | |
| 882 | 716 | { |
| 883 | const char *zipfile = header->filename + header->filename_length - filename.len(); | |
| 884 | ||
| 885 | return (zipfile >= header->filename && filename.icmp(zipfile) == 0 && | |
| 886 | (zipfile == header->filename || zipfile[-1] == '/')); | |
| 717 | const char *zipfile = header.filename + header.filename_length - filename.len(); | |
| 718 | return (zipfile >= header.filename && filename.icmp(zipfile) == 0 && (zipfile == header.filename || zipfile[-1] == '/')); | |
| 887 | 719 | } |
| 888 | 720 | |
| 889 | /*------------------------------------------------- | |
| 890 | zip_header_is_path - check whether filename | |
| 891 | in header is a path | |
| 892 | -------------------------------------------------*/ | |
| 893 | 721 | |
| 894 | static int zip_header_is_path(const zip_file_header *header) | |
| 895 | { | |
| 896 | const char *zipfile = header->filename + header->filename_length - 1; | |
| 722 | //------------------------------------------------- | |
| 723 | // zip_header_is_path - check whether filename | |
| 724 | // in header is a path | |
| 725 | //------------------------------------------------- | |
| 897 | 726 | |
| 898 | return (zipfile >= header->filename && zipfile[0] == '/'); | |
| 727 | bool emu_file::zip_header_is_path(const zip_file_header &header) | |
| 728 | { | |
| 729 | const char *zipfile = header.filename + header.filename_length - 1; | |
| 730 | return (zipfile >= header.filename && zipfile[0] == '/'); | |
| 899 | 731 | } |
| r10384 | r10385 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | Core file I/O interface functions and definitions. |
| 6 | 6 | |
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 7 | **************************************************************************** | |
| 9 | 8 | |
| 9 | Copyright Aaron Giles | |
| 10 | All rights reserved. | |
| 11 | ||
| 12 | Redistribution and use in source and binary forms, with or without | |
| 13 | modification, are permitted provided that the following conditions are | |
| 14 | met: | |
| 15 | ||
| 16 | * Redistributions of source code must retain the above copyright | |
| 17 | notice, this list of conditions and the following disclaimer. | |
| 18 | * Redistributions in binary form must reproduce the above copyright | |
| 19 | notice, this list of conditions and the following disclaimer in | |
| 20 | the documentation and/or other materials provided with the | |
| 21 | distribution. | |
| 22 | * Neither the name 'MAME' nor the names of its contributors may be | |
| 23 | used to endorse or promote products derived from this software | |
| 24 | without specific prior written permission. | |
| 25 | ||
| 26 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR | |
| 27 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 29 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, | |
| 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 32 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 33 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 35 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 36 | POSSIBILITY OF SUCH DAMAGE. | |
| 37 | ||
| 10 | 38 | ***************************************************************************/ |
| 11 | 39 | |
| 12 | 40 | #pragma once |
| r10384 | r10385 | |
| 15 | 43 | #define __FILEIO_H__ |
| 16 | 44 | |
| 17 | 45 | #include "corefile.h" |
| 46 | #include "hash.h" | |
| 18 | 47 | |
| 19 | 48 | |
| 20 | 49 | |
| 21 | /*************************************************************************** | |
| 22 | CONSTANTS | |
| 23 | ***************************************************************************/ | |
| 50 | //************************************************************************** | |
| 51 | // CONSTANTS | |
| 52 | //************************************************************************** | |
| 24 | 53 | |
| 25 | / | |
| 54 | // search paths | |
| 26 | 55 | #define SEARCHPATH_RAW NULL |
| 27 | 56 | #define SEARCHPATH_LANGUAGE NULL |
| 28 | 57 | #define SEARCHPATH_DEBUGLOG NULL |
| r10384 | r10385 | |
| 50 | 79 | |
| 51 | 80 | |
| 52 | 81 | |
| 53 | /*************************************************************************** | |
| 54 | TYPE DEFINITIONS | |
| 55 | ***************************************************************************/ | |
| 82 | //************************************************************************** | |
| 83 | // TYPE DEFINITIONS | |
| 84 | //************************************************************************** | |
| 56 | 85 | |
| 57 | typedef struct _mame_file mame_file; | |
| 58 | typedef struct _mame_path mame_path; | |
| 59 | ||
| 86 | // forward declarations | |
| 60 | 87 | typedef struct _core_options core_options; |
| 88 | typedef struct _zip_file_header zip_file_header; | |
| 89 | typedef struct _zip_file zip_file; | |
| 61 | 90 | |
| 62 | 91 | |
| 92 | // ======================> path_iterator | |
| 63 | 93 | |
| 64 | /*************************************************************************** | |
| 65 | FUNCTION PROTOTYPES | |
| 66 | ***************************************************************************/ | |
| 94 | // helper class for iterating over configured paths | |
| 95 | class path_iterator | |
| 96 | { | |
| 97 | public: | |
| 98 | // construction/destruction | |
| 99 | path_iterator(core_options &options, const char *searchpath = ""); | |
| 100 | ||
| 101 | // getters | |
| 102 | bool next(astring &buffer); | |
| 103 | ||
| 104 | // reset | |
| 105 | void reset() { m_current = m_base; m_index = 0; } | |
| 67 | 106 | |
| 107 | private: | |
| 108 | // internal state | |
| 109 | const char * m_base; | |
| 110 | const char * m_current; | |
| 111 | int m_index; | |
| 112 | }; | |
| 68 | 113 | |
| 69 | /* ----- core initialization ----- */ | |
| 70 | 114 | |
| 71 | /* initialize the fileio system */ | |
| 72 | void fileio_init(running_machine *machine); | |
| 73 | 115 | |
| 116 | // ======================> file_enumerator | |
| 74 | 117 | |
| 118 | // iterate over all files in all paths specified in the searchpath | |
| 119 | class file_enumerator | |
| 120 | { | |
| 121 | public: | |
| 122 | // construction/destruction | |
| 123 | file_enumerator(core_options &opts, const char *searchpath); | |
| 124 | ~file_enumerator(); | |
| 75 | 125 | |
| 76 | /* ----- file open/close ----- */ | |
| 126 | // iterator | |
| 127 | const osd_directory_entry *next(); | |
| 77 | 128 | |
| 78 | /* open a file in the given search path with the specified filename */ | |
| 79 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, mame_file **file); | |
| 129 | private: | |
| 130 | // internal state | |
| 131 | path_iterator m_iterator; | |
| 132 | osd_directory * m_curdir; | |
| 133 | astring m_pathbuffer; | |
| 134 | int m_buflen; | |
| 135 | }; | |
| 80 | 136 | |
| 81 | /* open a file in the given search path with the specified filename or a matching CRC */ | |
| 82 | file_error mame_fopen_crc(const char *searchpath, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file); | |
| 83 | 137 | |
| 84 | /* open a file in the given search path with the specified filename, using the specified options */ | |
| 85 | file_error mame_fopen_options(core_options *opts, const char *searchpath, const char *filename, UINT32 openflags, mame_file **file); | |
| 86 | 138 | |
| 87 | /* open a file in the given search path with the specified filename or a matching CRC, using the specified options */ | |
| 88 | file_error mame_fopen_crc_options(core_options *opts, const char *searchpath, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file); | |
| 139 | // ======================> emu_file | |
| 89 | 140 | |
| 90 | /* open a "file" which is actually data in RAM */ | |
| 91 | file_error mame_fopen_ram(const void *data, UINT32 length, UINT32 openflags, mame_file **file); | |
| 141 | class emu_file | |
| 142 | { | |
| 143 | public: | |
| 144 | // file open/creation | |
| 145 | emu_file(core_options &options, const char *searchpath, UINT32 openflags); | |
| 146 | virtual ~emu_file(); | |
| 92 | 147 | |
| 93 | /* close an open file */ | |
| 94 | void mame_fclose(mame_file *file); | |
| 148 | // getters | |
| 149 | operator core_file *(); | |
| 150 | bool open() const { return (m_file != NULL); } | |
| 151 | const char *filename() const { return m_filename; } | |
| 152 | const char *fullpath() const { return m_fullpath; } | |
| 153 | UINT32 openflags() const { return m_openflags; } | |
| 154 | const char *hash_string(UINT32 functions); | |
| 95 | 155 | |
| 96 | /* close an open file, and open the next entry in the original searchpath*/ | |
| 97 | file_error mame_fclose_and_open_next(mame_file **file, const char *filename, UINT32 openflags); | |
| 156 | // setters | |
| 157 | void remove_on_close() { m_remove_on_close = true; } | |
| 158 | void set_openflags(UINT32 openflags) { assert(m_file == NULL); m_openflags = openflags; } | |
| 98 | 159 | |
| 99 | /* enable/disable streaming file compression via zlib; level is 0 to disable compression, or up to 9 for max compression */ | |
| 100 | file_error mame_fcompress(mame_file *file, int compress); | |
| 160 | // open/close | |
| 161 | file_error open(const char *name); | |
| 162 | file_error open(const char *name1, const char *name2); | |
| 163 | file_error open(const char *name1, const char *name2, const char *name3); | |
| 164 | file_error open(const char *name1, const char *name2, const char *name3, const char *name4); | |
| 165 | file_error open(const char *name, UINT32 crc); | |
| 166 | file_error open(const char *name1, const char *name2, UINT32 crc); | |
| 167 | file_error open(const char *name1, const char *name2, const char *name3, UINT32 crc); | |
| 168 | file_error open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc); | |
| 169 | file_error open_next(); | |
| 170 | file_error open_ram(const void *data, UINT32 length); | |
| 171 | void close(); | |
| 172 | ||
| 173 | // control | |
| 174 | file_error compress(int compress); | |
| 175 | int seek(INT64 offset, int whence); | |
| 176 | UINT64 tell(); | |
| 177 | bool eof(); | |
| 178 | UINT64 size(); | |
| 179 | ||
| 180 | // reading | |
| 181 | UINT32 read(void *buffer, UINT32 length); | |
| 182 | int getc(); | |
| 183 | int ungetc(int c); | |
| 184 | char *gets(char *s, int n); | |
| 185 | ||
| 186 | // writing | |
| 187 | UINT32 write(const void *buffer, UINT32 length); | |
| 188 | int puts(const char *s); | |
| 189 | int vprintf(const char *fmt, va_list va); | |
| 190 | int printf(const char *fmt, ...); | |
| 191 | ||
| 192 | private: | |
| 193 | // internal helpers | |
| 194 | file_error attempt_zipped(); | |
| 195 | file_error load_zipped_file(); | |
| 196 | bool zip_filename_match(const zip_file_header &header, const astring &filename); | |
| 197 | bool zip_header_is_path(const zip_file_header &header); | |
| 198 | ||
| 199 | // internal state | |
| 200 | astring m_filename; // original filename provided | |
| 201 | astring m_fullpath; // full filename | |
| 202 | core_file * m_file; // core file pointer | |
| 203 | path_iterator m_iterator; // iterator for paths | |
| 204 | UINT32 m_crc; // iterator for paths | |
| 205 | UINT32 m_openflags; // flags we used for the open | |
| 206 | char m_hash[HASH_BUF_SIZE]; // hash data for the file | |
| 207 | zip_file * m_zipfile; // ZIP file pointer | |
| 208 | UINT8 * m_zipdata; // ZIP file data | |
| 209 | UINT64 m_ziplength; // ZIP file length | |
| 210 | bool m_remove_on_close; // flag: remove the file when closing | |
| 211 | }; | |
| 101 | 212 | |
| 102 | 213 | |
| 103 | ||
| 104 | /* ----- file positioning ----- */ | |
| 105 | ||
| 106 | /* adjust the file pointer within the file */ | |
| 107 | int mame_fseek(mame_file *file, INT64 offset, int whence); | |
| 108 | ||
| 109 | /* return the current file pointer */ | |
| 110 | UINT64 mame_ftell(mame_file *file); | |
| 111 | ||
| 112 | /* return true if we are at the EOF */ | |
| 113 | int mame_feof(mame_file *file); | |
| 114 | ||
| 115 | /* return the total size of the file */ | |
| 116 | UINT64 mame_fsize(mame_file *file); | |
| 117 | ||
| 118 | ||
| 119 | ||
| 120 | /* ----- file read ----- */ | |
| 121 | ||
| 122 | /* standard binary read from a file */ | |
| 123 | UINT32 mame_fread(mame_file *file, void *buffer, UINT32 length); | |
| 124 | ||
| 125 | /* read one character from the file */ | |
| 126 | int mame_fgetc(mame_file *file); | |
| 127 | ||
| 128 | /* put back one character from the file */ | |
| 129 | int mame_ungetc(int c, mame_file *file); | |
| 130 | ||
| 131 | /* read a full line of text from the file */ | |
| 132 | char *mame_fgets(char *s, int n, mame_file *file); | |
| 133 | ||
| 134 | ||
| 135 | ||
| 136 | /* ----- file write ----- */ | |
| 137 | ||
| 138 | /* standard binary write to a file */ | |
| 139 | UINT32 mame_fwrite(mame_file *file, const void *buffer, UINT32 length); | |
| 140 | ||
| 141 | /* write a line of text to the file */ | |
| 142 | int mame_fputs(mame_file *f, const char *s); | |
| 143 | ||
| 144 | /* printf-style text write to a file */ | |
| 145 | int CLIB_DECL mame_fprintf(mame_file *f, const char *fmt, ...) ATTR_PRINTF(2,3); | |
| 146 | ||
| 147 | ||
| 148 | ||
| 149 | /* ----- file enumeration ----- */ | |
| 150 | ||
| 151 | /* open a search path (multiple directories) for iteration */ | |
| 152 | mame_path *mame_openpath(core_options *opts, const char *searchpath); | |
| 153 | ||
| 154 | /* return information about the next file in the search path */ | |
| 155 | const osd_directory_entry *mame_readpath(mame_path *path); | |
| 156 | ||
| 157 | /* close an open seach path */ | |
| 158 | void mame_closepath(mame_path *path); | |
| 159 | ||
| 160 | ||
| 161 | ||
| 162 | /* ----- file misc ----- */ | |
| 163 | ||
| 164 | /* return the core_file underneath the mame_file */ | |
| 165 | core_file *mame_core_file(mame_file *file); | |
| 166 | ||
| 167 | /* return the full filename for a given mame_file */ | |
| 168 | const astring &mame_file_full_name(mame_file *file); | |
| 169 | ||
| 170 | /* return a hash string for the file with the given functions */ | |
| 171 | const char *mame_fhash(mame_file *file, UINT32 functions); | |
| 172 | ||
| 173 | ||
| 174 | ||
| 175 | 214 | #endif /* __FILEIO_H__ */ |
| r10384 | r10385 | |
|---|---|---|
| 200 | 200 | // configuration |
| 201 | 201 | //------------------------------------------------- |
| 202 | 202 | |
| 203 | bool timer_device_config::device_validity_check(const game_driver &driver) const | |
| 203 | bool timer_device_config::device_validity_check(core_options &options, const game_driver &driver) const | |
| 204 | 204 | { |
| 205 | 205 | bool error = false; |
| 206 | 206 |
| r10384 | r10385 | |
|---|---|---|
| 164 | 164 | // checks on the memory configuration |
| 165 | 165 | //------------------------------------------------- |
| 166 | 166 | |
| 167 | bool device_config_memory_interface::interface_validity_check(const game_driver &driver) const | |
| 167 | bool device_config_memory_interface::interface_validity_check(core_options &options, const game_driver &driver) const | |
| 168 | 168 | { |
| 169 | 169 | const device_config *devconfig = crosscast<const device_config *>(this); |
| 170 | 170 | bool detected_overlap = DETECT_OVERLAPPING_MEMORY ? false : true; |
| r10384 | r10385 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | private: |
| 130 | 130 | // device_config overrides |
| 131 | virtual bool device_validity_check(const game_driver &driver) const; | |
| 131 | virtual bool device_validity_check(core_options &options, const game_driver &driver) const; | |
| 132 | 132 | |
| 133 | 133 | // timer types |
| 134 | 134 | enum timer_type |
| r10384 | r10385 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | #define NVRAM_HANDLER_NAME(name) nvram_handler_##name |
| 87 | #define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine *machine, | |
| 87 | #define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine *machine, | |
| 88 | 88 | #define NVRAM_HANDLER_CALL(name) NVRAM_HANDLER_NAME(name)(machine, file, read_or_write) |
| 89 | 89 | |
| 90 | 90 | #define MEMCARD_HANDLER_NAME(name) memcard_handler_##name |
| 91 | #define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine *machine, | |
| 91 | #define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine *machine, | |
| 92 | 92 | #define MEMCARD_HANDLER_CALL(name) MEMCARD_HANDLER_NAME(name)(machine, file, action) |
| 93 | 93 | |
| 94 | 94 | |
| r10384 | r10385 | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // various callback functions |
| 113 | typedef void (*nvram_handler_func)(running_machine *machine, mame_file *file, int read_or_write); | |
| 114 | typedef void (*memcard_handler_func)(running_machine *machine, mame_file *file, int action); | |
| 113 | typedef void (*nvram_handler_func)(running_machine *machine, emu_file *file, int read_or_write); | |
| 114 | typedef void (*memcard_handler_func)(running_machine *machine, emu_file &file, int action); | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 |
| r10384 | r10385 | |
|---|---|---|
| 123 | 123 | virtual const address_space_config *memory_space_config(int spacenum) const = 0; |
| 124 | 124 | |
| 125 | 125 | // optional operation overrides |
| 126 | virtual bool interface_validity_check(const game_driver &driver) const; | |
| 126 | virtual bool interface_validity_check(core_options &options, const game_driver &driver) const; | |
| 127 | 127 | |
| 128 | 128 | address_map_constructor m_address_map[ADDRESS_SPACES]; // address maps for each address space |
| 129 | 129 | }; |
| r10384 | r10385 | |
|---|---|---|
| 71 | 71 | typedef struct |
| 72 | 72 | { |
| 73 | 73 | device_t *img; |
| 74 | | |
| 74 | | |
| 75 | 75 | |
| 76 | 76 | unsigned int ext_speed_control : 1; /* is motor rotation controlled by external device ? */ |
| 77 | 77 |
| r10384 | r10385 | |
|---|---|---|
| 617 | 617 | /* This line requires that cartslot_t be included in cartslot.h, |
| 618 | 618 | otherwise one cannot make use of multicart handling within such a |
| 619 | 619 | custom LOAD function. */ |
| 620 | me = multicart_open(image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 620 | me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 621 | 621 | |
| 622 | 622 | /* Now that we have loaded the image files, let the PCB put them all |
| 623 | 623 | together. This means we put the images in a structure which allows |
| r10384 | r10385 | |
| 660 | 660 | |
| 661 | 661 | /* Close the multicart; all RAM resources will be |
| 662 | 662 | written to disk */ |
| 663 | multicart_close(cart->mc); | |
| 663 | multicart_close(pcbdev->machine->options(), cart->mc); | |
| 664 | 664 | cart->mc = NULL; |
| 665 | 665 | } |
| 666 | 666 | // else |
| r10384 | r10385 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | //============================================================ |
| 43 | // win_error_to_ | |
| 43 | // win_error_to_ | |
| 44 | 44 | //============================================================ |
| 45 | 45 | |
| 46 | static file_error win_error_to_ | |
| 46 | static file_error win_error_to_ | |
| 47 | 47 | { |
| 48 | 48 | file_error filerr; |
| 49 | 49 | |
| r10384 | r10385 | |
| 104 | 104 | |
| 105 | 105 | if (!CreateDirectory(tempstr, NULL)) |
| 106 | 106 | { |
| 107 | filerr = win_error_to_ | |
| 107 | filerr = win_error_to_ | |
| 108 | 108 | goto done; |
| 109 | 109 | } |
| 110 | 110 | |
| r10384 | r10385 | |
| 132 | 132 | |
| 133 | 133 | if (!RemoveDirectory(tempstr)) |
| 134 | 134 | { |
| 135 | filerr = win_error_to_ | |
| 135 | filerr = win_error_to_ | |
| 136 | 136 | goto done; |
| 137 | 137 | } |
| 138 | 138 | |
| r10384 | r10385 | |
| 151 | 151 | { |
| 152 | 152 | // wrapper for win_copy_file_utf8() |
| 153 | 153 | if (!win_copy_file_utf8(srcfile, destfile, TRUE)) |
| 154 | return win_error_to_ | |
| 154 | return win_error_to_ | |
| 155 | 155 | |
| 156 | 156 | return FILERR_NONE; |
| 157 | 157 | } |
| r10384 | r10385 | |
|---|---|---|
| 24 | 24 | /* ----------------------------------------------------------------------- */ |
| 25 | 25 | /* total hack */ |
| 26 | 26 | |
| 27 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, | |
| 27 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, | |
| 28 | 28 | { |
| 29 | 29 | char buffer[2048]; |
| 30 | 30 | snprintf(buffer, sizeof(buffer), "crc/%s", filename); |
| 31 | *file = ( | |
| 31 | *file = ( | |
| 32 | 32 | return FILERR_NONE; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | char *mame_fgets(char *s, int n, | |
| 35 | char *mame_fgets(char *s, int n, | |
| 36 | 36 | { |
| 37 | 37 | return fgets(s, n, (FILE *) file); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | UINT32 mame_fwrite( | |
| 40 | UINT32 mame_fwrite( | |
| 41 | 41 | { |
| 42 | 42 | return fwrite(buffer, 1, length, (FILE *) file); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | void mame_fclose( | |
| 45 | void mame_fclose( | |
| 46 | 46 | { |
| 47 | 47 | fclose((FILE *) file); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | int CLIB_DECL mame_fprintf( | |
| 50 | int CLIB_DECL mame_fprintf( | |
| 51 | 51 | { |
| 52 | 52 | int rc; |
| 53 | 53 | va_list va; |
| r10384 | r10385 | |
|---|---|---|
| 210 | 210 | static void dump_screenshot(running_machine *machine, int write_file) |
| 211 | 211 | { |
| 212 | 212 | file_error filerr; |
| 213 | | |
| 213 | | |
| 214 | 214 | char buf[128]; |
| 215 | 215 | int is_blank = 0; |
| 216 | 216 |
| r10384 | r10385 | |
|---|---|---|
| 25 | 25 | /* ----------------------------------------------------------------------- */ |
| 26 | 26 | /* total hack */ |
| 27 | 27 | |
| 28 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, | |
| 28 | file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, | |
| 29 | 29 | { |
| 30 | 30 | char buffer[2048]; |
| 31 | 31 | snprintf(buffer, sizeof(buffer), "crc/%s", filename); |
| 32 | *file = ( | |
| 32 | *file = ( | |
| 33 | 33 | return FILERR_NONE; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | char *mame_fgets(char *s, int n, | |
| 36 | char *mame_fgets(char *s, int n, | |
| 37 | 37 | { |
| 38 | 38 | return fgets(s, n, (FILE *) file); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | UINT32 mame_fwrite( | |
| 41 | UINT32 mame_fwrite( | |
| 42 | 42 | { |
| 43 | 43 | return fwrite(buffer, 1, length, (FILE *) file); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | void mame_fclose( | |
| 46 | void mame_fclose( | |
| 47 | 47 | { |
| 48 | 48 | fclose((FILE *) file); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | int CLIB_DECL mame_fprintf( | |
| 51 | int CLIB_DECL mame_fprintf( | |
| 52 | 52 | { |
| 53 | 53 | int rc; |
| 54 | 54 | va_list va; |
| r10384 | r10385 | |
|---|---|---|
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | //============================================================ |
| 900 | // win_error_to_ | |
| 900 | // win_error_to_ | |
| 901 | 901 | //============================================================ |
| 902 | 902 | |
| 903 | static file_error win_error_to_ | |
| 903 | static file_error win_error_to_ | |
| 904 | 904 | { |
| 905 | 905 | file_error filerr; |
| 906 | 906 | |
| r10384 | r10385 | |
| 952 | 952 | |
| 953 | 953 | if (!CreateDirectory(tempstr, NULL)) |
| 954 | 954 | { |
| 955 | filerr = win_error_to_ | |
| 955 | filerr = win_error_to_ | |
| 956 | 956 | goto done; |
| 957 | 957 | } |
| 958 | 958 |
| r10384 | r10385 | |
|---|---|---|
| 123 | 123 | /* |
| 124 | 124 | load the FEEPROM contents from file |
| 125 | 125 | */ |
| 126 | int strataflash_load(device_t *device, | |
| 126 | int strataflash_load(device_t *device, | |
| 127 | 127 | { |
| 128 | 128 | strata_t *strata = get_safe_token(device); |
| 129 | 129 | UINT8 buf; |
| 130 | 130 | int i; |
| 131 | 131 | |
| 132 | 132 | /* version flag */ |
| 133 | if ( | |
| 133 | if ( | |
| 134 | 134 | return 1; |
| 135 | 135 | if (buf != 0) |
| 136 | 136 | return 1; |
| 137 | 137 | |
| 138 | 138 | /* chip state: master lock */ |
| 139 | if ( | |
| 139 | if ( | |
| 140 | 140 | return 1; |
| 141 | 141 | strata->master_lock = buf & 1; |
| 142 | 142 | |
| 143 | 143 | /* main FEEPROM area */ |
| 144 | if ( | |
| 144 | if ( | |
| 145 | 145 | return 1; |
| 146 | 146 | for (i = 0; i < FEEPROM_SIZE; i += 2) |
| 147 | 147 | { |
| r10384 | r10385 | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /* protection registers */ |
| 153 | if ( | |
| 153 | if ( | |
| 154 | 154 | return 1; |
| 155 | 155 | for (i = 0; i < PROT_REGS_SIZE; i += 2) |
| 156 | 156 | { |
| r10384 | r10385 | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /* block lock flags */ |
| 162 | if ( | |
| 162 | if ( | |
| 163 | 163 | return 1; |
| 164 | 164 | |
| 165 | 165 | return 0; |
| r10384 | r10385 | |
| 168 | 168 | /* |
| 169 | 169 | save the FEEPROM contents to file |
| 170 | 170 | */ |
| 171 | int strataflash_save(device_t *device, | |
| 171 | int strataflash_save(device_t *device, | |
| 172 | 172 | { |
| 173 | 173 | strata_t *strata = get_safe_token(device); |
| 174 | 174 | UINT8 buf; |
| r10384 | r10385 | |
| 176 | 176 | |
| 177 | 177 | /* version flag */ |
| 178 | 178 | buf = 0; |
| 179 | if ( | |
| 179 | if ( | |
| 180 | 180 | return 1; |
| 181 | 181 | |
| 182 | 182 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 183 | 183 | software data protect */ |
| 184 | 184 | buf = strata->master_lock; |
| 185 | if ( | |
| 185 | if ( | |
| 186 | 186 | return 1; |
| 187 | 187 | |
| 188 | 188 | /* main FEEPROM area */ |
| r10384 | r10385 | |
| 191 | 191 | UINT16 *ptr = (UINT16 *) (&strata->data_ptr[i]); |
| 192 | 192 | *ptr = LITTLE_ENDIANIZE_INT16(*ptr); |
| 193 | 193 | } |
| 194 | if ( | |
| 194 | if ( | |
| 195 | 195 | return 1; |
| 196 | 196 | for (i = 0; i < FEEPROM_SIZE; i += 2) |
| 197 | 197 | { |
| r10384 | r10385 | |
| 205 | 205 | UINT16 *ptr = (UINT16 *) (&strata->prot_regs[i]); |
| 206 | 206 | *ptr = LITTLE_ENDIANIZE_INT16(*ptr); |
| 207 | 207 | } |
| 208 | if ( | |
| 208 | if ( | |
| 209 | 209 | return 1; |
| 210 | 210 | for (i = 0; i < PROT_REGS_SIZE; i += 2) |
| 211 | 211 | { |
| r10384 | r10385 | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /* block lock flags */ |
| 217 | if ( | |
| 217 | if ( | |
| 218 | 218 | return 1; |
| 219 | 219 | |
| 220 | 220 | return 0; |
| r10384 | r10385 | |
|---|---|---|
| 7 | 7 | #define MCFG_STRATAFLASH_ADD(_tag) \ |
| 8 | 8 | MCFG_DEVICE_ADD(_tag, STRATAFLASH, 0) |
| 9 | 9 | |
| 10 | int strataflash_load(device_t *device, mame_file *file); | |
| 11 | int strataflash_save(device_t *device, mame_file *file); | |
| 10 | int strataflash_load(device_t *device, emu_file *file); | |
| 11 | int strataflash_save(device_t *device, emu_file *file); | |
| 12 | 12 | UINT8 strataflash_8_r(device_t *device, UINT32 address); |
| 13 | 13 | void strataflash_8_w(device_t *device, UINT32 address, UINT8 data); |
| 14 | 14 | UINT16 strataflash_16_r(device_t *device, offs_t offset); |
| r10384 | r10385 | |
|---|---|---|
| 377 | 377 | flash->pin.sck = data; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | void at45dbxx_load(device_t *device, | |
| 380 | void at45dbxx_load(device_t *device, | |
| 381 | 381 | { |
| 382 | 382 | at45dbxx_t *flash = get_token(device); |
| 383 | 383 | _logerror( 0, ("at45dbxx_load (%p)\n", file)); |
| 384 | | |
| 384 | | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | void at45dbxx_save(device_t *device, | |
| 387 | void at45dbxx_save(device_t *device, | |
| 388 | 388 | { |
| 389 | 389 | at45dbxx_t *flash = get_token(device); |
| 390 | 390 | _logerror( 0, ("at45dbxx_save (%p)\n", file)); |
| 391 | | |
| 391 | | |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | #ifdef UNUSED_FUNCTION |
| r10384 | r10385 | |
|---|---|---|
| 46 | 46 | int at45dbxx_pin_so(device_t *device); |
| 47 | 47 | |
| 48 | 48 | // load/save |
| 49 | void at45dbxx_load(device_t *device, mame_file *file); | |
| 50 | void at45dbxx_save(device_t *device, mame_file *file); | |
| 49 | void at45dbxx_load(device_t *device, emu_file *file); | |
| 50 | void at45dbxx_save(device_t *device, emu_file *file); | |
| 51 | 51 | |
| 52 | 52 | // non-volatile ram handler |
| 53 | 53 | //NVRAM_HANDLER( at45dbxx ); |
| r10384 | r10385 | |
|---|---|---|
| 746 | 746 | |
| 747 | 747 | MSX_SLOT_LOADSRAM(ascii8_sram) |
| 748 | 748 | { |
| 749 | file_error filerr; | |
| 750 | mame_file *f; | |
| 751 | ||
| 752 | 749 | if (!state->sramfile) |
| 753 | 750 | { |
| 754 | 751 | logerror ("ascii8_sram: error: no sram filename provided\n"); |
| 755 | 752 | return 1; |
| 756 | 753 | } |
| 757 | ||
| 758 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); | |
| 754 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 755 | file_error filerr = f.open(state->sramfile); | |
| 759 | 756 | if (filerr == FILERR_NONE) |
| 760 | 757 | { |
| 761 | if ( | |
| 758 | if ( | |
| 762 | 759 | { |
| 763 | mame_fclose (f); | |
| 764 | 760 | logerror ("ascii8_sram: info: sram loaded\n"); |
| 765 | 761 | return 0; |
| 766 | 762 | } |
| 767 | mame_fclose (f); | |
| 768 | 763 | memset (state->cart.sram.mem, 0, 0x2000); |
| 769 | 764 | logerror ("ascii8_sram: warning: could not read sram file\n"); |
| 770 | 765 | return 1; |
| r10384 | r10385 | |
| 777 | 772 | |
| 778 | 773 | MSX_SLOT_SAVESRAM(ascii8_sram) |
| 779 | 774 | { |
| 780 | file_error filerr; | |
| 781 | mame_file *f; | |
| 782 | ||
| 783 | 775 | if (!state->sramfile) |
| 784 | 776 | { |
| 785 | 777 | return 0; |
| 786 | 778 | } |
| 787 | 779 | |
| 788 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_WRITE, &f); | |
| 780 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE); | |
| 781 | file_error filerr = f.open(state->sramfile); | |
| 789 | 782 | if (filerr == FILERR_NONE) |
| 790 | 783 | { |
| 791 | mame_fwrite (f, state->cart.sram.mem, 0x2000); | |
| 792 | mame_fclose (f); | |
| 784 | f.write(state->cart.sram.mem, 0x2000); | |
| 793 | 785 | logerror ("ascii8_sram: info: sram saved\n"); |
| 794 | 786 | |
| 795 | 787 | return 0; |
| r10384 | r10385 | |
| 921 | 913 | |
| 922 | 914 | MSX_SLOT_LOADSRAM(ascii16_sram) |
| 923 | 915 | { |
| 924 | file_error filerr; | |
| 925 | mame_file *f; | |
| 926 | 916 | UINT8 *p; |
| 927 | 917 | |
| 928 | 918 | if (!state->sramfile) |
| r10384 | r10385 | |
| 931 | 921 | return 1; |
| 932 | 922 | } |
| 933 | 923 | |
| 934 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); | |
| 924 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 925 | file_error filerr = f.open(state->sramfile); | |
| 935 | 926 | if (filerr == FILERR_NONE) |
| 936 | 927 | { |
| 937 | 928 | p = state->cart.sram.mem; |
| 938 | 929 | |
| 939 | if ( | |
| 930 | if ( | |
| 940 | 931 | { |
| 941 | 932 | int /*offset,*/ i; |
| 942 | ||
| 943 | mame_fclose (f); | |
| 944 | ||
| 945 | 933 | //offset = 0; |
| 946 | 934 | for (i=0; i<7; i++) |
| 947 | 935 | { |
| r10384 | r10385 | |
| 952 | 940 | logerror ("ascii16_sram: info: sram loaded\n"); |
| 953 | 941 | return 0; |
| 954 | 942 | } |
| 955 | mame_fclose (f); | |
| 956 | 943 | memset (state->cart.sram.mem, 0, 0x4000); |
| 957 | 944 | logerror ("ascii16_sram: warning: could not read sram file\n"); |
| 958 | 945 | return 1; |
| r10384 | r10385 | |
| 965 | 952 | |
| 966 | 953 | MSX_SLOT_SAVESRAM(ascii16_sram) |
| 967 | 954 | { |
| 968 | file_error filerr; | |
| 969 | mame_file *f; | |
| 970 | ||
| 971 | 955 | if (!state->sramfile) |
| 972 | 956 | { |
| 973 | 957 | return 0; |
| 974 | 958 | } |
| 975 | ||
| 976 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_WRITE, &f); | |
| 959 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE); | |
| 960 | file_error filerr = f.open(state->sramfile); | |
| 977 | 961 | if (filerr == FILERR_NONE) |
| 978 | 962 | { |
| 979 | mame_fwrite (f, state->cart.sram.mem, 0x200); | |
| 980 | mame_fclose (f); | |
| 963 | f.write(state->cart.sram.mem, 0x200); | |
| 981 | 964 | logerror ("ascii16_sram: info: sram saved\n"); |
| 982 | 965 | |
| 983 | 966 | return 0; |
| r10384 | r10385 | |
| 1207 | 1190 | |
| 1208 | 1191 | MSX_SLOT_LOADSRAM(gmaster2) |
| 1209 | 1192 | { |
| 1210 | file_error filerr; | |
| 1211 | mame_file *f; | |
| 1212 | 1193 | UINT8 *p; |
| 1213 | 1194 | |
| 1214 | 1195 | p = state->cart.sram.mem; |
| 1215 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); | |
| 1196 | ||
| 1197 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 1198 | file_error filerr = f.open(state->sramfile); | |
| 1216 | 1199 | if (filerr == FILERR_NONE) |
| 1217 | 1200 | { |
| 1218 | if ( | |
| 1201 | if ( | |
| 1219 | 1202 | { |
| 1220 | 1203 | memcpy (p, p + 0x1000, 0x1000); |
| 1221 | 1204 | memcpy (p + 0x3000, p + 0x2000, 0x1000); |
| 1222 | mame_fclose (f); | |
| 1223 | 1205 | logerror ("gmaster2: info: sram loaded\n"); |
| 1224 | 1206 | return 0; |
| 1225 | 1207 | } |
| 1226 | mame_fclose (f); | |
| 1227 | 1208 | memset (p, 0, 0x4000); |
| 1228 | 1209 | logerror ("gmaster2: warning: could not read sram file\n"); |
| 1229 | 1210 | return 1; |
| r10384 | r10385 | |
| 1236 | 1217 | |
| 1237 | 1218 | MSX_SLOT_SAVESRAM(gmaster2) |
| 1238 | 1219 | { |
| 1239 | file_error filerr; | |
| 1240 | mame_file *f; | |
| 1241 | ||
| 1242 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_WRITE, &f); | |
| 1220 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE); | |
| 1221 | file_error filerr = f.open(state->sramfile); | |
| 1243 | 1222 | if (filerr == FILERR_NONE) |
| 1244 | 1223 | { |
| 1245 | mame_fwrite (f, state->cart.sram.mem + 0x1000, 0x2000); | |
| 1246 | mame_fclose (f); | |
| 1224 | f.write(state->cart.sram.mem + 0x1000, 0x2000); | |
| 1247 | 1225 | logerror ("gmaster2: info: sram saved\n"); |
| 1248 | 1226 | |
| 1249 | 1227 | return 0; |
| r10384 | r10385 | |
| 1782 | 1760 | |
| 1783 | 1761 | MSX_SLOT_LOADSRAM(fmpac) |
| 1784 | 1762 | { |
| 1785 | file_error filerr; | |
| 1786 | mame_file *f; | |
| 1787 | 1763 | char buf[PAC_HEADER_LEN]; |
| 1788 | 1764 | |
| 1789 | 1765 | if (!state->cart.fmpac.sram_support) |
| r10384 | r10385 | |
| 1797 | 1773 | logerror ("No sram filename provided\n"); |
| 1798 | 1774 | return 1; |
| 1799 | 1775 | } |
| 1800 | ||
| 1801 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); | |
| 1776 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_READ); | |
| 1777 | file_error filerr = f.open(state->sramfile); | |
| 1802 | 1778 | if (filerr == FILERR_NONE) |
| 1803 | 1779 | { |
| 1804 | if (( | |
| 1780 | if (( | |
| 1805 | 1781 | !strncmp (buf, PAC_HEADER, PAC_HEADER_LEN) && |
| 1806 | | |
| 1782 | | |
| 1807 | 1783 | { |
| 1808 | 1784 | logerror ("fmpac: info: sram loaded\n"); |
| 1809 | mame_fclose (f); | |
| 1810 | 1785 | return 0; |
| 1811 | 1786 | } |
| 1812 | 1787 | else |
| 1813 | 1788 | { |
| 1814 | 1789 | logerror ("fmpac: warning: failed to load sram\n"); |
| 1815 | mame_fclose (f); | |
| 1816 | 1790 | return 1; |
| 1817 | 1791 | } |
| 1818 | 1792 | } |
| r10384 | r10385 | |
| 1823 | 1797 | |
| 1824 | 1798 | MSX_SLOT_SAVESRAM(fmpac) |
| 1825 | 1799 | { |
| 1826 | file_error filerr; | |
| 1827 | mame_file *f; | |
| 1828 | ||
| 1829 | 1800 | if (!state->cart.fmpac.sram_support || !state->sramfile) |
| 1830 | 1801 | { |
| 1831 | 1802 | return 0; |
| 1832 | 1803 | } |
| 1833 | 1804 | |
| 1834 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_WRITE, &f); | |
| 1805 | emu_file f(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE); | |
| 1806 | file_error filerr = f.open(state->sramfile); | |
| 1835 | 1807 | if (filerr == FILERR_NONE) |
| 1836 | 1808 | { |
| 1837 | if ((mame_fwrite (f, PAC_HEADER, PAC_HEADER_LEN) == PAC_HEADER_LEN) && | |
| 1838 | (mame_fwrite (f, state->cart.fmpac.mem, 0x1ffe) == 0x1ffe)) | |
| 1809 | if ((f.write(PAC_HEADER, PAC_HEADER_LEN) == PAC_HEADER_LEN) && | |
| 1810 | (f.write(state->cart.fmpac.mem, 0x1ffe) == 0x1ffe)) | |
| 1839 | 1811 | { |
| 1840 | 1812 | logerror ("fmpac: info: sram saved\n"); |
| 1841 | mame_fclose (f); | |
| 1842 | 1813 | return 0; |
| 1843 | 1814 | } |
| 1844 | 1815 | else |
| 1845 | 1816 | { |
| 1846 | 1817 | logerror ("fmpac: warning: sram save to file failed\n"); |
| 1847 | mame_fclose (f); | |
| 1848 | 1818 | return 1; |
| 1849 | 1819 | } |
| 1850 | 1820 | } |
| r10384 | r10385 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | if (read_or_write) |
| 101 | 101 | { |
| 102 | mame_fwrite(file, cpu, 96); | |
| 103 | mame_fwrite(file, ram, 0x5000); | |
| 102 | file->write(cpu, 96); | |
| 103 | file->write(ram, 0x5000); | |
| 104 | 104 | } |
| 105 | 105 | else if (file) |
| 106 | 106 | { |
| 107 | mame_fread(file, cpu, 96); | |
| 108 | mame_fread(file, ram, 0x5000); | |
| 107 | file->read(cpu, 96); | |
| 108 | file->read(ram, 0x5000); | |
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
| r10384 | r10385 | |
|---|---|---|
| 1482 | 1482 | // This line requires that cartslot_t be included in cartslot.h, |
| 1483 | 1483 | // otherwise one cannot make use of multicart handling within such a |
| 1484 | 1484 | // custom LOAD function. |
| 1485 | multicart_open_error me = multicart_open(image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 1485 | multicart_open_error me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); | |
| 1486 | 1486 | |
| 1487 | 1487 | // Now that we have loaded the image files, let the PCB put them all |
| 1488 | 1488 | // together. This means we put the images in a structure which allows |
| r10384 | r10385 | |
| 1530 | 1530 | |
| 1531 | 1531 | // Close the multicart; all RAM resources will be |
| 1532 | 1532 | // written to disk |
| 1533 | multicart_close(cart->mc); | |
| 1533 | multicart_close(image.device().machine->options(),cart->mc); | |
| 1534 | 1534 | cart->mc = NULL; |
| 1535 | 1535 | |
| 1536 | 1536 | } |
| r10384 | r10385 | |
|---|---|---|
| 625 | 625 | hsgpl_state *card = get_safe_token(device); |
| 626 | 626 | astring *hsname = astring_assemble_3(astring_alloc(), device->machine->gamedrv->name, PATH_SEPARATOR, "hsgpl.nv"); |
| 627 | 627 | file_error filerr; |
| 628 | mame_file *nvfile; | |
| 629 | 628 | |
| 630 | 629 | if (read_or_write==0) |
| 631 | 630 | { |
| 632 | 631 | logerror("hsgpl: device nvram load %s\n", astring_c(hsname)); |
| 633 | 632 | |
| 634 | filerr = mame_fopen(SEARCHPATH_NVRAM, astring_c(hsname), OPEN_FLAG_READ, &nvfile); | |
| 633 | emu_file nvfile(device->machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_READ); | |
| 634 | filerr = nvfile.open(astring_c(hsname)); | |
| 635 | 635 | if (filerr != FILERR_NONE) |
| 636 | 636 | { |
| 637 | 637 | logerror("hsgpl: Could not restore NVRAM\n"); |
| 638 | 638 | return; |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | if ( | |
| 641 | if ( | |
| 642 | 642 | { |
| 643 | 643 | logerror("hsgpl: Error loading NVRAM; unexpected EOF\n"); |
| 644 | mame_fclose(nvfile); | |
| 645 | 644 | return; |
| 646 | 645 | } |
| 647 | 646 | |
| 648 | 647 | if (card->flashrom[0] != NVVERSION) |
| 649 | 648 | { |
| 650 | 649 | logerror("hsgpl: Wrong NVRAM image version: %d\n", card->flashrom[0]); |
| 651 | mame_fclose(nvfile); | |
| 652 | 650 | return; |
| 653 | 651 | } |
| 654 | mame_fclose(nvfile); | |
| 655 | 652 | } |
| 656 | 653 | else |
| 657 | 654 | { |
| r10384 | r10385 | |
| 663 | 660 | at29c040a_is_dirty(card->gromb)) |
| 664 | 661 | { |
| 665 | 662 | card->flashrom[0] = NVVERSION; |
| 666 | filerr = mame_fopen(SEARCHPATH_NVRAM, astring_c(hsname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &nvfile); | |
| 667 | ||
| 663 | ||
| 664 | emu_file nvfile(device->machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 665 | filerr = nvfile.open(astring_c(hsname)); | |
| 668 | 666 | if (filerr != FILERR_NONE) |
| 669 | 667 | { |
| 670 | 668 | logerror("hsgpl: Could not save NVRAM\n"); |
| 671 | 669 | } |
| 672 | 670 | else |
| 673 | 671 | { |
| 674 | if ( | |
| 672 | if (nv | |
| 675 | 673 | { |
| 676 | 674 | logerror("hsgpl: Error while saving contents of NVRAM.\n"); |
| 677 | 675 | } |
| 678 | 676 | } |
| 679 | mame_fclose(nvfile); | |
| 680 | 677 | return; |
| 681 | 678 | } |
| 682 | 679 | else |
| r10384 | r10385 | |
|---|---|---|
| 375 | 375 | ti99_evpc_state *card = get_safe_token(device); |
| 376 | 376 | astring *hsname = astring_assemble_3(astring_alloc(), device->machine->gamedrv->name, PATH_SEPARATOR, "evpc.nv"); |
| 377 | 377 | file_error filerr; |
| 378 | mame_file *nvfile; | |
| 379 | 378 | |
| 380 | 379 | if (read_or_write==0) |
| 381 | 380 | { |
| 382 | 381 | logerror("evpc: device nvram load %s\n", astring_c(hsname)); |
| 383 | 382 | |
| 384 | filerr = mame_fopen(SEARCHPATH_NVRAM, astring_c(hsname), OPEN_FLAG_READ, &nvfile); | |
| 383 | emu_file nvfile(device->machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_READ); | |
| 384 | filerr = nvfile.open(astring_c(hsname)); | |
| 385 | 385 | if (filerr == FILERR_NONE) |
| 386 | 386 | { |
| 387 | if ( | |
| 387 | if ( | |
| 388 | 388 | logerror("evpc: NOVRAM load error\n"); |
| 389 | mame_fclose(nvfile); | |
| 390 | 389 | } |
| 391 | 390 | } |
| 392 | 391 | else |
| 393 | 392 | { |
| 394 | 393 | logerror("evpc: device nvram save %s\n", astring_c(hsname)); |
| 395 | filerr = mame_fopen(SEARCHPATH_NVRAM, astring_c(hsname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &nvfile); | |
| 394 | emu_file nvfile(device->machine->options(), SEARCHPATH_NVRAM, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); | |
| 395 | filerr = nvfile.open(astring_c(hsname)); | |
| 396 | 396 | |
| 397 | 397 | if (filerr == FILERR_NONE) |
| 398 | 398 | { |
| 399 | if ( | |
| 399 | if (nv | |
| 400 | 400 | logerror("evpc: NOVRAM save error\n"); |
| 401 | mame_fclose(nvfile); | |
| 402 | 401 | } |
| 403 | 402 | } |
| 404 | 403 | } |
| r10384 | r10385 | |
|---|---|---|
| 182 | 182 | supplied file |
| 183 | 183 | -------------------------------------------------*/ |
| 184 | 184 | |
| 185 | void tc8521_load_stream(device_t *device, | |
| 185 | void tc8521_load_stream(device_t *device, | |
| 186 | 186 | { |
| 187 | 187 | tc8521_t *rtc = get_token(device); |
| 188 | 188 | |
| 189 | 189 | if (file) |
| 190 | 190 | { |
| 191 | mame_fread(file, &rtc->registers[0], sizeof(unsigned char)*16*4); | |
| 192 | mame_fread(file, &rtc->alarm_outputs, sizeof(UINT32)); | |
| 193 | mame_fread(file, &rtc->thirty_two_hz_counter, sizeof(UINT32)); | |
| 191 | file->read(&rtc->registers[0], sizeof(unsigned char)*16*4); | |
| 192 | file->read(&rtc->alarm_outputs, sizeof(UINT32)); | |
| 193 | file->read(&rtc->thirty_two_hz_counter, sizeof(UINT32)); | |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| r10384 | r10385 | |
| 201 | 201 | supplied file |
| 202 | 202 | -------------------------------------------------*/ |
| 203 | 203 | |
| 204 | void tc8521_save_stream(device_t *device, | |
| 204 | void tc8521_save_stream(device_t *device, | |
| 205 | 205 | { |
| 206 | 206 | tc8521_t *rtc = get_token(device); |
| 207 | 207 | |
| 208 | 208 | if (file) |
| 209 | 209 | { |
| 210 | mame_fwrite(file, &rtc->registers[0], sizeof(unsigned char)*16*4); | |
| 211 | mame_fwrite(file, &rtc->alarm_outputs, sizeof(UINT32)); | |
| 212 | mame_fwrite(file, &rtc->thirty_two_hz_counter, sizeof(UINT32)); | |
| 210 | file->write(&rtc->registers[0], sizeof(unsigned char)*16*4); | |
| 211 | file->write(&rtc->alarm_outputs, sizeof(UINT32)); | |
| 212 | file->write(&rtc->thirty_two_hz_counter, sizeof(UINT32)); | |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 |
| r10384 | r10385 | |
|---|---|---|
| 47 | 47 | READ8_DEVICE_HANDLER(tc8521_r); |
| 48 | 48 | WRITE8_DEVICE_HANDLER(tc8521_w); |
| 49 | 49 | |
| 50 | void tc8521_load_stream(device_t *device, mame_file *file); | |
| 51 | void tc8521_save_stream(device_t *device, mame_file *file); | |
| 50 | void tc8521_load_stream(device_t *device, emu_file *file); | |
| 51 | void tc8521_save_stream(device_t *device, emu_file *file); | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | #endif /* __TC8521_H__ */ |
| r10384 | r10385 | |
|---|---|---|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | void sst39vfx_load(device_t *device, | |
| 140 | void sst39vfx_load(device_t *device, | |
| 141 | 141 | { |
| 142 | 142 | sst39vfx_t *flash = get_token(device); |
| 143 | 143 | |
| 144 | 144 | _logerror( 0, ("sst39vfx_load (%p)\n", file)); |
| 145 | | |
| 145 | | |
| 146 | 146 | if (flash->swap) sst39vfx_swap(device); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | void sst39vfx_save(device_t *device, | |
| 149 | void sst39vfx_save(device_t *device, | |
| 150 | 150 | { |
| 151 | 151 | sst39vfx_t *flash = get_token(device); |
| 152 | 152 | |
| 153 | 153 | _logerror( 0, ("sst39vfx_save (%p)\n", file)); |
| 154 | 154 | if (flash->swap) sst39vfx_swap(device); |
| 155 | | |
| 155 | | |
| 156 | 156 | if (flash->swap) sst39vfx_swap(device); |
| 157 | 157 | } |
| 158 | 158 |
| r10384 | r10385 | |
|---|---|---|
| 63 | 63 | #endif |
| 64 | 64 | |
| 65 | 65 | // load/save |
| 66 | void sst39vfx_load(device_t *device, mame_file *file); | |
| 67 | void sst39vfx_save(device_t *device, mame_file *file); | |
| 66 | void sst39vfx_load(device_t *device, emu_file *file); | |
| 67 | void sst39vfx_save(device_t *device, emu_file *file); | |
| 68 | 68 | |
| 69 | 69 | // non-volatile ram handler |
| 70 | 70 | //NVRAM_HANDLER( sst39vfx ); |
| r10384 | r10385 | |
|---|---|---|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | static void europc_rtc_load_stream( | |
| 338 | static void europc_rtc_load_stream( | |
| 339 | 339 | { |
| 340 | | |
| 340 | | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | static void europc_rtc_save_stream( | |
| 343 | static void europc_rtc_save_stream( | |
| 344 | 344 | { |
| 345 | | |
| 345 | | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | NVRAM_HANDLER( europc_rtc ) |
| r10384 | r10385 | |
|---|---|---|
| 36 | 36 | } |
| 37 | 37 | else if (read_or_write) |
| 38 | 38 | { |
| 39 | | |
| 39 | | |
| 40 | 40 | } |
| 41 | 41 | else |
| 42 | 42 | { |
| 43 | | |
| 43 | | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 |
| r10384 | r10385 | |
|---|---|---|
| 804 | 804 | ti85_state *state = machine->driver_data<ti85_state>(); |
| 805 | 805 | if (read_or_write) |
| 806 | 806 | { |
| 807 | | |
| 807 | | |
| 808 | 808 | } |
| 809 | 809 | else |
| 810 | 810 | { |
| 811 | 811 | if (file) |
| 812 | 812 | { |
| 813 | | |
| 813 | | |
| 814 | 814 | cpu_set_reg(machine->device("maincpu"), Z80_PC,0x0c59); |
| 815 | 815 | } |
| 816 | 816 | else |
| r10384 | r10385 | |
| 823 | 823 | ti85_state *state = machine->driver_data<ti85_state>(); |
| 824 | 824 | if (read_or_write) |
| 825 | 825 | { |
| 826 | | |
| 826 | | |
| 827 | 827 | } |
| 828 | 828 | else |
| 829 | 829 | { |
| 830 | 830 | if (file) |
| 831 | 831 | { |
| 832 | | |
| 832 | | |
| 833 | 833 | cpu_set_reg(machine->device("maincpu"), Z80_PC,0x0c59); |
| 834 | 834 | } |
| 835 | 835 | else |
| r10384 | r10385 | |
|---|---|---|
| 271 | 271 | if ( read_or_write ) |
| 272 | 272 | { |
| 273 | 273 | /* Save the EEPROM data */ |
| 274 | | |
| 274 | | |
| 275 | 275 | } |
| 276 | 276 | else |
| 277 | 277 | { |
| 278 | 278 | /* Load the EEPROM data */ |
| 279 | 279 | if ( file ) |
| 280 | 280 | { |
| 281 | | |
| 281 | | |
| 282 | 282 | } |
| 283 | 283 | else |
| 284 | 284 | { |
| r10384 | r10385 | |
|---|---|---|
| 123 | 123 | |
| 124 | 124 | if (read_or_write) |
| 125 | 125 | { |
| 126 | mame_fwrite(file, cpu, 96); | |
| 127 | mame_fwrite(file, ram, 0x2800); | |
| 126 | file->write(cpu, 96); | |
| 127 | file->write(ram, 0x2800); | |
| 128 | 128 | } |
| 129 | 129 | else if (file) |
| 130 | 130 | { |
| 131 | mame_fread(file, cpu, 96); | |
| 132 | mame_fread(file, ram, 0x2800); | |
| 131 | file->read(cpu, 96); | |
| 132 | file->read(ram, 0x2800); | |
| 133 | 133 | } |
| 134 | 134 | else |
| 135 | 135 | { |
| r10384 | r10385 | |
|---|---|---|
| 242 | 242 | apple2gs_state *state = machine->driver_data<apple2gs_state>(); |
| 243 | 243 | if (read_or_write) |
| 244 | 244 | { |
| 245 | | |
| 245 | | |
| 246 | 246 | } |
| 247 | 247 | else if (file) |
| 248 | 248 | { |
| 249 | | |
| 249 | | |
| 250 | 250 | } |
| 251 | 251 | else |
| 252 | 252 | { |
| r10384 | r10385 | |
|---|---|---|
| 1392 | 1392 | { |
| 1393 | 1393 | if (LOG_RTC) |
| 1394 | 1394 | logerror("Writing PRAM to file\n"); |
| 1395 | | |
| 1395 | | |
| 1396 | 1396 | } |
| 1397 | 1397 | else |
| 1398 | 1398 | { |
| r10384 | r10385 | |
| 1400 | 1400 | { |
| 1401 | 1401 | if (LOG_RTC) |
| 1402 | 1402 | logerror("Reading PRAM from file\n"); |
| 1403 | | |
| 1403 | | |
| 1404 | 1404 | } |
| 1405 | 1405 | else |
| 1406 | 1406 | { |
| r10384 | r10385 | |
|---|---|---|
| 396 | 396 | pcf8593_load |
| 397 | 397 | -------------------------------------------------*/ |
| 398 | 398 | |
| 399 | void pcf8593_load(device_t *device, | |
| 399 | void pcf8593_load(device_t *device, | |
| 400 | 400 | { |
| 401 | 401 | pcf8593_t *rtc = get_token(device); |
| 402 | 402 | system_time systime; |
| 403 | 403 | |
| 404 | 404 | _logerror( 0, ("pcf8593_load (%p)\n", file)); |
| 405 | | |
| 405 | | |
| 406 | 406 | device->machine->current_datetime(systime); |
| 407 | 407 | pcf8593_set_date(device, systime.local_time.year, systime.local_time.month + 1, systime.local_time.mday); |
| 408 | 408 | pcf8593_set_time(device, systime.local_time.hour, systime.local_time.minute, systime.local_time.second); |
| r10384 | r10385 | |
| 414 | 414 | pcf8593_save |
| 415 | 415 | -------------------------------------------------*/ |
| 416 | 416 | |
| 417 | void pcf8593_save(device_t *device, | |
| 417 | void pcf8593_save(device_t *device, | |
| 418 | 418 | { |
| 419 | 419 | pcf8593_t *rtc = get_token(device); |
| 420 | 420 | |
| 421 | 421 | _logerror( 0, ("pcf8593_save (%p)\n", file)); |
| 422 | | |
| 422 | | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | #ifdef UNUSED_FUNCTION |
| r10384 | r10385 | |
|---|---|---|
| 35 | 35 | int pcf8593_pin_sda_r(device_t *device); |
| 36 | 36 | |
| 37 | 37 | /* load/save */ |
| 38 | void pcf8593_load(device_t *device, mame_file *file); | |
| 39 | void pcf8593_save(device_t *device, mame_file *file); | |
| 38 | void pcf8593_load(device_t *device, emu_file *file); | |
| 39 | void pcf8593_save(device_t *device, emu_file *file); | |
| 40 | 40 | |
| 41 | 41 | #endif /* __PCF8593_H__ */ |
| r10384 | r10385 | |
|---|---|---|
| 140 | 140 | /* |
| 141 | 141 | load the contents of one FEEPROM file |
| 142 | 142 | */ |
| 143 | int at29c040a_file_load(int id, | |
| 143 | int at29c040a_file_load(int id, | |
| 144 | 144 | { |
| 145 | 145 | UINT8 buf; |
| 146 | 146 | |
| 147 | 147 | /* version flag */ |
| 148 | if ( | |
| 148 | if ( | |
| 149 | 149 | return 1; |
| 150 | 150 | if (buf != 0) |
| 151 | 151 | return 1; |
| 152 | 152 | |
| 153 | 153 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 154 | 154 | software data protect */ |
| 155 | if ( | |
| 155 | if ( | |
| 156 | 156 | return 1; |
| 157 | 157 | at29c040a[id].s_lower_bbl = (buf >> 2) & 1; |
| 158 | 158 | at29c040a[id].s_higher_bbl = (buf >> 1) & 1; |
| 159 | 159 | at29c040a[id].s_sdp = buf & 1; |
| 160 | 160 | |
| 161 | 161 | /* data */ |
| 162 | if ( | |
| 162 | if ( | |
| 163 | 163 | return 1; |
| 164 | 164 | |
| 165 | 165 | at29c040a[id].s_dirty = FALSE; |
| r10384 | r10385 | |
| 170 | 170 | /* |
| 171 | 171 | save the FEEPROM contents to file |
| 172 | 172 | */ |
| 173 | int at29c040a_file_save(int id, | |
| 173 | int at29c040a_file_save(int id, | |
| 174 | 174 | { |
| 175 | 175 | UINT8 buf; |
| 176 | 176 | |
| 177 | 177 | /* version flag */ |
| 178 | 178 | buf = 0; |
| 179 | if ( | |
| 179 | if ( | |
| 180 | 180 | return 1; |
| 181 | 181 | |
| 182 | 182 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 183 | 183 | software data protect */ |
| 184 | 184 | buf = (at29c040a[id].s_lower_bbl << 2) | (at29c040a[id].s_higher_bbl << 1) | at29c040a[id].s_sdp; |
| 185 | if ( | |
| 185 | if ( | |
| 186 | 186 | return 1; |
| 187 | 187 | |
| 188 | 188 | /* data */ |
| 189 | if ( | |
| 189 | if ( | |
| 190 | 190 | return 1; |
| 191 | 191 | |
| 192 | 192 | return 0; |
| r10384 | r10385 | |
|---|---|---|
| 278 | 278 | return IMAGE_INIT_FAIL; |
| 279 | 279 | } |
| 280 | 280 | if (msx_slot_list[type].loadsram) { |
| 281 | msx_slot_list[type].loadsram (st); | |
| 281 | msx_slot_list[type].loadsram (image.device().machine, st); | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | state->cart_state[id] = st; |
| r10384 | r10385 | |
| 306 | 306 | |
| 307 | 307 | if (msx_slot_list[state->cart_state[id]->type].savesram) |
| 308 | 308 | { |
| 309 | msx_slot_list[state->cart_state[id]->type].savesram (state->cart_state[id]); | |
| 309 | msx_slot_list[state->cart_state[id]->type].savesram (image.device().machine, state->cart_state[id]); | |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 |
| r10384 | r10385 | |
|---|---|---|
| 1 | 1 | void at29c040a_init_data_ptr(int id, UINT8 *data_ptr); |
| 2 | 2 | void at29c040a_init(running_machine *machine,int id); |
| 3 | int at29c040a_file_load(int id, mame_file *file); | |
| 4 | int at29c040a_file_save(int id, mame_file *file); | |
| 3 | int at29c040a_file_load(int id, emu_file *file); | |
| 4 | int at29c040a_file_save(int id, emu_file *file); | |
| 5 | 5 | UINT8 at29c040a_r(int id, offs_t offset); |
| 6 | 6 | void at29c040a_w(int id, offs_t offset, UINT8 data); |
| 7 | 7 | int at29c040a_get_dirty_flag(int id); |
| r10384 | r10385 | |
|---|---|---|
| 938 | 938 | lisa_state *state = machine->driver_data<lisa_state>(); |
| 939 | 939 | if (read_or_write) |
| 940 | 940 | { |
| 941 | | |
| 941 | | |
| 942 | 942 | } |
| 943 | 943 | else |
| 944 | 944 | { |
| 945 | 945 | if (file) |
| 946 | | |
| 946 | | |
| 947 | 947 | else |
| 948 | 948 | memset(state->fdc_ram, 0, 1024); |
| 949 | 949 |
| r10384 | r10385 | |
|---|---|---|
| 813 | 813 | |
| 814 | 814 | #if 0 |
| 815 | 815 | |
| 816 | static | |
| 816 | static | |
| 817 | 817 | { |
| 818 | 818 | astring *fname; |
| 819 | 819 | file_error filerr; |
| 820 | | |
| 820 | | |
| 821 | 821 | fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, name, ".nv"); |
| 822 | 822 | filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file); |
| 823 | 823 | astring_free( fname); |
| r10384 | r10385 | |
| 826 | 826 | |
| 827 | 827 | static void diskonchip_load( device_t *device, const char *name) |
| 828 | 828 | { |
| 829 | | |
| 829 | | |
| 830 | 830 | file = nvram_system_fopen( device->machine, OPEN_FLAG_READ, name); |
| 831 | 831 | device_nvram_diskonchip_g3( device, file, 0); |
| 832 | 832 | if (file) mame_fclose( file); |
| r10384 | r10385 | |
| 834 | 834 | |
| 835 | 835 | static void diskonchip_save( device_t *device, const char *name) |
| 836 | 836 | { |
| 837 | | |
| 837 | | |
| 838 | 838 | file = nvram_system_fopen( device->machine, OPEN_FLAG_CREATE | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE_PATHS, name); |
| 839 | 839 | device_nvram_diskonchip_g3( device, file, 1); |
| 840 | 840 | if (file) mame_fclose( file); |
| r10384 | r10385 | |
| 901 | 901 | { |
| 902 | 902 | if (file) |
| 903 | 903 | { |
| 904 | mame_fwrite( file, doc->data[0], doc->data_size[0]); | |
| 905 | mame_fwrite( file, doc->data[1], doc->data_size[1]); | |
| 906 | mame_fwrite( file, doc->data[2], doc->data_size[2]); | |
| 904 | file->write(doc->data[0], doc->data_size[0]); | |
| 905 | file->write(doc->data[1], doc->data_size[1]); | |
| 906 | file->write(doc->data[2], doc->data_size[2]); | |
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | 909 | else |
| 910 | 910 | { |
| 911 | 911 | if (file) |
| 912 | 912 | { |
| 913 | mame_fread( file, doc->data[0], doc->data_size[0]); | |
| 914 | mame_fread( file, doc->data[1], doc->data_size[1]); | |
| 915 | mame_fread( file, doc->data[2], doc->data_size[2]); | |
| 913 | file->read(doc->data[0], doc->data_size[0]); | |
| 914 | file->read(doc->data[1], doc->data_size[1]); | |
| 915 | file->read(doc->data[2], doc->data_size[2]); | |
| 916 | 916 | } |
| 917 | 917 | else |
| 918 | 918 | { |
| r10384 | r10385 | |
|---|---|---|
| 151 | 151 | |
| 152 | 152 | if (read_or_write) |
| 153 | 153 | { |
| 154 | mame_fwrite(file, cpu, 96); | |
| 155 | mame_fwrite(file, ram, 0x8000); | |
| 154 | file->write(cpu, 96); | |
| 155 | file->write(ram, 0x8000); | |
| 156 | 156 | } |
| 157 | 157 | else if (file) |
| 158 | 158 | { |
| 159 | mame_fread(file, cpu, 96); | |
| 160 | mame_fread(file, ram, 0x8000); | |
| 159 | file->read(cpu, 96); | |
| 160 | file->read(ram, 0x8000); | |
| 161 | 161 | } |
| 162 | 162 | else |
| 163 | 163 | { |
| r10384 | r10385 | |
|---|---|---|
| 137 | 137 | // MACHINE START // |
| 138 | 138 | /////////////////// |
| 139 | 139 | |
| 140 | static | |
| 140 | static | |
| 141 | 141 | { |
| 142 | astring *fname; | |
| 143 | 142 | file_error filerr; |
| 144 | mame_file *file; | |
| 145 | fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, name, ".nv"); | |
| 146 | filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file); | |
| 143 | astring *fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, name, ".nv"); | |
| 144 | emu_file *file = global_alloc(emu_file(machine->options(), SEARCHPATH_NVRAM, openflags)); | |
| 145 | filerr = file->open(astring_c( fname)); | |
| 147 | 146 | astring_free( fname); |
| 148 | 147 | return (filerr == FILERR_NONE) ? file : NULL; |
| 149 | 148 | } |
| 150 | 149 | |
| 151 | typedef void (nvram_load_func)(running_machine *machine, | |
| 150 | typedef void (nvram_load_func)(running_machine *machine, | |
| 152 | 151 | |
| 153 | 152 | static int nvram_system_load( running_machine *machine, const char *name, nvram_load_func _nvram_load, int required) |
| 154 | 153 | { |
| 155 | | |
| 154 | | |
| 156 | 155 | file = nvram_system_fopen( machine, OPEN_FLAG_READ, name); |
| 157 | 156 | if (!file) |
| 158 | 157 | { |
| r10384 | r10385 | |
| 160 | 159 | return FALSE; |
| 161 | 160 | } |
| 162 | 161 | (*_nvram_load)(machine, file); |
| 163 | | |
| 162 | global | |
| 164 | 163 | return TRUE; |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | typedef void (nvram_save_func)(running_machine *machine, | |
| 166 | typedef void (nvram_save_func)(running_machine *machine, | |
| 168 | 167 | |
| 169 | 168 | static int nvram_system_save( running_machine *machine, const char *name, nvram_save_func _nvram_save) |
| 170 | 169 | { |
| 171 | | |
| 170 | | |
| 172 | 171 | file = nvram_system_fopen( machine, OPEN_FLAG_CREATE | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE_PATHS, name); |
| 173 | 172 | if (!file) |
| 174 | 173 | { |
| r10384 | r10385 | |
| 176 | 175 | return FALSE; |
| 177 | 176 | } |
| 178 | 177 | (*_nvram_save)(machine, file); |
| 179 | | |
| 178 | global | |
| 180 | 179 | return TRUE; |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | static void cybiko_pcf8593_load(running_machine *machine, | |
| 182 | static void cybiko_pcf8593_load(running_machine *machine, | |
| 184 | 183 | { |
| 185 | 184 | device_t *device = machine->device("rtc"); |
| 186 | 185 | pcf8593_load(device, file); |
| 187 | 186 | } |
| 188 | 187 | |
| 189 | static void cybiko_pcf8593_save(running_machine *machine, | |
| 188 | static void cybiko_pcf8593_save(running_machine *machine, | |
| 190 | 189 | { |
| 191 | 190 | device_t *device = machine->device("rtc"); |
| 192 | 191 | pcf8593_save(device, file); |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | static void cybiko_at45dbxx_load(running_machine *machine, | |
| 194 | static void cybiko_at45dbxx_load(running_machine *machine, | |
| 196 | 195 | { |
| 197 | 196 | device_t *device = machine->device("flash1"); |
| 198 | 197 | at45dbxx_load(device, file); |
| 199 | 198 | } |
| 200 | 199 | |
| 201 | static void cybiko_at45dbxx_save(running_machine *machine, | |
| 200 | static void cybiko_at45dbxx_save(running_machine *machine, | |
| 202 | 201 | { |
| 203 | 202 | device_t *device = machine->device("flash1"); |
| 204 | 203 | at45dbxx_save(device, file); |
| 205 | 204 | } |
| 206 | 205 | |
| 207 | static void cybiko_sst39vfx_load(running_machine *machine, | |
| 206 | static void cybiko_sst39vfx_load(running_machine *machine, | |
| 208 | 207 | { |
| 209 | 208 | device_t *device = machine->device("flash2"); |
| 210 | 209 | sst39vfx_load(device, file); |
| 211 | 210 | } |
| 212 | 211 | |
| 213 | static void cybiko_sst39vfx_save(running_machine *machine, | |
| 212 | static void cybiko_sst39vfx_save(running_machine *machine, | |
| 214 | 213 | { |
| 215 | 214 | device_t *device = machine->device("flash2"); |
| 216 | 215 | sst39vfx_save(device, file); |
| r10384 | r10385 | |
|---|---|---|
| 464 | 464 | { |
| 465 | 465 | if (read_or_write) |
| 466 | 466 | { |
| 467 | | |
| 467 | | |
| 468 | 468 | } |
| 469 | 469 | else |
| 470 | 470 | { |
| 471 | 471 | /* load battery backed memory from disk */ |
| 472 | 472 | if (file) |
| 473 | | |
| 473 | | |
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 |
| r10384 | r10385 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | if (read_or_write) |
| 101 | 101 | { |
| 102 | mame_fwrite(file, cpu, 96); | |
| 103 | mame_fwrite(file, ram, 0x4800); | |
| 102 | file->write(cpu, 96); | |
| 103 | file->write(ram, 0x4800); | |
| 104 | 104 | } |
| 105 | 105 | else if (file) |
| 106 | 106 | { |
| 107 | mame_fread(file, cpu, 96); | |
| 108 | mame_fread(file, ram, 0x4800); | |
| 107 | file->read(cpu, 96); | |
| 108 | file->read(ram, 0x4800); | |
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
| r10384 | r10385 | |
|---|---|---|
| 44 | 44 | int irq_latch; |
| 45 | 45 | int irq_latch_mask; |
| 46 | 46 | int sound_channel_periods[2]; |
| 47 | | |
| 47 | | |
| 48 | 48 | int previous_inputport_10_state; |
| 49 | 49 | int previous_alarm_state; |
| 50 | 50 | UINT8 nc200_uart_interrupt_irq; |
| r10384 | r10385 | |
|---|---|---|
| 153 | 153 | void (*reset)(running_machine *machine, slot_state*); |
| 154 | 154 | void (*map)(running_machine *machine, slot_state*, int page); |
| 155 | 155 | void (*write)(running_machine *machine, slot_state*, UINT16, UINT8); |
| 156 | int (*loadsram)(slot_state*); | |
| 157 | int (*savesram)(slot_state*); | |
| 156 | int (*loadsram)(running_machine *machine, slot_state*); | |
| 157 | int (*savesram)(running_machine *machine, slot_state*); | |
| 158 | 158 | } msx_slot; |
| 159 | 159 | |
| 160 | 160 | extern const msx_slot msx_slot_list[]; |
| r10384 | r10385 | |
| 235 | 235 | #define MSX_SLOT_RESET(nm) \ |
| 236 | 236 | static void slot_##nm##_reset (running_machine *machine, slot_state *state) |
| 237 | 237 | #define MSX_SLOT_LOADSRAM(nm) \ |
| 238 | static int slot_##nm##_loadsram (slot_state *state) | |
| 238 | static int slot_##nm##_loadsram (running_machine *machine, slot_state *state) | |
| 239 | 239 | #define MSX_SLOT_SAVESRAM(nm) \ |
| 240 | static int slot_##nm##_savesram (slot_state *state) | |
| 240 | static int slot_##nm##_savesram (running_machine *machine, slot_state *state) | |
| 241 | 241 | |
| 242 | 242 | typedef struct { |
| 243 | 243 | char name[9]; |
| r10384 | r10385 | |
|---|---|---|
| 718 | 718 | { |
| 719 | 719 | ti85serial_state *ti85serial = get_token( device ); |
| 720 | 720 | char var_file_name[16]; |
| 721 | mame_file * var_file; | |
| 722 | 721 | UINT8* temp; |
| 723 | 722 | file_error filerr; |
| 724 | 723 | |
| r10384 | r10385 | |
| 889 | 888 | ti85serial->variable_number = 0; |
| 890 | 889 | ti85serial->status = TI85_SEND_STOP; |
| 891 | 890 | sprintf (var_file_name, "%08d.85g", ti85serial->var_file_number); |
| 892 | filerr = mame_fopen(NULL, var_file_name, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &var_file); | |
| 891 | emu_file var_file(device->machine->options(), NULL, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 892 | filerr = var_file.open(var_file_name); | |
| 893 | ||
| 893 | 894 | if (filerr == FILERR_NONE) |
| 894 | 895 | { |
| 895 | mame_fwrite(var_file, ti85serial->var_file_data, ti85serial->var_file_size); | |
| 896 | mame_fclose(var_file); | |
| 896 | var_file.write(ti85serial->var_file_data, ti85serial->var_file_size); | |
| 897 | 897 | free (ti85serial->var_file_data); |
| 898 | 898 | ti85serial->var_file_data = NULL; |
| 899 | 899 | ti85serial->var_file_size = 0; |
| r10384 | r10385 | |
| 911 | 911 | |
| 912 | 912 | file_error filerr; |
| 913 | 913 | char backup_file_name[] = "00000000.85b"; |
| 914 | mame_file * backup_file; | |
| 915 | 914 | |
| 916 | 915 | switch (ti85serial->status) |
| 917 | 916 | { |
| r10384 | r10385 | |
| 1031 | 1030 | ti85serial->backup_file_data[0x42+0x06+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]] = ti85_calculate_checksum(ti85serial->backup_file_data+0x37, 0x42+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]+0x06-0x37)&0x00ff; |
| 1032 | 1031 | ti85serial->backup_file_data[0x42+0x06+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]+0x01] = (ti85_calculate_checksum(ti85serial->backup_file_data+0x37, 0x42+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]+0x06-0x37)&0xff00)>>8; |
| 1033 | 1032 | sprintf (backup_file_name, "%08d.85b", ti85serial->backup_file_number); |
| 1034 | filerr = mame_fopen(NULL, backup_file_name, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &backup_file); | |
| 1033 | ||
| 1034 | emu_file backup_file(device->machine->options(), NULL, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 1035 | filerr = backup_file.open(backup_file_name); | |
| 1036 | ||
| 1035 | 1037 | if (filerr == FILERR_NONE) |
| 1036 | 1038 | { |
| 1037 | mame_fwrite(backup_file, ti85serial->backup_file_data, 0x42+0x06+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]+0x02); | |
| 1038 | mame_fclose(backup_file); | |
| 1039 | backup_file.write(ti85serial->backup_file_data, 0x42+0x06+ti85serial->backup_data_size[0]+ti85serial->backup_data_size[1]+ti85serial->backup_data_size[2]+0x02); | |
| 1039 | 1040 | ti85serial->backup_file_number++; |
| 1040 | 1041 | } |
| 1041 | 1042 | free(ti85serial->backup_file_data); ti85serial->backup_file_data = NULL; |
| r10384 | r10385 | |
| 1051 | 1052 | ti85serial_state *ti85serial = get_token( device ); |
| 1052 | 1053 | char image_file_name[] = "00000000.85i"; |
| 1053 | 1054 | file_error filerr; |
| 1054 | mame_file * image_file; | |
| 1055 | 1055 | UINT8 * image_file_data; |
| 1056 | 1056 | |
| 1057 | 1057 | switch (ti85serial->status) |
| r10384 | r10385 | |
| 1095 | 1095 | { |
| 1096 | 1096 | ti85_convert_stream_to_data (ti85serial->receive_buffer, 1030*8, ti85serial->receive_data); |
| 1097 | 1097 | sprintf (image_file_name, "%08d.85i", ti85serial->image_file_number); |
| 1098 | filerr = mame_fopen(NULL, image_file_name, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &image_file); | |
| 1098 | ||
| 1099 | emu_file image_file(device->machine->options(), NULL, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); | |
| 1100 | filerr = image_file.open(image_file_name); | |
| 1101 | ||
| 1099 | 1102 | if (filerr == FILERR_NONE) |
| 1100 | 1103 | { |
| 1101 | 1104 | image_file_data = (UINT8*)malloc (0x49+1008); |
| r10384 | r10385 | |
| 1124 | 1127 | memcpy(image_file_data+0x47, ti85serial->receive_data+4, 1008); |
| 1125 | 1128 | image_file_data[1008+0x49-2] = ti85_calculate_checksum(image_file_data+0x37, 1008+0x10)&0x00ff; |
| 1126 | 1129 | image_file_data[1008+0x49-1] = (ti85_calculate_checksum(image_file_data+0x37, 1008+0x10)&0xff00)>>8; |
| 1127 | mame_fwrite(image_file, image_file_data, 1008+0x49); | |
| 1128 | mame_fclose(image_file); | |
| 1130 | image_file.write(image_file_data, 1008+0x49); | |
| 1129 | 1131 | free(image_file_data); |
| 1130 | 1132 | ti85serial->image_file_number++; |
| 1131 | 1133 | } |
| r10384 | r10385 | |
|---|---|---|
| 193 | 193 | * |
| 194 | 194 | ********************************************************************/ |
| 195 | 195 | /* |
| 196 | static | |
| 196 | static | |
| 197 | 197 | { |
| 198 | 198 | device_image_interface *image = dynamic_cast<device_image_interface *>(machine->device("cart")); |
| 199 | 199 | astring *fname; |
| 200 | 200 | file_error filerr; |
| 201 | | |
| 201 | | |
| 202 | 202 | if (image->exists()) |
| 203 | 203 | { |
| 204 | 204 | fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, image->basename_noext(), ".nv"); |
| r10384 | r10385 | |
| 212 | 212 | |
| 213 | 213 | static void jaguar_nvram_load(running_machine *machine) |
| 214 | 214 | { |
| 215 | | |
| 215 | | |
| 216 | 216 | device_t *device; |
| 217 | 217 | |
| 218 | 218 | for (device = machine->m_devicelist.first(); device != NULL; device = device->next()) |
| r10384 | r10385 | |
| 232 | 232 | |
| 233 | 233 | static void jaguar_nvram_save(running_machine *machine) |
| 234 | 234 | { |
| 235 | | |
| 235 | | |
| 236 | 236 | device_t *device; |
| 237 | 237 | |
| 238 | 238 | for (device = machine->m_devicelist.first(); device != NULL; device = device->next()) |
| r10384 | r10385 | |
|---|---|---|
| 802 | 802 | |
| 803 | 803 | if (read_or_write) |
| 804 | 804 | { |
| 805 | mame_fwrite(file, cpu, 96); | |
| 806 | mame_fwrite(file, ram, 0x2800); | |
| 805 | file->write(cpu, 96); | |
| 806 | file->write(ram, 0x2800); | |
| 807 | 807 | } |
| 808 | 808 | else if (file) |
| 809 | 809 | { |
| 810 | mame_fread(file, cpu, 96); | |
| 811 | mame_fread(file, ram, 0x2800); | |
| 810 | file->read(cpu, 96); | |
| 811 | file->read(ram, 0x2800); | |
| 812 | 812 | } |
| 813 | 813 | else |
| 814 | 814 | { |
| r10384 | r10385 | |
|---|---|---|
| 392 | 392 | |
| 393 | 393 | if (read_or_write) |
| 394 | 394 | { |
| 395 | | |
| 395 | | |
| 396 | 396 | } |
| 397 | 397 | else |
| 398 | 398 | { |
| 399 | 399 | if (file) |
| 400 | 400 | { |
| 401 | | |
| 401 | | |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| r10384 | r10385 | |
|---|---|---|
| 131 | 131 | ip22_state *state = machine->driver_data<ip22_state>(); |
| 132 | 132 | if (read_or_write) |
| 133 | 133 | { |
| 134 | mame_fwrite(file, state->nRTC_UserRAM, 0x200); | |
| 135 | mame_fwrite(file, state->nRTC_RAM, 0x200); | |
| 134 | file->write(state->nRTC_UserRAM, 0x200); | |
| 135 | file->write(state->nRTC_RAM, 0x200); | |
| 136 | 136 | } |
| 137 | 137 | else |
| 138 | 138 | { |
| 139 | 139 | if (file) |
| 140 | 140 | { |
| 141 | mame_fread(file, state->nRTC_UserRAM, 0x200); | |
| 142 | mame_fread(file, state->nRTC_RAM, 0x200); | |
| 141 | file->read(state->nRTC_UserRAM, 0x200); | |
| 142 | file->read(state->nRTC_RAM, 0x200); | |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
| r10384 | r10385 | |
|---|---|---|
| 541 | 541 | { |
| 542 | 542 | case MEMCARD_CREATE: |
| 543 | 543 | memset(state->memcard_data, 0, MEMCARD_SIZE); |
| 544 | | |
| 544 | | |
| 545 | 545 | break; |
| 546 | 546 | |
| 547 | 547 | case MEMCARD_INSERT: |
| 548 | | |
| 548 | | |
| 549 | 549 | break; |
| 550 | 550 | |
| 551 | 551 | case MEMCARD_EJECT: |
| 552 | | |
| 552 | | |
| 553 | 553 | break; |
| 554 | 554 | } |
| 555 | 555 | } |
| r10384 | r10385 | |
|---|---|---|
| 1257 | 1257 | |
| 1258 | 1258 | if (read_or_write) |
| 1259 | 1259 | { |
| 1260 | mame_fwrite(file, state->m_t6834_ram, sizeof(state->m_t6834_ram)); | |
| 1261 | mame_fwrite(file, ram_get_ptr(state->m_ram), ram_get_size(state->m_ram)); | |
| 1260 | file->write(state->m_t6834_ram, sizeof(state->m_t6834_ram)); | |
| 1261 | file->write(ram_get_ptr(state->m_ram), ram_get_size(state->m_ram)); | |
| 1262 | 1262 | } |
| 1263 | 1263 | else |
| 1264 | 1264 | { |
| 1265 | 1265 | if (file) |
| 1266 | 1266 | { |
| 1267 | mame_fread(file, state->m_t6834_ram, sizeof(state->m_t6834_ram)); | |
| 1268 | mame_fread(file, ram_get_ptr(state->m_ram), ram_get_size(state->m_ram)); | |
| 1267 | file->read(state->m_t6834_ram, sizeof(state->m_t6834_ram)); | |
| 1268 | file->read(ram_get_ptr(state->m_ram), ram_get_size(state->m_ram)); | |
| 1269 | 1269 | state->m_warm_start = 1; |
| 1270 | 1270 | } |
| 1271 | 1271 | else |
| r10384 | r10385 | |
|---|---|---|
| 432 | 432 | |
| 433 | 433 | LOG(("restoring nc memory\n")); |
| 434 | 434 | /* get size of memory data stored */ |
| 435 | | |
| 435 | | |
| 436 | 436 | |
| 437 | 437 | if (stored_size > ram_get_size(machine->device(RAM_TAG))) |
| 438 | 438 | restore_size = ram_get_size(machine->device(RAM_TAG)); |
| r10384 | r10385 | |
| 440 | 440 | restore_size = stored_size; |
| 441 | 441 | |
| 442 | 442 | /* read as much as will fit into memory */ |
| 443 | | |
| 443 | | |
| 444 | 444 | /* seek over remaining data */ |
| 445 | | |
| 445 | | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* store a block of memory to the nvram file */ |
| r10384 | r10385 | |
| 455 | 455 | |
| 456 | 456 | LOG(("storing nc memory\n")); |
| 457 | 457 | /* write size of memory data */ |
| 458 | | |
| 458 | | |
| 459 | 459 | |
| 460 | 460 | /* write data block */ |
| 461 | | |
| 461 | | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | static void nc_common_open_stream_for_reading(running_machine *machine) |
| r10384 | r10385 | |
| 468 | 468 | |
| 469 | 469 | sprintf(filename,"%s.nv", machine->gamedrv->name); |
| 470 | 470 | |
| 471 | mame_fopen(SEARCHPATH_MEMCARD, filename, OPEN_FLAG_READ, &state->file); | |
| 471 | state->file = global_alloc(emu_file(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE)); | |
| 472 | state->file->open(filename); | |
| 472 | 473 | } |
| 473 | 474 | |
| 474 | 475 | static void nc_common_open_stream_for_writing(running_machine *machine) |
| r10384 | r10385 | |
| 477 | 478 | char filename[MAX_DRIVER_NAME_CHARS + 5]; |
| 478 | 479 | |
| 479 | 480 | sprintf(filename,"%s.nv", machine->gamedrv->name); |
| 480 | ||
| 481 | mame_fopen(SEARCHPATH_MEMCARD, filename, OPEN_FLAG_WRITE, &state->file); | |
| 481 | ||
| 482 | state->file = global_alloc(emu_file(machine->options(), SEARCHPATH_MEMCARD, OPEN_FLAG_WRITE)); | |
| 483 | state->file->open(filename); | |
| 482 | 484 | } |
| 483 | 485 | |
| 484 | 486 | |
| r10384 | r10385 | |
| 486 | 488 | { |
| 487 | 489 | nc_state *state = machine->driver_data<nc_state>(); |
| 488 | 490 | if (state->file) |
| 489 | | |
| 491 | global | |
| 490 | 492 | } |
| 491 | 493 | |
| 492 | 494 |
| r10384 | r10385 | |
|---|---|---|
| 1015 | 1015 | px4_state *px4 = machine->driver_data<px4_state>(); |
| 1016 | 1016 | |
| 1017 | 1017 | if (read_or_write) |
| 1018 | | |
| 1018 | | |
| 1019 | 1019 | else |
| 1020 | 1020 | if (file) |
| 1021 | | |
| 1021 | | |
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 |
| r10384 | r10385 | |
|---|---|---|
| 1770 | 1770 | { |
| 1771 | 1771 | if (file) |
| 1772 | 1772 | { |
| 1773 | | |
| 1773 | | |
| 1774 | 1774 | } |
| 1775 | 1775 | } |
| 1776 | 1776 | else |
| 1777 | 1777 | { |
| 1778 | 1778 | if (file) |
| 1779 | 1779 | { |
| 1780 | | |
| 1780 | | |
| 1781 | 1781 | } |
| 1782 | 1782 | else |
| 1783 | 1783 | { |
| r10384 | r10385 | |
|---|---|---|
| 1886 | 1886 | int i; |
| 1887 | 1887 | |
| 1888 | 1888 | if (read_or_write) |
| 1889 | | |
| 1889 | | |
| 1890 | 1890 | else |
| 1891 | 1891 | { |
| 1892 | 1892 | if (file) |
| 1893 | 1893 | { |
| 1894 | | |
| 1894 | | |
| 1895 | 1895 | } |
| 1896 | 1896 | else |
| 1897 | 1897 | { |
| r10384 | r10385 | |
|---|---|---|
| 403 | 403 | |
| 404 | 404 | if (read_or_write) |
| 405 | 405 | { |
| 406 | mame_fwrite(file, state->ram, 0x8000); | |
| 407 | mame_fwrite(file, ram_get_ptr(machine->device(RAM_TAG)), 224*1024); | |
| 406 | file->write(state->ram, 0x8000); | |
| 407 | file->write(ram_get_ptr(machine->device(RAM_TAG)), 224*1024); | |
| 408 | 408 | } |
| 409 | 409 | else |
| 410 | 410 | { |
| 411 | 411 | if (file) |
| 412 | 412 | { |
| 413 | mame_fread(file, state->ram, 0x8000); | |
| 414 | mame_fread(file, ram_get_ptr(machine->device(RAM_TAG)), 224*1024); | |
| 413 | file->read(state->ram, 0x8000); | |
| 414 | file->read(ram_get_ptr(machine->device(RAM_TAG)), 224*1024); | |
| 415 | 415 | |
| 416 | 416 | /* reload register A and B for restore the periodic irq state */ |
| 417 | mame_fseek(file, 0x4000a, SEEK_SET); | |
| 418 | mame_fread(file, ®_a, 0x01); | |
| 419 | mame_fread(file, ®_b, 0x01); | |
| 417 | file->seek(0x4000a, SEEK_SET); | |
| 418 | file->read(®_a, 0x01); | |
| 419 | file->read(®_b, 0x01); | |
| 420 | 420 | |
| 421 | 421 | set_146818_periodic_irq(machine, reg_a); |
| 422 | 422 | state->periodic_irq = (reg_b & 0x40) ? 1 : 0; |
| r10384 | r10385 | |
|---|---|---|
| 611 | 611 | |
| 612 | 612 | if (read_or_write) |
| 613 | 613 | { |
| 614 | mame_fwrite(file, state->m_sys_register, 0xc0); | |
| 615 | mame_fwrite(file, state->m_ram, state->m_ram_size); | |
| 614 | file->write(state->m_sys_register, 0xc0); | |
| 615 | file->write(state->m_ram, state->m_ram_size); | |
| 616 | 616 | if (state->m_ram_bank_count) |
| 617 | | |
| 617 | | |
| 618 | 618 | } |
| 619 | 619 | else |
| 620 | 620 | { |
| 621 | 621 | if (file) |
| 622 | 622 | { |
| 623 | mame_fread(file, state->m_sys_register, 0xc0); | |
| 624 | mame_fread(file, state->m_ram, state->m_ram_size); | |
| 623 | file->read(state->m_sys_register, 0xc0); | |
| 624 | file->read(state->m_ram, state->m_ram_size); | |
| 625 | 625 | if (state->m_ram_bank_count) |
| 626 | | |
| 626 | | |
| 627 | 627 | |
| 628 | 628 | //warm start |
| 629 | 629 | state->m_stby_pwr = 1; |
| r10384 | r10385 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | static chd_file *get_disc(device_t *device) |
| 91 | 91 | { |
| 92 | | |
| 92 | | |
| 93 | 93 | chd_file *image_chd = NULL; |
| 94 | mame_path *path; | |
| 95 | 94 | |
| 96 | 95 | /* open a path to the ROMs and find the first CHD file */ |
| 97 | path = mame_openpath(device->machine->options(), OPTION_ROMPATH); | |
| 98 | if (path != NULL) | |
| 96 | file_enumerator path(device->machine->options(), OPTION_ROMPATH); | |
| 97 | const osd_directory_entry *dir; | |
| 98 | ||
| 99 | /* iterate while we get new objects */ | |
| 100 | while ((dir = path.next()) != NULL) | |
| 99 | 101 | { |
| 100 | | |
| 102 | i | |
| 101 | 103 | |
| 102 | /* iterate while we get new objects */ | |
| 103 | while ((dir = mame_readpath(path)) != NULL) | |
| 104 | /* look for files ending in .chd */ | |
| 105 | if (length > 4 && | |
| 106 | dir->name[length - 4] == '.' && | |
| 107 | tolower(dir->name[length - 3]) == 'c' && | |
| 108 | tolower(dir->name[length - 2]) == 'h' && | |
| 109 | tolower(dir->name[length - 1]) == 'd') | |
| 104 | 110 | { |
| 105 | int length = strlen(dir->name); | |
| 111 | file_error filerr; | |
| 112 | chd_error chderr; | |
| 106 | 113 | |
| 107 | /* look for files ending in .chd */ | |
| 108 | if (length > 4 && | |
| 109 | dir->name[length - 4] == '.' && | |
| 110 | tolower(dir->name[length - 3]) == 'c' && | |
| 111 | tolower(dir->name[length - 2]) == 'h' && | |
| 112 | tolower(dir->name[length - 1]) == 'd') | |
| 114 | /* open the file itself via our search path */ | |
| 115 | image_file = auto_alloc(device->machine, emu_file(device->machine->options(), SEARCHPATH_IMAGE, OPEN_FLAG_READ)); | |
| 116 | filerr = image_file->open(dir->name); | |
| 117 | if (filerr == FILERR_NONE) | |
| 113 | 118 | { |
| 114 | file_error filerr; | |
| 115 | chd_error chderr; | |
| 116 | ||
| 117 | /* open the file itself via our search path */ | |
| 118 | filerr = mame_fopen(SEARCHPATH_IMAGE, dir->name, OPEN_FLAG_READ, &image_file); | |
| 119 | if (filerr == FILERR_NONE) | |
| 119 | /* try to open the CHD */ | |
| 120 | chderr = chd_open_file(image_file, CHD_OPEN_READ, NULL, &image_chd); | |
| 121 | if (chderr == CHDERR_NONE) | |
| 120 | 122 | { |
| 121 | /* try to open the CHD */ | |
| 122 | chderr = chd_open_file(mame_core_file(image_file), CHD_OPEN_READ, NULL, &image_chd); | |
| 123 | if (chderr == CHDERR_NONE) | |
| 124 | { | |
| 125 | set_disk_handle(device->machine, "laserdisc", image_file, image_chd); | |
| 126 | filename.cpy(dir->name); | |
| 127 | device->machine->add_notifier(MACHINE_NOTIFY_EXIT, free_string); | |
| 128 | break; | |
| 129 | } | |
| 130 | ||
| 131 | /* close the file on failure */ | |
| 132 | mame_fclose(image_file); | |
| 133 | image_file = NULL; | |
| 123 | set_disk_handle(*device->machine, "laserdisc", *image_file, *image_chd); | |
| 124 | filename.cpy(dir->name); | |
| 125 | device->machine->add_notifier(MACHINE_NOTIFY_EXIT, free_string); | |
| 126 | break; | |
| 134 | 127 | } |
| 135 | 128 | } |
| 129 | ||
| 130 | /* close the file on failure */ | |
| 131 | auto_free(device->machine, image_file); | |
| 132 | image_file = NULL; | |
| 136 | 133 | } |
| 137 | mame_closepath(path); | |
| 138 | 134 | } |
| 139 | 135 | |
| 140 | 136 | /* if we failed, pop a message and exit */ |
| Previous | 15994 Revisions | Next |