2018-12-23 15:34:53 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2016-12-10 11:40:41 +01:00
|
|
|
#include <guisan.hpp>
|
|
|
|
#include <SDL_ttf.h>
|
|
|
|
#include <guisan/sdl.hpp>
|
2017-09-27 00:15:50 +02:00
|
|
|
#include <guisan/sdl/sdltruetypefont.hpp>
|
2015-05-13 18:47:23 +00:00
|
|
|
#include "SelectorEntry.hpp"
|
|
|
|
|
|
|
|
#include "sysdeps.h"
|
|
|
|
#include "options.h"
|
2020-01-31 23:31:32 +01:00
|
|
|
#include "memory.h"
|
2017-09-19 14:24:41 +02:00
|
|
|
#include "newcpu.h"
|
2015-05-13 18:47:23 +00:00
|
|
|
#include "gui_handling.h"
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
static gcn::Window* grpCPU;
|
2020-05-14 01:25:14 +02:00
|
|
|
static gcn::RadioButton* optCPU68000;
|
|
|
|
static gcn::RadioButton* optCPU68010;
|
|
|
|
static gcn::RadioButton* optCPU68020;
|
|
|
|
static gcn::RadioButton* optCPU68030;
|
|
|
|
static gcn::RadioButton* optCPU68040;
|
|
|
|
static gcn::CheckBox* chk24Bit;
|
|
|
|
static gcn::CheckBox* chkCPUCompatible;
|
|
|
|
static gcn::CheckBox* chkJIT;
|
2017-01-29 12:03:00 +01:00
|
|
|
static gcn::Window* grpFPU;
|
2020-05-14 01:25:14 +02:00
|
|
|
static gcn::RadioButton* optFPUnone;
|
|
|
|
static gcn::RadioButton* optFPU68881;
|
|
|
|
static gcn::RadioButton* optFPU68882;
|
|
|
|
static gcn::RadioButton* optFPUinternal;
|
|
|
|
static gcn::CheckBox* chkFPUstrict;
|
|
|
|
static gcn::CheckBox* chkFPUJIT;
|
2017-01-29 12:03:00 +01:00
|
|
|
static gcn::Window* grpCPUSpeed;
|
2020-05-14 01:25:14 +02:00
|
|
|
static gcn::RadioButton* opt7Mhz;
|
|
|
|
static gcn::RadioButton* opt14Mhz;
|
2020-05-22 13:08:45 +02:00
|
|
|
static gcn::RadioButton* opt25Mhz;
|
2020-05-14 01:25:14 +02:00
|
|
|
static gcn::RadioButton* optFastest;
|
2020-05-22 13:08:45 +02:00
|
|
|
static gcn::Label* lblCpuIdle;
|
|
|
|
static gcn::Slider* sldCpuIdle;
|
2015-05-13 18:47:23 +00:00
|
|
|
|
|
|
|
class CPUButtonActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
if (actionEvent.getSource() == optCPU68000)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_model = 68000;
|
|
|
|
changed_prefs.fpu_model = 0;
|
|
|
|
changed_prefs.address_space_24 = true;
|
|
|
|
changed_prefs.z3fastmem[0].size = 0;
|
|
|
|
changed_prefs.rtgboards[0].rtgmem_size = 0;
|
|
|
|
changed_prefs.cachesize = 0;
|
|
|
|
changed_prefs.compfpu = false;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optCPU68010)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_model = 68010;
|
|
|
|
changed_prefs.fpu_model = 0;
|
|
|
|
changed_prefs.address_space_24 = true;
|
|
|
|
changed_prefs.z3fastmem[0].size = 0;
|
|
|
|
changed_prefs.rtgboards[0].rtgmem_size = 0;
|
|
|
|
changed_prefs.cachesize = 0;
|
|
|
|
changed_prefs.compfpu = false;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optCPU68020)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_model = 68020;
|
|
|
|
if (changed_prefs.fpu_model == 68040)
|
|
|
|
changed_prefs.fpu_model = 68881;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optCPU68030)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_model = 68030;
|
|
|
|
if (changed_prefs.fpu_model == 68040)
|
|
|
|
changed_prefs.fpu_model = 68881;
|
|
|
|
changed_prefs.address_space_24 = false;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optCPU68040)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_model = 68040;
|
|
|
|
changed_prefs.fpu_model = 68040;
|
|
|
|
changed_prefs.address_space_24 = false;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
|
|
|
RefreshPanelRAM();
|
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
static CPUButtonActionListener* cpuButtonActionListener;
|
2015-05-13 18:47:23 +00:00
|
|
|
|
|
|
|
class FPUButtonActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
if (actionEvent.getSource() == optFPUnone)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.fpu_model = 0;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optFPU68881)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.fpu_model = 68881;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optFPU68882)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.fpu_model = 68882;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else if (actionEvent.getSource() == optFPUinternal)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.fpu_model = 68040;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
|
|
|
RefreshPanelRAM();
|
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
static FPUButtonActionListener* fpuButtonActionListener;
|
|
|
|
|
|
|
|
|
|
|
|
class CPUSpeedButtonActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
if (actionEvent.getSource() == opt7Mhz)
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.m68k_speed = M68K_SPEED_7MHZ_CYCLES;
|
2017-01-29 12:03:00 +01:00
|
|
|
else if (actionEvent.getSource() == opt14Mhz)
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.m68k_speed = M68K_SPEED_14MHZ_CYCLES;
|
2020-05-22 13:08:45 +02:00
|
|
|
else if (actionEvent.getSource() == opt25Mhz)
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.m68k_speed = M68K_SPEED_25MHZ_CYCLES;
|
2017-01-29 12:03:00 +01:00
|
|
|
else if (actionEvent.getSource() == optFastest)
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.m68k_speed = -1;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
static CPUSpeedButtonActionListener* cpuSpeedButtonActionListener;
|
|
|
|
|
|
|
|
|
2015-10-11 14:23:51 +02:00
|
|
|
class CPU24BitActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.address_space_24 = chk24Bit->isSelected();
|
2017-01-29 12:03:00 +01:00
|
|
|
RefreshPanelCPU();
|
2020-05-10 11:56:18 +02:00
|
|
|
RefreshPanelRAM();
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
2015-10-11 14:23:51 +02:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-10-11 14:23:51 +02:00
|
|
|
static CPU24BitActionListener* cpu24BitActionListener;
|
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
class CPUCompActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
if (chkCPUCompatible->isSelected())
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_compatible = true;
|
|
|
|
changed_prefs.cachesize = 0;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_compatible = false;
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
static CPUCompActionListener* cpuCompActionListener;
|
|
|
|
|
|
|
|
|
|
|
|
class JITActionListener : public gcn::ActionListener
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
public:
|
2017-02-24 01:34:54 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
2018-01-30 01:08:23 +01:00
|
|
|
if (actionEvent.getSource() == chkJIT)
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
2018-01-30 01:08:23 +01:00
|
|
|
if (chkJIT->isSelected())
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cpu_compatible = false;
|
|
|
|
changed_prefs.cachesize = MAX_JIT_CACHE;
|
|
|
|
changed_prefs.compfpu = true;
|
2020-07-05 15:04:22 +02:00
|
|
|
changed_prefs.cpu_cycle_exact = false;
|
|
|
|
changed_prefs.cpu_memory_cycle_exact = false;
|
2020-07-06 18:57:15 +02:00
|
|
|
changed_prefs.address_space_24 = false;
|
|
|
|
changed_prefs.cpu_compatible = false;
|
2018-01-30 01:08:23 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.cachesize = 0;
|
|
|
|
changed_prefs.compfpu = false;
|
2018-01-30 01:08:23 +01:00
|
|
|
}
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
2018-01-30 01:08:23 +01:00
|
|
|
else if (actionEvent.getSource() == chkFPUJIT)
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.compfpu = chkFPUJIT->isSelected();
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
2020-07-13 01:30:53 +02:00
|
|
|
RefreshPanelRAM();
|
2017-01-29 12:03:00 +01:00
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
static JITActionListener* jitActionListener;
|
|
|
|
|
2017-09-18 17:36:45 +02:00
|
|
|
class FPUActionListener : public gcn::ActionListener
|
|
|
|
{
|
|
|
|
public:
|
2017-12-03 20:56:58 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-09-18 17:36:45 +02:00
|
|
|
{
|
2019-10-19 10:25:11 +02:00
|
|
|
if (actionEvent.getSource() == chkFPUstrict)
|
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
changed_prefs.fpu_strict = chkFPUstrict->isSelected();
|
2017-09-18 17:36:45 +02:00
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
|
|
|
}
|
|
|
|
};
|
2019-10-19 10:25:11 +02:00
|
|
|
|
2017-09-18 17:36:45 +02:00
|
|
|
static FPUActionListener* fpuActionListener;
|
2015-05-13 18:47:23 +00:00
|
|
|
|
2020-05-22 13:08:45 +02:00
|
|
|
class CPUIdleSliderActionListener : public gcn::ActionListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
|
|
|
{
|
|
|
|
if (actionEvent.getSource() == sldCpuIdle)
|
|
|
|
{
|
|
|
|
changed_prefs.cpu_idle = static_cast<int>(sldCpuIdle->getValue());
|
|
|
|
if (changed_prefs.cpu_idle > 0)
|
|
|
|
changed_prefs.cpu_idle = (12 - changed_prefs.cpu_idle) * 15;
|
|
|
|
}
|
|
|
|
RefreshPanelCPU();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static CPUIdleSliderActionListener* cpuIdleActionListener;
|
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
void InitPanelCPU(const struct _ConfigCategory& category)
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
cpuButtonActionListener = new CPUButtonActionListener();
|
|
|
|
cpu24BitActionListener = new CPU24BitActionListener();
|
|
|
|
cpuCompActionListener = new CPUCompActionListener();
|
|
|
|
jitActionListener = new JITActionListener();
|
2017-09-18 17:36:45 +02:00
|
|
|
fpuActionListener = new FPUActionListener();
|
2020-05-22 13:08:45 +02:00
|
|
|
cpuIdleActionListener = new CPUIdleSliderActionListener();
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optCPU68000 = new gcn::RadioButton("68000", "radiocpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optCPU68000->setId("68000");
|
2016-11-30 22:25:43 +01:00
|
|
|
optCPU68000->addActionListener(cpuButtonActionListener);
|
2020-05-14 01:25:14 +02:00
|
|
|
optCPU68010 = new gcn::RadioButton("68010", "radiocpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optCPU68010->setId("68010");
|
2016-11-30 22:25:43 +01:00
|
|
|
optCPU68010->addActionListener(cpuButtonActionListener);
|
2020-05-14 01:25:14 +02:00
|
|
|
optCPU68020 = new gcn::RadioButton("68020", "radiocpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optCPU68020->setId("68020");
|
2016-11-30 22:25:43 +01:00
|
|
|
optCPU68020->addActionListener(cpuButtonActionListener);
|
2020-05-14 01:25:14 +02:00
|
|
|
optCPU68030 = new gcn::RadioButton("68030", "radiocpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optCPU68030->setId("68030");
|
2016-11-30 22:25:43 +01:00
|
|
|
optCPU68030->addActionListener(cpuButtonActionListener);
|
2020-05-14 01:25:14 +02:00
|
|
|
optCPU68040 = new gcn::RadioButton("68040", "radiocpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optCPU68040->setId("68040");
|
2016-11-30 22:25:43 +01:00
|
|
|
optCPU68040->addActionListener(cpuButtonActionListener);
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
chk24Bit = new gcn::CheckBox("24-bit addressing", true);
|
2016-11-30 22:25:43 +01:00
|
|
|
chk24Bit->setId("CPU24Bit");
|
2017-01-29 12:03:00 +01:00
|
|
|
chk24Bit->addActionListener(cpu24BitActionListener);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
chkCPUCompatible = new gcn::CheckBox("More compatible", true);
|
2016-11-30 22:25:43 +01:00
|
|
|
chkCPUCompatible->setId("CPUComp");
|
2017-01-29 12:03:00 +01:00
|
|
|
chkCPUCompatible->addActionListener(cpuCompActionListener);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
chkJIT = new gcn::CheckBox("JIT", true);
|
2016-11-30 22:25:43 +01:00
|
|
|
chkJIT->setId("JIT");
|
2017-01-29 12:03:00 +01:00
|
|
|
chkJIT->addActionListener(jitActionListener);
|
|
|
|
|
2016-11-30 22:25:43 +01:00
|
|
|
grpCPU = new gcn::Window("CPU");
|
|
|
|
grpCPU->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpCPU->add(optCPU68000, 10, 10);
|
|
|
|
grpCPU->add(optCPU68010, 10, 40);
|
|
|
|
grpCPU->add(optCPU68020, 10, 70);
|
|
|
|
grpCPU->add(optCPU68030, 10, 100);
|
|
|
|
grpCPU->add(optCPU68040, 10, 130);
|
|
|
|
grpCPU->add(chk24Bit, 10, 170);
|
|
|
|
grpCPU->add(chkCPUCompatible, 10, 200);
|
|
|
|
grpCPU->add(chkJIT, 10, 230);
|
2016-11-30 22:25:43 +01:00
|
|
|
grpCPU->setMovable(false);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpCPU->setSize(chk24Bit->getWidth() + 20, 285);
|
2020-05-15 00:27:51 +02:00
|
|
|
grpCPU->setTitleBarHeight(TITLEBAR_HEIGHT);
|
2017-01-29 12:03:00 +01:00
|
|
|
grpCPU->setBaseColor(gui_baseCol);
|
|
|
|
|
|
|
|
category.panel->add(grpCPU);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
fpuButtonActionListener = new FPUButtonActionListener();
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optFPUnone = new gcn::RadioButton("None", "radiofpugroup");
|
2016-11-30 22:25:43 +01:00
|
|
|
optFPUnone->setId("FPUnone");
|
|
|
|
optFPUnone->addActionListener(fpuButtonActionListener);
|
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optFPU68881 = new gcn::RadioButton("68881", "radiofpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optFPU68881->setId("68881");
|
2016-11-30 22:25:43 +01:00
|
|
|
optFPU68881->addActionListener(fpuButtonActionListener);
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optFPU68882 = new gcn::RadioButton("68882", "radiofpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optFPU68882->setId("68882");
|
2016-11-30 22:25:43 +01:00
|
|
|
optFPU68882->addActionListener(fpuButtonActionListener);
|
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optFPUinternal = new gcn::RadioButton("CPU internal", "radiofpugroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optFPUinternal->setId("CPU internal");
|
2016-11-30 22:25:43 +01:00
|
|
|
optFPUinternal->addActionListener(fpuButtonActionListener);
|
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
chkFPUstrict = new gcn::CheckBox("More compatible", true);
|
2017-09-18 17:36:45 +02:00
|
|
|
chkFPUstrict->setId("FPUstrict");
|
|
|
|
chkFPUstrict->addActionListener(fpuActionListener);
|
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
chkFPUJIT = new gcn::CheckBox("FPU JIT", true);
|
2018-01-30 01:08:23 +01:00
|
|
|
chkFPUJIT->setId("FPUJIT");
|
|
|
|
chkFPUJIT->addActionListener(jitActionListener);
|
2017-09-18 17:36:45 +02:00
|
|
|
|
2016-11-30 22:25:43 +01:00
|
|
|
grpFPU = new gcn::Window("FPU");
|
|
|
|
grpFPU->setPosition(DISTANCE_BORDER + grpCPU->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpFPU->add(optFPUnone, 10, 10);
|
|
|
|
grpFPU->add(optFPU68881, 10, 40);
|
|
|
|
grpFPU->add(optFPU68882, 10, 70);
|
|
|
|
grpFPU->add(optFPUinternal, 10, 100);
|
|
|
|
grpFPU->add(chkFPUstrict, 10, 140);
|
|
|
|
grpFPU->add(chkFPUJIT, 10, 170);
|
2016-11-30 22:25:43 +01:00
|
|
|
grpFPU->setMovable(false);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpFPU->setSize(175, 225);
|
2020-05-15 00:27:51 +02:00
|
|
|
grpFPU->setTitleBarHeight(TITLEBAR_HEIGHT);
|
2017-01-29 12:03:00 +01:00
|
|
|
grpFPU->setBaseColor(gui_baseCol);
|
|
|
|
|
|
|
|
category.panel->add(grpFPU);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
cpuSpeedButtonActionListener = new CPUSpeedButtonActionListener();
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
opt7Mhz = new gcn::RadioButton("7 Mhz", "radiocpuspeedgroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
opt7Mhz->setId("7 Mhz");
|
2016-11-30 22:25:43 +01:00
|
|
|
opt7Mhz->addActionListener(cpuSpeedButtonActionListener);
|
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
opt14Mhz = new gcn::RadioButton("14 Mhz", "radiocpuspeedgroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
opt14Mhz->setId("14 Mhz");
|
2016-11-30 22:25:43 +01:00
|
|
|
opt14Mhz->addActionListener(cpuSpeedButtonActionListener);
|
|
|
|
|
2020-05-22 13:08:45 +02:00
|
|
|
opt25Mhz = new gcn::RadioButton("25 Mhz", "radiocpuspeedgroup");
|
|
|
|
opt25Mhz->setId("25 Mhz");
|
|
|
|
opt25Mhz->addActionListener(cpuSpeedButtonActionListener);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2020-05-14 01:25:14 +02:00
|
|
|
optFastest = new gcn::RadioButton("Fastest", "radiocpuspeedgroup");
|
2020-05-14 20:43:26 +02:00
|
|
|
optFastest->setId("Fastest");
|
2016-11-30 22:25:43 +01:00
|
|
|
optFastest->addActionListener(cpuSpeedButtonActionListener);
|
|
|
|
|
2020-05-22 13:08:45 +02:00
|
|
|
lblCpuIdle = new gcn::Label("CPU Idle");
|
|
|
|
sldCpuIdle = new gcn::Slider(0, 10);
|
|
|
|
sldCpuIdle->setSize(70, SLIDER_HEIGHT);
|
|
|
|
sldCpuIdle->setBaseColor(gui_baseCol);
|
|
|
|
sldCpuIdle->setMarkerLength(20);
|
|
|
|
sldCpuIdle->setStepLength(1);
|
|
|
|
sldCpuIdle->setId("sldCpuIdle");
|
|
|
|
sldCpuIdle->addActionListener(cpuIdleActionListener);
|
2018-01-28 19:58:17 +01:00
|
|
|
|
2016-11-30 22:25:43 +01:00
|
|
|
grpCPUSpeed = new gcn::Window("CPU Speed");
|
|
|
|
grpCPUSpeed->setPosition(grpFPU->getX() + grpFPU->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpCPUSpeed->add(opt7Mhz, 10, 10);
|
|
|
|
grpCPUSpeed->add(opt14Mhz, 10, 40);
|
|
|
|
grpCPUSpeed->add(opt25Mhz, 10, 70);
|
|
|
|
grpCPUSpeed->add(optFastest, 10, 100);
|
|
|
|
grpCPUSpeed->add(lblCpuIdle, 10, 160);
|
|
|
|
grpCPUSpeed->add(sldCpuIdle, lblCpuIdle->getWidth() + 20, 160);
|
2016-11-30 22:25:43 +01:00
|
|
|
grpCPUSpeed->setMovable(false);
|
2020-07-13 21:55:31 +02:00
|
|
|
grpCPUSpeed->setSize(175, 225);
|
2020-05-15 00:27:51 +02:00
|
|
|
grpCPUSpeed->setTitleBarHeight(TITLEBAR_HEIGHT);
|
2017-01-29 12:03:00 +01:00
|
|
|
grpCPUSpeed->setBaseColor(gui_baseCol);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
category.panel->add(grpCPUSpeed);
|
2016-11-30 22:25:43 +01:00
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
RefreshPanelCPU();
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
void ExitPanelCPU()
|
2015-05-13 18:47:23 +00:00
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
delete optCPU68000;
|
|
|
|
delete optCPU68010;
|
|
|
|
delete optCPU68020;
|
|
|
|
delete optCPU68030;
|
|
|
|
delete optCPU68040;
|
|
|
|
delete chk24Bit;
|
|
|
|
delete chkCPUCompatible;
|
|
|
|
delete chkJIT;
|
|
|
|
delete grpCPU;
|
|
|
|
delete cpuButtonActionListener;
|
|
|
|
delete cpu24BitActionListener;
|
|
|
|
delete cpuCompActionListener;
|
|
|
|
delete jitActionListener;
|
|
|
|
|
|
|
|
delete optFPUnone;
|
|
|
|
delete optFPU68881;
|
|
|
|
delete optFPU68882;
|
|
|
|
delete optFPUinternal;
|
2017-09-18 17:36:45 +02:00
|
|
|
delete chkFPUstrict;
|
2018-01-30 01:08:23 +01:00
|
|
|
delete chkFPUJIT;
|
2017-01-29 12:03:00 +01:00
|
|
|
delete grpFPU;
|
|
|
|
delete fpuButtonActionListener;
|
2017-09-18 17:36:45 +02:00
|
|
|
delete fpuActionListener;
|
2017-01-29 12:03:00 +01:00
|
|
|
|
|
|
|
delete opt7Mhz;
|
|
|
|
delete opt14Mhz;
|
2020-05-22 13:08:45 +02:00
|
|
|
delete opt25Mhz;
|
2017-01-29 12:03:00 +01:00
|
|
|
delete optFastest;
|
2020-05-22 13:08:45 +02:00
|
|
|
delete lblCpuIdle;
|
|
|
|
delete sldCpuIdle;
|
|
|
|
delete cpuIdleActionListener;
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
delete grpCPUSpeed;
|
|
|
|
delete cpuSpeedButtonActionListener;
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
void RefreshPanelCPU()
|
2015-05-13 18:47:23 +00:00
|
|
|
{
|
2019-09-20 18:39:27 +02:00
|
|
|
if (changed_prefs.cpu_model == 68000)
|
2017-01-29 12:03:00 +01:00
|
|
|
optCPU68000->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.cpu_model == 68010)
|
2017-01-29 12:03:00 +01:00
|
|
|
optCPU68010->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.cpu_model == 68020)
|
2017-01-29 12:03:00 +01:00
|
|
|
optCPU68020->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.cpu_model == 68030)
|
2017-01-29 12:03:00 +01:00
|
|
|
optCPU68030->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.cpu_model == 68040)
|
2017-01-29 12:03:00 +01:00
|
|
|
optCPU68040->setSelected(true);
|
|
|
|
|
2019-09-20 18:39:27 +02:00
|
|
|
chk24Bit->setSelected(changed_prefs.address_space_24);
|
2020-07-06 18:57:15 +02:00
|
|
|
chk24Bit->setEnabled(changed_prefs.cpu_model == 68020 && changed_prefs.cachesize == 0);
|
2019-09-20 18:39:27 +02:00
|
|
|
chkCPUCompatible->setSelected(changed_prefs.cpu_compatible > 0);
|
2020-07-06 18:57:15 +02:00
|
|
|
chkCPUCompatible->setEnabled(changed_prefs.cachesize == 0);
|
|
|
|
chkJIT->setEnabled(changed_prefs.cpu_model >= 68020);
|
2019-09-20 18:39:27 +02:00
|
|
|
chkJIT->setSelected(changed_prefs.cachesize > 0);
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2019-09-20 18:39:27 +02:00
|
|
|
switch (changed_prefs.fpu_model)
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
case 68881:
|
|
|
|
optFPU68881->setSelected(true);
|
|
|
|
break;
|
|
|
|
case 68882:
|
|
|
|
optFPU68882->setSelected(true);
|
|
|
|
break;
|
|
|
|
case 68040:
|
|
|
|
optFPUinternal->setSelected(true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
optFPUnone->setSelected(true);
|
|
|
|
break;
|
|
|
|
}
|
2019-09-20 18:39:27 +02:00
|
|
|
optFPU68881->setEnabled(changed_prefs.cpu_model >= 68020 && changed_prefs.cpu_model < 68040);
|
|
|
|
optFPU68882->setEnabled(changed_prefs.cpu_model >= 68020 && changed_prefs.cpu_model < 68040);
|
|
|
|
optFPUinternal->setEnabled(changed_prefs.cpu_model == 68040);
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2019-09-20 18:39:27 +02:00
|
|
|
chkFPUstrict->setSelected(changed_prefs.fpu_strict);
|
2018-02-03 01:30:57 +01:00
|
|
|
|
|
|
|
#ifdef USE_JIT_FPU
|
2019-09-20 18:39:27 +02:00
|
|
|
chkFPUJIT->setEnabled(changed_prefs.cachesize > 0);
|
|
|
|
chkFPUJIT->setSelected(changed_prefs.compfpu);
|
2018-02-03 01:30:57 +01:00
|
|
|
#else
|
2020-05-24 11:33:54 +02:00
|
|
|
chkFPUJIT->setSelected(false);
|
|
|
|
chkFPUJIT->setEnabled(false);
|
2018-02-03 01:30:57 +01:00
|
|
|
#endif
|
2017-09-18 17:36:45 +02:00
|
|
|
|
2019-09-20 18:39:27 +02:00
|
|
|
if (changed_prefs.m68k_speed == M68K_SPEED_7MHZ_CYCLES)
|
2017-01-29 12:03:00 +01:00
|
|
|
opt7Mhz->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.m68k_speed == M68K_SPEED_14MHZ_CYCLES)
|
2017-01-29 12:03:00 +01:00
|
|
|
opt14Mhz->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.m68k_speed == M68K_SPEED_25MHZ_CYCLES)
|
2020-05-22 13:08:45 +02:00
|
|
|
opt25Mhz->setSelected(true);
|
2019-09-20 18:39:27 +02:00
|
|
|
else if (changed_prefs.m68k_speed == -1)
|
2017-01-29 12:03:00 +01:00
|
|
|
optFastest->setSelected(true);
|
2020-05-22 13:08:45 +02:00
|
|
|
|
|
|
|
sldCpuIdle->setValue(changed_prefs.cpu_idle == 0 ? 0 : 12 - changed_prefs.cpu_idle / 15);
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|
2017-09-18 17:36:45 +02:00
|
|
|
|
2019-10-19 10:25:11 +02:00
|
|
|
bool HelpPanelCPU(std::vector<std::string>& helptext)
|
2017-09-18 17:36:45 +02:00
|
|
|
{
|
|
|
|
helptext.clear();
|
2017-12-21 13:53:45 +01:00
|
|
|
helptext.emplace_back("Select the required Amiga CPU (68000 - 68040).");
|
|
|
|
helptext.emplace_back("If you select 68020, you can choose between 24-bit addressing (68EC020) or 32-bit");
|
|
|
|
helptext.emplace_back("addressing (68020). The option \"More compatible\" is only available if 68000 or 68010");
|
|
|
|
helptext.emplace_back("is selected and emulates simple prefetch of the 68000. This may improve compatibility");
|
|
|
|
helptext.emplace_back("in few situations but is not required for most games and demos.");
|
2019-09-02 15:01:01 +02:00
|
|
|
helptext.emplace_back(" ");
|
2020-03-16 22:06:28 +01:00
|
|
|
helptext.emplace_back("JIT/JIT FPU enables the Just-in-time compiler. This may break compatibility in some games.");
|
|
|
|
helptext.emplace_back(" ");
|
2017-12-21 13:53:45 +01:00
|
|
|
helptext.emplace_back("The available FPU models depending on the selected CPU.");
|
|
|
|
helptext.emplace_back("The option \"More compatible\" activates more accurate rounding and compare of two floats.");
|
2019-09-02 15:01:01 +02:00
|
|
|
helptext.emplace_back(" ");
|
2020-03-16 22:06:28 +01:00
|
|
|
helptext.emplace_back("With \"CPU Speed\" you can choose the clock rate of the emulated Amiga.");
|
2020-05-22 13:08:45 +02:00
|
|
|
helptext.emplace_back("Use 7MHz for A500 or 14MHz for A1200 speed. Fastest Possible will give only the minimum time");
|
|
|
|
helptext.emplace_back("to the Chipset, using as much as possible for the CPU, which might result in dropping");
|
|
|
|
helptext.emplace_back("frames also.");
|
|
|
|
helptext.emplace_back(" ");
|
|
|
|
helptext.emplace_back("You can use the CPU Idle slider to set how much the CPU emulation should sleep when idle.");
|
|
|
|
helptext.emplace_back("This is useful to keep the system temperature down.");
|
2019-09-02 15:01:01 +02:00
|
|
|
helptext.emplace_back(" ");
|
2017-12-21 13:53:45 +01:00
|
|
|
helptext.emplace_back("In current version, you will not see a difference in the performance for 68020,");
|
|
|
|
helptext.emplace_back("68030 and 68040 CPUs. The CPU cycles for the opcodes are based on 68020. The different");
|
|
|
|
helptext.emplace_back("cycles for 68030 and 68040 may come in a later version.");
|
2017-09-18 17:36:45 +02:00
|
|
|
return true;
|
2017-09-27 00:15:50 +02:00
|
|
|
}
|