MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / UserSelectNewDiskImageOnly

Method UserSelectNewDiskImageOnly

source/Harddisk.cpp:485–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483//-----------------------------------------------------------------------------
484
485bool HarddiskInterfaceCard::UserSelectNewDiskImageOnly(const int drive, LPCSTR pszFilename, std::string& openFilename, DWORD flags)
486{
487 char directory[MAX_PATH];
488 char filename[MAX_PATH];
489
490 StringCbCopy(filename, MAX_PATH, pszFilename);
491
492 RegLoadString(REG_PREFS, REGVALUE_PREF_HDV_START_DIR, 1, directory, MAX_PATH, "");
493 std::string title = StrFormat("Select HDV Image For HDD %d", drive + 1);
494
495 OPENFILENAME ofn;
496 memset(&ofn, 0, sizeof(OPENFILENAME));
497 ofn.lStructSize = sizeof(OPENFILENAME);
498 ofn.hwndOwner = GetFrame().g_hFrameWindow;
499 ofn.hInstance = GetFrame().g_hInstance;
500 ofn.lpstrFilter = "Hard Disk Images (*.hdv,*.po,*.2mg,*.2img,*.gz,*.zip)\0*.hdv;*.po;*.2mg;*.2img;*.gz;*.zip\0"
501 "All Files\0*.*\0";
502 ofn.lpstrFile = filename;
503 ofn.nMaxFile = MAX_PATH;
504 ofn.lpstrInitialDir = directory;
505 ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; // Don't allow creation & hide the read-only checkbox
506 ofn.lpstrTitle = title.c_str();
507
508 bool bRes = false;
509
510 if (!GetOpenFileName(&ofn))
511 return false;
512
513 flags = ofn.Flags;
514 openFilename = filename;
515 if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension])
516 openFilename += ".hdv";
517
518 return true;
519}
520
521bool HarddiskInterfaceCard::SelectImage(const int drive, LPCSTR pszFilename)
522{

Callers

nothing calls this directly

Calls 2

RegLoadStringFunction · 0.85
StrFormatFunction · 0.85

Tested by

no test coverage detected