Merge branch 'master' into feature/ich2

This commit is contained in:
Jasmine Iwanek
2022-08-15 21:22:10 -04:00
16 changed files with 65 additions and 26 deletions

View File

@@ -649,10 +649,14 @@ load_monitor(int monitor_index)
if (p == NULL)
p = temp;
if (window_remember)
if (window_remember) {
sscanf(p, "%i, %i, %i, %i",
&monitor_settings[monitor_index].mon_window_x, &monitor_settings[monitor_index].mon_window_y,
&monitor_settings[monitor_index].mon_window_w, &monitor_settings[monitor_index].mon_window_h);
monitor_settings[monitor_index].mon_window_maximized = !!config_get_int(cat, "window_maximized", 0);
} else {
monitor_settings[monitor_index].mon_window_maximized = 0;
}
}
/* Load "Machine" section. */
@@ -2415,8 +2419,15 @@ save_monitor(int monitor_index)
monitor_settings[monitor_index].mon_window_w, monitor_settings[monitor_index].mon_window_h);
config_set_string(cat, "window_coordinates", temp);
} else
if (monitor_settings[monitor_index].mon_window_maximized != 0) {
config_set_int(cat, "window_maximized", monitor_settings[monitor_index].mon_window_maximized);
} else {
config_delete_var(cat, "window_maximized");
}
} else {
config_delete_var(cat, "window_coordinates");
config_delete_var(cat, "window_maximized");
}
}
/* Save "Machine" section. */

View File

@@ -1742,9 +1742,11 @@ cpu_CPUID(void)
break;
case 0x80000000:
EAX = 0x80000005;
EBX = ECX = EDX = 0;
break;
case 0x80000001:
EAX = CPUID + 0x100;
EBX = ECX = 0;
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_AMDSEP | CPUID_MMX | CPUID_3DNOW;
break;
case 0x80000002: /* Processor name string */
@@ -1760,6 +1762,7 @@ cpu_CPUID(void)
EDX = 0x00000000;
break;
case 0x80000005: /*Cache information*/
EAX = 0;
EBX = 0x02800140; /*TLBs*/
ECX = 0x20020220; /*L1 data cache*/
EDX = 0x20020220; /*L1 instruction cache*/
@@ -1785,9 +1788,11 @@ cpu_CPUID(void)
break;
case 0x80000000:
EAX = 0x80000006;
EBX = ECX = EDX = 0;
break;
case 0x80000001:
EAX = CPUID + 0x100;
EBX = ECX = 0;
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_AMDSEP | CPUID_MMX | CPUID_3DNOW;
break;
case 0x80000002: /* Processor name string */
@@ -1803,11 +1808,13 @@ cpu_CPUID(void)
EDX = 0x00000000;
break;
case 0x80000005: /* Cache information */
EAX = 0;
EBX = 0x02800140; /* TLBs */
ECX = 0x20020220; /*L1 data cache*/
EDX = 0x20020220; /*L1 instruction cache*/
break;
case 0x80000006: /* L2 Cache information */
EAX = EBX = EDX = 0;
ECX = 0x01004220;
break;
default:
@@ -1832,9 +1839,11 @@ cpu_CPUID(void)
break;
case 0x80000000:
EAX = 0x80000007;
EBX = ECX = EDX = 0;
break;
case 0x80000001:
EAX = CPUID + 0x100;
EBX = ECX = 0;
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_AMDSEP | CPUID_MMX | CPUID_3DNOW;
break;
case 0x80000002: /* Processor name string */
@@ -1850,17 +1859,20 @@ cpu_CPUID(void)
EDX = 0x00000000;
break;
case 0x80000005: /* Cache information */
EAX = 0;
EBX = 0x02800140; /* TLBs */
ECX = 0x20020220; /* L1 data cache */
EDX = 0x20020220; /* L1 instruction cache */
break;
case 0x80000006: /* L2 Cache information */
EAX = EBX = EDX = 0;
if (cpu_s->cpu_type == CPU_K6_3P)
ECX = 0x01004220;
else
ECX = 0x00804220;
break;
case 0x80000007: /* PowerNow information */
EAX = EBX = ECX = 0;
EDX = 7;
break;
default:

