diff --git a/src/gba/video.h b/src/gba/video.h index 086682247..f60370ba5 100644 --- a/src/gba/video.h +++ b/src/gba/video.h @@ -26,19 +26,17 @@ #define GBA_B8(X) (((X) >> 7) & 0xF8) enum { - VIDEO_CYCLES_PER_PIXEL = 4, - VIDEO_HORIZONTAL_PIXELS = 240, VIDEO_HBLANK_PIXELS = 68, VIDEO_HDRAW_LENGTH = 1006, VIDEO_HBLANK_LENGTH = 226, - VIDEO_HORIZONTAL_LENGTH = 1232, + VIDEO_HORIZONTAL_LENGTH = VIDEO_HDRAW_LENGTH + VIDEO_HBLANK_LENGTH, VIDEO_VERTICAL_PIXELS = 160, VIDEO_VBLANK_PIXELS = 68, - VIDEO_VERTICAL_TOTAL_PIXELS = 228, + VIDEO_VERTICAL_TOTAL_PIXELS = VIDEO_VERTICAL_PIXELS + VIDEO_VBLANK_PIXELS, - VIDEO_TOTAL_LENGTH = 280896, + VIDEO_TOTAL_LENGTH = VIDEO_HORIZONTAL_LENGTH * VIDEO_VERTICAL_TOTAL_PIXELS, REG_DISPSTAT_MASK = 0xFF38, diff --git a/src/platform/qt/DisplayQt.cpp b/src/platform/qt/DisplayQt.cpp index 438c44e47..4ebcee38a 100644 --- a/src/platform/qt/DisplayQt.cpp +++ b/src/platform/qt/DisplayQt.cpp @@ -7,6 +7,10 @@ #include +extern "C" { +#include "gba/video.h" +} + using namespace QGBA; DisplayQt::DisplayQt(QWidget* parent) @@ -69,9 +73,9 @@ void DisplayQt::paintEvent(QPaintEvent*) { QRect full(origin, ds); #ifdef COLOR_5_6_5 - painter.drawImage(full, m_backing, QRect(0, 0, 240, 160)); + painter.drawImage(full, m_backing, QRect(0, 0, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS)); #else - painter.drawImage(full, m_backing.rgbSwapped(), QRect(0, 0, 240, 160)); + painter.drawImage(full, m_backing.rgbSwapped(), QRect(0, 0, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS)); #endif m_messagePainter.paint(&painter); } diff --git a/src/platform/qt/VideoView.cpp b/src/platform/qt/VideoView.cpp index d8f6fb65f..6fbf27dad 100644 --- a/src/platform/qt/VideoView.cpp +++ b/src/platform/qt/VideoView.cpp @@ -131,8 +131,8 @@ VideoView::VideoView(QWidget* parent) .acodec = QString(), .vbr = 0, .abr = 0, - .width = 240, - .height = 160 + .width = VIDEO_HORIZONTAL_PIXELS, + .height = VIDEO_VERTICAL_PIXELS }); addPreset(m_ui.presetHQ, (Preset) { @@ -169,8 +169,8 @@ VideoView::VideoView(QWidget* parent) .acodec = "FLAC", .vbr = 0, .abr = 0, - .width = 240, - .height = 160, + .width = VIDEO_HORIZONTAL_PIXELS, + .height = VIDEO_VERTICAL_PIXELS, }); setPreset((Preset) { @@ -179,8 +179,8 @@ VideoView::VideoView(QWidget* parent) .acodec = "FLAC", .vbr = 0, .abr = 0, - .width = 240, - .height = 160, + .width = VIDEO_HORIZONTAL_PIXELS, + .height = VIDEO_VERTICAL_PIXELS, }); showAdvanced(false); diff --git a/src/platform/sdl/sw-sdl.c b/src/platform/sdl/sw-sdl.c index ee295e846..275225a04 100644 --- a/src/platform/sdl/sw-sdl.c +++ b/src/platform/sdl/sw-sdl.c @@ -111,10 +111,10 @@ void GBASDLSWRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* rend switch (renderer->ratio) { #if defined(__ARM_NEON) && COLOR_16_BIT case 2: - _neon2x(surface->pixels, renderer->d.outputBuffer, 240, 160); + _neon2x(surface->pixels, renderer->d.outputBuffer, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); break; case 4: - _neon4x(surface->pixels, renderer->d.outputBuffer, 240, 160); + _neon4x(surface->pixels, renderer->d.outputBuffer, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); break; #endif case 1: