ref: 5ae8a5cc7145fdfec335d20ee22029059f7ce94c
parent: f732352300f0cff1786168e93954803969d46070
author: Snesrev <snesrev@protonmail.com>
date: Tue Oct 11 19:30:36 EDT 2022
Add [Graphics].SoftwareRendering Possibly gives better performance on raspberry pi
--- a/config.c
+++ b/config.c
@@ -259,6 +259,8 @@
} else if (StringEqualsNoCase(key, "WindowScale")) {
g_config.window_scale = (uint8)strtol(value, (char**)NULL, 10);
return true;
+ } else if (StringEqualsNoCase(key, "SoftwareRendering")) {
+ return ParseBool(value, &g_config.software_rendering);
} else if (StringEqualsNoCase(key, "NoSpriteLimits")) {
return ParseBool(value, &g_config.no_sprite_limits);
} else if (StringEqualsNoCase(key, "LinkGraphics")) {
--- a/config.h
+++ b/config.h
@@ -44,6 +44,7 @@
bool ignore_aspect_ratio;
uint8 fullscreen;
uint8 window_scale;
+ bool software_rendering;
bool enable_audio;
uint16 audio_freq;
uint8 audio_channels;
--- a/main.c
+++ b/main.c
@@ -260,7 +260,9 @@
}
g_window = window;
SDL_SetWindowHitTest(window, HitTestCallback, NULL);
- SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+ SDL_Renderer* renderer = SDL_CreateRenderer(window, -1,
+ g_config.software_rendering ? SDL_RENDERER_SOFTWARE :
+ SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if(renderer == NULL) {
printf("Failed to create renderer: %s\n", SDL_GetError());
return 1;
--- a/zelda3.ini
+++ b/zelda3.ini
@@ -18,8 +18,13 @@
[Graphics]
# Window size ( Auto or WidthxHeight )
WindowSize = Auto
+
# Fullscreen mode (0=windowed, 1=desktop fullscreen, 2=fullscreen w/mode change)
Fullscreen = 0
+
+# Set to 1 to use SDL software rendering. Might give better performance on Raspberry pi.
+SoftwareRendering = 0
+
# Window scale (1=100%, 2=200%, 3=300%, etc.)
WindowScale = 3
NewRenderer = 1