vba-m: switch to wxWidgets-gtk3

This commit is contained in:
maxice8 2018-09-12 13:28:49 -03:00
parent 75652e1e8d
commit c01146a4bb
No known key found for this signature in database
GPG key ID: 543B9D4F4299F06B
3 changed files with 56 additions and 71 deletions

View file

@ -1,55 +0,0 @@
source: https://github.com/visualboyadvance-m/visualboyadvance-m/commit/f3f6ee7b1c9f95cc1e8df368652034b9da84c130
--- src/common/ffmpeg.cpp.orig 2016-12-14 22:52:45.000000000 +0100
+++ src/common/ffmpeg.cpp 2018-05-09 16:41:18.048068182 +0200
@@ -84,11 +84,22 @@
// I have no idea what size to make these buffers
// I don't see any ffmpeg functions to guess the size, either
-// use frame size, or FF_MIN_BUFFER_SIZE (that seems to be what it wants)
+#ifdef AV_INPUT_BUFFER_MIN_SIZE
+
+ // use frame size, or AV_INPUT_BUFFER_MIN_SIZE (that seems to be what it wants)
+#define AUDIO_BUF_LEN (frame_len > AV_INPUT_BUFFER_MIN_SIZE ? frame_len : AV_INPUT_BUFFER_MIN_SIZE)
+ // use maximum frame size * 32 bpp * 2 for good measure
+#define VIDEO_BUF_LEN (AV_INPUT_BUFFER_MIN_SIZE + 256 * 244 * 4 * 2)
+
+#else
+
+ // use frame size, or FF_MIN_BUFFER_SIZE (that seems to be what it wants)
#define AUDIO_BUF_LEN (frame_len > FF_MIN_BUFFER_SIZE ? frame_len : FF_MIN_BUFFER_SIZE)
-// use maximum frame size * 32 bpp * 2 for good measure
+ // use maximum frame size * 32 bpp * 2 for good measure
#define VIDEO_BUF_LEN (FF_MIN_BUFFER_SIZE + 256 * 244 * 4 * 2)
+#endif
+
bool MediaRecorder::did_init = false;
MediaRecorder::MediaRecorder() : oc(0), vid_st(0), aud_st(0), video_buf(0),
@@ -435,6 +446,7 @@
}
av_init_packet(&pkt);
pkt.stream_index = vid_st->index;
+#ifdef AVFMT_RAWPICTURE
if(oc->oformat->flags & AVFMT_RAWPICTURE) {
// this won't work due to border
// not sure what formats set this, anyway
@@ -442,6 +454,7 @@
pkt.data = f->data[0];
pkt.size = linesize * ctx->height;
} else {
+#endif
#if LIBAVCODEC_VERSION_MAJOR > 56
pkt.data = video_buf;
pkt.size = VIDEO_BUF_LEN;
@@ -468,7 +481,9 @@
if(ctx->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.data = video_buf;
+#ifdef AVFMT_RAWPICTURE
}
+#endif
if(av_interleaved_write_frame(oc, &pkt) < 0) {
avformat_free_context(oc);
oc = NULL;

View file

@ -0,0 +1,44 @@
From a8d0508cf299a58b2a659d6017b049db121de8ba Mon Sep 17 00:00:00 2001
From: Rafael Kitover <rkitover@gmail.com>
Date: Mon, 2 Jul 2018 18:32:18 -0700
Subject: [PATCH] use GetWindow()->Refresh() in Wayland only
Some people are reporting stuttering, and @retro-wertz tested both
DrawArea() and Refresh() on wxgtk3 under xorg and found that the
Refresh() method produces more stuttering.
Change the compile check for wxgtk2 to a runtime check for wayland, and
use Refresh() under Wayland only.
---
src/wx/panel.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp
index e4b86301..faaf6e4d 100644
--- a/src/wx/panel.cpp
+++ b/src/wx/panel.cpp
@@ -1817,19 +1817,16 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
}
// next, draw the frame (queue a PaintEv) Refresh must be used under
- // Wayland or nothing is drawn, however it causes high CPU usage with GTK2,
- // so use the old method in that case
-#if !defined(__WXGTK__) || defined(__WXGTK3__)
- GetWindow()->Refresh();
-#else
- {
+ // Wayland or nothing is drawn.
+ if (wxGetApp().UsingWayland())
+ GetWindow()->Refresh();
+ else {
DrawingPanelBase* panel = wxGetApp().frame->GetPanel()->panel;
if (panel) {
wxClientDC dc(panel->GetWindow());
panel->DrawArea(dc);
}
}
-#endif
// finally, draw on-screen text using wx method, if possible
// this method flickers too much right now

View file

@ -2,24 +2,20 @@
pkgname=vba-m
reverts=1292_2
version=2.1.0
revision=4
_subversion=Beta-3
wrksrc="visualboyadvance-m-${_subversion}"
revision=5
wrksrc="visualboyadvance-m-${version}"
patch_args="-Np1"
build_style=cmake
hostmakedepends="unzip pkg-config zip"
makedepends="zlib-devel libpng-devel MesaLib-devel SDL2-devel libopenal-devel gtkmm2-devel
gtkglext-devel gtkglextmm-devel ffmpeg-devel gtk+-devel SFML-devel wxWidgets-devel"
configure_args="-DENABLE_GTK=TRUE -DENABLE_FFMPEG=TRUE -DENABLE_LINK=TRUE
-DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-gtk3"
hostmakedepends="unzip pkg-config zip yasm"
makedepends="zlib-devel libpng-devel MesaLib-devel libopenal-devel SDL2-devel
gtkmm2-devel gtkglext-devel gtkglextmm-devel ffmpeg-devel gtk+3-devel
SFML-devel wxWidgets-gtk3-devel"
short_desc="Gameboy Advance Emulator"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-2"
license="GPL-2.0-or-later"
homepage="https://github.com/visualboyadvance-m/visualboyadvance-m/"
distfiles="https://github.com/visualboyadvance-m/visualboyadvance-m/archive/${_subversion}.tar.gz"
checksum=100176bdf31f27211876bac72a297e5545189aebf74c8fe7ddf5a943a39e79b0
configure_args="-DENABLE_GTK=TRUE -DENABLE_FFMPEG=TRUE -DENABLE_LINK=TRUE"
distfiles="https://github.com/visualboyadvance-m/visualboyadvance-m/archive/v${version}.tar.gz"
checksum=e8d59c5adba451396c88a72960923e615b843d5f8a990b75dbba5d730acb1ae9
nocross="executes binary 'bin2c' when building"
pre_configure() {
sed 's|Common/|common/|' -i src/gba/debugger-expr-yacc.cpp
sed 's|wxrc|wxrc-3.0|g' -i src/wx/CMakeLists.txt
sed 's|wxrc|wxrc-3.0|g' -i po/update_pot.sh
}