shithub: zelda3

Download patch

ref: ba4a5ff6d907c08b1a59c2567636aa1ea6196c55
parent: 90276fc440c4bfbc6fed7f18f3f8f23e14afe393
author: Snesrev <snesrev@protonmail.com>
date: Fri Oct 14 19:32:57 EDT 2022

Reduce texture size when EnhancedMode7 is disabled

--- a/main.c
+++ b/main.c
@@ -239,8 +239,10 @@
     SDL_RenderSetLogicalSize(renderer, g_snes_width, g_snes_height);
   if (g_config.linear_filtering)
     SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");
-  g_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888/*SDL_PIXELFORMAT_RGBA8888*/, SDL_TEXTUREACCESS_STREAMING,
-                                g_snes_width * 4, g_snes_height * 4);
+
+  int tex_mult = (g_ppu_render_flags & kPpuRenderFlags_4x4Mode7) ? 4 : 1;
+  g_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING,
+                                g_snes_width * tex_mult, g_snes_height * tex_mult);
   if (g_texture == NULL) {
     printf("Failed to create texture: %s\n", SDL_GetError());
     return false;