This commit is contained in:
ts-korhonen
2021-12-16 19:35:34 +02:00
2 changed files with 12 additions and 18 deletions

View File

@@ -158,26 +158,18 @@ void SettingsMachine::on_comboBoxMachine_currentIndexChanged(int index) {
ui->comboBoxCPU->setCurrentIndex(-1); ui->comboBoxCPU->setCurrentIndex(-1);
ui->comboBoxCPU->setCurrentIndex(selectedCpuFamilyRow); ui->comboBoxCPU->setCurrentIndex(selectedCpuFamilyRow);
auto* machine = &machines[machineId]; int divisor;
if ((machine->ram_granularity < 1024)) { if ((machine_get_ram_granularity(machineId) < 1024)) {
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId)); divisor = 1;
ui->spinBoxRAM->setMaximum(machine_get_max_ram(machineId)); ui->spinBoxRAM->setSuffix(" KB");
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId));
ui->spinBoxRAM->setSuffix(" KiB");
ui->spinBoxRAM->setValue(mem_size);
} else { } else {
int maxram; divisor = 1024;
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)) ui->spinBoxRAM->setSuffix(" MB");
maxram = std::min(machine->max_ram, 2097152);
#else
maxram = std::min(machine_get_max_ram(machineId), 3145728);
#endif
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId) / 1024);
ui->spinBoxRAM->setMaximum(maxram / 1024);
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId) / 1024);
ui->spinBoxRAM->setSuffix(" MiB");
ui->spinBoxRAM->setValue(mem_size / 1024);
} }
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)); ui->spinBoxRAM->setEnabled(machine_get_min_ram(machineId) != machine_get_max_ram(machineId));
emit currentMachineChanged(machineId); emit currentMachineChanged(machineId);

View File

@@ -2,6 +2,8 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <algorithm>
extern "C" { extern "C" {
#include <86box/device.h> #include <86box/device.h>
#include <86box/gameport.h> #include <86box/gameport.h>