mirror of https://github.com/PCSX2/pcsx2.git
DEV9: LBA48 Support
This commit is contained in:
parent
2f0463d936
commit
1aa7b591b6
|
@ -253,6 +253,8 @@ DEV9SettingsWidget::DEV9SettingsWidget(SettingsWindow* dialog, QWidget* parent)
|
||||||
else
|
else
|
||||||
m_ui.hddFile->setText(QString::fromUtf8(m_dialog->getStringValue("DEV9/Hdd", "HddFile", "DEV9hdd.raw").value().c_str()));
|
m_ui.hddFile->setText(QString::fromUtf8(m_dialog->getStringValue("DEV9/Hdd", "HddFile", "DEV9hdd.raw").value().c_str()));
|
||||||
|
|
||||||
|
connect(m_ui.hddLBA48, QOverload<int>::of(&QCheckBox::stateChanged), this, &DEV9SettingsWidget::onHddLBA48Changed);
|
||||||
|
|
||||||
UpdateHddSizeUIValues();
|
UpdateHddSizeUIValues();
|
||||||
|
|
||||||
connect(m_ui.hddFile, &QLineEdit::textChanged, this, &DEV9SettingsWidget::onHddFileTextChange);
|
connect(m_ui.hddFile, &QLineEdit::textChanged, this, &DEV9SettingsWidget::onHddFileTextChange);
|
||||||
|
@ -720,6 +722,21 @@ void DEV9SettingsWidget::onHddSizeAccessorSpin()
|
||||||
m_ui.hddSizeSlider->setValue(m_ui.hddSizeSpinBox->value());
|
m_ui.hddSizeSlider->setValue(m_ui.hddSizeSpinBox->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DEV9SettingsWidget::onHddLBA48Changed(int state)
|
||||||
|
{
|
||||||
|
const bool enabled = state;
|
||||||
|
|
||||||
|
m_ui.hddSizeSlider->setMaximum(state ? 2000 : 120);
|
||||||
|
m_ui.hddSizeSpinBox->setMaximum(state ? 2000 : 120);
|
||||||
|
m_ui.hddSizeMaxLabel->setText(state ? tr("2000") : tr("120"));
|
||||||
|
// Bump up min size to have ticks align with 100GiB sizes
|
||||||
|
m_ui.hddSizeSlider->setMinimum(state ? 100 : 40);
|
||||||
|
m_ui.hddSizeSpinBox->setMinimum(state ? 100 : 40);
|
||||||
|
m_ui.hddSizeMinLabel->setText(state ? tr("100") : tr("40"));
|
||||||
|
|
||||||
|
m_ui.hddSizeSlider->setTickInterval(state ? 100 : 5);
|
||||||
|
}
|
||||||
|
|
||||||
void DEV9SettingsWidget::onHddCreateClicked()
|
void DEV9SettingsWidget::onHddCreateClicked()
|
||||||
{
|
{
|
||||||
//Do the thing
|
//Do the thing
|
||||||
|
@ -800,6 +817,11 @@ void DEV9SettingsWidget::UpdateHddSizeUIValues()
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (size > static_cast<s64>(120) * 1024 * 1024 * 1024)
|
||||||
|
m_ui.hddLBA48->setChecked(true);
|
||||||
|
else
|
||||||
|
m_ui.hddLBA48->setChecked(false);
|
||||||
|
|
||||||
const int sizeGB = size / 1024 / 1024 / 1024;
|
const int sizeGB = size / 1024 / 1024 / 1024;
|
||||||
QSignalBlocker sb1(m_ui.hddSizeSpinBox);
|
QSignalBlocker sb1(m_ui.hddSizeSpinBox);
|
||||||
QSignalBlocker sb2(m_ui.hddSizeSlider);
|
QSignalBlocker sb2(m_ui.hddSizeSlider);
|
||||||
|
|
|
@ -39,6 +39,7 @@ private Q_SLOTS:
|
||||||
void onHddFileEdit();
|
void onHddFileEdit();
|
||||||
void onHddSizeSlide(int i);
|
void onHddSizeSlide(int i);
|
||||||
void onHddSizeAccessorSpin();
|
void onHddSizeAccessorSpin();
|
||||||
|
void onHddLBA48Changed(int state);
|
||||||
void onHddCreateClicked();
|
void onHddCreateClicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -365,6 +365,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="hddLBA48Label">
|
||||||
|
<property name="text">
|
||||||
|
<string>48-bit LBA:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QCheckBox" name="hddLBA48">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enabled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
int nsector = 0; //sector count
|
int nsector = 0; //sector count
|
||||||
int nsectorLeft = 0; //sectors left to transfer
|
int nsectorLeft = 0; //sectors left to transfer
|
||||||
private:
|
private:
|
||||||
const bool lba48Supported = false;
|
bool lba48Supported = false;
|
||||||
|
|
||||||
std::FILE* hddImage = nullptr;
|
std::FILE* hddImage = nullptr;
|
||||||
u64 hddImageSize;
|
u64 hddImageSize;
|
||||||
|
|
|
@ -94,6 +94,8 @@ int ATA::Open(const std::string& hddPath)
|
||||||
|
|
||||||
//Store HddImage size for later use
|
//Store HddImage size for later use
|
||||||
hddImageSize = static_cast<u64>(size);
|
hddImageSize = static_cast<u64>(size);
|
||||||
|
lba48Supported = (hddImageSize > ((static_cast<s64>(1) << 28) - 1) * 512);
|
||||||
|
|
||||||
CreateHDDinfo(hddImageSize / 512);
|
CreateHDDinfo(hddImageSize / 512);
|
||||||
|
|
||||||
InitSparseSupport(hddPath);
|
InitSparseSupport(hddPath);
|
||||||
|
|
|
@ -133,7 +133,7 @@ void ATA::HDD_ReadDMA(bool isLBA48)
|
||||||
{
|
{
|
||||||
if (!PreCmd())
|
if (!PreCmd())
|
||||||
return;
|
return;
|
||||||
DevCon.WriteLn("DEV9: HDD_ReadDMA");
|
DevCon.WriteLn(isLBA48 ? "DEV9: HDD_ReadDMA48" : "DEV9: HDD_ReadDMA");
|
||||||
|
|
||||||
IDE_CmdLBA48Transform(isLBA48);
|
IDE_CmdLBA48Transform(isLBA48);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void ATA::HDD_WriteDMA(bool isLBA48)
|
||||||
{
|
{
|
||||||
if (!PreCmd())
|
if (!PreCmd())
|
||||||
return;
|
return;
|
||||||
DevCon.WriteLn("DEV9: HDD_WriteDMA");
|
DevCon.WriteLn(isLBA48 ? "DEV9: HDD_WriteDMA48" : "DEV9: HDD_WriteDMA");
|
||||||
|
|
||||||
IDE_CmdLBA48Transform(isLBA48);
|
IDE_CmdLBA48Transform(isLBA48);
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,27 @@ void ATA::IDE_ExecCmd(u16 value)
|
||||||
case 0x20:
|
case 0x20:
|
||||||
HDD_ReadSectors(false);
|
HDD_ReadSectors(false);
|
||||||
break;
|
break;
|
||||||
//0x21
|
case 0x24:
|
||||||
|
if (lba48Supported)
|
||||||
|
HDD_ReadSectors(true);
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
|
case 0x29:
|
||||||
|
if (lba48Supported)
|
||||||
|
HDD_ReadMultiple(true);
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
case 0x40:
|
case 0x40:
|
||||||
HDD_ReadVerifySectors(false);
|
HDD_ReadVerifySectors(false);
|
||||||
break;
|
break;
|
||||||
//0x41
|
case 0x42:
|
||||||
|
if (lba48Supported)
|
||||||
|
HDD_ReadVerifySectors(true);
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
case 0x70:
|
case 0x70:
|
||||||
HDD_SeekCmd();
|
HDD_SeekCmd();
|
||||||
break;
|
break;
|
||||||
|
@ -37,13 +53,21 @@ void ATA::IDE_ExecCmd(u16 value)
|
||||||
case 0xC8:
|
case 0xC8:
|
||||||
HDD_ReadDMA(false);
|
HDD_ReadDMA(false);
|
||||||
break;
|
break;
|
||||||
//0xC9
|
|
||||||
case 0xCA:
|
case 0xCA:
|
||||||
HDD_WriteDMA(false);
|
HDD_WriteDMA(false);
|
||||||
break;
|
break;
|
||||||
//0xCB
|
case 0x25:
|
||||||
//0x25 = HDDreadDMA48;
|
if (lba48Supported)
|
||||||
//0x35 = HDDwriteDMA48;*/
|
HDD_ReadDMA(true);
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
|
case 0x35:
|
||||||
|
if (lba48Supported)
|
||||||
|
HDD_WriteDMA(true);
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
case 0xE1:
|
case 0xE1:
|
||||||
HDD_IdleImmediate();
|
HDD_IdleImmediate();
|
||||||
break;
|
break;
|
||||||
|
@ -53,7 +77,12 @@ void ATA::IDE_ExecCmd(u16 value)
|
||||||
case 0xE7:
|
case 0xE7:
|
||||||
HDD_FlushCache();
|
HDD_FlushCache();
|
||||||
break;
|
break;
|
||||||
//0xEA = HDDflushCache48
|
case 0xEA:
|
||||||
|
if (lba48Supported)
|
||||||
|
HDD_FlushCache();
|
||||||
|
else
|
||||||
|
HDD_Unk();
|
||||||
|
break;
|
||||||
case 0xEC:
|
case 0xEC:
|
||||||
HDD_IdentifyDevice();
|
HDD_IdentifyDevice();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue