summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/filecreate.cpp
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-03-04 10:49:33 +0100
committer Olivier Galibert <galibert@pobox.com>2021-03-05 10:17:20 +0100
commit92326e47afea2dd65ec6b5ec842454fc74f046cc (patch)
tree515de40cefa3c48bf30869f9031fbf78e4ba45d4 /src/frontend/mame/ui/filecreate.cpp
parentf7011c21e11e988ec26d095f48b9070760c72bc3 (diff)
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)
Diffstat (limited to 'src/frontend/mame/ui/filecreate.cpp')
-rw-r--r--src/frontend/mame/ui/filecreate.cpp55
1 files changed, 55 insertions, 0 deletions
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<floppy_image_device::fs_info> &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