mirror of https://github.com/mgba-emu/mgba.git
GBA: Move VIDEO_*_PIXELS to public interface
This commit is contained in:
parent
37a564da4c
commit
43e2a6ab5d
|
@ -13,6 +13,11 @@ CXX_GUARD_START
|
|||
#include <mgba/core/interface.h>
|
||||
#include <mgba/core/timing.h>
|
||||
|
||||
enum {
|
||||
GBA_VIDEO_HORIZONTAL_PIXELS = 240,
|
||||
GBA_VIDEO_VERTICAL_PIXELS = 160,
|
||||
};
|
||||
|
||||
enum GBASIOMode {
|
||||
SIO_NORMAL_8 = 0,
|
||||
SIO_NORMAL_32 = 1,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
CXX_GUARD_START
|
||||
|
||||
#include <mgba/core/core.h>
|
||||
#include <mgba/gba/interface.h>
|
||||
#include <mgba/internal/gba/io.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
|
||||
|
@ -122,8 +123,8 @@ struct GBAVideoSoftwareRenderer {
|
|||
|
||||
GBARegisterDISPCNT dispcnt;
|
||||
|
||||
uint32_t row[VIDEO_HORIZONTAL_PIXELS];
|
||||
uint32_t spriteLayer[VIDEO_HORIZONTAL_PIXELS];
|
||||
uint32_t row[GBA_VIDEO_HORIZONTAL_PIXELS];
|
||||
uint32_t spriteLayer[GBA_VIDEO_HORIZONTAL_PIXELS];
|
||||
int32_t spriteCyclesRemaining;
|
||||
|
||||
// BLDCNT
|
||||
|
@ -169,7 +170,7 @@ struct GBAVideoSoftwareRenderer {
|
|||
struct ScanlineCache {
|
||||
uint16_t io[REG_SOUND1CNT_LO];
|
||||
int32_t scale[2][2];
|
||||
} cache[VIDEO_VERTICAL_PIXELS];
|
||||
} cache[GBA_VIDEO_VERTICAL_PIXELS];
|
||||
int nextY;
|
||||
|
||||
int start;
|
||||
|
|
|
@ -16,13 +16,11 @@ CXX_GUARD_START
|
|||
mLOG_DECLARE_CATEGORY(GBA_VIDEO);
|
||||
|
||||
enum {
|
||||
VIDEO_HORIZONTAL_PIXELS = 240,
|
||||
VIDEO_HBLANK_PIXELS = 68,
|
||||
VIDEO_HDRAW_LENGTH = 1006,
|
||||
VIDEO_HBLANK_LENGTH = 226,
|
||||
VIDEO_HORIZONTAL_LENGTH = 1232,
|
||||
|
||||
VIDEO_VERTICAL_PIXELS = 160,
|
||||
VIDEO_VBLANK_PIXELS = 68,
|
||||
VIDEO_VERTICAL_TOTAL_PIXELS = 228,
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "ffmpeg-encoder.h"
|
||||
|
||||
#include <mgba/core/core.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#include <mgba/gba/interface.h>
|
||||
|
||||
#include <libavcodec/version.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -48,9 +48,9 @@ void FFmpegEncoderInit(struct FFmpegEncoder* encoder) {
|
|||
FFmpegEncoderSetAudio(encoder, "flac", 0);
|
||||
FFmpegEncoderSetVideo(encoder, "png", 0);
|
||||
FFmpegEncoderSetContainer(encoder, "matroska");
|
||||
FFmpegEncoderSetDimensions(encoder, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
encoder->iwidth = VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->iheight = VIDEO_VERTICAL_PIXELS;
|
||||
FFmpegEncoderSetDimensions(encoder, GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
encoder->iwidth = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->iheight = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
encoder->resampleContext = 0;
|
||||
encoder->absf = 0;
|
||||
encoder->context = 0;
|
||||
|
@ -175,8 +175,8 @@ bool FFmpegEncoderSetContainer(struct FFmpegEncoder* encoder, const char* contai
|
|||
}
|
||||
|
||||
void FFmpegEncoderSetDimensions(struct FFmpegEncoder* encoder, int width, int height) {
|
||||
encoder->width = width > 0 ? width : VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->height = height > 0 ? height : VIDEO_VERTICAL_PIXELS;
|
||||
encoder->width = width > 0 ? width : GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->height = height > 0 ? height : GBA_VIDEO_VERTICAL_PIXELS;
|
||||
}
|
||||
|
||||
bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder* encoder) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "imagemagick-gif-encoder.h"
|
||||
|
||||
#include <mgba/internal/gba/gba.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#include <mgba/gba/interface.h>
|
||||
#include <mgba-util/string.h>
|
||||
|
||||
static void _magickPostVideoFrame(struct mAVStream*, const color_t* pixels, size_t stride);
|
||||
|
@ -23,8 +23,8 @@ void ImageMagickGIFEncoderInit(struct ImageMagickGIFEncoder* encoder) {
|
|||
encoder->frameskip = 2;
|
||||
encoder->delayMs = -1;
|
||||
|
||||
encoder->iwidth = VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->iheight = VIDEO_VERTICAL_PIXELS;
|
||||
encoder->iwidth = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
encoder->iheight = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
}
|
||||
|
||||
void ImageMagickGIFEncoderSetParams(struct ImageMagickGIFEncoder* encoder, int frameskip, int delayMs) {
|
||||
|
|
|
@ -254,8 +254,8 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
|
|||
|
||||
static void _GBACoreDesiredVideoDimensions(struct mCore* core, unsigned* width, unsigned* height) {
|
||||
UNUSED(core);
|
||||
*width = VIDEO_HORIZONTAL_PIXELS;
|
||||
*height = VIDEO_VERTICAL_PIXELS;
|
||||
*width = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
*height = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
}
|
||||
|
||||
static void _GBACoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) {
|
||||
|
@ -311,7 +311,7 @@ static void _GBACoreSetAVStream(struct mCore* core, struct mAVStream* stream) {
|
|||
struct GBA* gba = core->board;
|
||||
gba->stream = stream;
|
||||
if (stream && stream->videoDimensionsChanged) {
|
||||
stream->videoDimensionsChanged(stream, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
stream->videoDimensionsChanged(stream, GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ void _dmaEvent(struct mTiming* timing, void* context, uint32_t cyclesLate) {
|
|||
dma->nextCount = 0;
|
||||
bool noRepeat = !GBADMARegisterIsRepeat(dma->reg);
|
||||
noRepeat |= GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_NOW;
|
||||
noRepeat |= memory->activeDMA == 3 && GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_CUSTOM && gba->video.vcount == VIDEO_VERTICAL_PIXELS + 1;
|
||||
noRepeat |= memory->activeDMA == 3 && GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_CUSTOM && gba->video.vcount == GBA_VIDEO_VERTICAL_PIXELS + 1;
|
||||
if (noRepeat) {
|
||||
dma->reg = GBADMARegisterClearEnable(dma->reg);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static bool _parsePacket(struct mVideoLogger* logger, const struct mVideoLoggerD
|
|||
}
|
||||
break;
|
||||
case DIRTY_SCANLINE:
|
||||
if (item->address < VIDEO_VERTICAL_PIXELS) {
|
||||
if (item->address < GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
proxyRenderer->backend->drawScanline(proxyRenderer->backend, item->address);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -98,10 +98,10 @@ void GBAVideoSoftwareRendererDrawBackgroundMode3(struct GBAVideoSoftwareRenderer
|
|||
int outX;
|
||||
uint32_t* pixel;
|
||||
for (outX = renderer->start, pixel = &renderer->row[outX]; outX < renderer->end; ++outX, ++pixel) {
|
||||
BACKGROUND_BITMAP_ITERATE(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
BACKGROUND_BITMAP_ITERATE(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
|
||||
if (!mosaicWait) {
|
||||
LOAD_16(color, ((localX >> 8) + (localY >> 8) * VIDEO_HORIZONTAL_PIXELS) << 1, renderer->d.vram);
|
||||
LOAD_16(color, ((localX >> 8) + (localY >> 8) * GBA_VIDEO_HORIZONTAL_PIXELS) << 1, renderer->d.vram);
|
||||
color = mColorFrom555(color);
|
||||
mosaicWait = mosaicH;
|
||||
} else {
|
||||
|
@ -137,10 +137,10 @@ void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer
|
|||
int outX;
|
||||
uint32_t* pixel;
|
||||
for (outX = renderer->start, pixel = &renderer->row[outX]; outX < renderer->end; ++outX, ++pixel) {
|
||||
BACKGROUND_BITMAP_ITERATE(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
BACKGROUND_BITMAP_ITERATE(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
|
||||
if (!mosaicWait) {
|
||||
color = ((uint8_t*)renderer->d.vram)[offset + (localX >> 8) + (localY >> 8) * VIDEO_HORIZONTAL_PIXELS];
|
||||
color = ((uint8_t*)renderer->d.vram)[offset + (localX >> 8) + (localY >> 8) * GBA_VIDEO_HORIZONTAL_PIXELS];
|
||||
|
||||
mosaicWait = mosaicH;
|
||||
} else {
|
||||
|
|
|
@ -378,7 +378,7 @@
|
|||
if (background->mosaic && GBAMosaicControlGetBgH(renderer->mosaic)) { \
|
||||
int mosaicH = GBAMosaicControlGetBgH(renderer->mosaic) + 1; \
|
||||
int x; \
|
||||
int mosaicWait = (mosaicH - outX + VIDEO_HORIZONTAL_PIXELS * mosaicH) % mosaicH; \
|
||||
int mosaicWait = (mosaicH - outX + GBA_VIDEO_HORIZONTAL_PIXELS * mosaicH) % mosaicH; \
|
||||
int carryData = 0; \
|
||||
paletteData = 0; /* Quiets compiler warning */ \
|
||||
DRAW_BACKGROUND_MODE_0_MOSAIC_ ## BPP (BLEND, OBJWIN) \
|
||||
|
@ -417,7 +417,7 @@
|
|||
/*! TODO: Make sure these lines can be removed */ \
|
||||
/*!*/ pixel = &renderer->row[outX]; \
|
||||
outX += (tileEnd - tileX) * 8; \
|
||||
/*!*/ if (VIDEO_CHECKS && UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
||||
/*!*/ if (VIDEO_CHECKS && UNLIKELY(outX > GBA_VIDEO_HORIZONTAL_PIXELS)) { \
|
||||
/*!*/ mLOG(GBA_VIDEO, FATAL, "Out of bounds background draw would occur!"); \
|
||||
/*!*/ return; \
|
||||
/*!*/ } \
|
||||
|
@ -440,7 +440,7 @@
|
|||
if (VIDEO_CHECKS && UNLIKELY(&renderer->row[outX] != pixel)) { \
|
||||
mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
|
||||
} \
|
||||
if (VIDEO_CHECKS && UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
||||
if (VIDEO_CHECKS && UNLIKELY(outX > GBA_VIDEO_HORIZONTAL_PIXELS)) { \
|
||||
mLOG(GBA_VIDEO, FATAL, "Out of bounds background draw occurred!"); \
|
||||
return; \
|
||||
}
|
||||
|
|
|
@ -261,8 +261,8 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re
|
|||
SPRITE_TRANSFORMED_LOOP(256, NORMAL);
|
||||
}
|
||||
}
|
||||
if (end == VIDEO_HORIZONTAL_PIXELS && x + totalWidth > VIDEO_HORIZONTAL_PIXELS) {
|
||||
renderer->spriteCyclesRemaining -= (x + totalWidth - VIDEO_HORIZONTAL_PIXELS) * 2;
|
||||
if (end == GBA_VIDEO_HORIZONTAL_PIXELS && x + totalWidth > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
renderer->spriteCyclesRemaining -= (x + totalWidth - GBA_VIDEO_HORIZONTAL_PIXELS) * 2;
|
||||
}
|
||||
} else {
|
||||
int outX = x >= start ? x : start;
|
||||
|
@ -321,8 +321,8 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re
|
|||
SPRITE_NORMAL_LOOP(256, NORMAL);
|
||||
}
|
||||
}
|
||||
if (end == VIDEO_HORIZONTAL_PIXELS && x + width > VIDEO_HORIZONTAL_PIXELS) {
|
||||
renderer->spriteCyclesRemaining -= x + width - VIDEO_HORIZONTAL_PIXELS;
|
||||
if (end == GBA_VIDEO_HORIZONTAL_PIXELS && x + width > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
renderer->spriteCyclesRemaining -= x + width - GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -72,10 +72,10 @@ static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) {
|
|||
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
||||
|
||||
int y;
|
||||
for (y = 0; y < VIDEO_VERTICAL_PIXELS; ++y) {
|
||||
for (y = 0; y < GBA_VIDEO_VERTICAL_PIXELS; ++y) {
|
||||
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
||||
int x;
|
||||
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||
row[x] = GBA_COLOR_WHITE;
|
||||
}
|
||||
}
|
||||
|
@ -315,52 +315,52 @@ static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRender
|
|||
case REG_WIN0H:
|
||||
softwareRenderer->winN[0].h.end = value;
|
||||
softwareRenderer->winN[0].h.start = value >> 8;
|
||||
if (softwareRenderer->winN[0].h.start > VIDEO_HORIZONTAL_PIXELS && softwareRenderer->winN[0].h.start > softwareRenderer->winN[0].h.end) {
|
||||
if (softwareRenderer->winN[0].h.start > GBA_VIDEO_HORIZONTAL_PIXELS && softwareRenderer->winN[0].h.start > softwareRenderer->winN[0].h.end) {
|
||||
softwareRenderer->winN[0].h.start = 0;
|
||||
}
|
||||
if (softwareRenderer->winN[0].h.end > VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[0].h.end = VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].h.start > VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[0].h.start = VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].h.end > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[0].h.end = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].h.start > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[0].h.start = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case REG_WIN1H:
|
||||
softwareRenderer->winN[1].h.end = value;
|
||||
softwareRenderer->winN[1].h.start = value >> 8;
|
||||
if (softwareRenderer->winN[1].h.start > VIDEO_HORIZONTAL_PIXELS && softwareRenderer->winN[1].h.start > softwareRenderer->winN[1].h.end) {
|
||||
if (softwareRenderer->winN[1].h.start > GBA_VIDEO_HORIZONTAL_PIXELS && softwareRenderer->winN[1].h.start > softwareRenderer->winN[1].h.end) {
|
||||
softwareRenderer->winN[1].h.start = 0;
|
||||
}
|
||||
if (softwareRenderer->winN[1].h.end > VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[1].h.end = VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].h.start > VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[1].h.start = VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].h.end > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[1].h.end = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].h.start > GBA_VIDEO_HORIZONTAL_PIXELS) {
|
||||
softwareRenderer->winN[1].h.start = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case REG_WIN0V:
|
||||
softwareRenderer->winN[0].v.end = value;
|
||||
softwareRenderer->winN[0].v.start = value >> 8;
|
||||
if (softwareRenderer->winN[0].v.start > VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[0].v.start > softwareRenderer->winN[0].v.end) {
|
||||
if (softwareRenderer->winN[0].v.start > GBA_VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[0].v.start > softwareRenderer->winN[0].v.end) {
|
||||
softwareRenderer->winN[0].v.start = 0;
|
||||
}
|
||||
if (softwareRenderer->winN[0].v.end > VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[0].v.end = VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].v.start > VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[0].v.start = VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].v.end > GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[0].v.end = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[0].v.start > GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[0].v.start = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case REG_WIN1V:
|
||||
softwareRenderer->winN[1].v.end = value;
|
||||
softwareRenderer->winN[1].v.start = value >> 8;
|
||||
if (softwareRenderer->winN[1].v.start > VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[1].v.start > softwareRenderer->winN[1].v.end) {
|
||||
if (softwareRenderer->winN[1].v.start > GBA_VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[1].v.start > softwareRenderer->winN[1].v.end) {
|
||||
softwareRenderer->winN[1].v.start = 0;
|
||||
}
|
||||
if (softwareRenderer->winN[1].v.end > VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[1].v.end = VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].v.start > VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[1].v.start = VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].v.end > GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[1].v.end = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
if (softwareRenderer->winN[1].v.start > GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
softwareRenderer->winN[1].v.start = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -436,10 +436,10 @@ static void _breakWindow(struct GBAVideoSoftwareRenderer* softwareRenderer, stru
|
|||
} else if (y >= win->v.end && y < win->v.start) {
|
||||
return;
|
||||
}
|
||||
if (win->h.end > VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {
|
||||
if (win->h.end > GBA_VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {
|
||||
struct WindowN splits[2] = { *win, *win };
|
||||
splits[0].h.start = 0;
|
||||
splits[1].h.end = VIDEO_HORIZONTAL_PIXELS;
|
||||
splits[1].h.end = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
_breakWindowInner(softwareRenderer, &splits[0]);
|
||||
_breakWindowInner(softwareRenderer, &splits[1]);
|
||||
} else {
|
||||
|
@ -511,7 +511,7 @@ static void _cleanOAM(struct GBAVideoSoftwareRenderer* renderer) {
|
|||
if (GBAObjAttributesAIsTransformed(obj.a)) {
|
||||
height <<= GBAObjAttributesAGetDoubleSize(obj.a);
|
||||
}
|
||||
if (GBAObjAttributesAGetY(obj.a) < VIDEO_VERTICAL_PIXELS || GBAObjAttributesAGetY(obj.a) + height >= VIDEO_VERTICAL_TOTAL_PIXELS) {
|
||||
if (GBAObjAttributesAGetY(obj.a) < GBA_VIDEO_VERTICAL_PIXELS || GBAObjAttributesAGetY(obj.a) + height >= VIDEO_VERTICAL_TOTAL_PIXELS) {
|
||||
int y = GBAObjAttributesAGetY(obj.a) + renderer->objOffsetY;
|
||||
renderer->sprites[oamMax].y = y;
|
||||
renderer->sprites[oamMax].endY = y + height;
|
||||
|
@ -527,7 +527,7 @@ static void _cleanOAM(struct GBAVideoSoftwareRenderer* renderer) {
|
|||
static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) {
|
||||
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
||||
|
||||
if (y == VIDEO_VERTICAL_PIXELS - 1) {
|
||||
if (y == GBA_VIDEO_VERTICAL_PIXELS - 1) {
|
||||
softwareRenderer->nextY = 0;
|
||||
} else {
|
||||
softwareRenderer->nextY = y + 1;
|
||||
|
@ -567,21 +567,21 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
|
|||
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
||||
if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) {
|
||||
int x;
|
||||
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||
row[x] = GBA_COLOR_WHITE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int x;
|
||||
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||
softwareRenderer->spriteLayer[x] = FLAG_UNWRITTEN;
|
||||
softwareRenderer->spriteLayer[x + 1] = FLAG_UNWRITTEN;
|
||||
softwareRenderer->spriteLayer[x + 2] = FLAG_UNWRITTEN;
|
||||
softwareRenderer->spriteLayer[x + 3] = FLAG_UNWRITTEN;
|
||||
}
|
||||
|
||||
softwareRenderer->windows[0].endX = VIDEO_HORIZONTAL_PIXELS;
|
||||
softwareRenderer->windows[0].endX = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
softwareRenderer->nWindows = 1;
|
||||
if (GBARegisterDISPCNTIsWin0Enable(softwareRenderer->dispcnt) || GBARegisterDISPCNTIsWin1Enable(softwareRenderer->dispcnt) || GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) {
|
||||
softwareRenderer->windows[0].control = softwareRenderer->winout;
|
||||
|
@ -676,14 +676,14 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
|
|||
}
|
||||
|
||||
#ifdef COLOR_16_BIT
|
||||
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||
row[x] = softwareRenderer->row[x];
|
||||
row[x + 1] = softwareRenderer->row[x + 1];
|
||||
row[x + 2] = softwareRenderer->row[x + 2];
|
||||
row[x + 3] = softwareRenderer->row[x + 3];
|
||||
}
|
||||
#else
|
||||
memcpy(row, softwareRenderer->row, VIDEO_HORIZONTAL_PIXELS * sizeof(*row));
|
||||
memcpy(row, softwareRenderer->row, GBA_VIDEO_HORIZONTAL_PIXELS * sizeof(*row));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* rendere
|
|||
|
||||
softwareRenderer->nextY = 0;
|
||||
if (softwareRenderer->temporaryBuffer) {
|
||||
mappedMemoryFree(softwareRenderer->temporaryBuffer, VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4);
|
||||
mappedMemoryFree(softwareRenderer->temporaryBuffer, GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4);
|
||||
softwareRenderer->temporaryBuffer = 0;
|
||||
}
|
||||
softwareRenderer->bg[2].sx = softwareRenderer->bg[2].refx;
|
||||
|
@ -725,8 +725,8 @@ static void GBAVideoSoftwareRendererPutPixels(struct GBAVideoRenderer* renderer,
|
|||
|
||||
const color_t* colorPixels = pixels;
|
||||
unsigned i;
|
||||
for (i = 0; i < VIDEO_VERTICAL_PIXELS; ++i) {
|
||||
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);
|
||||
for (i = 0; i < GBA_VIDEO_VERTICAL_PIXELS; ++i) {
|
||||
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], GBA_VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) {
|
|||
case 0:
|
||||
GBAFrameStarted(video->p);
|
||||
break;
|
||||
case VIDEO_VERTICAL_PIXELS:
|
||||
case GBA_VIDEO_VERTICAL_PIXELS:
|
||||
video->p->memory.io[REG_DISPSTAT >> 1] = GBARegisterDISPSTATFillInVblank(dispstat);
|
||||
if (video->frameskipCounter <= 0) {
|
||||
video->renderer->finishFrame(video->renderer);
|
||||
|
@ -177,14 +177,14 @@ void _startHblank(struct mTiming* timing, void* context, uint32_t cyclesLate) {
|
|||
|
||||
// Begin Hblank
|
||||
dispstat = GBARegisterDISPSTATFillInHblank(dispstat);
|
||||
if (video->vcount < VIDEO_VERTICAL_PIXELS && video->frameskipCounter <= 0) {
|
||||
if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS && video->frameskipCounter <= 0) {
|
||||
video->renderer->drawScanline(video->renderer, video->vcount);
|
||||
}
|
||||
|
||||
if (video->vcount < VIDEO_VERTICAL_PIXELS) {
|
||||
if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) {
|
||||
GBADMARunHblank(video->p, -cyclesLate);
|
||||
}
|
||||
if (video->vcount >= 2 && video->vcount < VIDEO_VERTICAL_PIXELS + 2) {
|
||||
if (video->vcount >= 2 && video->vcount < GBA_VIDEO_VERTICAL_PIXELS + 2) {
|
||||
GBADMARunDisplayStart(video->p, -cyclesLate);
|
||||
}
|
||||
if (GBARegisterDISPSTATIsHblankIRQ(dispstat)) {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include <mgba/core/core.h>
|
||||
#include <mgba/core/serialize.h>
|
||||
#ifdef M_CORE_GBA
|
||||
#include <mgba/gba/interface.h>
|
||||
#include <mgba/internal/gba/gba.h>
|
||||
#include <mgba/internal/gba/input.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
#include <mgba/internal/gb/gb.h>
|
||||
|
@ -550,9 +550,9 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
|
|||
UNUSED(runner);
|
||||
C3D_Tex* tex = &outputTexture;
|
||||
|
||||
GSPGPU_FlushDataCache(outputBuffer, 256 * VIDEO_VERTICAL_PIXELS * 2);
|
||||
GSPGPU_FlushDataCache(outputBuffer, 256 * GBA_VIDEO_VERTICAL_PIXELS * 2);
|
||||
C3D_SyncDisplayTransfer(
|
||||
(u32*) outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS),
|
||||
(u32*) outputBuffer, GX_BUFFER_DIM(256, GBA_VIDEO_VERTICAL_PIXELS),
|
||||
tex->data, GX_BUFFER_DIM(256, 256),
|
||||
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) |
|
||||
GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB565) |
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#include <mgba/gba/interface.h>
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
|
@ -39,9 +39,9 @@ void MessagePainter::resize(const QSize& size, bool lockAspectRatio, qreal scale
|
|||
}
|
||||
}
|
||||
m_world.reset();
|
||||
m_world.scale(qreal(drawW) / VIDEO_HORIZONTAL_PIXELS, qreal(drawH) / VIDEO_VERTICAL_PIXELS);
|
||||
m_world.scale(qreal(drawW) / GBA_VIDEO_HORIZONTAL_PIXELS, qreal(drawH) / GBA_VIDEO_VERTICAL_PIXELS);
|
||||
m_scaleFactor = scaleFactor;
|
||||
m_local = QPoint(1, VIDEO_VERTICAL_PIXELS - m_messageFont.pixelSize() - 1);
|
||||
m_local = QPoint(1, GBA_VIDEO_VERTICAL_PIXELS - m_messageFont.pixelSize() - 1);
|
||||
m_local = m_world.map(m_local);
|
||||
m_local += QPoint((w - drawW) / 2, (h - drawH) / 2);
|
||||
m_pixmapBuffer = QPixmap(drawW * m_scaleFactor,
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
#include <mgba/internal/gb/video.h>
|
||||
#endif
|
||||
#ifdef M_CORE_GBA
|
||||
#include <mgba/gba/interface.h>
|
||||
#include <mgba/internal/gba/gba.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#endif
|
||||
#include <mgba/feature/commandline.h>
|
||||
#include "feature/sqlite3/no-intro.h"
|
||||
|
@ -131,7 +131,7 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
|
|||
});
|
||||
#endif
|
||||
#if defined(M_CORE_GBA)
|
||||
resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i));
|
||||
resizeFrame(QSize(GBA_VIDEO_HORIZONTAL_PIXELS * i, GBA_VIDEO_VERTICAL_PIXELS * i));
|
||||
#elif defined(M_CORE_GB)
|
||||
resizeFrame(QSize(GB_VIDEO_HORIZONTAL_PIXELS * i, GB_VIDEO_VERTICAL_PIXELS * i));
|
||||
#endif
|
||||
|
@ -580,7 +580,7 @@ void Window::resizeEvent(QResizeEvent* event) {
|
|||
}
|
||||
|
||||
int factor = 0;
|
||||
QSize size(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
QSize size(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
if (m_controller) {
|
||||
size = m_controller->screenDimensions();
|
||||
}
|
||||
|
@ -625,8 +625,8 @@ void Window::closeEvent(QCloseEvent* event) {
|
|||
m_config->setQtOption("windowPos", pos());
|
||||
|
||||
if (m_savedScale > 0) {
|
||||
m_config->setOption("height", VIDEO_VERTICAL_PIXELS * m_savedScale);
|
||||
m_config->setOption("width", VIDEO_HORIZONTAL_PIXELS * m_savedScale);
|
||||
m_config->setOption("height", GBA_VIDEO_VERTICAL_PIXELS * m_savedScale);
|
||||
m_config->setOption("width", GBA_VIDEO_HORIZONTAL_PIXELS * m_savedScale);
|
||||
}
|
||||
saveConfig();
|
||||
m_display.reset();
|
||||
|
@ -805,7 +805,7 @@ void Window::gameStopped() {
|
|||
#ifdef M_CORE_GB
|
||||
m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS);
|
||||
#elif defined(M_CORE_GBA)
|
||||
m_display->setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ void Window::reloadDisplayDriver() {
|
|||
#ifdef M_CORE_GB
|
||||
m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS);
|
||||
#elif defined(M_CORE_GBA)
|
||||
m_display->setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1410,7 +1410,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
}
|
||||
connect(setSize, &QAction::triggered, [this, i, setSize]() {
|
||||
showNormal();
|
||||
QSize size(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
QSize size(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
|
||||
if (m_controller) {
|
||||
size = m_controller->screenDimensions();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "Window.h"
|
||||
|
||||
#include <mgba/core/version.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#include <mgba/gba/interface.h>
|
||||
|
||||
#include <QLibraryInfo>
|
||||
#include <QTranslator>
|
||||
|
@ -94,7 +94,7 @@ int main(int argc, char* argv[]) {
|
|||
freeArguments(&args);
|
||||
|
||||
if (graphicsOpts.multiplier) {
|
||||
w->resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * graphicsOpts.multiplier, VIDEO_VERTICAL_PIXELS * graphicsOpts.multiplier));
|
||||
w->resizeFrame(QSize(GBA_VIDEO_HORIZONTAL_PIXELS * graphicsOpts.multiplier, GBA_VIDEO_VERTICAL_PIXELS * graphicsOpts.multiplier));
|
||||
}
|
||||
if (graphicsOpts.fullscreen) {
|
||||
w->enterFullScreen();
|
||||
|
|
|
@ -55,7 +55,7 @@ bool mSDLInit(struct SDLSoftwareRenderer* renderer) {
|
|||
ioctl(renderer->fb, OMAPFB_SETUP_PLANE, &plane);
|
||||
}
|
||||
|
||||
mem.size = VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4;
|
||||
mem.size = GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4;
|
||||
ioctl(renderer->fb, OMAPFB_SETUP_MEM, &mem);
|
||||
|
||||
plane.enabled = 1;
|
||||
|
@ -67,19 +67,19 @@ bool mSDLInit(struct SDLSoftwareRenderer* renderer) {
|
|||
|
||||
struct fb_var_screeninfo info;
|
||||
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
|
||||
info.xres = VIDEO_HORIZONTAL_PIXELS;
|
||||
info.yres = VIDEO_VERTICAL_PIXELS;
|
||||
info.xres_virtual = VIDEO_HORIZONTAL_PIXELS;
|
||||
info.yres_virtual = VIDEO_VERTICAL_PIXELS * 2;
|
||||
info.xres = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
info.yres = GBA_VIDEO_VERTICAL_PIXELS;
|
||||
info.xres_virtual = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
info.yres_virtual = GBA_VIDEO_VERTICAL_PIXELS * 2;
|
||||
info.bits_per_pixel = 16;
|
||||
ioctl(renderer->fb, FBIOPUT_VSCREENINFO, &info);
|
||||
|
||||
renderer->odd = 0;
|
||||
renderer->base[0] = mmap(0, VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4, PROT_READ | PROT_WRITE, MAP_SHARED, renderer->fb, 0);
|
||||
renderer->base[1] = (uint16_t*) renderer->base[0] + VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS;
|
||||
renderer->base[0] = mmap(0, GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4, PROT_READ | PROT_WRITE, MAP_SHARED, renderer->fb, 0);
|
||||
renderer->base[1] = (uint16_t*) renderer->base[0] + GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS;
|
||||
|
||||
renderer->d.outputBuffer = renderer->base[0];
|
||||
renderer->d.outputBufferStride = VIDEO_HORIZONTAL_PIXELS;
|
||||
renderer->d.outputBufferStride = GBA_VIDEO_HORIZONTAL_PIXELS;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer
|
|||
if (mCoreSyncWaitFrameStart(&context->sync)) {
|
||||
struct fb_var_screeninfo info;
|
||||
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
|
||||
info.yoffset = VIDEO_VERTICAL_PIXELS * renderer->odd;
|
||||
info.yoffset = GBA_VIDEO_VERTICAL_PIXELS * renderer->odd;
|
||||
ioctl(renderer->fb, FBIOPAN_DISPLAY, &info);
|
||||
|
||||
int arg = 0;
|
||||
|
@ -108,7 +108,7 @@ void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer
|
|||
}
|
||||
|
||||
void mSDLDeinit(struct SDLSoftwareRenderer* renderer) {
|
||||
munmap(renderer->base[0], VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4);
|
||||
munmap(renderer->base[0], GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4);
|
||||
|
||||
struct omapfb_plane_info plane;
|
||||
struct omapfb_mem_info mem;
|
||||
|
|
Loading…
Reference in New Issue