From 92326e47afea2dd65ec6b5ec842454fc74f046cc Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Thu, 4 Mar 2021 10:49:33 +0100 Subject: floppy: Beginning of the support for preformatted floppy images. What's missing: - parameters (like the disk name when it exists) - possibly a cleanup of ram_open and friends (but not sure of the appropriate direction in which to go) --- src/frontend/mame/ui/filecreate.cpp | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'src/frontend/mame/ui/filecreate.cpp') diff --git a/src/frontend/mame/ui/filecreate.cpp b/src/frontend/mame/ui/filecreate.cpp index 181c4a985ab..25a1eb55c08 100644 --- a/src/frontend/mame/ui/filecreate.cpp +++ b/src/frontend/mame/ui/filecreate.cpp @@ -291,4 +291,59 @@ void menu_select_format::handle() } +/*************************************************************************** +SELECT FORMAT MENU +***************************************************************************/ + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +menu_select_floppy_init::menu_select_floppy_init(mame_ui_manager &mui, render_container &container, const std::vector &fs, int *result) + : menu(mui, container), + m_fs(fs), + m_result(result) + +{ +} + + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +menu_select_floppy_init::~menu_select_floppy_init() +{ +} + + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void menu_select_floppy_init::populate(float &customtop, float &custombottom) +{ + item_append(_("Select initial contents"), FLAG_DISABLE, nullptr); + int id = 0; + for (const auto &fmt : m_fs) + item_append(fmt.m_description, fmt.m_name, 0, (void *)(uintptr_t)(id++)); +} + + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void menu_select_floppy_init::handle() +{ + // process the menu + const event *event = process(0); + if (event != nullptr && event->iptkey == IPT_UI_SELECT) + { + *m_result = int(uintptr_t(event->itemref)); + stack_pop(); + } +} + + } // namespace ui -- cgit v1.2.3-70-g09d2