From 1fdc81aa0870c144091c32026954b51a4892a059 Mon Sep 17 00:00:00 2001
From: XargonWan <XargonWan@gmail.com>
Date: Tue, 18 Feb 2025 11:56:48 +0900
Subject: [PATCH] FRAMEWORK: introduced resolution check

---
 functions/global.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/functions/global.sh b/functions/global.sh
index 9d83c59f..4fc27e6d 100644
--- a/functions/global.sh
+++ b/functions/global.sh
@@ -11,12 +11,24 @@ rd_logs_folder="/var/config/retrodeck/logs" # Static location to write all Retro
 source /app/libexec/logger.sh
 rotate_logs
 
+width=$(grep -oP '\d+(?=x)' /sys/class/graphics/fb0/modes)
+height=$(grep -oP '(?<=x)\d+' /sys/class/graphics/fb0/modes)
+if [[ $width -ne 1280 ]] || [[ $height -ne 800 ]]; then
+  native_resolution=false
+else
+  native_resolution=true
+fi
+
 log d "Debug mode enabled"
 log i "Initializing RetroDECK"
 log i "Running on $XDG_SESSION_DESKTOP, $XDG_SESSION_TYPE"
 if [[ -n $container ]]; then
   log i "$container environment"
 fi
+log i "Resolution: $width x $height"
+if [[ $native_resolution == true ]]; then
+  log i "Steam Deck native resolution detected"
+fi
 
 source /app/libexec/050_save_migration.sh
 source /app/libexec/checks.sh