From 9e5697126b08ffb6329a40151da6f9caf1ea7b67 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 11 Mar 2025 10:40:40 +0100 Subject: [PATCH 1/2] QT: Fix two strings. --- src/qt/qt_main.cpp | 2 +- src/qt/qt_platform.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index b48d272c5..f6ddddd32 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -665,7 +665,7 @@ main(int argc, char *argv[]) /* Force raw input if a debugger is present. */ if (IsDebuggerPresent()) { - pclog("WARNING: Debugged detected, forcing raw input\n"); + pclog("WARNING: Debugger detected, forcing raw input\n"); hook_enabled = 0; } diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index a1deb4137..ee8d8842a 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -647,7 +647,7 @@ ProgSettings::reloadStrings() translatedstrings[STRING_NET_ERROR] = QCoreApplication::translate("", "Failed to initialize network driver").toStdWString(); translatedstrings[STRING_NET_ERROR_DESC] = QCoreApplication::translate("", "The network configuration will be switched to the null driver").toStdWString(); translatedstrings[STRING_ESCP_ERROR_TITLE] = QCoreApplication::translate("", "Unable to find Dot-Matrix fonts").toStdWString(); - translatedstrings[STRING_ESCP_ERROR_DESC] = QCoreApplication::translate("", "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulatio of the Generic ESC/P Dot-Matrix Printer.").toStdWString(); + translatedstrings[STRING_ESCP_ERROR_DESC] = QCoreApplication::translate("", "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P Dot-Matrix Printer.").toStdWString(); } wchar_t * From 4d5adeae36d47085da9bcdd0014dbe1b2e12b391 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 11 Mar 2025 20:35:05 +0600 Subject: [PATCH 2/2] Restore older GLSL version code --- src/qt/qt_openglrenderer.cpp | 47 +++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 6f024f36f..b451c2245 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -34,6 +34,7 @@ extern MainWindow* main_window; #include #include #include +#include #include #include @@ -171,30 +172,33 @@ OpenGLRenderer::create_program(struct shader_program *program) int OpenGLRenderer::compile_shader(GLenum shader_type, const char *prepend, const char *program, int *dst) { - const char *source[3]; + QRegularExpression versionRegex("^\\s*(#version\\s+\\w+)", QRegularExpression::MultilineOption); + QString progSource = QString(program); + QByteArray finalSource = nullptr; + const char *source[5]; char version[50]; int ver = 0; char *version_loc = (char *) strstr(program, "#version"); - if (version_loc) - ver = (int) strtol(version_loc + 8, (char **) &program, 10); - else { - ver = glsl_version[0] * 100 + glsl_version[1] * 10; - if (ver == 300) - ver = 130; - else if (ver == 310) - ver = 140; - else if (ver == 320) - ver = 150; + if (version_loc) { + snprintf(version, 49, "%s\n", versionRegex.match(progSource).captured(1).toLatin1().data()); + progSource.remove(versionRegex); + } else { + snprintf(version, 49, "%s\n", this->glslVersion.toLatin1().data()); } - sprintf(version, "#version %d\n", ver); - source[0] = version; - source[1] = prepend ? prepend : ""; - source[2] = program; + + /* Remove parameter lines. */ + progSource.remove(QRegularExpression("^\\s*#pragma parameter.*?\\n", QRegularExpression::MultilineOption)); - pclog("GLSL version %d\n", ver); + finalSource = progSource.toLatin1(); + + source[0] = version; + source[1] = "\n#extension GL_ARB_shading_language_420pack : enable\n"; + source[2] = prepend ? prepend : ""; + source[3] = "\n#line 1\n"; + source[4] = finalSource.data(); GLuint shader = glw.glCreateShader(shader_type); - glw.glShaderSource(shader, 3, source, NULL); + glw.glShaderSource(shader, 5, source, NULL); glw.glCompileShader(shader); GLint status = 0; @@ -840,6 +844,15 @@ OpenGLRenderer::initialize() pclog("Using OpenGL %s\n", glw.glGetString(GL_VERSION)); pclog("Using Shading Language %s\n", glw.glGetString(GL_SHADING_LANGUAGE_VERSION)); + glslVersion = reinterpret_cast(glw.glGetString(GL_SHADING_LANGUAGE_VERSION)); + glslVersion.truncate(4); + glslVersion.remove('.'); + glslVersion.prepend("#version "); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) + glslVersion.append(" es"); + else if (context->format().profile() == QSurfaceFormat::CoreProfile) + glslVersion.append(" core"); + glw.glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); pclog("Max texture size: %dx%d\n", max_texture_size, max_texture_size);