From dc5f1dc84b7b89652bbf9ba0beabf203cc4dffda Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Tue, 14 Aug 2018 01:50:59 +0200
Subject: [PATCH] Ignore Original Resolution added

---
 gta5view         |   2 +-
 gta5view-cmd.pro |   2 +
 main.cpp         | 156 +++++++++++++++++++++++++----------------------
 3 files changed, 86 insertions(+), 74 deletions(-)

diff --git a/gta5view b/gta5view
index dc101a6..feabaac 160000
--- a/gta5view
+++ b/gta5view
@@ -1 +1 @@
-Subproject commit dc101a66dad3bf09336556bfd9fc92bb6f723212
+Subproject commit feabaac48eadfcc5a7ccc998884f1f96432d3f7c
diff --git a/gta5view-cmd.pro b/gta5view-cmd.pro
index 014a5fd..19b79f0 100644
--- a/gta5view-cmd.pro
+++ b/gta5view-cmd.pro
@@ -32,6 +32,8 @@ HEADERS  += \
 
 INCLUDEPATH += ./gta5view
 
+DEFINES += GTA5SYNC_NOASSIST
+
 # WINDOWS ONLY
 
 win32: DEFINES += GTA5SYNC_WIN
diff --git a/main.cpp b/main.cpp
index 8fcbd32..983eaa8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
         QString format = "jpg";
         bool isDefault = true;
         bool avatarMode = false;
+        bool ignoreORes = false;
         bool convertToGTA = false;
         bool customFormat = false;
         bool formatSwitch = false;
@@ -77,6 +78,11 @@ int main(int argc, char *argv[])
             {
                 isDefault = true;
             }
+            else if (args.at(4) == "-fs")
+            {
+                convertToGTA = false;
+                formatSwitch = true;
+            }
             else if (args.at(4) == "-aiar")
             {
                 isDefault = false;
@@ -111,10 +117,11 @@ int main(int argc, char *argv[])
                 isDefault = true;
                 keepAspectRatio = true;
             }
