mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Generate layouts for dual-screen machines rather than loading
dualhsxs.lay - this ensures aspect ratio is correct for non-4:3 screens. (nw) Also restore internal layouts for multi-screen Game & Watch systems.
This commit is contained in:
parent
4de961c8b1
commit
96c1be1325
@ -1728,15 +1728,6 @@ void render_target::load_additional_layout_files(const char *basename, bool have
|
||||
screen_device_iterator iter(m_manager.machine().root_device());
|
||||
std::vector<screen_info> const screens(std::begin(iter), std::end(iter));
|
||||
|
||||
if (!have_default && !have_artwork)
|
||||
{
|
||||
if (screens.size() == 2U)
|
||||
{
|
||||
load_layout_file(nullptr, layout_dualhsxs);
|
||||
if (m_filelist.empty())
|
||||
throw emu_fatalerror("Couldn't parse default layout??");
|
||||
}
|
||||
}
|
||||
|
||||
if (screens.empty()) // ensure the fallback view for systems with no screens is loaded if necessary
|
||||
{
|
||||
@ -1945,6 +1936,47 @@ void render_target::load_additional_layout_files(const char *basename, bool have
|
||||
generate_view("Top-to-Bottom", 1U, false, [] (unsigned x, unsigned y) { return y; });
|
||||
generate_view("Top-to-Bottom (Gapless)", 1U, true, [] (unsigned x, unsigned y) { return y; });
|
||||
|
||||
// generate fake cocktail view for systems with two screens
|
||||
if (screens.size() == 2U)
|
||||
{
|
||||
float const height0(float(screens[0].physical_y()) / screens[0].physical_x());
|
||||
float const height1(float(screens[1].physical_y()) / screens[1].physical_x());
|
||||
float const minor((std::max)((std::min)(height0, 1.0F), (std::min)(height1, 1.0F)));
|
||||
|
||||
util::xml::data_node *const viewnode(layoutnode->add_child("view", nullptr));
|
||||
if (!viewnode)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
viewnode->set_attribute("name", "Cocktail");
|
||||
|
||||
util::xml::data_node *const mirrornode(viewnode->add_child("screen", nullptr));
|
||||
if (!mirrornode)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
mirrornode->set_attribute_int("index", 1);
|
||||
util::xml::data_node *const mirrorbounds(mirrornode->add_child("bounds", nullptr));
|
||||
if (!mirrorbounds)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
mirrorbounds->set_attribute_int("x", 0);
|
||||
mirrorbounds->set_attribute_float("y", (-0.01 * minor) - height1);
|
||||
mirrorbounds->set_attribute_int("width", 1);
|
||||
mirrorbounds->set_attribute_float("height", height1);
|
||||
util::xml::data_node *const flipper(mirrornode->add_child("orientation", nullptr));
|
||||
if (!flipper)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
flipper->set_attribute_int("rotate", 180);
|
||||
|
||||
util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr));
|
||||
if (!screennode)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
screennode->set_attribute_int("index", 0);
|
||||
util::xml::data_node *const screenbounds(screennode->add_child("bounds", nullptr));
|
||||
if (!screenbounds)
|
||||
throw emu_fatalerror("Couldn't create XML node??");
|
||||
screenbounds->set_attribute_int("x", 0);
|
||||
screenbounds->set_attribute_int("y", 0);
|
||||
screenbounds->set_attribute_int("width", 1);
|
||||
screenbounds->set_attribute_float("height", height0);
|
||||
}
|
||||
|
||||
// generate tiled views
|
||||
for (unsigned mindim = 2; ((screens.size() + mindim - 1) / mindim) >= mindim; ++mindim)
|
||||
{
|
||||
|
@ -1205,6 +1205,7 @@ MACHINE_CONFIG_START(gnw_mickdon_state::gnw_mickdon)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 1920/2-1, 0, 1236/2-1)
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1))
|
||||
config.set_default_layout(layout_gnw_dualv);
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
@ -1288,6 +1289,7 @@ MACHINE_CONFIG_START(gnw_dkong2_state::gnw_dkong2)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 1920/2-1, 0, 1237/2-1)
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1))
|
||||
config.set_default_layout(layout_gnw_dualv);
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
@ -1373,6 +1375,7 @@ MACHINE_CONFIG_START(gnw_mario_state::gnw_mario)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 2261/2-1, 0, 1440/2-1)
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1))
|
||||
config.set_default_layout(layout_gnw_dualh);
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
Loading…
Reference in New Issue
Block a user