View File

@@ -31,14 +31,7 @@ static int opAAD(uint32_t fetchdat)
static int opAAM(uint32_t fetchdat)
{
int base = getbytef();
if (base == 0) {
x86de(NULL, 0);
return 1;
}
if (!cpu_isintel) base = 10;
if (!base || !cpu_isintel) base = 10;
AH = AL / base;
AL %= base;
setznp16(AX);

View File

@@ -124,6 +124,7 @@ typedef struct monitor_settings_t {
int mon_window_y;
int mon_window_w;
int mon_window_h;
int mon_window_maximized;
} monitor_settings_t;
#define MONITORS_NUM 2

View File

@@ -7391,7 +7391,7 @@ const machine_t machines[] = {
.min_multi = 1.5,
.max_multi = 1.5
},
.bus_flags = MACHINE_PS2_PCI,
.bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL,
.ram = {
.min = 2048,

View File

@@ -608,6 +608,7 @@ void HarddiskDialog::onExistingFileSelected(const QString &fileName) {
}
void HarddiskDialog::recalcSize() {
if (disallowSizeModifications) return;
uint64_t size = (static_cast<uint64_t>(cylinders_) * static_cast<uint64_t>(heads_) * static_cast<uint64_t>(sectors_)) << 9;
ui->lineEditSize->setText(QString::number(size >> 20));
}
@@ -731,6 +732,7 @@ void HarddiskDialog::on_comboBoxBus_currentIndexChanged(int index) {
}
void HarddiskDialog::on_lineEditSize_textEdited(const QString &text) {
disallowSizeModifications = true;
uint32_t size = text.toUInt();
/* This is needed to ensure VHD standard compliance. */
hdd_image_calc_chs(&cylinders_, &heads_, &sectors_, size);
@@ -742,6 +744,8 @@ void HarddiskDialog::on_lineEditSize_textEdited(const QString &text) {
checkAndAdjustCylinders();
checkAndAdjustHeads();
checkAndAdjustSectors();
disallowSizeModifications = false;
}
void HarddiskDialog::on_lineEditCylinders_textEdited(const QString &text) {

View File

@@ -49,6 +49,8 @@ private:
uint32_t max_sectors = 0;
uint32_t max_heads = 0;
uint32_t max_cylinders = 0;
bool disallowSizeModifications = false;
bool checkAndAdjustCylinders();
bool checkAndAdjustHeads();

View File

@@ -173,6 +173,7 @@ int main(int argc, char* argv[]) {
return 0;
}
bool startMaximized = window_remember && monitor_settings[0].mon_window_maximized;
fprintf(stderr, "Qt: version %s, platform \"%s\"\n", qVersion(), QApplication::platformName().toUtf8().data());
ProgSettings::loadTranslators(&app);
#ifdef Q_OS_WINDOWS
@@ -200,7 +201,12 @@ int main(int argc, char* argv[]) {
discord_load();
main_window = new MainWindow();
main_window->show();
if (startMaximized) {
main_window->showMaximized();
} else {
main_window->show();
}
app.installEventFilter(main_window);
#ifdef Q_OS_WINDOWS

View File

@@ -657,6 +657,9 @@ void MainWindow::initRendererMonitorSlot(int monitor_index)
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
}
if (monitor_settings[monitor_index].mon_window_maximized) {
secondaryRenderer->showMaximized();
}
secondaryRenderer->switchRenderer((RendererStack::Renderer)vid_api);
}
@@ -2070,6 +2073,10 @@ void MainWindow::changeEvent(QEvent* event)
}
#endif
QWidget::changeEvent(event);
if (isVisible()) {
monitor_settings[0].mon_window_maximized = isMaximized();
config_save();
}
}
void MainWindow::on_actionRenderer_options_triggered()

View File

@@ -254,7 +254,7 @@ OpenGLRenderer::initializeExtensions()
glBufferStorage = (PFNGLBUFFERSTORAGEEXTPROC_LOCAL) context->getProcAddress(context->hasExtension("GL_EXT_buffer_storage") ? "glBufferStorageEXT" : "glBufferStorage");
if (!glBufferStorage)
glBufferStorage = glBufferStorage = (PFNGLBUFFERSTORAGEEXTPROC_LOCAL) context->getProcAddress("glBufferStorage");
glBufferStorage = (PFNGLBUFFERSTORAGEEXTPROC_LOCAL) context->getProcAddress("glBufferStorage");
}
#endif
}

