Fixed #348 (>800KiB HDD images not mountable)

This commit is contained in:
tomcw 2016-09-19 22:14:57 +01:00
parent 9e18b95326
commit 0a7a0e9e5c
5 changed files with 10 additions and 7 deletions

View File

@ -1196,7 +1196,6 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
// ENTER THE MAIN MESSAGE LOOP
LogFileOutput("Main: EnterMessageLoop()\n");
LogFileTimeUntilFirstKeyReadReset();
EnterMessageLoop();
LogFileOutput("Main: LeaveMessageLoop()\n");

View File

@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static CDiskImageHelper sg_DiskImageHelper;
static CHardDiskImageHelper sg_HardDiskImageHelper;
//===========================================================================
@ -43,7 +44,8 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
bool* pWriteProtected,
const bool bCreateIfNecessary,
std::string& strFilenameInZip,
const bool bExpectFloppy /*=true*/)
const bool bExpectFloppy /*=true*/,
const bool bIsHarddisk /*=false*/)
{
if (! (pszImageFilename && hDiskImage && pWriteProtected && sg_DiskImageHelper.GetWorkBuffer()))
return eIMAGE_ERROR_BAD_POINTER;
@ -57,7 +59,8 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
ImageInfo* pImageInfo = (ImageInfo*) *hDiskImage;
pImageInfo->bWriteProtected = *pWriteProtected;
ImageError_e Err = sg_DiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip);
ImageError_e Err = (!bIsHarddisk) ? sg_DiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip)
: sg_HardDiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip);
if (Err != eIMAGE_ERROR_NONE)
{

View File

@ -62,7 +62,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const int MAX_DISK_FULL_NAME = 127;
ImageError_e ImageOpen(LPCTSTR pszImageFilename, HIMAGE* hDiskImage, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
ImageError_e ImageOpen(LPCTSTR pszImageFilename, HIMAGE* hDiskImage, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true, const bool bIsHarddisk=false);
void ImageClose(const HIMAGE hDiskImage, const bool bOpenError=false);
BOOL ImageBoot(const HIMAGE hDiskImage);
void ImageDestroy(void);

View File

@ -1831,6 +1831,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
if (g_nAppMode == MODE_LOGO)
{
DiskBoot();
LogFileTimeUntilFirstKeyReadReset();
g_nAppMode = MODE_RUNNING;
}
else if (g_nAppMode == MODE_RUNNING)

View File

@ -148,8 +148,6 @@ static HDD g_HardDisk[NUM_HARDDISKS] = {0};
static bool g_bSaveDiskImage = true; // Save the DiskImage name to Registry
static UINT g_uSlot = 7;
static CHardDiskImageHelper sg_HardDiskImageHelper;
//===========================================================================
static void HD_SaveLastDiskImage(const int iDrive);
@ -359,12 +357,14 @@ static BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename)
const bool bCreateIfNecessary = false; // NB. Don't allow creation of HDV files
const bool bExpectFloppy = false;
const bool bIsHarddisk = true;
ImageError_e Error = ImageOpen(pszImageFilename,
&g_HardDisk[iDrive].imagehandle,
&g_HardDisk[iDrive].bWriteProtected,
bCreateIfNecessary,
g_HardDisk[iDrive].strFilenameInZip, // TODO: Use this
bExpectFloppy);
bExpectFloppy,
bIsHarddisk);
g_HardDisk[iDrive].hd_imageloaded = (Error == eIMAGE_ERROR_NONE);