Removed the Win32 UI and the legacy makefiles.
125
src/qt/86Box-qt.rc
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Application resource script for Windows.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
*
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2018-2019 David Hrdlička.
|
||||
* Copyright 2021 Laci bá'
|
||||
*/
|
||||
#define IN_RESOURCE_H
|
||||
#include <86box/version.h>
|
||||
#undef IN_RESOURCE_H
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include <windows.h>
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
|
||||
#ifndef NO_INCLUDE_MANIFEST
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 24
|
||||
//
|
||||
|
||||
1 24 MOVEABLE PURE "86Box.manifest"
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
#ifdef CMAKE
|
||||
#define ICON_PATH
|
||||
#else
|
||||
#define ICON_PATH "win/"
|
||||
#endif
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
// defining the icons depending on the build status
|
||||
#ifdef RELEASE_BUILD
|
||||
/* Icon by OBattler and laciba96 (green for release builds)*/
|
||||
10 ICON DISCARDABLE ICON_PATH "icons/86Box-green.ico"
|
||||
#elif BETA_BUILD
|
||||
/* Icon by OBattler and laciba96 (yellow for beta builds done by Jenkins)*/
|
||||
10 ICON DISCARDABLE ICON_PATH "icons/86Box-yellow.ico"
|
||||
#elif ALPHA_BUILD
|
||||
/* Icon by OBattler and laciba96 (red for alpha builds done by Jenkins)*/
|
||||
10 ICON DISCARDABLE ICON_PATH "icons/86Box-red.ico"
|
||||
#else
|
||||
/* Icon by OBattler and laciba96 (gray for builds of branches and from the git master)*/
|
||||
10 ICON DISCARDABLE ICON_PATH "icons/86Box-gray.ico"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM
|
||||
PRODUCTVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", EMU_NAME "\0"
|
||||
VALUE "FileDescription", EMU_NAME "\0"
|
||||
VALUE "FileVersion", EMU_VERSION "\0"
|
||||
VALUE "InternalName", EMU_NAME "\0"
|
||||
VALUE "LegalCopyright", "Copyright \xa9 2007-" COPYRIGHT_YEAR " " EMU_NAME " contributors\0"
|
||||
VALUE "OriginalFilename", EMU_NAME ".exe\0"
|
||||
VALUE "ProductName", EMU_NAME "\0"
|
||||
VALUE "ProductVersion", EMU_VERSION "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
49
src/qt/86Box.manifest
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="3.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="86Box.exe"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<application>
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2</dpiAwareness>
|
||||
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10/11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
@@ -189,7 +189,7 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
enable_language(RC)
|
||||
target_sources(86Box PUBLIC ../win/86Box-qt.rc)
|
||||
target_sources(86Box PUBLIC 86Box-qt.rc)
|
||||
target_sources(plat PRIVATE win_dynld.c)
|
||||
|
||||
# CMake 3.22 messed this up for clang/clang++
|
||||
@@ -198,8 +198,8 @@ if(WIN32)
|
||||
# MSVC linker adds its own manifest to the executable, which fails if
|
||||
# we include ours in 86Box.rc. We therefore need to pass the manifest
|
||||
# directly as as a source file, so the linker can use that instead.
|
||||
set_property(SOURCE ../win/86Box-qt.rc DIRECTORY .. PROPERTY COMPILE_DEFINITIONS NO_INCLUDE_MANIFEST)
|
||||
target_sources(86Box PRIVATE ../win/86Box.manifest)
|
||||
set_property(SOURCE 86Box-qt.rc DIRECTORY .. PROPERTY COMPILE_DEFINITIONS NO_INCLUDE_MANIFEST)
|
||||
target_sources(86Box PRIVATE 86Box.manifest)
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
@@ -217,11 +217,11 @@ else()
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
target_sources(plat PRIVATE ../win/win_opendir.c)
|
||||
target_sources(plat PRIVATE win_opendir.c)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(plat PRIVATE ../win/win_serial_passthrough.c ../win/win_netsocket.c)
|
||||
target_sources(plat PRIVATE win_serial_passthrough.c win_netsocket.c)
|
||||
else()
|
||||
target_sources(plat PRIVATE ../unix/unix_serial_passthrough.c ../unix/unix_netsocket.c)
|
||||
endif()
|
||||
|
||||
BIN
src/qt/assets/86Box-green.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
src/qt/assets/86box-rb.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
src/qt/assets/86box-red.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
src/qt/assets/86box-yellow.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
src/qt/assets/86box.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
src/qt/assets/status-paused.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
src/qt/assets/status-running.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/qt/icons/86Box-gray.ico
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
src/qt/icons/86Box-green.ico
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
src/qt/icons/86Box-red.ico
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
src/qt/icons/86Box-yellow.ico
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
src/qt/icons/acpi_shutdown.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cartridge.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cartridge_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cassette.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cassette_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cassette_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cassette_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_disabled.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/display.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_35.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_35_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_35_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_35_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_525.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_525_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_525_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_525_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_and_cdrom_drives.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_disabled.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/hard_disk.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/hard_disk_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/hard_reset.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/input_devices.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/machine.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo_disabled.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/network.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/network_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/network_empty.ico
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src/qt/icons/other_peripherals.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/other_removable_devices.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/pause.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/ports.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/run.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/send_cad.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/send_cae.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/settings.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/sound.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/storage_controllers.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip_disabled.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip_empty.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip_empty_active.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
@@ -199,13 +199,13 @@ main(int argc, char *argv[])
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
# ifdef RELEASE_BUILD
|
||||
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-green.ico"));
|
||||
app.setWindowIcon(QIcon(":/settings/qt/icons/86Box-green.ico"));
|
||||
# elif defined ALPHA_BUILD
|
||||
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-red.ico"));
|
||||
app.setWindowIcon(QIcon(":/settings/qt/icons/86Box-red.ico"));
|
||||
# elif defined BETA_BUILD
|
||||
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
|
||||
app.setWindowIcon(QIcon(":/settings/qt/icons/86Box-yellow.ico"));
|
||||
# else
|
||||
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-gray.ico"));
|
||||
app.setWindowIcon(QIcon(":/settings/qt/icons/86Box-gray.ico"));
|
||||
# endif
|
||||
|
||||
# ifdef Q_OS_UNIX
|
||||
|
||||
@@ -1704,13 +1704,13 @@ MainWindow::on_actionAbout_86Box_triggered()
|
||||
QDesktopServices::openUrl(QUrl("https://" EMU_SITE));
|
||||
});
|
||||
#ifdef RELEASE_BUILD
|
||||
msgBox.setIconPixmap(QIcon(":/settings/win/icons/86Box-green.ico").pixmap(32, 32));
|
||||
msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-green.ico").pixmap(32, 32));
|
||||
#elif defined ALPHA_BUILD
|
||||
msgBox.setIconPixmap(QIcon(":/settings/win/icons/86Box-red.ico").pixmap(32, 32));
|
||||
msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-red.ico").pixmap(32, 32));
|
||||
#elif defined BETA_BUILD
|
||||
msgBox.setIconPixmap(QIcon(":/settings/win/icons/86Box-yellow.ico").pixmap(32, 32));
|
||||
msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-yellow.ico").pixmap(32, 32));
|
||||
#else
|
||||
msgBox.setIconPixmap(QIcon(":/settings/win/icons/86Box-gray.ico").pixmap(32, 32));
|
||||
msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-gray.ico").pixmap(32, 32));
|
||||
#endif
|
||||
msgBox.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||
msgBox.exec();
|
||||
@@ -1869,7 +1869,7 @@ MainWindow::setSendKeyboardInput(bool enabled)
|
||||
void
|
||||
MainWindow::updateUiPauseState()
|
||||
{
|
||||
auto pause_icon = dopause ? QIcon(":/menuicons/win/icons/run.ico") : QIcon(":/menuicons/win/icons/pause.ico");
|
||||
auto pause_icon = dopause ? QIcon(":/menuicons/qt/icons/run.ico") : QIcon(":/menuicons/qt/icons/pause.ico");
|
||||
auto tooltip_text = dopause ? QString(tr("Resume execution")) : QString(tr("Pause execution"));
|
||||
ui->actionPause->setIcon(pause_icon);
|
||||
ui->actionPause->setToolTip(tooltip_text);
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
<action name="actionHard_Reset">
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/hard_reset.ico</normaloff>:/menuicons/win/icons/hard_reset.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/hard_reset.ico</normaloff>:/menuicons/qt/icons/hard_reset.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Hard Reset...</string>
|
||||
@@ -304,7 +304,7 @@
|
||||
<action name="actionCtrl_Alt_Del">
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/send_cad.ico</normaloff>:/menuicons/win/icons/send_cad.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/send_cad.ico</normaloff>:/menuicons/qt/icons/send_cad.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Ctrl+Alt+Del</string>
|
||||
@@ -325,7 +325,7 @@
|
||||
<action name="actionCtrl_Alt_Esc">
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/send_cae.ico</normaloff>:/menuicons/win/icons/send_cae.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/send_cae.ico</normaloff>:/menuicons/qt/icons/send_cae.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ctrl+Alt+&Esc</string>
|
||||
@@ -340,7 +340,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/pause.ico</normaloff>:/menuicons/win/icons/pause.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/pause.ico</normaloff>:/menuicons/qt/icons/pause.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Pause</string>
|
||||
@@ -357,7 +357,7 @@
|
||||
<action name="actionSettings">
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/settings.ico</normaloff>:/menuicons/win/icons/settings.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/settings.ico</normaloff>:/menuicons/qt/icons/settings.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Settings...</string>
|
||||
@@ -768,7 +768,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/win/icons/acpi_shutdown.ico</normaloff>:/menuicons/win/icons/acpi_shutdown.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/acpi_shutdown.ico</normaloff>:/menuicons/qt/icons/acpi_shutdown.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ACPI shutdown</string>
|
||||
|
||||
@@ -46,7 +46,7 @@ ProgSettings::getIconSetPath()
|
||||
{
|
||||
if (iconset_to_qt.isEmpty()) {
|
||||
// Always include default bundled icons
|
||||
iconset_to_qt.insert("", ":/settings/win/icons");
|
||||
iconset_to_qt.insert("", ":/settings/qt/icons");
|
||||
// Walk rom_paths to get the candidates
|
||||
for (rom_path_t *emu_rom_path = &rom_paths; emu_rom_path != nullptr; emu_rom_path = emu_rom_path->next) {
|
||||
// Check for icons subdir in each candidate
|
||||
|
||||
@@ -206,7 +206,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
ui->checkBoxCassette->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->checkBoxLbaEnhancer->setEnabled(device_available(&lba_enhancer_device));
|
||||
ui->checkBoxLbaEnhancer->setChecked(lba_enhancer_enabled > 0 && device_available(&lba_enhancer_device));
|
||||
ui->pushButtonConfigureLbaEnhancer->setEnabled(ui->checkBoxLbaEnhancer->isChecked());
|
||||
}
|
||||
|
||||
195
src/qt/win_netsocket.c
Normal file
@@ -0,0 +1,195 @@
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/log.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat_netsocket.h>
|
||||
#include <86box/ui.h>
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <winerror.h>
|
||||
|
||||
SOCKET plat_netsocket_create(int type)
|
||||
{
|
||||
SOCKET socket = -1;
|
||||
u_long yes = 1;
|
||||
|
||||
if (type != NET_SOCKET_TCP)
|
||||
return -1;
|
||||
|
||||
socket = WSASocketA(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
|
||||
if (socket == INVALID_SOCKET)
|
||||
return -1;
|
||||
|
||||
ioctlsocket(socket, FIONBIO, &yes);
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
SOCKET plat_netsocket_create_server(int type, unsigned short port)
|
||||
{
|
||||
struct sockaddr_in sock_addr;
|
||||
SOCKET socket = -1;
|
||||
u_long yes = 1;
|
||||
|
||||
if (type != NET_SOCKET_TCP)
|
||||
return -1;
|
||||
|
||||
socket = WSASocketA(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
|
||||
if (socket == INVALID_SOCKET)
|
||||
return -1;
|
||||
|
||||
memset(&sock_addr, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
sock_addr.sin_family = AF_INET;
|
||||
sock_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
sock_addr.sin_port = htons(port);
|
||||
|
||||
if (bind(socket, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
|
||||
plat_netsocket_close(socket);
|
||||
return (SOCKET)-1;
|
||||
}
|
||||
|
||||
if (listen(socket, 5) == SOCKET_ERROR) {
|
||||
plat_netsocket_close(socket);
|
||||
return (SOCKET)-1;
|
||||
}
|
||||
|
||||
ioctlsocket(socket, FIONBIO, &yes);
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
void plat_netsocket_close(SOCKET socket)
|
||||
{
|
||||
closesocket((SOCKET)socket);
|
||||
}
|
||||
|
||||
SOCKET plat_netsocket_accept(SOCKET socket)
|
||||
{
|
||||
SOCKET clientsocket = accept(socket, NULL, NULL);
|
||||
|
||||
if (clientsocket == INVALID_SOCKET)
|
||||
return -1;
|
||||
|
||||
return clientsocket;
|
||||
}
|
||||
|
||||
int plat_netsocket_connected(SOCKET socket)
|
||||
{
|
||||
struct sockaddr addr;
|
||||
socklen_t len = sizeof(struct sockaddr);
|
||||
fd_set wrfds, exfds;
|
||||
struct timeval tv;
|
||||
int res = SOCKET_ERROR;
|
||||
int status = 0;
|
||||
int optlen = 4;
|
||||
|
||||
FD_ZERO(&wrfds);
|
||||
FD_ZERO(&exfds);
|
||||
FD_SET(socket, &wrfds);
|
||||
FD_SET(socket, &exfds);
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
res = select(socket + 1, NULL, &wrfds, &exfds, &tv);
|
||||
|
||||
if (res == SOCKET_ERROR)
|
||||
return -1;
|
||||
|
||||
if (res >= 1 && FD_ISSET(socket, &exfds)) {
|
||||
res = getsockopt(socket, SOL_SOCKET, SO_ERROR, (char*)&status, &optlen);
|
||||
pclog("Socket error %d\n", status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (res == 0 || !(res >= 1 && FD_ISSET(socket, &wrfds)))
|
||||
return 0;
|
||||
|
||||
res = getsockopt(socket, SOL_SOCKET, SO_ERROR, (char*)&status, &optlen);
|
||||
|
||||
if (res == SOCKET_ERROR)
|
||||
return -1;
|
||||
|
||||
if (status != 0)
|
||||
return -1;
|
||||
|
||||
if (getpeername(socket, &addr, &len) == SOCKET_ERROR)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int plat_netsocket_connect(SOCKET socket, const char* hostname, unsigned short port)
|
||||
{
|
||||
struct sockaddr_in sock_addr;
|
||||
int res = -1;
|
||||
|
||||
sock_addr.sin_family = AF_INET;
|
||||
sock_addr.sin_addr.s_addr = inet_addr(hostname);
|
||||
sock_addr.sin_port = htons(port);
|
||||
|
||||
if (sock_addr.sin_addr.s_addr == INADDR_ANY || sock_addr.sin_addr.s_addr == INADDR_NONE) {
|
||||
struct hostent *hp;
|
||||
|
||||
hp = gethostbyname(hostname);
|
||||
|
||||
if (hp)
|
||||
memcpy(&sock_addr.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = connect(socket, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr_in));
|
||||
|
||||
if (res == SOCKET_ERROR) {
|
||||
int error = WSAGetLastError();
|
||||
|
||||
if (error == WSAEISCONN || error == WSAEWOULDBLOCK)
|
||||
return 0;
|
||||
|
||||
res = -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int plat_netsocket_send(SOCKET socket, const unsigned char* data, unsigned int size, int *wouldblock)
|
||||
{
|
||||
int res = send(socket, (const char*)data, size, 0);
|
||||
|
||||
if (res == SOCKET_ERROR) {
|
||||
int error = WSAGetLastError();
|
||||
|
||||
if (wouldblock)
|
||||
*wouldblock = !!(error == WSAEWOULDBLOCK);
|
||||
|
||||
return -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int plat_netsocket_receive(SOCKET socket, unsigned char* data, unsigned int size, int *wouldblock)
|
||||
{
|
||||
int res = recv(socket, (char*)data, size, 0);
|
||||
|
||||
if (res == SOCKET_ERROR) {
|
||||
int error = WSAGetLastError();
|
||||
|
||||
if (wouldblock)
|
||||
*wouldblock = !!(error == WSAEWOULDBLOCK);
|
||||
|
||||
return -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
178
src/qt/win_opendir.c
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation POSIX OpenDir(3) and friends for Win32 API.
|
||||
*
|
||||
* Based on old original code @(#)dir_win32.c 1.2.0 2007/04/19
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 1998-2007 MicroWalt Corporation
|
||||
* Copyright 2017 Fred N. van Kempen
|
||||
* Copyright 2021-2023 Jasmine Iwanek.
|
||||
*/
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dir.h>
|
||||
|
||||
#define SUFFIX "\\*"
|
||||
#define FINDATA struct _finddata_t
|
||||
#define FINDFIRST _findfirst
|
||||
#define FINDNEXT _findnext
|
||||
|
||||
/* Open a directory. */
|
||||
DIR *
|
||||
opendir(const char *name)
|
||||
{
|
||||
DIR *p;
|
||||
|
||||
/* Create a new control structure. */
|
||||
p = (DIR *) malloc(sizeof(DIR));
|
||||
if (p == NULL)
|
||||
return (NULL);
|
||||
memset(p, 0x00, sizeof(DIR));
|
||||
p->flags = (DIR_F_LOWER | DIR_F_SANE);
|
||||
p->offset = 0;
|
||||
p->sts = 0;
|
||||
|
||||
/* Create a work area. */
|
||||
p->dta = (char *) malloc(sizeof(FINDATA));
|
||||
if (p->dta == NULL) {
|
||||
free(p);
|
||||
return (NULL);
|
||||
}
|
||||
memset(p->dta, 0x00, sizeof(struct _finddata_t));
|
||||
|
||||
/* Add search filespec. */
|
||||
strcpy(p->dir, name);
|
||||
strcat(p->dir, SUFFIX);
|
||||
|
||||
/* Special case: flag if we are in the root directory. */
|
||||
if (strlen(p->dir) == 3)
|
||||
p->flags |= DIR_F_ISROOT;
|
||||
|
||||
/* Start the searching by doing a FindFirst. */
|
||||
p->handle = FINDFIRST(p->dir, (FINDATA *) p->dta);
|
||||
if (p->handle < 0L) {
|
||||
free(p->dta);
|
||||
free(p);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* All OK. */
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Close an open directory. */
|
||||
int
|
||||
closedir(DIR *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
return 0;
|
||||
|
||||
_findclose(p->handle);
|
||||
|
||||
if (p->dta != NULL)
|
||||
free(p->dta);
|
||||
free(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the next entry from a directory.
|
||||
* Note that the DOS (FAT), Windows (FAT, FAT32) and Windows NTFS
|
||||
* file systems do not have a root directory containing the UNIX-
|
||||
* standard "." and ".." entries. Many applications do assume
|
||||
* this anyway, so we simply fake these entries.
|
||||
*/
|
||||
struct dirent *
|
||||
readdir(DIR *p)
|
||||
{
|
||||
FINDATA *ffp;
|
||||
|
||||
if (p == NULL || p->sts == 1)
|
||||
return (NULL);
|
||||
|
||||
/* Format structure with current data. */
|
||||
ffp = (FINDATA *) p->dta;
|
||||
p->dent.d_ino = 1L;
|
||||
p->dent.d_off = p->offset++;
|
||||
switch (p->offset) {
|
||||
case 1: /* . */
|
||||
strncpy(p->dent.d_name, ".", MAXNAMLEN + 1);
|
||||
p->dent.d_reclen = 1;
|
||||
break;
|
||||
|
||||
case 2: /* .. */
|
||||
strncpy(p->dent.d_name, "..", MAXNAMLEN + 1);
|
||||
p->dent.d_reclen = 2;
|
||||
break;
|
||||
|
||||
default: /* regular entry. */
|
||||
strncpy(p->dent.d_name, ffp->name, MAXNAMLEN + 1);
|
||||
p->dent.d_reclen = (char) strlen(p->dent.d_name);
|
||||
}
|
||||
|
||||
/* Read next entry. */
|
||||
p->sts = 0;
|
||||
|
||||
/* Fake the "." and ".." entries here.. */
|
||||
if ((p->flags & DIR_F_ISROOT) && (p->offset <= 2))
|
||||
return (&(p->dent));
|
||||
|
||||
/* Get the next entry if we did not fake the above. */
|
||||
if (FINDNEXT(p->handle, ffp) < 0)
|
||||
p->sts = 1;
|
||||
|
||||
return (&(p->dent));
|
||||
}
|
||||
|
||||
/* Report current position within the directory. */
|
||||
long
|
||||
telldir(DIR *p)
|
||||
{
|
||||
return (p->offset);
|
||||
}
|
||||
|
||||
void
|
||||
seekdir(DIR *p, long newpos)
|
||||
{
|
||||
short pos;
|
||||
|
||||
/* First off, rewind to start of directory. */
|
||||
p->handle = FINDFIRST(p->dir, (FINDATA *) p->dta);
|
||||
if (p->handle < 0L) {
|
||||
p->sts = 1;
|
||||
return;
|
||||
}
|
||||
p->offset = 0;
|
||||
p->sts = 0;
|
||||
|
||||
/* If we are rewinding, that's all... */
|
||||
if (newpos == 0L)
|
||||
return;
|
||||
|
||||
/* Nope.. read entries until we hit the right spot. */
|
||||
pos = (short) newpos;
|
||||
while (p->offset != pos) {
|
||||
p->offset++;
|
||||
if (FINDNEXT(p->handle, (FINDATA *) p->dta) < 0) {
|
||||
p->sts = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
238
src/qt/win_serial_passthrough.c
Normal file
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Definitions for platform specific serial to host passthrough
|
||||
*
|
||||
*
|
||||
* Authors: Andreas J. Reichel <webmaster@6th-dimension.com>,
|
||||
* Jasmine Iwanek <jasmine@iwanek.co.uk>
|
||||
*
|
||||
* Copyright 2021 Andreas J. Reichel
|
||||
* Copyright 2021-2023 Jasmine Iwanek
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/log.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/serial_passthrough.h>
|
||||
#include <86box/plat_serial_passthrough.h>
|
||||
#include <86box/ui.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define LOG_PREFIX "serial_passthrough: "
|
||||
|
||||
void
|
||||
plat_serpt_close(void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
#if 0
|
||||
fclose(dev->master_fd);
|
||||
#endif
|
||||
FlushFileBuffers((HANDLE) dev->master_fd);
|
||||
if (dev->mode == SERPT_MODE_VCON)
|
||||
DisconnectNamedPipe((HANDLE) dev->master_fd);
|
||||
if (dev->mode == SERPT_MODE_HOSTSER) {
|
||||
SetCommState((HANDLE) dev->master_fd, (DCB *) dev->backend_priv);
|
||||
free(dev->backend_priv);
|
||||
}
|
||||
CloseHandle((HANDLE) dev->master_fd);
|
||||
}
|
||||
|
||||
static void
|
||||
plat_serpt_write_vcon(serial_passthrough_t *dev, uint8_t data)
|
||||
{
|
||||
#if 0
|
||||
fd_set wrfds;
|
||||
int res;
|
||||
#endif
|
||||
|
||||
/* We cannot use select here, this would block the hypervisor! */
|
||||
#if 0
|
||||
FD_ZERO(&wrfds);
|
||||
FD_SET(ctx->master_fd, &wrfds);
|
||||
|
||||
res = select(ctx->master_fd + 1, NULL, &wrfds, NULL, NULL);
|
||||
|
||||
if (res <= 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* just write it out */
|
||||
#if 0
|
||||
fwrite(dev->master_fd, &data, 1);
|
||||
#endif
|
||||
DWORD bytesWritten = 0;
|
||||
WriteFile((HANDLE) dev->master_fd, &data, 1, &bytesWritten, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
plat_serpt_set_params(void *priv)
|
||||
{
|
||||
const serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
if (dev->mode == SERPT_MODE_HOSTSER) {
|
||||
DCB serialattr = {};
|
||||
GetCommState((HANDLE) dev->master_fd, &serialattr);
|
||||
#define BAUDRATE_RANGE(baud_rate, min, max) \
|
||||
if (baud_rate >= min && baud_rate < max) { \
|
||||
serialattr.BaudRate = min; \
|
||||
}
|
||||
|
||||
BAUDRATE_RANGE(dev->baudrate, 110, 300);
|
||||
BAUDRATE_RANGE(dev->baudrate, 300, 600);
|
||||
BAUDRATE_RANGE(dev->baudrate, 600, 1200);
|
||||
BAUDRATE_RANGE(dev->baudrate, 1200, 2400);
|
||||
BAUDRATE_RANGE(dev->baudrate, 2400, 4800);
|
||||
BAUDRATE_RANGE(dev->baudrate, 4800, 9600);
|
||||
BAUDRATE_RANGE(dev->baudrate, 9600, 14400);
|
||||
BAUDRATE_RANGE(dev->baudrate, 14400, 19200);
|
||||
BAUDRATE_RANGE(dev->baudrate, 19200, 38400);
|
||||
BAUDRATE_RANGE(dev->baudrate, 38400, 57600);
|
||||
BAUDRATE_RANGE(dev->baudrate, 57600, 115200);
|
||||
BAUDRATE_RANGE(dev->baudrate, 115200, 0xFFFFFFFF);
|
||||
|
||||
serialattr.ByteSize = dev->data_bits;
|
||||
serialattr.StopBits = (dev->serial->lcr & 0x04) ? TWOSTOPBITS : ONESTOPBIT;
|
||||
if (!(dev->serial->lcr & 0x08)) {
|
||||
serialattr.fParity = 0;
|
||||
serialattr.Parity = NOPARITY;
|
||||
} else {
|
||||
serialattr.fParity = 1;
|
||||
if (dev->serial->lcr & 0x20) {
|
||||
serialattr.Parity = MARKPARITY + !!(dev->serial->lcr & 0x10);
|
||||
} else {
|
||||
serialattr.Parity = ODDPARITY + !!(dev->serial->lcr & 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
SetCommState((HANDLE) dev->master_fd, &serialattr);
|
||||
#undef BAUDRATE_RANGE
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
plat_serpt_write(void *priv, uint8_t data)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
switch (dev->mode) {
|
||||
case SERPT_MODE_VCON:
|
||||
case SERPT_MODE_HOSTSER:
|
||||
plat_serpt_write_vcon(dev, data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
plat_serpt_read_vcon(serial_passthrough_t *dev, uint8_t *data)
|
||||
{
|
||||
DWORD bytesRead = 0;
|
||||
ReadFile((HANDLE) dev->master_fd, data, 1, &bytesRead, NULL);
|
||||
return !!bytesRead;
|
||||
}
|
||||
|
||||
int
|
||||
plat_serpt_read(void *priv, uint8_t *data)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
int res = 0;
|
||||
|
||||
switch (dev->mode) {
|
||||
case SERPT_MODE_VCON:
|
||||
case SERPT_MODE_HOSTSER:
|
||||
res = plat_serpt_read_vcon(dev, data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
open_pseudo_terminal(serial_passthrough_t *dev)
|
||||
{
|
||||
char ascii_pipe_name[1024] = { 0 };
|
||||
strncpy(ascii_pipe_name, dev->named_pipe, sizeof(ascii_pipe_name));
|
||||
ascii_pipe_name[1023] = '\0';
|
||||
dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL);
|
||||
if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) {
|
||||
wchar_t errorMsg[1024] = { 0 };
|
||||
wchar_t finalMsg[1024] = { 0 };
|
||||
DWORD error = GetLastError();
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errorMsg, 1024, NULL);
|
||||
swprintf(finalMsg, 1024, L"Named Pipe (server, named_pipe=\"%hs\", port=COM%d): %ls\n", ascii_pipe_name, dev->port + 1, errorMsg);
|
||||
ui_msgbox(MBX_ERROR | MBX_FATAL, finalMsg);
|
||||
return 0;
|
||||
}
|
||||
pclog("Named Pipe @ %s\n", ascii_pipe_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
open_host_serial_port(serial_passthrough_t *dev)
|
||||
{
|
||||
COMMTIMEOUTS timeouts = {
|
||||
.ReadIntervalTimeout = MAXDWORD,
|
||||
.ReadTotalTimeoutConstant = 0,
|
||||
.ReadTotalTimeoutMultiplier = 0,
|
||||
.WriteTotalTimeoutMultiplier = 0,
|
||||
.WriteTotalTimeoutConstant = 1000
|
||||
};
|
||||
DCB *serialattr = calloc(1, sizeof(DCB));
|
||||
if (!serialattr)
|
||||
return 0;
|
||||
dev->master_fd = (intptr_t) CreateFileA(dev->host_serial_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL);
|
||||
if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) {
|
||||
free(serialattr);
|
||||
return 0;
|
||||
}
|
||||
if (!SetCommTimeouts((HANDLE) dev->master_fd, &timeouts)) {
|
||||
pclog(LOG_PREFIX "error setting COM port timeouts.\n");
|
||||
CloseHandle((HANDLE) dev->master_fd);
|
||||
free(serialattr);
|
||||
return 0;
|
||||
}
|
||||
GetCommState((HANDLE) dev->master_fd, serialattr);
|
||||
dev->backend_priv = serialattr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
plat_serpt_open_device(void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
switch (dev->mode) {
|
||||
case SERPT_MODE_VCON:
|
||||
if (open_pseudo_terminal(dev)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case SERPT_MODE_HOSTSER:
|
||||
if (open_host_serial_port(dev)) {
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||