2006-02-25 20:50:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
2010-12-18 20:58:29 +00:00
|
|
|
/*
|
|
|
|
AppleWin : An Apple //e emulator for Windows
|
|
|
|
|
|
|
|
Copyright (C) 1994-1996, Michael O'Brien
|
|
|
|
Copyright (C) 1999-2001, Oliver Schmidt
|
|
|
|
Copyright (C) 2002-2005, Tom Charlesworth
|
|
|
|
Copyright (C) 2006-2010, Tom Charlesworth, Michael Pohoreski
|
|
|
|
|
|
|
|
AppleWin is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
AppleWin is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with AppleWin; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
#include "DiskImage.h"
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2010-12-18 20:58:29 +00:00
|
|
|
// Floppy Disk Drives
|
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
enum Drive_e
|
|
|
|
{
|
|
|
|
DRIVE_1 = 0,
|
|
|
|
DRIVE_2,
|
|
|
|
NUM_DRIVES
|
|
|
|
};
|
|
|
|
|
|
|
|
const bool IMAGE_USE_FILES_WRITE_PROTECT_STATUS = false;
|
|
|
|
const bool IMAGE_FORCE_WRITE_PROTECTED = true;
|
|
|
|
const bool IMAGE_DONT_CREATE = false;
|
|
|
|
const bool IMAGE_CREATE = true;
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2015-02-13 22:40:53 +00:00
|
|
|
const char* DiskGetDiskPathFilename(const int iDrive);
|
2009-02-24 22:13:46 +00:00
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
void DiskInitialize(void); // DiskIIManagerStartup()
|
|
|
|
void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
|
2006-02-26 02:02:57 +00:00
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
void DiskBoot(void);
|
|
|
|
void DiskEject(const int iDrive);
|
2017-10-20 05:49:10 +00:00
|
|
|
void DiskFlushCurrentTrack(const int iDrive);
|
2006-02-28 18:37:47 +00:00
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
LPCTSTR DiskGetFullName(const int iDrive);
|
|
|
|
LPCTSTR DiskGetFullDiskFilename(const int iDrive);
|
|
|
|
LPCTSTR DiskGetBaseName(const int iDrive);
|
2006-02-28 18:37:47 +00:00
|
|
|
|
2018-02-25 13:38:04 +00:00
|
|
|
void DiskGetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
|
2006-02-28 18:37:47 +00:00
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
|
2018-02-27 21:07:16 +00:00
|
|
|
bool Disk_IsConditionForFullSpeed(void);
|
2010-01-03 18:43:08 +00:00
|
|
|
BOOL DiskIsSpinning(void);
|
|
|
|
void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error);
|
2017-08-11 20:45:07 +00:00
|
|
|
void DiskReset(const bool bIsPowerCycle=false);
|
2010-01-03 18:43:08 +00:00
|
|
|
bool DiskGetProtect(const int iDrive);
|
|
|
|
void DiskSetProtect(const int iDrive, const bool bWriteProtect);
|
2013-11-02 21:24:45 +00:00
|
|
|
int DiskGetCurrentDrive();
|
|
|
|
int DiskGetCurrentTrack();
|
2014-07-22 01:21:31 +00:00
|
|
|
int DiskGetTrack( int drive );
|
2013-11-02 21:24:45 +00:00
|
|
|
int DiskGetCurrentPhase();
|
|
|
|
int DiskGetCurrentOffset();
|
2018-02-24 15:12:40 +00:00
|
|
|
const char* DiskGetCurrentState();
|
2017-06-03 17:12:40 +00:00
|
|
|
bool DiskSelect(const int iDrive);
|
2018-01-14 18:01:22 +00:00
|
|
|
void DiskUpdateDriveState(DWORD);
|
2010-01-03 18:43:08 +00:00
|
|
|
bool DiskDriveSwap(void);
|
2007-05-28 11:16:42 +00:00
|
|
|
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
|
2015-02-13 22:40:53 +00:00
|
|
|
|
2015-12-05 16:50:27 +00:00
|
|
|
std::string DiskGetSnapshotCardName(void);
|
|
|
|
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
|
|
|
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
2008-08-31 04:31:35 +00:00
|
|
|
|
2010-01-03 18:43:08 +00:00
|
|
|
void Disk_LoadLastDiskImage(const int iDrive);
|
|
|
|
void Disk_SaveLastDiskImage(const int iDrive);
|
|
|
|
|
|
|
|
bool Disk_ImageIsWriteProtected(const int iDrive);
|
|
|
|
bool Disk_IsDriveEmpty(const int iDrive);
|
2018-01-14 18:01:22 +00:00
|
|
|
|
2018-02-25 15:09:25 +00:00
|
|
|
bool Disk_GetEnhanceDisk(void);
|
|
|
|
void Disk_SetEnhanceDisk(bool bEnhanceDisk);
|
|
|
|
|
2018-01-14 18:01:22 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
// For sharing with class FormatTrack
|
|
|
|
struct Disk_t
|
|
|
|
{
|
2018-02-25 13:38:04 +00:00
|
|
|
TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension)
|
|
|
|
TCHAR fullname [ MAX_DISK_FULL_NAME + 1 ]; // <FILENAME.EXT> or <FILENAME.zip> : This is persisted to the snapshot file
|
2018-01-14 18:01:22 +00:00
|
|
|
std::string strFilenameInZip; // "" or <FILENAME.EXT>
|
|
|
|
ImageInfo* imagehandle; // Init'd by DiskInsert() -> ImageOpen()
|
2018-02-25 13:38:04 +00:00
|
|
|
bool bWriteProtected;
|
2018-01-14 18:01:22 +00:00
|
|
|
//
|
2018-02-25 13:38:04 +00:00
|
|
|
int byte;
|
|
|
|
int nibbles; // Init'd by ReadTrack() -> ImageReadTrack()
|
|
|
|
LPBYTE trackimage;
|
|
|
|
bool trackimagedata;
|
|
|
|
bool trackimagedirty;
|
2018-01-14 18:01:22 +00:00
|
|
|
|
2018-02-24 15:12:40 +00:00
|
|
|
Disk_t()
|
2018-01-14 18:01:22 +00:00
|
|
|
{
|
2018-02-24 15:12:40 +00:00
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
ZeroMemory(imagename, sizeof(imagename));
|
|
|
|
ZeroMemory(fullname, sizeof(fullname));
|
|
|
|
strFilenameInZip.clear();
|
|
|
|
imagehandle = NULL;
|
|
|
|
bWriteProtected = false;
|
2018-02-25 13:38:04 +00:00
|
|
|
//
|
2018-02-24 15:12:40 +00:00
|
|
|
byte = 0;
|
|
|
|
nibbles = 0;
|
2018-02-25 13:38:04 +00:00
|
|
|
trackimage = NULL;
|
|
|
|
trackimagedata = false;
|
|
|
|
trackimagedirty = false;
|
2018-01-14 18:01:22 +00:00
|
|
|
}
|
|
|
|
};
|