void debug_view_state::reset() { // free all items in the state list while (m_state_list != nullptr) { state_item *oldhead = m_state_list; m_state_list = oldhead->m_next; auto_free(machine(), oldhead); } }
PALETTE_INIT_MEMBER(popper_state, popper) { const UINT8 *color_prom = memregion("proms")->base(); rgb_t *rgb; rgb = compute_res_net_all(machine(), color_prom, &popper_decode_info, &popper_net_info); palette.set_pen_colors(0, rgb, 64); palette.palette()->normalize_range(0, 63); auto_free(machine(), rgb); }
void popper_state::palette_init() { const UINT8 *color_prom = memregion("proms")->base(); rgb_t *rgb; rgb = compute_res_net_all(machine(), color_prom, &popper_decode_info, &popper_net_info); palette_set_colors(machine(), 0, rgb, 64); palette_normalize_range(machine().palette, 0, 63, 0, 255); auto_free(machine(), rgb); }
void eeprom_device::nvram_read(mame_file &file) { UINT32 eeprom_length = 1 << m_config.m_address_bits; UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes); mame_fread(&file, buffer, eeprom_bytes); for (offs_t offs = 0; offs < eeprom_bytes; offs++) m_addrspace[0]->write_byte(offs, buffer[offs]); auto_free(&m_machine, buffer); }
void eeprom_device::nvram_write(emu_file &file) { UINT32 eeprom_length = 1 << m_address_bits; UINT32 eeprom_bytes = eeprom_length * m_data_bits / 8; UINT8 *buffer = auto_alloc_array(machine(), UINT8, eeprom_bytes); for (offs_t offs = 0; offs < eeprom_bytes; offs++) buffer[offs] = m_addrspace[0]->read_byte(offs); file.write(buffer, eeprom_bytes); auto_free(machine(), buffer); }
void debug_view_manager::free_view(debug_view &view) { // free us but only if we're in the list for (debug_view **viewptr = &m_viewlist; *viewptr != NULL; viewptr = &(*viewptr)->m_next) if (*viewptr == &view) { *viewptr = view.m_next; auto_free(machine(), &view); break; } }
void at28c16_device::nvram_write( emu_file &file ) { UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES ); for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) { buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs ); } file.write( buffer, AT28C16_TOTAL_BYTES ); auto_free( &m_machine, buffer ); }
void at28c16_device::nvram_read( emu_file &file ) { UINT8 *buffer = auto_alloc_array( machine(), UINT8, AT28C16_TOTAL_BYTES ); file.read( buffer, AT28C16_TOTAL_BYTES ); for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) { m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] ); } auto_free( machine(), buffer ); }
/* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_YM2151_ADD("ymsnd", YM_CLOCK) MCFG_YM2151_IRQ_HANDLER(WRITELINE(driver_device, member_wrapper_line<t5182_ym2151_irq_handler>)) MCFG_SOUND_ROUTE(0, "mono", 1.0) MCFG_SOUND_ROUTE(1, "mono", 1.0) MACHINE_CONFIG_END ROM_START( mustache ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) ) ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) ) ROM_REGION( 0x10000, "t5182", 0 ) /* Toshiba T5182 module */ ROM_LOAD( "t5182.rom", 0x0000, 0x2000, CRC(d354c8fc) SHA1(a1c9e1ac293f107f69cc5788cf6abc3db1646e33) ) ROM_LOAD( "mustache.e5", 0x8000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) ) ROM_REGION( 0x0c000, "gfx1",0) /* BG tiles */ ROM_LOAD( "mustache.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) ) ROM_LOAD( "mustache.a14", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) ) ROM_LOAD( "mustache.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) ) ROM_REGION( 0x20000, "gfx2",0 ) /* sprites */ ROM_LOAD( "mustache.a4", 0x00000, 0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) ) ROM_LOAD( "mustache.a7", 0x08000, 0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) ) ROM_LOAD( "mustache.a5", 0x10000, 0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) ) ROM_LOAD( "mustache.a8", 0x18000, 0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) ) ROM_REGION( 0x1300, "proms",0 ) /* proms */ ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) ) ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) ) ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) ) ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */ ROM_END DRIVER_INIT_MEMBER(mustache_state,mustache) { t5182_init(machine()); int i; int G1 = memregion("gfx1")->bytes()/3; int G2 = memregion("gfx2")->bytes()/2; UINT8 *gfx1 = memregion("gfx1")->base(); UINT8 *gfx2 = memregion("gfx2")->base(); UINT8 *buf=auto_alloc_array(machine(), UINT8, G2*2); /* BG data lines */ for (i=0;i<G1; i++) { UINT16 w; buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3); w = (gfx1[i+G1] << 8) | gfx1[i+G1*2]; w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7); buf[i+G1] = w >> 8; buf[i+G1*2] = w & 0xff; } /* BG address lines */ for (i = 0; i < 3*G1; i++) gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)]; /* SPR data lines */ for (i=0;i<G2; i++) { UINT16 w; w = (gfx2[i] << 8) | gfx2[i+G2]; w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 ); buf[i] = w >> 8; buf[i+G2] = w & 0xff; } /* SPR address lines */ for (i = 0; i < 2*G2; i++) gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)]; auto_free(machine(), buf); seibu_sound_decrypt(machine(),"maincpu",0x8000); }
void debug_view_source_list::reset() { // free from the head while (m_head != NULL) { debug_view_source *source = m_head; m_head = source->m_next; auto_free(machine(), source); } // reset the tail pointer and index m_tail = NULL; m_count = 0; }
void bfm_decode_mainrom(running_machine &machine, const char *rom_region, UINT8* codec_data) { UINT8 *tmp, *rom; rom = machine.root_device().memregion(rom_region)->base(); tmp = auto_alloc_array(machine, UINT8, 0x10000); { int i; long address; memcpy(tmp, rom, 0x10000); for ( i = 0; i < 256; i++ ) { UINT8 data,pattern,newdata,*tab; data = i; tab = (UINT8*)DataDecode; pattern = 0x01; newdata = 0; do { newdata |= data & pattern ? *tab : 0; pattern <<= 1; } while ( *(++tab) ); codec_data[i] = newdata; } for ( address = 0; address < 0x10000; address++) { int newaddress,pattern; UINT16 *tab; tab = (UINT16*)AddressDecode; pattern = 0x0001; newaddress = 0; do { newaddress |= address & pattern ? *tab : 0; pattern <<= 1; } while ( *(++tab) ); rom[newaddress] = codec_data[ tmp[address] ]; } auto_free(machine, tmp); } }
void decrypt_ga2_protrom(running_machine &machine) { int i; UINT8 *rom = machine.region("mcu")->base(); UINT8* temp = auto_alloc_array(machine, UINT8, 0x100000); // make copy of ROM so original can be overwritten memcpy(temp, rom, 0x10000); // unscramble the address lines for(i = 0; i < 0x10000; i++) rom[i] = temp[BITSWAP16(i, 14, 11, 15, 12, 13, 4, 3, 7, 5, 10, 2, 8, 9, 6, 1, 0)]; auto_free(machine, temp); }
PALETTE_INIT_MEMBER(m62_state,battroad) { const UINT8 *color_prom = memregion("proms")->base(); rgb_t *rgb; // m62 palette rgb = compute_res_net_all(machine(), color_prom, &m62_tile_decode_info, &m62_tile_net_info); palette_set_colors(machine(), 0x000, rgb, 0x100); auto_free(machine(), rgb); rgb = compute_res_net_all(machine(), color_prom, &m62_sprite_decode_info, &m62_sprite_net_info); palette_set_colors(machine(), 0x100, rgb, 0x100); auto_free(machine(), rgb); m62_amplify_contrast(machine().palette,0x200); // custom palette for foreground rgb = compute_res_net_all(machine(), color_prom, &battroad_char_decode_info, &battroad_char_net_info); palette_set_colors(machine(), 0x200, rgb, 0x020); auto_free(machine(), rgb); /* we'll need this at run time */ m_sprite_height_prom = color_prom + 0x620; }
static void deco_decrypt(running_machine *machine,const char *rgntag,const UINT8 *xor_table,const UINT16 *address_table,const UINT8 *swap_table,int remap_only) { UINT16 *rom = (UINT16 *)machine->region(rgntag)->base(); int len = machine->region(rgntag)->bytes()/2; UINT16 *buffer = auto_alloc_array(machine, UINT16, len); int i; /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) rom[i] = BIG_ENDIANIZE_INT16(rom[i]); memcpy(buffer,rom,len*2); for (i = 0;i < len;i++) { int addr = (i & ~0x7ff) | address_table[i & 0x7ff]; int pat = swap_table[i & 0x7ff]; if (remap_only) rom[i] = buffer[addr]; else rom[i] = BITSWAP16(buffer[addr] ^ xor_masks[xor_table[addr & 0x7ff]], swap_patterns[pat][0], swap_patterns[pat][1], swap_patterns[pat][2], swap_patterns[pat][3], swap_patterns[pat][4], swap_patterns[pat][5], swap_patterns[pat][6], swap_patterns[pat][7], swap_patterns[pat][8], swap_patterns[pat][9], swap_patterns[pat][10], swap_patterns[pat][11], swap_patterns[pat][12], swap_patterns[pat][13], swap_patterns[pat][14], swap_patterns[pat][15]); } auto_free(machine, buffer); /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) rom[i] = BIG_ENDIANIZE_INT16(rom[i]); }
static DRIVER_INIT(jujub) { /* Program ROMs are bitswapped */ { int i; UINT16 *prgrom = (UINT16*)machine.region("maincpu")->base(); for (i = 0; i < 0x60000/2; i++) { prgrom[i] = BITSWAP16(prgrom[i],15,12,13,14, 11,10, 9, 8, 7, 6, 5, 3, 4, 2, 1, 0); } } /* Decrypt data for z80 program */ { address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x20000); UINT8 *rom = machine.region("audiocpu")->base(); int i; memcpy(decrypt,rom,0x20000); space->set_decrypted_region(0x0000, 0x1fff, decrypt); for (i = 0;i < 0x2000;i++) { UINT8 src = decrypt[i]; rom[i] = src^0x55; } } { UINT8 *ROM = machine.region("oki")->base(); UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } auto_free(machine, buffer); } }
static DRIVER_INIT( thndzone ) { const UINT8 *src = machine.root_device().memregion("gfx1")->base(); UINT8 *dst = machine.root_device().memregion("gfx2")->base(); UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx bank then the colours would be wrong). */ memcpy(tmp + 0x000000, dst + 0x80000, 0x80000); memcpy(dst + 0x090000, tmp + 0x00000, 0x80000); memcpy(dst + 0x080000, src + 0x00000, 0x10000); memcpy(dst + 0x110000, src + 0x10000, 0x10000); auto_free(machine, tmp); }
chd_file *ldplayer_state::get_disc() { // open a path to the ROMs and find the first CHD file file_enumerator path(machine().options().media_path()); // iterate while we get new objects const osd_directory_entry *dir; emu_file *image_file = NULL; chd_file *image_chd = NULL; while ((dir = path.next()) != NULL) { int length = strlen(dir->name); // look for files ending in .chd if (length > 4 && dir->name[length - 4] == '.' && tolower(dir->name[length - 3]) == 'c' && tolower(dir->name[length - 2]) == 'h' && tolower(dir->name[length - 1]) == 'd') { // open the file itself via our search path image_file = auto_alloc(machine(), emu_file(machine().options().media_path(), OPEN_FLAG_READ)); file_error filerr = image_file->open(dir->name); if (filerr == FILERR_NONE) { // try to open the CHD chd_error chderr = chd_open_file(*image_file, CHD_OPEN_READ, NULL, &image_chd); if (chderr == CHDERR_NONE) { set_disk_handle(machine(), "laserdisc", *image_file, *image_chd); m_filename.cpy(dir->name); break; } } // close the file on failure auto_free(machine(), image_file); image_file = NULL; } } // if we failed, pop a message and exit if (image_file == NULL) throw emu_fatalerror("No valid image file found!\n"); return get_disk_handle(machine(), "laserdisc"); }
void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref) { ui_menu_item *pitem; int index; // only allow multiline as the first item if ((flags & MENU_FLAG_MULTILINE) != 0) assert(numitems == 1); // only allow a single multi-line item else if (numitems >= 2) assert((item[0].flags & MENU_FLAG_MULTILINE) == 0); // realloc the item array if necessary if (numitems >= allocitems) { int olditems = allocitems; allocitems += UI_MENU_ALLOC_ITEMS; ui_menu_item *newitems = auto_alloc_array(machine(), ui_menu_item, allocitems); for (int itemnum = 0; itemnum < olditems; itemnum++) newitems[itemnum] = item[itemnum]; auto_free(machine(), item); item = newitems; } index = numitems++; // copy the previous last item to the next one if (index != 0) { index--; item[index + 1] = item[index]; } // allocate a new item and populate it pitem = &item[index]; pitem->text = (text != nullptr) ? pool_strdup(text) : nullptr; pitem->subtext = (subtext != nullptr) ? pool_strdup(subtext) : nullptr; pitem->flags = flags; pitem->ref = ref; // update the selection if we need to if (resetpos == index || (resetref != nullptr && resetref == ref)) selected = index; if (resetpos == numitems - 1) selected = numitems - 1; }
DRIVER_INIT_MEMBER(alg_state,palr3) { UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); UINT8 *original = auto_alloc_array(machine(), UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); for (srcaddr = 0; srcaddr < length; srcaddr++) { UINT32 dstaddr = srcaddr; if (srcaddr & 0x2000) dstaddr ^= 0x1000; rom[dstaddr] = original[srcaddr]; } auto_free(machine(), original); alg_init(); }
static DRIVER_INIT( tokib ) { UINT8 *temp = auto_alloc_array(machine, UINT8, 65536 * 2); int i, offs, len; UINT8 *rom; /* invert the sprite data in the ROMs */ len = machine.region("gfx2")->bytes(); rom = machine.region("gfx2")->base(); for (i = 0; i < len; i++) rom[i] ^= 0xff; /* merge background tile graphics together */ len = machine.region("gfx3")->bytes(); rom = machine.region("gfx3")->base(); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; memcpy (temp, base, 65536 * 2); for (i = 0; i < 16; i++) { memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); } } len = machine.region("gfx4")->bytes(); rom = machine.region("gfx4")->base(); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; memcpy (temp, base, 65536 * 2); for (i = 0; i < 16; i++) { memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); } } auto_free (machine, temp); }
static void sdwx_gfx_decrypt(running_machine &machine) { int i; unsigned rom_size = 0x80000; UINT8 *src = (UINT8 *) (machine.root_device().memregion("gfx1")->base()); UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)]; for (i=0; i<rom_size; i+=0x200) { memcpy(src+i+0x000,result_data+i+0x000,0x80); memcpy(src+i+0x080,result_data+i+0x100,0x80); memcpy(src+i+0x100,result_data+i+0x080,0x80); memcpy(src+i+0x180,result_data+i+0x180,0x80); } auto_free(machine, result_data); }
ROM_END DRIVER_INIT_MEMBER(travrusa_state,motorace) { int A, j; UINT8 *rom = memregion("maincpu")->base(); UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x2000); memcpy(buffer, rom, 0x2000); /* The first CPU ROM has the address and data lines scrambled */ for (A = 0; A < 0x2000; A++) { j = BITSWAP16(A,15,14,13,9,7,5,3,1,12,10,8,6,4,2,0,11); rom[j] = BITSWAP8(buffer[A],2,7,4,1,6,3,0,5); } auto_free(machine(), buffer); }
static int scsidev_dispatch( int operation, void *file, INT64 intparm, void *ptrparm ) { SCSIAllocInstanceParams *params; switch( operation ) { case SCSIOP_EXEC_COMMAND: return scsidev_exec_command( (SCSIInstance *)file, (UINT8 *)ptrparm ); case SCSIOP_READ_DATA: scsidev_read_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); break; case SCSIOP_WRITE_DATA: scsidev_write_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); break; case SCSIOP_SET_PHASE: scsidev_set_phase( (SCSIInstance *)file, intparm ); return 0; case SCSIOP_GET_PHASE: return scsidev_get_phase( (SCSIInstance *)file ); case SCSIOP_SET_COMMAND: scsidev_set_command( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_GET_COMMAND: return scsidev_get_command( (SCSIInstance *)file, (void **)ptrparm ); case SCSIOP_ALLOC_INSTANCE: params = (SCSIAllocInstanceParams *)ptrparm; params->instance = SCSIMalloc( params->machine, (const SCSIClass *)file ); scsidev_alloc_instance( params->instance, params->diskregion ); return 0; case SCSIOP_DELETE_INSTANCE: auto_free( ((SCSIInstance *)file)->machine, file ); return 0; } return 0; }
ROM_END DRIVER_INIT_MEMBER(coinmstr_state,coinmstr) { UINT8 *rom = memregion("user1")->base(); int length = memregion("user1")->bytes(); UINT8 *buf = auto_alloc_array(machine(), UINT8, length); int i; memcpy(buf,rom,length); for(i = 0; i < length; i++) { int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4); rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7); } auto_free(machine(), buf); }
static DRIVER_INIT( thndzone ) { const UINT8 *src = machine.region("gfx1")->base(); UINT8 *dst = machine.region("gfx2")->base(); UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx bank then the colours would be wrong). */ memcpy(tmp + 0x000000, dst + 0x80000, 0x80000); memcpy(dst + 0x090000, tmp + 0x00000, 0x80000); memcpy(dst + 0x080000, src + 0x00000, 0x10000); memcpy(dst + 0x110000, src + 0x10000, 0x10000); auto_free(machine, tmp); /* Save time waiting on vblank bit */ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3f8000, 0x3f8001, FUNC(thndzone_main_skip)); }
ROM_END static DRIVER_INIT( toki ) { UINT8 *ROM = machine.region("oki")->base(); UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } auto_free(machine, buffer); seibu_sound_decrypt(machine,"audiocpu",0x2000); }
static DRIVER_INIT( thndzone ) { const UINT8 *src = memory_region(machine, "gfx1"); UINT8 *dst = memory_region(machine, "gfx2"); UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx bank then the colours would be wrong). */ memcpy(tmp + 0x000000, dst + 0x80000, 0x80000); memcpy(dst + 0x090000, tmp + 0x00000, 0x80000); memcpy(dst + 0x080000, src + 0x00000, 0x10000); memcpy(dst + 0x110000, src + 0x10000, 0x10000); auto_free(machine, tmp); /* Save time waiting on vblank bit */ memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip); }
void video_manager::end_recording() { // close the file if it exists if (m_avifile != NULL) { avi_close(m_avifile); m_avifile = NULL; } // close the file if it exists if (m_mngfile != NULL) { mng_capture_stop(*m_mngfile); auto_free(machine(), m_mngfile); m_mngfile = NULL; } // reset the state m_movie_frame = 0; }
ROM_END #define ROL(x,n) (BITSWAP8((x),(7+8-n)&7,(6+8-n)&7,(5+8-n)&7,(4+8-n)&7,(3+8-n)&7,(2+8-n)&7,(1+8-n)&7,(0+8-n)&7)) #define WRITEDEST( n ) \ dest[idx]=n; \ dest[idx+0x10000]=(n)^0xff; \ idx++; DRIVER_INIT_MEMBER(tcl_state,tcl) { /* only the first part is decrypted (and verified)*/ address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *dest = machine().root_device().memregion("maincpu")->base(); int len = machine().root_device().memregion("maincpu")->bytes(); UINT8 *src = auto_alloc_array(machine(), UINT8, len); int i,idx=0; memcpy(src, dest, len); for(i=0;i<64*1024;i+=4) { if(i&0x8000) { WRITEDEST(ROL(src[idx]^0x44,4)); // abcdefgh -> aFghaBcd WRITEDEST(ROL(src[idx]^0x44,7)); // abcdefgh -> haBcdeFg WRITEDEST(ROL(src[idx]^0x44,2)); // abcdefgh -> cdeFghaB WRITEDEST((src[idx]^0x44)^0xf0); // abcdefgh -> AbCEeFgh } else { WRITEDEST(ROL(src[idx]^0x11,4)); // abcdefgh -> efgHabcD WRITEDEST(ROL(src[idx]^0x11,7)); // abcdefgh -> HabcDefg WRITEDEST(ROL(src[idx]^0x11,2)); // abcdefgh -> cDefgHab WRITEDEST((src[idx]^0x11)^0xf0); // abcdefgh -> ABCdefgH } } auto_free(machine(), src); space.set_decrypted_region(0x0000, 0x7fff, dest+0x10000); }
chd_file *ldplayer_state::get_disc() { // open a path to the ROMs and find the first CHD file file_enumerator path(machine().options().media_path()); // iterate while we get new objects const osd_directory_entry *dir; while ((dir = path.next()) != NULL) { int length = strlen(dir->name); // look for files ending in .chd if (length > 4 && dir->name[length - 4] == '.' && tolower(dir->name[length - 3]) == 'c' && tolower(dir->name[length - 2]) == 'h' && tolower(dir->name[length - 1]) == 'd') { // open the file itself via our search path emu_file image_file(machine().options().media_path(), OPEN_FLAG_READ); file_error filerr = image_file.open(dir->name); if (filerr == FILERR_NONE) { astring fullpath(image_file->fullpath(); image_file.close(); // try to open the CHD if (set_disk_handle(machine(), "laserdisc", fullpath) == CHDERR_NONE) { m_filename.cpy(dir->name); break; } } // close the file on failure auto_free(machine(), image_file); image_file = NULL; }