Allow one to enable/disable unit tester exit

Memo to self: Hardware renderers often exit in a silent segfault. Look into this at some point.
This commit is contained in:
GreaseMonkey
2024-01-08 13:48:33 +13:00
parent 5a2e3611d9
commit 276e43428e
4 changed files with 40 additions and 4 deletions

View File

@@ -114,10 +114,18 @@ static const struct unittester_state unittester_defaults = {
.cmd_id = UT_CMD_NOOP,
};
static const device_config_t unittester_config[] = {
{ .name = "exit_enabled",
.description = "Enable 0x04 \"Exit 86Box\" command",
.type = CONFIG_BINARY,
.default_int = 1,
.default_string = "" },
{ .type = CONFIG_END }
};
/* Kept separate, as we will be reusing this object */
static bitmap_t *unittester_screen_buffer = NULL;
/* FIXME: This needs a config option! --GM */
static bool unittester_exit_enabled = true;
#ifdef ENABLE_UNITTESTER_LOG
@@ -572,10 +580,13 @@ unittester_trigger_write(UNUSED(uint16_t port), uint8_t val, UNUSED(void *priv))
static void *
unittester_init(UNUSED(const device_t *info))
{
unittester = (struct unittester_state) unittester_defaults;
unittester_exit_enabled = !!device_get_config_int("exit_enabled");
if (unittester_screen_buffer == NULL)
unittester_screen_buffer = create_bitmap(2048, 2048);
unittester = (struct unittester_state) unittester_defaults;
io_sethandler(unittester.trigger_port, 1, NULL, NULL, NULL, unittester_trigger_write, NULL, NULL, NULL);
unittester_log("[UT] 86Box Unit Tester initialised\n");
@@ -611,5 +622,5 @@ const device_t unittester_device = {
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
.config = unittester_config,
};

View File

@@ -23,6 +23,7 @@ extern "C" {
#include <86box/machine.h>
#include <86box/isamem.h>
#include <86box/isartc.h>
#include <86box/unittester.h>
}
#include "qt_deviceconfig.hpp"
@@ -199,3 +200,9 @@ SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard4->currentData().toInt()), 4, qobject_cast<Settings *>(Settings::settings));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureUT_clicked()
{
DeviceConfig::ConfigureDevice(&unittester_device);
}

View File

@@ -30,6 +30,7 @@ private slots:
void on_comboBoxCard1_currentIndexChanged(int index);
void on_pushButtonConfigureRTC_clicked();
void on_comboBoxRTC_currentIndexChanged(int index);
void on_pushButtonConfigureUT_clicked();
private:
Ui::SettingsOtherPeripherals *ui;

View File

@@ -190,10 +190,27 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBoxUnitTester">
<property name="text">
<string>86Box unit tester</string>
<string>86Box Unit Tester</string>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonConfigureUT">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>