Merge branch 'master' of ssh://github.com/86Box/86Box

This commit is contained in:
RichardG867
2022-09-05 16:35:04 -03:00
7 changed files with 34 additions and 15 deletions

View File

@@ -23,7 +23,9 @@
#ifndef PLAT_WIN_H #ifndef PLAT_WIN_H
#define PLAT_WIN_H #define PLAT_WIN_H
#ifndef UNICODE
#define UNICODE #define UNICODE
#endif
#define BITMAP WINDOWS_BITMAP #define BITMAP WINDOWS_BITMAP
#if 0 #if 0
# ifdef _WIN32_WINNT # ifdef _WIN32_WINNT

View File

@@ -329,9 +329,11 @@ net_slirp_thread(void *priv)
break; break;
case NET_EVENT_TX: case NET_EVENT_TX:
int packets = network_tx_popv(slirp->card, slirp->pkt_tx_v, SLIRP_PKT_BATCH); {
for (int i = 0; i < packets; i++) { int packets = network_tx_popv(slirp->card, slirp->pkt_tx_v, SLIRP_PKT_BATCH);
net_slirp_in(slirp, slirp->pkt_tx_v[i].data, slirp->pkt_tx_v[i].len); for (int i = 0; i < packets; i++) {
net_slirp_in(slirp, slirp->pkt_tx_v[i].data, slirp->pkt_tx_v[i].len);
}
} }
break; break;

View File

@@ -21,7 +21,10 @@
#include "qt_hardwarerenderer.hpp" #include "qt_hardwarerenderer.hpp"
#include <QApplication> #include <QApplication>
#include <QVector2D> #include <QVector2D>
#include <QOpenGLPixelTransferOptions>
#include <atomic> #include <atomic>
#include <cstdint>
#include <vector> #include <vector>
extern "C" { extern "C" {
@@ -196,7 +199,14 @@ void HardwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) {
return; return;
} }
m_context->makeCurrent(this); m_context->makeCurrent(this);
m_texture->setData(QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::UInt8, (const void*)imagebufs[buf_idx].get()); #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
m_texture->setData(x, y, 0, w, h, 0, QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::UInt8, (const void*)((uintptr_t)imagebufs[buf_idx].get() + (uintptr_t)(2048 * 4 * y + x * 4)), &m_transferOptions);
#else
m_texture->bind();
glPixelStorei(GL_UNPACK_ROW_LENGTH, 2048);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::UInt8, (const void*)((uintptr_t)imagebufs[buf_idx].get() + (uintptr_t)(2048 * 4 * y + x * 4)));
m_texture->release();
#endif
buf_usage[buf_idx].clear(); buf_usage[buf_idx].clear();
source.setRect(x, y, w, h); source.setRect(x, y, w, h);
if (origSource != source) onResize(this->width(), this->height()); if (origSource != source) onResize(this->width(), this->height());

View File

@@ -8,6 +8,7 @@
#include <QOpenGLShader> #include <QOpenGLShader>
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
#include <QOpenGLTextureBlitter> #include <QOpenGLTextureBlitter>
#include <QOpenGLPixelTransferOptions>
#include <QPainter> #include <QPainter>
#include <QEvent> #include <QEvent>
#include <QKeyEvent> #include <QKeyEvent>
@@ -38,6 +39,8 @@ private:
QOpenGLTextureBlitter* m_blt{nullptr}; QOpenGLTextureBlitter* m_blt{nullptr};
QOpenGLBuffer m_vbo[2]; QOpenGLBuffer m_vbo[2];
QOpenGLVertexArrayObject m_vao; QOpenGLVertexArrayObject m_vao;
QOpenGLPixelTransferOptions m_transferOptions;
public: public:
enum class RenderType { enum class RenderType {
OpenGL, OpenGL,
@@ -67,6 +70,8 @@ public:
parentWidget = parent; parentWidget = parent;
setRenderType(rtype); setRenderType(rtype);
m_transferOptions.setRowLength(2048);
m_context = new QOpenGLContext(); m_context = new QOpenGLContext();
m_context->setFormat(format()); m_context->setFormat(format());
m_context->create(); m_context->create();

View File

@@ -293,7 +293,7 @@ int main(int argc, char* argv[]) {
QObject::connect(&discordupdate, &QTimer::timeout, &app, [] { QObject::connect(&discordupdate, &QTimer::timeout, &app, [] {
discord_run_callbacks(); discord_run_callbacks();
}); });
discordupdate.start(0); discordupdate.start(1000);
} }
/* Initialize the rendering window, or fullscreen. */ /* Initialize the rendering window, or fullscreen. */

View File

@@ -205,15 +205,15 @@ void joystick_get_capabilities(raw_joystick_t* rawjoy, plat_joystick_t* joy) {
void joystick_get_device_name(raw_joystick_t* rawjoy, plat_joystick_t* joy, PRID_DEVICE_INFO info) { void joystick_get_device_name(raw_joystick_t* rawjoy, plat_joystick_t* joy, PRID_DEVICE_INFO info) {
UINT size = 0; UINT size = 0;
char *device_name = NULL; WCHAR *device_name = NULL;
WCHAR device_desc_wide[200] = {0}; WCHAR device_desc_wide[200] = {0};
GetRawInputDeviceInfoA(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size); GetRawInputDeviceInfoW(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size);
device_name = calloc(size, sizeof(char)); device_name = calloc(size, sizeof(WCHAR));
if (GetRawInputDeviceInfoA(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size) <= 0) if (GetRawInputDeviceInfoW(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size) <= 0)
fatal("joystick_get_capabilities: Failed to get device name.\n"); fatal("joystick_get_capabilities: Failed to get device name.\n");
HANDLE hDevObj = CreateFile(device_name, GENERIC_READ | GENERIC_WRITE, HANDLE hDevObj = CreateFileW(device_name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevObj) { if (hDevObj) {
HidD_GetProductString(hDevObj, device_desc_wide, sizeof(WCHAR) * 200); HidD_GetProductString(hDevObj, device_desc_wide, sizeof(WCHAR) * 200);

View File

@@ -220,15 +220,15 @@ void
joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_t *joy, PRID_DEVICE_INFO info) joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_t *joy, PRID_DEVICE_INFO info)
{ {
UINT size = 0; UINT size = 0;
char *device_name = NULL; WCHAR *device_name = NULL;
WCHAR device_desc_wide[200] = { 0 }; WCHAR device_desc_wide[200] = { 0 };
GetRawInputDeviceInfoA(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size); GetRawInputDeviceInfoW(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size);
device_name = calloc(size, sizeof(char)); device_name = calloc(size, sizeof(WCHAR));
if (GetRawInputDeviceInfoA(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size) <= 0) if (GetRawInputDeviceInfoW(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size) <= 0)
fatal("joystick_get_capabilities: Failed to get device name.\n"); fatal("joystick_get_capabilities: Failed to get device name.\n");
HANDLE hDevObj = CreateFile(device_name, GENERIC_READ | GENERIC_WRITE, HANDLE hDevObj = CreateFileW(device_name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevObj) { if (hDevObj) {
HidD_GetProductString(hDevObj, device_desc_wide, sizeof(WCHAR) * 200); HidD_GetProductString(hDevObj, device_desc_wide, sizeof(WCHAR) * 200);