src/emu/render.c
| r12135 | r12136 | |
| 1626 | 1626 | |
| 1627 | 1627 | void render_target::load_layout_files(const char *layoutfile, bool singlefile) |
| 1628 | 1628 | { |
| 1629 | bool have_default = false; |
| 1629 | 1630 | // if there's an explicit file, load that first |
| 1630 | 1631 | const char *basename = m_manager.machine().basename(); |
| 1631 | 1632 | if (layoutfile != NULL) |
| 1632 | | load_layout_file(basename, layoutfile); |
| 1633 | have_default |= load_layout_file(basename, layoutfile); |
| 1633 | 1634 | |
| 1634 | 1635 | // if we're only loading this file, we know our final result |
| 1635 | 1636 | if (singlefile) |
| r12135 | r12136 | |
| 1638 | 1639 | // try to load a file based on the driver name |
| 1639 | 1640 | const game_driver &system = m_manager.machine().system(); |
| 1640 | 1641 | if (!load_layout_file(basename, system.name)) |
| 1641 | | load_layout_file(basename, "default"); |
| 1642 | have_default |= load_layout_file(basename, "default"); |
| 1643 | else |
| 1644 | have_default |= true; |
| 1642 | 1645 | |
| 1643 | 1646 | // if a default view has been specified, use that as a fallback |
| 1644 | 1647 | if (system.default_layout != NULL) |
| 1645 | | load_layout_file(NULL, system.default_layout); |
| 1648 | have_default |= load_layout_file(NULL, system.default_layout); |
| 1646 | 1649 | if (m_manager.machine().config().m_default_layout != NULL) |
| 1647 | | load_layout_file(NULL, m_manager.machine().config().m_default_layout); |
| 1650 | have_default |= load_layout_file(NULL, m_manager.machine().config().m_default_layout); |
| 1648 | 1651 | |
| 1649 | 1652 | // try to load another file based on the parent driver name |
| 1650 | 1653 | int cloneof = driver_list::clone(system); |
| 1651 | | if (cloneof != -1) |
| 1654 | if (cloneof != -1) { |
| 1652 | 1655 | if (!load_layout_file(driver_list::driver(cloneof).name, driver_list::driver(cloneof).name)) |
| 1653 | | load_layout_file(driver_list::driver(cloneof).name, "default"); |
| 1654 | | |
| 1656 | have_default |= load_layout_file(driver_list::driver(cloneof).name, "default"); |
| 1657 | else |
| 1658 | have_default |= true; |
| 1659 | } |
| 1655 | 1660 | int screens = m_manager.machine().devicelist().count(SCREEN); |
| 1656 | 1661 | // now do the built-in layouts for single-screen games |
| 1657 | 1662 | if (screens == 1) |
| r12135 | r12136 | |
| 1662 | 1667 | load_layout_file(NULL, layout_horizont); |
| 1663 | 1668 | assert_always(m_filelist.count() > 0, "Couldn't parse default layout??"); |
| 1664 | 1669 | } |
| 1665 | | if (system.default_layout== NULL && m_manager.machine().config().m_default_layout==NULL) |
| 1670 | if (!have_default) |
| 1666 | 1671 | { |
| 1667 | 1672 | if (screens == 2) |
| 1668 | 1673 | { |