本文整理汇总了C++中running_machine::root_device方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::root_device方法的具体用法?C++ running_machine::root_device怎么用?C++ running_machine::root_device使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::root_device方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nvram_save
void nvram_save(running_machine &machine)
{
if (machine.config().m_nvram_handler != NULL)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, TRUE);
file.close();
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_save(file);
file.close();
}
}
}
示例2: nvram_load
void nvram_load(running_machine &machine)
{
if (machine.config().m_nvram_handler != NULL)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, FALSE);
file.close();
}
else
{
(*machine.config().m_nvram_handler)(machine, NULL, FALSE);
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_load(file);
file.close();
}
else
nvram->nvram_reset();
}
}
示例3:
ROM_END
/***************************************************************************
Split even/odd bytes from ROMs in 16 bit mode to different memory areas
***************************************************************************/
static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
{
int i;
/* get a pointer to the source data */
UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base();
/* get a pointer to the destination data */
UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base();
/* fill destination areas with the proper data */
for (i = 0; i < length / 2; i++)
{
dst[dest1 + i] = src[start + i * 2 + 0];
dst[dest2 + i] = src[start + i * 2 + 1];
}
}
示例4: decode_bg
static void decode_bg(running_machine &machine, const char * region)
{
tceptor_state *state = machine.driver_data<tceptor_state>();
static const gfx_layout bg_layout =
{
8, 8,
2048,
3,
{ 0x40000+4, 0, 4 },
{ 0, 1, 2, 3, 8, 9, 10, 11 },
{ 0, 16, 32, 48, 64, 80, 96, 112 },
128
};
int gfx_index = state->m_bg;
UINT8 *src = machine.root_device().memregion(region)->base() + 0x8000;
UINT8 *buffer;
int len = 0x8000;
int i;
buffer = auto_alloc_array(machine, UINT8, len);
/* expand rom tc2-19.10d */
for (i = 0; i < len / 2; i++)
{
buffer[i*2+1] = src[i] & 0x0f;
buffer[i*2] = (src[i] & 0xf0) >> 4;
}
memcpy(src, buffer, len);
auto_free(machine, buffer);
/* decode the graphics */
machine.gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, machine.root_device().memregion(region)->base(), 64, 2048);
}
示例5: smpc_mouse
static void smpc_mouse(running_machine &machine, UINT8 pad_num, UINT8 offset, UINT8 id)
{
saturn_state *state = machine.driver_data<saturn_state>();
static const char *const mousenames[2][3] = { { "MOUSEB1", "MOUSEX1", "MOUSEY1" },
{ "MOUSEB2", "MOUSEX2", "MOUSEY2" }};
UINT8 mouse_ctrl;
INT16 mouse_x, mouse_y;
mouse_ctrl = machine.root_device().ioport(mousenames[pad_num][0])->read();
mouse_x = machine.root_device().ioport(mousenames[pad_num][1])->read();
mouse_y = machine.root_device().ioport(mousenames[pad_num][2])->read();
if(mouse_x < 0)
mouse_ctrl |= 0x10;
if(mouse_y < 0)
mouse_ctrl |= 0x20;
if((mouse_x & 0xff00) != 0xff00 && (mouse_x & 0xff00) != 0x0000)
mouse_ctrl |= 0x40;
if((mouse_y & 0xff00) != 0xff00 && (mouse_y & 0xff00) != 0x0000)
mouse_ctrl |= 0x80;
state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
state->m_smpc.OREG[1+pad_num*offset] = id; // 0x23 / 0xe3
state->m_smpc.OREG[2+pad_num*offset] = mouse_ctrl;
state->m_smpc.OREG[3+pad_num*offset] = mouse_x & 0xff;
state->m_smpc.OREG[4+pad_num*offset] = mouse_y & 0xff;
}
示例6: ui_gfx_count_devices
static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
{
// count the palette devices
state.palette.devcount = palette_device_iterator(machine.root_device()).count();
// set the pointer to the first palette
if (state.palette.devcount > 0)
palette_set_device(machine, state);
// count the gfx devices
state.gfxset.devcount = 0;
for (device_gfx_interface &interface : gfx_interface_iterator(machine.root_device()))
{
// count the gfx sets in each device, skipping devices with none
UINT8 count = 0;
while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr)
count++;
// count = index of first nullptr
if (count > 0)
{
state.gfxdev[state.gfxset.devcount].interface = &interface;
state.gfxdev[state.gfxset.devcount].setcount = count;
if (++state.gfxset.devcount == MAX_GFX_DECODERS)
break;
}
}
state.started = true;
}
示例7: arcadia_init
static void arcadia_init(running_machine &machine)
{
arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>();
static const amiga_machine_interface arcadia_intf =
{
ANGUS_CHIP_RAM_MASK,
NULL, NULL, NULL,
NULL,
NULL, arcadia_reset_coins,
NULL,
0
};
UINT16 *biosrom;
/* configure our Amiga setup */
amiga_machine_config(machine, &arcadia_intf);
/* set up memory */
state->membank("bank1")->configure_entry(0, state->m_chip_ram);
state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
/* OnePlay bios is encrypted, TenPlay is not */
biosrom = (UINT16 *)machine.root_device().memregion("user2")->base();
if (biosrom[0] != 0x4afc)
generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7);
}
示例8: common_decrypt
/* This is based on code by Niclas Karlsson Mate, who figured out the
encryption method! The technique is a combination of a XOR table plus
bit-swapping */
static void common_decrypt(running_machine &machine)
{
UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
int i;
for (i = 0; i < 0x20000; i++)
{
static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 };
UINT16 data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x0f];
data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0);
RAM[0xc0000/2 + i] = data;
}
RAM = (UINT16 *)machine.root_device().memregion("sub")->base();
for (i = 0; i < 0x20000; i++)
{
static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 };
UINT16 data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x07];
data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6);
RAM[0xc0000/2 + i] = data;
}
}
示例9: descramble_sound
// ROM_REGION( 0x80, "user1", 0 ) /* eeprom */
// ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) )
ROM_END
/**********************************************************************************/
static void descramble_sound( running_machine &machine, const char *tag )
{
UINT8 *rom = machine.root_device().memregion(tag)->base();
int length = machine.root_device().memregion(tag)->bytes();
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x;
for (x = 0; x < length; x++)
{
UINT32 addr;
addr = BITSWAP24 (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
7, 6, 5, 4,
3, 2, 1 );
buf1[addr] = rom[x];
}
memcpy(rom,buf1,length);
auto_free(machine, buf1);
}
示例10: deco156_decrypt
void deco156_decrypt(running_machine &machine)
{
uint32_t *rom = (uint32_t *)machine.root_device().memregion("maincpu")->base();
int length = machine.root_device().memregion("maincpu")->bytes();
std::vector<uint32_t> buf(length/4);
memcpy(&buf[0], rom, length);
decrypt(&buf[0], rom, length);
}
示例11: deco156_decrypt
void deco156_decrypt(running_machine &machine)
{
UINT32 *rom = (UINT32 *)machine.root_device().memregion("maincpu")->base();
int length = machine.root_device().memregion("maincpu")->bytes();
UINT32 *buf = auto_alloc_array(machine, UINT32, length/4);
memcpy(buf, rom, length);
decrypt(buf, rom, length);
auto_free(machine, buf);
}
示例12: get_crosshair_xy
INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *y)
{
static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
const rectangle &visarea = machine.primary_screen->visible_area();
int width = visarea.width();
int height = visarea.height();
*x = ((machine.root_device().ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255;
*y = ((machine.root_device().ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255;
}
示例13: set_videorom_bank
static void set_videorom_bank(running_machine& machine, int start, int count, int bank, int bank_size_in_kb)
{
int i;
int offset = bank * (bank_size_in_kb * 0x400);
/* bank_size_in_kb is used to determine how large the "bank" parameter is */
/* count determines the size of the area mapped in KB */
for (i = 0; i < count; i++, offset += 0x400)
{
machine.root_device().membank(banknames[i + start])->set_base(machine.root_device().memregion("gfx1")->base() + offset);
}
}
示例14:
UINT16 pb1000_state::read_touchscreen(running_machine &machine, UINT8 line)
{
UINT8 x = machine.root_device().ioport("POSX")->read()/0x40;
UINT8 y = machine.root_device().ioport("POSY")->read()/0x40;
if (machine.root_device().ioport("TOUCH")->read())
{
if (x == line-7)
return (0x1000<<y);
}
return 0x0000;
}
示例15:
static UINT16 amiga_read_joy1dat(running_machine &machine)
{
if ( machine.root_device().ioport("input")->read() & 0x10 ) {
/* Joystick */
return machine.root_device().ioport("JOY1DAT")->read_safe(0xffff);
} else {
/* Mouse */
int input;
input = ( machine.root_device().ioport("P1MOUSEX")->read() & 0xff );
input |= ( machine.root_device().ioport("P1MOUSEY")->read() & 0xff ) << 8;
return input;
}
}