ref: 24bcbb8dfd67a659ffee790de7282db70b277a36
parent: a177f44b8884810adc58ce5d83617ef421fb49aa
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Apr 17 10:15:59 EDT 2020
Upscale 320x240 to 640x480 on the Wii U For performance reasons, I'm going to switch to 320x240 for Wii U builds.
--- a/src/Backends/WiiU/Window-Software.cpp
+++ b/src/Backends/WiiU/Window-Software.cpp
@@ -1,6 +1,7 @@
#include "../Window-Software.h"
#include <stdlib.h>
+#include <string.h>
//#include <coreinit/cache.h>
#include <coreinit/screen.h>
@@ -66,22 +67,55 @@
const unsigned char *in_pointer = fake_framebuffer;
- for (size_t y = 0; y < framebuffer_height; ++y)
+ if (framebuffer_width == 320 && framebuffer_height == 240)
{
- unsigned char *out_pointer = &drc_framebuffer[line_size * y];
+ for (size_t y = 0; y < framebuffer_height; ++y)
+ {
+ unsigned char *out_line = &drc_framebuffer[line_size * 2 * y];
- if (!flipflop)
- out_pointer += drc_buffer_size / 2;
+ if (!flipflop)
+ out_line += drc_buffer_size / 2;
- out_pointer += ((854 - framebuffer_width) * 4) / 2;
- out_pointer += ((480 - framebuffer_height) * line_size) / 2;
+ out_line += ((854 - (framebuffer_width * 2)) * 4) / 2;
- for (size_t x = 0; x < framebuffer_width; ++x)
+ unsigned char *out_pointer = out_line;
+
+ for (size_t x = 0; x < framebuffer_width; ++x)
+ {
+ *out_pointer++ = in_pointer[0];
+ *out_pointer++ = in_pointer[1];
+ *out_pointer++ = in_pointer[2];
+ *out_pointer++ = 0;
+ *out_pointer++ = in_pointer[0];
+ *out_pointer++ = in_pointer[1];
+ *out_pointer++ = in_pointer[2];
+ *out_pointer++ = 0;
+
+ in_pointer += 3;
+ }
+
+ memcpy(out_line + line_size, out_line, framebuffer_width * 4 * 2);
+ }
+ }
+ else
+ {
+ for (size_t y = 0; y < framebuffer_height; ++y)
{
- *out_pointer++ = *in_pointer++;
- *out_pointer++ = *in_pointer++;
- *out_pointer++ = *in_pointer++;
- *out_pointer++ = 0;
+ unsigned char *out_pointer = &drc_framebuffer[line_size * y];
+
+ if (!flipflop)
+ out_pointer += drc_buffer_size / 2;
+
+ out_pointer += ((854 - framebuffer_width) * 4) / 2;
+ out_pointer += ((480 - framebuffer_height) * line_size) / 2;
+
+ for (size_t x = 0; x < framebuffer_width; ++x)
+ {
+ *out_pointer++ = *in_pointer++;
+ *out_pointer++ = *in_pointer++;
+ *out_pointer++ = *in_pointer++;
+ *out_pointer++ = 0;
+ }
}
}