PIT type selection, CD-ROM model filtering by bus, and translation updates - closes #3354.
This commit is contained in:
@@ -72,6 +72,21 @@ SettingsMachine::SettingsMachine(QWidget *parent)
|
||||
waitStatesModel->setData(idx, i + 1, Qt::UserRole);
|
||||
}
|
||||
|
||||
auto *pitModeModel = ui->comboBoxPitMode->model();
|
||||
pitModeModel->insertRows(0, 3);
|
||||
idx = pitModeModel->index(0, 0);
|
||||
pitModeModel->setData(idx, tr("Auto"), Qt::DisplayRole);
|
||||
pitModeModel->setData(idx, -1, Qt::UserRole);
|
||||
idx = pitModeModel->index(1, 0);
|
||||
pitModeModel->setData(idx, tr("Slow"), Qt::DisplayRole);
|
||||
pitModeModel->setData(idx, 0, Qt::UserRole);
|
||||
idx = pitModeModel->index(2, 0);
|
||||
pitModeModel->setData(idx, tr("Fast"), Qt::DisplayRole);
|
||||
pitModeModel->setData(idx, 1, Qt::UserRole);
|
||||
|
||||
ui->comboBoxPitMode->setCurrentIndex(-1);
|
||||
ui->comboBoxPitMode->setCurrentIndex(pit_mode + 1);
|
||||
|
||||
int selectedMachineType = 0;
|
||||
auto *machineTypesModel = ui->comboBoxMachineType->model();
|
||||
for (int i = 1; i < MACHINE_TYPE_MAX; ++i) {
|
||||
@@ -79,9 +94,8 @@ SettingsMachine::SettingsMachine(QWidget *parent)
|
||||
while (machine_get_internal_name_ex(j) != nullptr) {
|
||||
if (machine_available(j) && (machine_get_type(j) == i)) {
|
||||
int row = Models::AddEntry(machineTypesModel, machine_types[i].name, machine_types[i].id);
|
||||
if (machine_types[i].id == machine_get_type(machine)) {
|
||||
if (machine_types[i].id == machine_get_type(machine))
|
||||
selectedMachineType = row;
|
||||
}
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
@@ -113,202 +127,191 @@ SettingsMachine::save()
|
||||
fpu_softfloat = ui->checkBoxFPUSoftfloat->isChecked() ? 1 : 0;
|
||||
|
||||
int64_t temp_mem_size;
|
||||
if (machine_get_ram_granularity(machine) < 1024) {
|
||||
if (machine_get_ram_granularity(machine) < 1024)
|
||||
temp_mem_size = ui->spinBoxRAM->value();
|
||||
} else {
|
||||
else
|
||||
temp_mem_size = ui->spinBoxRAM->value() * 1024;
|
||||
}
|
||||
|
||||
temp_mem_size &= ~(machine_get_ram_granularity(machine) - 1);
|
||||
if (temp_mem_size < machine_get_min_ram(machine)) {
|
||||
if (temp_mem_size < machine_get_min_ram(machine))
|
||||
temp_mem_size = machine_get_min_ram(machine);
|
||||
} else if (temp_mem_size > machine_get_max_ram(machine)) {
|
||||
else if (temp_mem_size > machine_get_max_ram(machine))
|
||||
temp_mem_size = machine_get_max_ram(machine);
|
||||
}
|
||||
mem_size = static_cast<uint32_t>(temp_mem_size);
|
||||
|
||||
if (ui->comboBoxWaitStates->isEnabled()) {
|
||||
if (ui->comboBoxWaitStates->isEnabled())
|
||||
cpu_waitstates = ui->comboBoxWaitStates->currentData().toInt();
|
||||
} else {
|
||||
else
|
||||
cpu_waitstates = 0;
|
||||
}
|
||||
|
||||
pit_mode = ui->comboBoxPitMode->currentData().toInt();
|
||||
|
||||
time_sync = 0;
|
||||
if (ui->radioButtonLocalTime->isChecked()) {
|
||||
if (ui->radioButtonLocalTime->isChecked())
|
||||
time_sync = TIME_SYNC_ENABLED;
|
||||
}
|
||||
if (ui->radioButtonUTC->isChecked()) {
|
||||
if (ui->radioButtonUTC->isChecked())
|
||||
time_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SettingsMachine::on_comboBoxMachineType_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
if (index >= 0) {
|
||||
auto *model = ui->comboBoxMachine->model();
|
||||
int removeRows = model->rowCount();
|
||||
|
||||
auto *model = ui->comboBoxMachine->model();
|
||||
int removeRows = model->rowCount();
|
||||
|
||||
int selectedMachineRow = 0;
|
||||
for (int i = 0; i < machine_count(); ++i) {
|
||||
if ((machine_get_type(i) == ui->comboBoxMachineType->currentData().toInt()) && machine_available(i)) {
|
||||
int row = Models::AddEntry(model, machines[i].name, i);
|
||||
if (i == machine) {
|
||||
selectedMachineRow = row - removeRows;
|
||||
int selectedMachineRow = 0;
|
||||
for (int i = 0; i < machine_count(); ++i) {
|
||||
if ((machine_get_type(i) == ui->comboBoxMachineType->currentData().toInt()) &&
|
||||
machine_available(i)) {
|
||||
int row = Models::AddEntry(model, machines[i].name, i);
|
||||
if (i == machine)
|
||||
selectedMachineRow = row - removeRows;
|
||||
}
|
||||
}
|
||||
}
|
||||
model->removeRows(0, removeRows);
|
||||
model->removeRows(0, removeRows);
|
||||
|
||||
ui->comboBoxMachine->setCurrentIndex(-1);
|
||||
ui->comboBoxMachine->setCurrentIndex(selectedMachineRow);
|
||||
ui->comboBoxMachine->setCurrentIndex(-1);
|
||||
ui->comboBoxMachine->setCurrentIndex(selectedMachineRow);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SettingsMachine::on_comboBoxMachine_currentIndexChanged(int index)
|
||||
{
|
||||
// win_settings_machine_recalc_machine
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
if (index >= 0) {
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
const auto *device = machine_get_device(machineId);
|
||||
ui->pushButtonConfigure->setEnabled((device != nullptr) && (device->config != nullptr));
|
||||
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
const auto *device = machine_get_device(machineId);
|
||||
ui->pushButtonConfigure->setEnabled((device != nullptr) && (device->config != nullptr));
|
||||
auto *modelCpu = ui->comboBoxCPU->model();
|
||||
int removeRows = modelCpu->rowCount();
|
||||
|
||||
auto *modelCpu = ui->comboBoxCPU->model();
|
||||
int removeRows = modelCpu->rowCount();
|
||||
|
||||
int i = 0;
|
||||
int eligibleRows = 0;
|
||||
int selectedCpuFamilyRow = 0;
|
||||
while (cpu_families[i].package != 0) {
|
||||
if (cpu_family_is_eligible(&cpu_families[i], machineId)) {
|
||||
Models::AddEntry(modelCpu, QString("%1 %2").arg(cpu_families[i].manufacturer, cpu_families[i].name), i);
|
||||
if (&cpu_families[i] == cpu_f) {
|
||||
selectedCpuFamilyRow = eligibleRows;
|
||||
int i = 0;
|
||||
int eligibleRows = 0;
|
||||
int selectedCpuFamilyRow = 0;
|
||||
while (cpu_families[i].package != 0) {
|
||||
if (cpu_family_is_eligible(&cpu_families[i], machineId)) {
|
||||
Models::AddEntry(modelCpu, QString("%1 %2").arg(cpu_families[i].manufacturer,
|
||||
cpu_families[i].name), i);
|
||||
if (&cpu_families[i] == cpu_f)
|
||||
selectedCpuFamilyRow = eligibleRows;
|
||||
++eligibleRows;
|
||||
}
|
||||
++eligibleRows;
|
||||
++i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
modelCpu->removeRows(0, removeRows);
|
||||
ui->comboBoxCPU->setEnabled(eligibleRows > 1);
|
||||
ui->comboBoxCPU->setCurrentIndex(-1);
|
||||
ui->comboBoxCPU->setCurrentIndex(selectedCpuFamilyRow);
|
||||
modelCpu->removeRows(0, removeRows);
|
||||
ui->comboBoxCPU->setEnabled(eligibleRows > 1);
|
||||
ui->comboBoxCPU->setCurrentIndex(-1);
|
||||
ui->comboBoxCPU->setCurrentIndex(selectedCpuFamilyRow);
|
||||
|
||||
int divisor;
|
||||
if (machine_get_ram_granularity(machineId) < 1024) {
|
||||
divisor = 1;
|
||||
ui->spinBoxRAM->setSuffix(QCoreApplication::translate("", "KB").prepend(' '));
|
||||
} else {
|
||||
divisor = 1024;
|
||||
ui->spinBoxRAM->setSuffix(QCoreApplication::translate("", "MB").prepend(' '));
|
||||
}
|
||||
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId) / divisor);
|
||||
ui->spinBoxRAM->setMaximum(machine_get_max_ram(machineId) / divisor);
|
||||
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId) / divisor);
|
||||
ui->spinBoxRAM->setValue(mem_size / divisor);
|
||||
ui->spinBoxRAM->setEnabled(machine_get_min_ram(machineId) != machine_get_max_ram(machineId));
|
||||
int divisor;
|
||||
if (machine_get_ram_granularity(machineId) < 1024) {
|
||||
divisor = 1;
|
||||
ui->spinBoxRAM->setSuffix(QCoreApplication::translate("", "KB").prepend(' '));
|
||||
} else {
|
||||
divisor = 1024;
|
||||
ui->spinBoxRAM->setSuffix(QCoreApplication::translate("", "MB").prepend(' '));
|
||||
}
|
||||
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId) / divisor);
|
||||
ui->spinBoxRAM->setMaximum(machine_get_max_ram(machineId) / divisor);
|
||||
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId) / divisor);
|
||||
ui->spinBoxRAM->setValue(mem_size / divisor);
|
||||
ui->spinBoxRAM->setEnabled(machine_get_min_ram(machineId) != machine_get_max_ram(machineId));
|
||||
|
||||
emit currentMachineChanged(machineId);
|
||||
emit currentMachineChanged(machineId);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SettingsMachine::on_comboBoxCPU_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
if (index >= 0) {
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
int cpuFamilyId = ui->comboBoxCPU->currentData().toInt();
|
||||
const auto *cpuFamily = &cpu_families[cpuFamilyId];
|
||||
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
int cpuFamilyId = ui->comboBoxCPU->currentData().toInt();
|
||||
const auto *cpuFamily = &cpu_families[cpuFamilyId];
|
||||
auto *modelSpeed = ui->comboBoxSpeed->model();
|
||||
int removeRows = modelSpeed->rowCount();
|
||||
|
||||
auto *modelSpeed = ui->comboBoxSpeed->model();
|
||||
int removeRows = modelSpeed->rowCount();
|
||||
|
||||
// win_settings_machine_recalc_cpu_m
|
||||
int i = 0;
|
||||
int eligibleRows = 0;
|
||||
int selectedSpeedRow = 0;
|
||||
while (cpuFamily->cpus[i].cpu_type != 0) {
|
||||
if (cpu_is_eligible(cpuFamily, i, machineId)) {
|
||||
Models::AddEntry(modelSpeed, QString("%1").arg(cpuFamily->cpus[i].name), i);
|
||||
if (cpu == i) {
|
||||
selectedSpeedRow = eligibleRows;
|
||||
// win_settings_machine_recalc_cpu_m
|
||||
int i = 0;
|
||||
int eligibleRows = 0;
|
||||
int selectedSpeedRow = 0;
|
||||
while (cpuFamily->cpus[i].cpu_type != 0) {
|
||||
if (cpu_is_eligible(cpuFamily, i, machineId)) {
|
||||
Models::AddEntry(modelSpeed, QString("%1").arg(cpuFamily->cpus[i].name), i);
|
||||
if (cpu == i)
|
||||
selectedSpeedRow = eligibleRows;
|
||||
++eligibleRows;
|
||||
}
|
||||
++eligibleRows;
|
||||
++i;
|
||||
}
|
||||
++i;
|
||||
modelSpeed->removeRows(0, removeRows);
|
||||
ui->comboBoxSpeed->setEnabled(eligibleRows > 1);
|
||||
ui->comboBoxSpeed->setCurrentIndex(-1);
|
||||
ui->comboBoxSpeed->setCurrentIndex(selectedSpeedRow);
|
||||
}
|
||||
modelSpeed->removeRows(0, removeRows);
|
||||
ui->comboBoxSpeed->setEnabled(eligibleRows > 1);
|
||||
ui->comboBoxSpeed->setCurrentIndex(-1);
|
||||
ui->comboBoxSpeed->setCurrentIndex(selectedSpeedRow);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsMachine::on_comboBoxSpeed_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
if (index >= 0) {
|
||||
// win_settings_machine_recalc_cpu
|
||||
int cpuFamilyId = ui->comboBoxCPU->currentData().toInt();
|
||||
const auto *cpuFamily = &cpu_families[cpuFamilyId];
|
||||
int cpuId = ui->comboBoxSpeed->currentData().toInt();
|
||||
uint cpuType = cpuFamily->cpus[cpuId].cpu_type;
|
||||
|
||||
// win_settings_machine_recalc_cpu
|
||||
int cpuFamilyId = ui->comboBoxCPU->currentData().toInt();
|
||||
const auto *cpuFamily = &cpu_families[cpuFamilyId];
|
||||
int cpuId = ui->comboBoxSpeed->currentData().toInt();
|
||||
uint cpuType = cpuFamily->cpus[cpuId].cpu_type;
|
||||
|
||||
if ((cpuType >= CPU_286) && (cpuType <= CPU_386DX)) {
|
||||
ui->comboBoxWaitStates->setEnabled(true);
|
||||
ui->comboBoxWaitStates->setCurrentIndex(cpu_waitstates);
|
||||
} else {
|
||||
ui->comboBoxWaitStates->setCurrentIndex(0);
|
||||
ui->comboBoxWaitStates->setEnabled(false);
|
||||
}
|
||||
if ((cpuType >= CPU_286) && (cpuType <= CPU_386DX)) {
|
||||
ui->comboBoxWaitStates->setEnabled(true);
|
||||
ui->comboBoxWaitStates->setCurrentIndex(cpu_waitstates);
|
||||
} else {
|
||||
ui->comboBoxWaitStates->setCurrentIndex(0);
|
||||
ui->comboBoxWaitStates->setEnabled(false);
|
||||
}
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
uint8_t flags = cpuFamily->cpus[cpuId].cpu_flags;
|
||||
if (!(flags & CPU_SUPPORTS_DYNAREC)) {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(false);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(false);
|
||||
} else if (flags & CPU_REQUIRES_DYNAREC) {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(true);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(false);
|
||||
} else {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(cpu_use_dynarec);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(true);
|
||||
}
|
||||
uint8_t flags = cpuFamily->cpus[cpuId].cpu_flags;
|
||||
if (!(flags & CPU_SUPPORTS_DYNAREC)) {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(false);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(false);
|
||||
} else if (flags & CPU_REQUIRES_DYNAREC) {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(true);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(false);
|
||||
} else {
|
||||
ui->checkBoxDynamicRecompiler->setChecked(cpu_use_dynarec);
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
// win_settings_machine_recalc_fpu
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
auto *modelFpu = ui->comboBoxFPU->model();
|
||||
int removeRows = modelFpu->rowCount();
|
||||
// win_settings_machine_recalc_fpu
|
||||
int machineId = ui->comboBoxMachine->currentData().toInt();
|
||||
auto *modelFpu = ui->comboBoxFPU->model();
|
||||
int removeRows = modelFpu->rowCount();
|
||||
|
||||
int i = 0;
|
||||
int selectedFpuRow = 0;
|
||||
for (const char *fpuName = fpu_get_name_from_index(cpuFamily, cpuId, i); fpuName != nullptr; fpuName = fpu_get_name_from_index(cpuFamily, cpuId, ++i)) {
|
||||
auto fpuType = fpu_get_type_from_index(cpuFamily, cpuId, i);
|
||||
Models::AddEntry(modelFpu, QString("%1").arg(fpuName), fpuType);
|
||||
if (fpu_type == fpuType) {
|
||||
selectedFpuRow = i;
|
||||
int i = 0;
|
||||
int selectedFpuRow = 0;
|
||||
for (const char *fpuName = fpu_get_name_from_index(cpuFamily, cpuId, i);
|
||||
fpuName != nullptr; fpuName = fpu_get_name_from_index(cpuFamily, cpuId, ++i)) {
|
||||
auto fpuType = fpu_get_type_from_index(cpuFamily, cpuId, i);
|
||||
Models::AddEntry(modelFpu, QString("%1").arg(fpuName), fpuType);
|
||||
if (fpu_type == fpuType)
|
||||
selectedFpuRow = i;
|
||||
}
|
||||
|
||||
modelFpu->removeRows(0, removeRows);
|
||||
ui->comboBoxFPU->setEnabled(modelFpu->rowCount() > 1);
|
||||
ui->comboBoxFPU->setCurrentIndex(-1);
|
||||
ui->comboBoxFPU->setCurrentIndex(selectedFpuRow);
|
||||
|
||||
ui->checkBoxFPUSoftfloat->setChecked(machine_has_flags(machineId, MACHINE_SOFTFLOAT_ONLY) ?
|
||||
true : fpu_softfloat);
|
||||
ui->checkBoxFPUSoftfloat->setEnabled(machine_has_flags(machineId, MACHINE_SOFTFLOAT_ONLY) ?
|
||||
false : true);
|
||||
}
|
||||
|
||||
modelFpu->removeRows(0, removeRows);
|
||||
ui->comboBoxFPU->setEnabled(modelFpu->rowCount() > 1);
|
||||
ui->comboBoxFPU->setCurrentIndex(-1);
|
||||
ui->comboBoxFPU->setCurrentIndex(selectedFpuRow);
|
||||
|
||||
ui->checkBoxFPUSoftfloat->setChecked(machine_has_flags(machineId, MACHINE_SOFTFLOAT_ONLY) ? true : fpu_softfloat);
|
||||
ui->checkBoxFPUSoftfloat->setEnabled(machine_has_flags(machineId, MACHINE_SOFTFLOAT_ONLY) ? false : true);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user