From 96c1be1325662de3d3f7e387799dc8ca779a0c70 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 18 Sep 2018 23:36:00 +1000 Subject: [PATCH] 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. --- src/emu/render.cpp | 50 ++++++++++++++++++++++++++++------- src/mame/drivers/hh_sm510.cpp | 3 +++ 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/emu/render.cpp b/src/emu/render.cpp index e3071d5f9f4..d6828cce124 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -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 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) { diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp index b224001112a..f103d4edde6 100644 --- a/src/mame/drivers/hh_sm510.cpp +++ b/src/mame/drivers/hh_sm510.cpp @@ -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();