mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
windebug: images: added Create option.
This commit is contained in:
parent
347a33c6a0
commit
1a1a22d6ca
@ -180,8 +180,8 @@ void consolewin_info::update_menu()
|
||||
|
||||
AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_OPEN, TEXT("Mount..."));
|
||||
|
||||
//if (img.is_creatable())
|
||||
//AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_CREATE, TEXT("Create..."));
|
||||
if (img.is_creatable())
|
||||
AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_CREATE, TEXT("Create..."));
|
||||
AppendMenu(devicesubmenu, flags_for_exists, new_item + DEVOPTION_CLOSE, TEXT("Unmount"));
|
||||
|
||||
if (img.device().type() == CASSETTE)
|
||||
@ -262,8 +262,49 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//case DEVOPTION_CREATE:
|
||||
//return true;
|
||||
case DEVOPTION_CREATE:
|
||||
{
|
||||
std::string filter;
|
||||
build_generic_filter(img, true, filter);
|
||||
LPTSTR t_filter = tstring_from_utf8(filter.c_str());
|
||||
if (t_filter)
|
||||
{
|
||||
// convert a pipe-char delimited string into a NUL delimited string
|
||||
for (int i = 0; t_filter[i] != '\0'; i++)
|
||||
{
|
||||
if (t_filter[i] == '|')
|
||||
t_filter[i] = '\0';
|
||||
}
|
||||
|
||||
TCHAR selectedFilename[MAX_PATH];
|
||||
selectedFilename[0] = '\0';
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = nullptr;
|
||||
ofn.lpstrFile = selectedFilename;
|
||||
ofn.lpstrFile[0] = '\0';
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrFilter = t_filter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFileTitle = nullptr;
|
||||
ofn.nMaxFileTitle = 0;
|
||||
ofn.lpstrInitialDir = nullptr;
|
||||
ofn.Flags = OFN_PATHMUSTEXIST;
|
||||
|
||||
if (GetSaveFileName(&ofn))
|
||||
{
|
||||
char *utf8_buf = utf8_from_tstring(selectedFilename);
|
||||
if (utf8_buf != nullptr)
|
||||
{
|
||||
img->create(utf8_buf, img->device_get_indexed_creatable_format(0), nullptr);
|
||||
osd_free(utf8_buf);
|
||||
}
|
||||
}
|
||||
osd_free(t_filter);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case DEVOPTION_CLOSE:
|
||||
img->unload();
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user