-            else if (args.at(4) == "-fs")
+            else if (args.at(4) == "-ior")
             {
-                convertToGTA = false;
-                formatSwitch = true;
+                isDefault = false;
+                ignoreORes = true;
+                keepAspectRatio = false;
             }
             else
             {
@@ -249,89 +256,92 @@ int main(int argc, char *argv[])
                 }
                 if (!image.isNull())
                 {
-                    QSize snapmaticRes(960, 536);
-                    QSize avatarRes(470, 470);
-                    int avatarZoneX = 145;
-                    int avatarZoneY = 66;
-
-                    if (isDefault)
+                    if (!ignoreORes)
                     {
-                        if (image.width() == image.height())
+                        QSize snapmaticRes(960, 536);
+                        QSize avatarRes(470, 470);
+                        int avatarZoneX = 145;
+                        int avatarZoneY = 66;
+
+                        if (isDefault)
                         {
-                            avatarMode = true;
+                            if (image.width() == image.height())
+                            {
+                                avatarMode = true;
+                            }
+                            else
+                            {
+                                avatarMode = false;
+                            }
+                        }
+                        if (!avatarMode)
+                        {
+                            QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
+                            snapmaticImage.fill(Qt::black);
+                            QPainter snapmaticPainter(&snapmaticImage);
+
+                            // Picture mode
+                            int diffWidth = 0;
+                            int diffHeight = 0;
+                            if (keepAspectRatio)
+                            {
+                                image = image.scaled(snapmaticRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+                                if (image.width() != snapmaticRes.width())
+                                {
+                                    diffWidth = snapmaticRes.width() - image.width();
+                                    diffWidth = diffWidth / 2;
+                                }
+                                else if (image.height() != snapmaticRes.height())
+                                {
+                                    diffHeight = snapmaticRes.height() - image.height();
+                                    diffHeight = diffHeight / 2;
+                                }
+                            }
+                            else
+                            {
+                                image = image.scaled(snapmaticRes.width(), snapmaticRes.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+                            }
+                            snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, image);
+                            snapmaticPainter.end();
+                            image = snapmaticImage;
                         }
                         else
                         {
-                            avatarMode = false;
-                        }
-                    }
-                    if (!avatarMode)
-                    {
-                        QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
-                        snapmaticImage.fill(Qt::black);
-                        QPainter snapmaticPainter(&snapmaticImage);
+                            QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
+                            snapmaticImage.fill(Qt::black);
+                            QPainter snapmaticPainter(&snapmaticImage);
 
-                        // Picture mode
-                        int diffWidth = 0;
-                        int diffHeight = 0;
-                        if (keepAspectRatio)
-                        {
-                            image = image.scaled(snapmaticRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-                            if (image.width() != snapmaticRes.width())
+                            // Scale to Avatar Resolution if needed
+                            if (image.width() != avatarRes.width())
                             {
-                                diffWidth = snapmaticRes.width() - image.width();
-                                diffWidth = diffWidth / 2;
+                                image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
                             }
-                            else if (image.height() != snapmaticRes.height())
-                            {
-                                diffHeight = snapmaticRes.height() - image.height();
-                                diffHeight = diffHeight / 2;
-                            }
-                        }
-                        else
-                        {
-                            image = image.scaled(snapmaticRes.width(), snapmaticRes.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-                        }
-                        snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, image);
-                        snapmaticPainter.end();
-                        image = snapmaticImage;
-                    }
-                    else
-                    {
-                        QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
-                        snapmaticImage.fill(Qt::black);
-                        QPainter snapmaticPainter(&snapmaticImage);
 
-                        // Scale to Avatar Resolution if needed
-                        if (image.width() != avatarRes.width())
-                        {
-                            image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-                        }
-
-                        // Avatar mode
-                        int diffWidth = 0;
-                        int diffHeight = 0;
-                        if (keepAspectRatio)
-                        {
-                            image = image.scaled(avatarRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-                            if (image.width() > image.height())
+                            // Avatar mode
+                            int diffWidth = 0;
+                            int diffHeight = 0;
+                            if (keepAspectRatio)
                             {
-                                diffHeight = avatarRes.height() - image.height();
-                                diffHeight = diffHeight / 2;
+                                image = image.scaled(avatarRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+                                if (image.width() > image.height())
+                                {
+                                    diffHeight = avatarRes.height() - image.height();
+                                    diffHeight = diffHeight / 2;
+                                }
+                                else if (image.width() < image.height())
+                                {
+                                    diffWidth = avatarRes.width() - image.width();
+                                    diffWidth = diffWidth / 2;
+                                }
                             }
-                            else if (image.width() < image.height())
+                            else
                             {
-                                diffWidth = avatarRes.width() - image.width();
-                                diffWidth = diffWidth / 2;
+                                image = image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
                             }
+                            snapmaticPainter.drawImage(avatarZoneX + diffWidth, avatarZoneY + diffHeight, image);
+                            snapmaticPainter.end();
+                            image = snapmaticImage;
                         }
-                        else
-                        {
-                            image = image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-                        }
-                        snapmaticPainter.drawImage(avatarZoneX + diffWidth, avatarZoneY + diffHeight, image);
-                        snapmaticPainter.end();
-                        image = snapmaticImage;
                     }
 
                     if (picture.setImage(image))
@@ -510,7 +520,7 @@ int main(int argc, char *argv[])
             cout << "Convert-only: <autodef> (auto file name at convert)" << endl;
             cout << "Convert-only: <autoext> (auto file extension at convert)" << endl;
             cout << "Formats: jpg pgta g5e" << endl;
-            cout << "Snapmatic Modes: a p d fs aiar akar piar pkar diar dkar" << endl;
+            cout << "Snapmatic Modes: a p d fs aiar akar piar pkar diar dkar ior" << endl;
             cout << "Snapmatic Flags: crew=int players=int[] position=double[] title=string" << endl;
             cout << "Global Flags: output=string" << endl;
         }