foxygit / fake-08-xbox360 Log in
commit 8ed656c675386abbe15ea74d458d1a8c2390f58f
Author:     Christian_Haitian <mckman@comcast.net>
AuthorDate: Mon Sep 12 20:09:49 2022 +0000
Commit:     Christian_Haitian <mckman@comcast.net>
CommitDate: Mon Sep 12 20:09:49 2022 +0000

    Remove fixed resolution and set it based on teh current display mode.
---
 platform/SDL2Desktop/source/SDL2Host.cpp | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/platform/SDL2Desktop/source/SDL2Host.cpp b/platform/SDL2Desktop/source/SDL2Host.cpp
index 3fc3b29..7c7a78f 100644
--- a/platform/SDL2Desktop/source/SDL2Host.cpp
+++ b/platform/SDL2Desktop/source/SDL2Host.cpp
@@ -22,8 +22,8 @@ using namespace std;
 // sdl
 #include <SDL2/SDL.h>

-#define WINDOW_SIZE_X 1280
-#define WINDOW_SIZE_Y 720
+/*#define WINDOW_SIZE_X 1280
+#define WINDOW_SIZE_Y 720*/

 #define WINDOW_FLAGS 0

@@ -45,6 +45,24 @@ string _desktopSdl2customBiosLua = "cartpath = \"~/p8carts/\"\n"

 Host::Host()
 {
+
+    SDL_DisplayMode current;
+
+    SDL_Init(SDL_INIT_VIDEO);
+
+    int should_be_zero = SDL_GetCurrentDisplayMode(0, &current);
+
+    if(should_be_zero != 0)
+      // In case of error...
+      SDL_Log("Could not get display mode for video display #%d: %s", 0, SDL_GetError());
+
+    else
+      // On success, print the current display mode.
+      SDL_Log("Display #%d: current display mode is %dx%dpx @ %dhz.", 0, current.w, current.h, current.refresh_rate);
+
+    int WINDOW_SIZE_X=current.w;
+    int WINDOW_SIZE_Y=current.h;
+
     struct stat st = {0};

     int res = chdir(getenv("HOME"));