ref: 885d1d6f05ff759a192b5dfdb20567ffed4c7967
parent: 38906cd8727b76667e8abc6a021f3ef52ffd1c7d
author: Snesrev <snesrev@protonmail.com>
date: Wed Sep 7 20:42:54 EDT 2022
Remove black bars on top/bottom
--- a/main.c
+++ b/main.c
@@ -48,8 +48,8 @@
enum {
- kRenderWidth = 512,
- kRenderHeight = 480,
+ kRenderWidth = 256 * 2,
+ kRenderHeight = 224 * 2,
kDefaultZoom = 2,
};
@@ -171,7 +171,7 @@
}
g_renderer = renderer;
if (!g_config.ignore_aspect_ratio)
- SDL_RenderSetLogicalSize(renderer, 512, 480);
+ SDL_RenderSetLogicalSize(renderer, kRenderWidth, kRenderHeight);
SDL_Texture* texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBX8888, SDL_TEXTUREACCESS_STREAMING, kRenderWidth * 2, kRenderHeight * 2);
if(texture == NULL) {
printf("Failed to create texture: %s\n", SDL_GetError());
@@ -395,7 +395,7 @@
SDL_UnlockTexture(texture);
SDL_RenderClear(renderer);
- SDL_Rect src_rect = { 0, 0, 512, 480 };
+ SDL_Rect src_rect = { 0, 0, kRenderWidth, kRenderHeight };
SDL_RenderCopy(renderer, texture, hq ? NULL : &src_rect, NULL);
}
--- a/snes/ppu.c
+++ b/snes/ppu.c
@@ -141,16 +141,7 @@
bool hq = ppu->mode == 7 && !ppu->forcedBlank &&
(ppu->renderFlags & (kPpuRenderFlags_4x4Mode7 | kPpuRenderFlags_NewRenderer)) == (kPpuRenderFlags_4x4Mode7 | kPpuRenderFlags_NewRenderer);
ppu->renderPitch = (uint)pitch;
- ppu->renderBuffer = pixels + (pitch * 16 << hq);
-
- // clear top 16 and last 16 lines (or 32 in hq)
- int w = 512 * 4 << hq;
- int n = 16 << hq;
- int y1 = 464 << hq;
- for (size_t i = 0; i < n; i++) {
- memset(pixels + pitch * i, 0, w);
- memset(pixels + pitch * (y1 + i), 0, w);
- }
+ ppu->renderBuffer = pixels;
// Cache the brightness computation
if (ppu->brightness != ppu->lastBrightnessMult) {