Add display mode options: stretch, aspect ratio, and integer scaling

Renders the emulator framebuffer into a calculated sub-rect with
nearest-neighbor scaling and black bars, driven by the core's
reported aspect ratio. Adds a cycle button in the game HUD and
a display mode setting in the settings screen.
This commit is contained in:
2026-04-08 20:48:52 -04:00
parent 39e3f8b7c0
commit 14045accb5
11 changed files with 214 additions and 15 deletions

View File

@@ -10,6 +10,12 @@
#include <thread>
#include <unordered_map>
enum class DisplayMode : int {
STRETCH = 0,
ASPECT_RATIO = 1,
INTEGER_SCALE = 2
};
class LibretroFrontend {
public:
static LibretroFrontend& instance();
@@ -33,6 +39,7 @@ public:
void setAudioEnabled(bool enabled);
void setFrameSkip(int skip);
void setDisplayMode(int mode);
void setSystemDir(const char* dir);
void setSaveDir(const char* dir);
@@ -90,6 +97,10 @@ private:
ANativeWindow* window_ = nullptr;
std::mutex window_mutex_;
unsigned pixel_format_ = RETRO_PIXEL_FORMAT_RGB565;
std::atomic<DisplayMode> display_mode_{DisplayMode::STRETCH};
float core_aspect_ratio_ = 0.0f;
unsigned core_base_width_ = 0;
unsigned core_base_height_ = 0;
// Audio
AudioEngine audio_engine_;