Merge from Tom:

. Don't create HDV file (when it doesn't exist).
. Bug fix when iterating through image types.
This commit is contained in:
tomch 2010-01-05 22:25:33 +00:00
parent 744a9cd840
commit 9bbf3392cf
2 changed files with 7 additions and 9 deletions

View File

@ -788,9 +788,6 @@ public:
return WriteBlock(pImageInfo, nBlock, pBlockBuffer);
}
virtual bool AllowCreate(void) { return true; }
virtual UINT GetImageSizeForCreate(void) { return 0; } // Start with a zero size buffer
virtual eImageType GetType(void) { return eImageHDV; }
virtual char* GetCreateExtensions(void) { return ".hdv"; }
virtual char* GetRejectExtensions(void) { return ".do;.iie;.prg"; }
@ -1503,7 +1500,7 @@ CImageBase* CDiskImageHelper::Detect(LPBYTE pImage, DWORD dwSize, const TCHAR* p
CImageBase* CDiskImageHelper::GetImageForCreation(const TCHAR* pszExt, DWORD* pCreateImageSize)
{
// WE CREATE ONLY DOS ORDER (DO) OR 6656-NIBBLE (NIB) FORMAT FILES
for (UINT uLoop = 0; uLoop <= GetNumImages(); uLoop++)
for (UINT uLoop = 0; uLoop < GetNumImages(); uLoop++)
{
if (!GetImage(uLoop)->AllowCreate())
continue;
@ -1579,8 +1576,10 @@ CImageBase* CHardDiskImageHelper::Detect(LPBYTE pImage, DWORD dwSize, const TCHA
CImageBase* CHardDiskImageHelper::GetImageForCreation(const TCHAR* pszExt, DWORD* pCreateImageSize)
{
// Only HDV file supported
for (UINT uLoop = 0; uLoop <= GetNumImages(); uLoop++)
// NB. Not supported for HardDisks
// - Would need to create a default 16-block file like CiderPress
for (UINT uLoop = 0; uLoop < GetNumImages(); uLoop++)
{
if (!GetImage(uLoop)->AllowCreate())
continue;

View File

@ -223,7 +223,7 @@ static void NotifyInvalidImage(TCHAR* pszImageFilename)
static BOOL HD_Load_Image(const int iDrive, LPCSTR pszImageFilename)
{
const bool bCreateIfNecessary = false; // NB. File Select dialog uses OFN_CREATEPROMPT
const bool bCreateIfNecessary = false; // NB. Don't allow creation of HDV files
string strFilenameInZip; // TODO: Use this
ImageError_e Error = ImageOpen(pszImageFilename, iDrive, bCreateIfNecessary, strFilenameInZip);
@ -370,9 +370,8 @@ void HD_Select(const int iDrive)
ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = directory;
ofn.Flags = OFN_CREATEPROMPT;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; // Don't allow creation & hide the read-only checkbox
ofn.lpstrTitle = title;
ofn.lpTemplateName = TEXT("INSERT_DIALOG");
if (GetOpenFileName(&ofn))
{