View File

@@ -77,8 +77,8 @@ private:
static constexpr int BUFFERBYTES = 16777216; /* Pixel is 4 bytes. */
static constexpr int BUFFERCOUNT = 3; /* How many buffers to use for pixel transfer (2-3 is commonly recommended). */
OpenGLOptions *options;
QTimer *renderTimer;
OpenGLOptions *options;
QString glslVersion;

View File

@@ -48,6 +48,7 @@
extern "C" {
#include <86box/86box.h>
#include <86box/config.h>
#include <86box/mouse.h>
#include <86box/plat.h>
#include <86box/video.h>
@@ -75,15 +76,10 @@ RendererStack::RendererStack(QWidget *parent, int monitor_index)
if (!mouse_type || (mouse_type[0] == '\0') || !stricmp(mouse_type, "auto")) {
if (QApplication::platformName().contains("wayland"))
strcpy(auto_mouse_type, "wayland");
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
else if (QApplication::platformName() == "eglfs")
strcpy(auto_mouse_type, "evdev");
else if (QApplication::platformName() == "xcb")
strcpy(auto_mouse_type, "xinput2");
# else
else if (QApplication::platformName() == "eglfs" || QApplication::platformName() == "xcb")
strcpy(auto_mouse_type, "evdev");
# endif
else
auto_mouse_type[0] = '\0';
mouse_type = auto_mouse_type;
@@ -486,3 +482,10 @@ void RendererStack::closeEvent(QCloseEvent* event)
main_window->close();
}
void RendererStack::changeEvent(QEvent *event)
{
if (m_monitor_index != 0 && isVisible()) {
monitor_settings[m_monitor_index].mon_window_maximized = isMaximized();
config_save();
}
}

View File

@@ -32,6 +32,7 @@ public:
void wheelEvent(QWheelEvent *event) override;
void leaveEvent(QEvent *event) override;
void closeEvent(QCloseEvent *event) override;
void changeEvent(QEvent* event) override;
void resizeEvent(QResizeEvent *event) override
{
onResize(event->size().width(), event->size().height());

View File

@@ -81,8 +81,7 @@ void xinput2_proc()
Window win;
win = DefaultRootWindow(disp);
// XIAllMasterDevices doesn't work for click-and-drag operations.
ximask.deviceid = XIAllDevices;
ximask.deviceid = XIAllMasterDevices;
ximask.mask_len = XIMaskLen(XI_LASTEVENT);
ximask.mask = (unsigned char*)calloc(ximask.mask_len, sizeof(unsigned char));
@@ -166,7 +165,7 @@ void xinput2_init()
qWarning() << "Cannot open current X11 display";
return;
}
auto event = 0, err = 0, minor = 0, major = 2;
auto event = 0, err = 0, minor = 1, major = 2;
if (XQueryExtension(disp, "XInputExtension", &xi2opcode, &event, &err))
{
if (XIQueryVersion(disp, &major, &minor) == Success)

View File

@@ -1654,16 +1654,16 @@ sb_2_init(const device_t *info)
io_sethandler(addr, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.write);
sb->opl.priv);
}
io_sethandler(addr + 8, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.write);
sb->opl.priv);
io_sethandler(0x0388, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.write);
sb->opl.priv);
}
if (sb->cms_enabled) {

View File

@@ -728,7 +728,7 @@ et4000_init(const device_t *info)
et4000_kasan_recalctimings, et4000_in, et4000_out,
NULL, NULL);
io_sethandler(0x03c0, 32,
et4000_in,NULL,NULL, et4000_out,NULL,NULL, dev);
et4000k_in,NULL,NULL, et4000k_out,NULL,NULL, dev);
io_sethandler(0x0250, 8,
et4000_kasan_in, NULL, NULL, et4000_kasan_out, NULL, NULL, dev);
io_sethandler(0x0258, 2,