Merge remote-tracking branch 'upstream/master' into qt-wacom-serial

This commit is contained in:
Cacodemon345
2023-02-17 14:26:15 +06:00
8 changed files with 131 additions and 24 deletions

View File

@@ -168,6 +168,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id += 2;
break;
case CONFIG_FNAME:
case CONFIG_STRING:
wstr = config_get_wstring((char *) config_device.name,
(char *) config->name, 0);
if (wstr)
@@ -288,6 +289,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id += 2;
break;
case CONFIG_FNAME:
case CONFIG_STRING:
str = config_get_string((char *) config_device.name,
(char *) config->name, (char *) "");
SendMessage(h, WM_GETTEXT, 511, (LPARAM) s);
@@ -397,6 +399,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id += 2;
break;
case CONFIG_FNAME:
case CONFIG_STRING:
SendMessage(h, WM_GETTEXT, 511, (LPARAM) ws);
config_set_wstring((char *) config_device.name, (char *) config->name, ws);
@@ -455,6 +458,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case CONFIG_MIDI_OUT:
case CONFIG_MIDI_IN:
case CONFIG_SPINNER:
case CONFIG_STRING:
id += 2;
break;
case CONFIG_FNAME:
@@ -640,6 +644,52 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst)
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
*data++ = 0; /* no creation data */
if (((uintptr_t) data) & 2)
data++;
y += 20;
break;
case CONFIG_STRING:
/*Editable Text*/
item = (DLGITEMTEMPLATE *) data;
item->x = 70;
item->y = y;
item->id = id++;
item->cx = 140;
item->cy = 14;
item->style = WS_CHILD | WS_VISIBLE | ES_READONLY;
item->dwExtendedStyle = WS_EX_CLIENTEDGE;
data = (uint16_t *) (item + 1);
*data++ = 0xFFFF;
*data++ = 0x0081; /* edit text class */
data += MultiByteToWideChar(CP_ACP, 0, "", -1, data, 256);
*data++ = 0; /* no creation data */
if (((uintptr_t) data) & 2)
data++;
/*Static text*/
item = (DLGITEMTEMPLATE *) data;
item->x = 10;
item->y = y + 2;
item->id = id++;
item->cx = 60;
item->cy = 20;
item->style = WS_CHILD | WS_VISIBLE;
data = (uint16_t *) (item + 1);
*data++ = 0xFFFF;
*data++ = 0x0082; /* static class */
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
*data++ = 0; /* no creation data */
if (((uintptr_t) data) & 2)
data++;

View File

@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/log.h>
@@ -30,6 +31,7 @@
#include <86box/device.h>
#include <86box/serial_passthrough.h>
#include <86box/plat_serial_passthrough.h>
#include <86box/ui.h>
#include <windows.h>
@@ -161,9 +163,15 @@ static int
open_pseudo_terminal(serial_passthrough_t *dev)
{
char ascii_pipe_name[1024] = { 0 };
snprintf(ascii_pipe_name, sizeof(ascii_pipe_name), "\\\\.\\pipe\\86Box\\%s", vm_name);
strncpy(ascii_pipe_name, dev->named_pipe, 1023);
dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 32, 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);