Fix all disk related function due to Disk class introduction.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
f6719554e6
commit
a51118cf35
9 changed files with 52 additions and 34 deletions
|
@ -144,7 +144,7 @@ namespace
|
|||
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
|
||||
g_dwCyclesThisFrame += uActualCyclesExecuted;
|
||||
|
||||
DiskUpdateDriveState(uActualCyclesExecuted);
|
||||
sg_Disk2Card.UpdateDriveState(uActualCyclesExecuted);
|
||||
|
||||
const int key = ProcessKeyboard();
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace
|
|||
|
||||
g_relativeSpeed = g_relativeSpeed * coeff + double(us) / double(nExecutionPeriodUsec) * (1.0 - coeff);
|
||||
|
||||
if (!DiskIsSpinning())
|
||||
if (!sg_Disk2Card.IsConditionForFullSpeed())
|
||||
{
|
||||
if (us < nExecutionPeriodUsec)
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ namespace
|
|||
strPathName.append(fileName);
|
||||
}
|
||||
|
||||
ImageError_e Error = DiskInsert(nDrive, strPathName.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
ImageError_e Error = sg_Disk2Card.InsertDisk(nDrive, strPathName.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
return Error == eIMAGE_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,6 @@ namespace
|
|||
LogFileOutput("Initialisation\n");
|
||||
|
||||
ImageInitialize();
|
||||
DiskInitialize();
|
||||
|
||||
bool disksOk = true;
|
||||
if (!options.disk1.empty())
|
||||
|
@ -277,7 +276,7 @@ namespace
|
|||
|
||||
MemInitialize();
|
||||
VideoInitialize();
|
||||
DiskReset();
|
||||
sg_Disk2Card.Reset();
|
||||
HD_Reset();
|
||||
|
||||
if (!options.snapshot.empty())
|
||||
|
@ -312,7 +311,7 @@ namespace
|
|||
PrintDestroy();
|
||||
CpuDestroy();
|
||||
|
||||
DiskDestroy();
|
||||
sg_Disk2Card.Destroy();
|
||||
ImageDestroy();
|
||||
|
||||
fclose(g_fh);
|
||||
|
|
|
@ -275,7 +275,7 @@ void FrameRefresh()
|
|||
|
||||
void FrameDrawDiskLEDS(HDC x)
|
||||
{
|
||||
DiskGetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2);
|
||||
sg_Disk2Card.GetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2);
|
||||
FrameRefresh();
|
||||
}
|
||||
|
||||
|
@ -290,10 +290,10 @@ void FrameDrawDiskStatus(HDC x)
|
|||
// Track $B7EC LC1 $D356
|
||||
// Sector $B7ED LC1 $D357
|
||||
// RWTS LC1 $D300
|
||||
int nActiveFloppy = DiskGetCurrentDrive();
|
||||
int nActiveFloppy = sg_Disk2Card.GetCurrentDrive();
|
||||
|
||||
int nDisk1Track = DiskGetTrack(0);
|
||||
int nDisk2Track = DiskGetTrack(1);
|
||||
int nDisk1Track = sg_Disk2Card.GetTrack(0);
|
||||
int nDisk2Track = sg_Disk2Card.GetTrack(1);
|
||||
|
||||
// Probe known OS's for Track/Sector
|
||||
int isProDOS = mem[ 0xBF00 ] == 0x4C;
|
||||
|
|
|
@ -25,12 +25,12 @@ namespace
|
|||
{
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
DiskEject(disk);
|
||||
sg_Disk2Card.EjectDisk(disk);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool createMissingDisk = true;
|
||||
const ImageError_e result = DiskInsert(disk, filename.toStdString().c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
const ImageError_e result = sg_Disk2Card.InsertDisk(disk, filename.toStdString().c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
if (result != eIMAGE_ERROR_NONE)
|
||||
{
|
||||
const QString message = QString("Error [%1] inserting '%2'").arg(QString::number(result), filename);
|
||||
|
@ -111,7 +111,7 @@ Preferences::Data getCurrentOptions(const std::shared_ptr<QGamepad> & gamepad)
|
|||
currentOptions.disks.resize(diskIDs.size());
|
||||
for (size_t i = 0; i < diskIDs.size(); ++i)
|
||||
{
|
||||
const char * diskName = DiskGetFullName(diskIDs[i]);
|
||||
const char * diskName = sg_Disk2Card.GetFullName(diskIDs[i]);
|
||||
if (diskName)
|
||||
{
|
||||
currentOptions.disks[i] = diskName;
|
||||
|
@ -128,6 +128,7 @@ Preferences::Data getCurrentOptions(const std::shared_ptr<QGamepad> & gamepad)
|
|||
}
|
||||
}
|
||||
|
||||
currentOptions.enhancedSpeed = sg_Disk2Card.GetEnhanceDisk();
|
||||
currentOptions.languageCardInSlot0 = g_Slot0 == CT_LanguageCard;
|
||||
currentOptions.mouseInSlot4 = g_Slot4 == CT_MouseInterface;
|
||||
currentOptions.cpmInSlot5 = g_Slot5 == CT_Z80;
|
||||
|
@ -202,6 +203,12 @@ void setNewOptions(const Preferences::Data & currentOptions, const Preferences::
|
|||
}
|
||||
}
|
||||
|
||||
if (currentOptions.enhancedSpeed != newOptions.enhancedSpeed)
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), newOptions.enhancedSpeed ? 1 : 0);
|
||||
sg_Disk2Card.SetEnhanceDisk(newOptions.enhancedSpeed);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < diskIDs.size(); ++i)
|
||||
{
|
||||
if (currentOptions.disks[i] != newOptions.disks[i])
|
||||
|
|
|
@ -168,6 +168,7 @@ void Preferences::setData(const Data & data)
|
|||
initialiseDisks(myDisks, data.disks);
|
||||
initialiseDisks(myHDs, data.hds);
|
||||
|
||||
enhanced_speed->setChecked(data.enhancedSpeed);
|
||||
apple2Type->setCurrentIndex(data.apple2Type);
|
||||
lc_0->setChecked(data.languageCardInSlot0);
|
||||
mouse_4->setChecked(data.mouseInSlot4);
|
||||
|
@ -190,6 +191,7 @@ Preferences::Data Preferences::getData() const
|
|||
fillData(myDisks, data.disks);
|
||||
fillData(myHDs, data.hds);
|
||||
|
||||
data.enhancedSpeed = enhanced_speed->isChecked();
|
||||
data.apple2Type = apple2Type->currentIndex();
|
||||
data.languageCardInSlot0 = lc_0->isChecked();
|
||||
data.mouseInSlot4 = mouse_4->isChecked();
|
||||
|
|
|
@ -23,6 +23,8 @@ public:
|
|||
QString joystick;
|
||||
int joystickId; // only putput
|
||||
|
||||
bool enhancedSpeed;
|
||||
|
||||
std::vector<QString> disks;
|
||||
std::vector<QString> hds;
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
<string>Disks</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="2">
|
||||
<widget class="QComboBox" name="hd2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -189,21 +189,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>HD 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Disk 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="disk1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -221,14 +221,14 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Disk 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="disk2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -238,7 +238,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="4" column="2">
|
||||
<widget class="QComboBox" name="hd1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -253,41 +253,48 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>HD 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="browse_disk1">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="browse_disk2">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="browse_hd1">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="browse_hd2">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="enhanced_speed">
|
||||
<property name="text">
|
||||
<string>Enhanced Speed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="advanced">
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace
|
|||
LogFileOutput("Initialisation\n");
|
||||
|
||||
ImageInitialize();
|
||||
DiskInitialize();
|
||||
}
|
||||
|
||||
/* In AppleWin there are 3 ways to reset the emulator
|
||||
|
@ -67,7 +66,7 @@ namespace
|
|||
}
|
||||
MemInitialize();
|
||||
VideoInitialize();
|
||||
DiskReset();
|
||||
sg_Disk2Card.Reset();
|
||||
HD_Reset();
|
||||
}
|
||||
|
||||
|
@ -84,7 +83,7 @@ namespace
|
|||
PrintDestroy();
|
||||
CpuDestroy();
|
||||
|
||||
DiskDestroy();
|
||||
sg_Disk2Card.Destroy();
|
||||
ImageDestroy();
|
||||
fclose(g_fh);
|
||||
g_fh = NULL;
|
||||
|
@ -229,6 +228,7 @@ void QApple::on_timer()
|
|||
{
|
||||
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
|
||||
g_dwCyclesThisFrame += uActualCyclesExecuted;
|
||||
sg_Disk2Card.UpdateDriveState(uActualCyclesExecuted);
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame)
|
||||
{
|
||||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
|
@ -236,7 +236,7 @@ void QApple::on_timer()
|
|||
}
|
||||
++count;
|
||||
}
|
||||
while (DiskIsSpinning() && (myElapsedTimer.elapsed() < target + full_speed_ms));
|
||||
while (sg_Disk2Card.IsConditionForFullSpeed() && (myElapsedTimer.elapsed() < target + full_speed_ms));
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -414,5 +414,5 @@ void QApple::on_actionSwap_disks_triggered()
|
|||
PauseEmulator pause(this);
|
||||
|
||||
// this might open a file dialog
|
||||
DiskDriveSwap();
|
||||
sg_Disk2Card.DriveSwap();
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void VideoBenchmark(std::function<void()> VideoRedrawScreen)
|
|||
while (cycles > 0) {
|
||||
DWORD executedcycles = CpuExecute(103, true);
|
||||
cycles -= executedcycles;
|
||||
DiskUpdateDriveState(executedcycles);
|
||||
sg_Disk2Card.UpdateDriveState(executedcycles);
|
||||
#if 0
|
||||
JoyUpdateButtonLatch(executedcycles);
|
||||
#endif
|
||||
|
|
|
@ -38,6 +38,7 @@ const TCHAR *g_pAppTitle = TITLE_APPLE_2E_ENHANCED;
|
|||
bool g_bRestart = false;
|
||||
CSuperSerialCard sg_SSC;
|
||||
CMouseInterface sg_Mouse;
|
||||
Disk2InterfaceCard sg_Disk2Card;
|
||||
const short SPKR_DATA_INIT = (short)0x8000;
|
||||
|
||||
short g_nSpeakerData = SPKR_DATA_INIT;
|
||||
|
@ -202,7 +203,7 @@ void LoadConfiguration(void)
|
|||
|
||||
DWORD dwEnhanceDisk;
|
||||
REGLOAD(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk);
|
||||
Disk_SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
||||
sg_Disk2Card.SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
||||
|
||||
#if 0
|
||||
Config_Load_Video();
|
||||
|
@ -293,8 +294,8 @@ void LoadConfiguration(void)
|
|||
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
||||
SetCurrentImageDir(szFilename);
|
||||
|
||||
Disk_LoadLastDiskImage(DRIVE_1);
|
||||
Disk_LoadLastDiskImage(DRIVE_2);
|
||||
sg_Disk2Card.LoadLastDiskImage(DRIVE_1);
|
||||
sg_Disk2Card.LoadLastDiskImage(DRIVE_2);
|
||||
|
||||
//
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue