From 06e4a315abcfea7945997459c2838e3913246b0c Mon Sep 17 00:00:00 2001
From: Steel Titanium <steeltitanium1@gmail.com>
Date: Fri, 7 May 2021 17:24:09 -0400
Subject: [PATCH] Add support for adding files via drag and drop onto exe

Depends on support for file manager
---
 src/d_main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/d_main.c b/src/d_main.c
index 61510d590..2fbe822d0 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1038,6 +1038,7 @@ void D_SRB2Main(void)
 
 	INT32 pstartmap = 1;
 	boolean autostart = false;
+	INT32 i;
 
 	/* break the version string into version numbers, for netplay */
 	D_ConvertVersionNumbers();
@@ -1190,6 +1191,19 @@ void D_SRB2Main(void)
 					D_AddFile(startuppwads, s);
 			}
 		}
+
+		// Add any files that was dragged onto the executable
+		// Start at 1 as myargv[0] is the executable
+		if (myargc > 1)
+		{
+			for (i = 1; i < myargc; i++)
+			{
+				if (myargv[i][0] == '-') // Skip anything that starts with hyphen, if we do get any somehow.
+					continue;
+
+				D_AddFile(startuppwads, myargv[i]);
+			}
+		}
 	}
 
 	// get map from parms
-- 
GitLab