diff options
author | 2018-10-19 00:35:32 +0200 | |
---|---|---|
committer | 2018-10-19 00:35:32 +0200 | |
commit | efe1757a858f03fff73e110626e85af8d2ed7d03 (patch) | |
tree | 5433f1344a7120f3d90f9480e79c65ca850b7564 /src/emu/render.cpp | |
parent | cdb4ae2fab56a624bf8e2ea59f19a57f11ff1109 (diff) | |
parent | f1b3e649fb0a50a6a01da667278b8a62fef99d92 (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src/emu/render.cpp')
-rw-r--r-- | src/emu/render.cpp | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp index e3071d5f9f4..ab26abaf154 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<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_dim((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_dim) - 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) { |