Пример #1
0
// imagefilename is qualified with path
BOOL HD_InsertDisk(int nDrive, LPCTSTR imagefilename)
{
  if (*imagefilename == 0x00)
    return false;

  if (g_HardDrive[nDrive].hd_imageloaded)
    HD_CleanupDrive(nDrive);

  BOOL result = HD_Load_Image(nDrive, imagefilename);

  if (result)
    GetImageTitle(imagefilename, &g_HardDrive[nDrive]);
  else NotifyInvalidImage((char*)imagefilename);	// could not load hd image

  return result;
}
Пример #2
0
void HD_Select(int nDrive)
{
	TCHAR directory[MAX_PATH] = TEXT("");
	TCHAR filename[MAX_PATH]  = TEXT("");
	TCHAR title[40];

	RegLoadString(TEXT("Preferences"),TEXT("HDV Starting Directory"),1,directory,MAX_PATH);
	_tcscpy(title,TEXT("Select HDV Image For HDD "));
	_tcscat(title,nDrive ? TEXT("2") : TEXT("1"));
	
	OPENFILENAME ofn;
	ZeroMemory(&ofn,sizeof(OPENFILENAME));
	ofn.lStructSize     = sizeof(OPENFILENAME);
	ofn.hwndOwner       = g_hFrameWindow;
	ofn.hInstance       = g_hInstance;
	ofn.lpstrFilter     = TEXT("Hard Disk Images (*.hdv,*.po)\0*.hdv;*.po\0")
						  TEXT("All Files\0*.*\0");
	ofn.lpstrFile       = filename;
	ofn.nMaxFile        = MAX_PATH;
	ofn.lpstrInitialDir = directory;
	ofn.Flags           = OFN_CREATEPROMPT | OFN_HIDEREADONLY;
	ofn.lpstrTitle      = title;
	ofn.lpTemplateName  = TEXT("INSERT_DIALOG");
	
	if (GetOpenFileName(&ofn))
	{
		if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension])
			_tcscat(filename,TEXT(".hdv"));
		
		if (HD_InsertDisk(nDrive, filename))
		{
			filename[ofn.nFileOffset] = 0;
			if (_tcsicmp(directory,filename))
				RegSaveString(TEXT("Preferences"),TEXT("HDV Starting Directory"),1,filename);
		}
		else
		{
			NotifyInvalidImage(filename);
		}
	}
}
Пример #3
0
void HD_Select(const int iDrive)
{
	TCHAR directory[MAX_PATH] = TEXT("");
	TCHAR filename[MAX_PATH]  = TEXT("");
	TCHAR title[40];

	RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, directory, MAX_PATH);
	_tcscpy(title, TEXT("Select HDV Image For HDD "));
	_tcscat(title, iDrive ? TEXT("2") : TEXT("1"));

	OPENFILENAME ofn;
	ZeroMemory(&ofn,sizeof(OPENFILENAME));
	ofn.lStructSize     = sizeof(OPENFILENAME);
	ofn.hwndOwner       = g_hFrameWindow;
	ofn.hInstance       = g_hInstance;
	ofn.lpstrFilter     = TEXT("Hard Disk Images (*.hdv,*.po,*.2mg,*.2img,*.gz,*.zip)\0*.hdv;*.po;*.2mg;*.2img;*.gz;*.zip\0")
						  TEXT("All Files\0*.*\0");
	ofn.lpstrFile       = filename;
	ofn.nMaxFile        = MAX_PATH;
	ofn.lpstrInitialDir = directory;
	ofn.Flags           = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;	// Don't allow creation & hide the read-only checkbox
	ofn.lpstrTitle      = title;

	if (GetOpenFileName(&ofn))
	{
		if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension])
			_tcscat(filename,TEXT(".hdv"));
		
		if (HD_InsertDisk(iDrive, filename))
		{
			filename[ofn.nFileOffset] = 0;
			if (_tcsicmp(directory, filename))
				RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, filename);
		}
		else
		{
			NotifyInvalidImage(filename);
		}
	}
}