app-emulation/punes: fix build with Qt 6.9

Closes: https://bugs.gentoo.org/957576
Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42517
Closes: https://github.com/gentoo/gentoo/pull/42517
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Azamat H. Hackimov
2025-06-09 17:01:32 +03:00
committed by Sam James
parent 3921fd954e
commit f91dbfff15
2 changed files with 107 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
From https://github.com/punesemu/puNES/commit/ff906e0a79eeac9a2d16783e0accf65748bb275e
From: Fabio Cavallo <punes.development@gmail.com>
Date: Fri, 9 May 2025 16:24:54 +0200
Subject: [PATCH] Updated code for Qt 6.9.0 compatibility (#423).
--- a/src/gui/qt.cpp
+++ b/src/gui/qt.cpp
@@ -1137,8 +1137,8 @@ BYTE gui_load_lut(void *l, const uTCHAR *path) {
return (EXIT_OK);
}
void gui_save_screenshot(int w, int h, int stride, char *buffer, BYTE flip) {
- QString basename = QString(uQString(gui_data_folder())) + QString(SCRSHT_FOLDER) + "/"
- + QFileInfo(uQString(info.rom.file)).completeBaseName();
+ QString basename = QString(uQString(gui_data_folder())) + QString(SCRSHT_FOLDER) + "/" +
+ QFileInfo(uQString(info.rom.file)).completeBaseName();
QImage screenshot = QImage((uchar *)buffer, w, h, stride, QImage::Format_RGB32);
QFile file;
uint count = 0;
@@ -1148,7 +1148,7 @@ void gui_save_screenshot(int w, int h, int stride, char *buffer, BYTE flip) {
}
for (count = 1; count < 999999; count++) {
- QString final = basename + QString("_%1.png").arg(count, 6, 'd', 0, '0');
+ QString final = basename + QString("_%1.png").arg(count, 6, 10, QChar(u'0'));
if (!QFileInfo::exists(final)) {
file.setFileName(final);
@@ -1157,7 +1157,11 @@ void gui_save_screenshot(int w, int h, int stride, char *buffer, BYTE flip) {
}
if (flip) {
+#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
screenshot = screenshot.mirrored(false, true);
+#else
+ screenshot = screenshot.flipped(Qt::Vertical);
+#endif
}
file.open(QIODevice::WriteOnly);
--- a/src/gui/wdgStatusBar.cpp
+++ b/src/gui/wdgStatusBar.cpp
@@ -137,7 +137,7 @@ void alignmentStatusBar::update_label(void) {
if (cfg->ppu_alignment == PPU_ALIGMENT_DEFAULT) {
hide();
} else {
- label->setText(QString("c%0p%1").arg(ppu_alignment.cpu, 2, 'd', 0, '0').arg(ppu_alignment.ppu));
+ label->setText(QString("c%0p%1").arg(ppu_alignment.cpu, 2, 10, QChar(u'0')).arg(ppu_alignment.ppu));
show();
}
}

View File

@@ -0,0 +1,57 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake xdg
DESCRIPTION="Nintendo Entertainment System (NES) emulator"
HOMEPAGE="https://github.com/punesemu/puNES"
SRC_URI="https://github.com/punesemu/puNES/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/puNES-${PV}"
LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="X cg ffmpeg"
RDEPEND="
dev-qt/qtbase:6[gui,network,opengl,widgets]
dev-qt/qtsvg:6
media-libs/alsa-lib
media-libs/libglvnd[X?]
virtual/glu
virtual/udev
X? (
x11-libs/libX11
x11-libs/libXrandr
)
cg? ( media-gfx/nvidia-cg-toolkit )
ffmpeg? ( media-video/ffmpeg:= )
"
DEPEND="
${RDEPEND}
X? ( x11-base/xorg-proto )"
BDEPEND="
virtual/pkgconfig
dev-qt/qttools[linguist]
"
PATCHES=(
"${FILESDIR}/punes-0.111-FULLSCREEN_RESFREQ-fix.patch"
"${FILESDIR}/punes-0.111-qt6.7_Q_OBJECT.patch"
"${FILESDIR}/punes-0.111-qt6.9-compatibility.patch"
)
src_configure() {
local mycmakeargs=(
-DENABLE_GIT_INFO=OFF
-DENABLE_QT6_LIBS=ON
-DDISABLE_PORTABLE_MODE=OFF
-DENABLE_FFMPEG=$(usex ffmpeg)
-DENABLE_FULLSCREEN_RESFREQ=$(usex X)
-DENABLE_OPENGL_CG=$(usex cg)
)
cmake_src_configure
}