From 09f79a693460aadc49b4cc2ca3fe51aa7f121bd8 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Thu, 7 Sep 2023 17:24:06 +0200 Subject: [PATCH 1/2] Addfile per drag and drop https://git.do.srb2.org/SteelT/SRB2/-/commit/01cc2b91e189e4d268eddd38f3ba917133a07adc --- src/sdl/i_video.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 3fd96819c..09ed77658 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -969,6 +969,7 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint void I_GetEvent(void) { SDL_Event evt; + char* dropped_filedir; // We only want the first motion event, // otherwise we'll end up catching the warp back to center. //int mouseMotionOnce = 0; @@ -1293,6 +1294,11 @@ void I_GetEvent(void) if (currentMenu == &OP_JoystickSetDef) M_SetupJoystickMenu(0); break; + case SDL_DROPFILE: + dropped_filedir = evt.drop.file; + COM_BufInsertText(va("addfile \"%s\"", dropped_filedir)); + SDL_free(dropped_filedir); // Free dropped_filedir memory + break; case SDL_QUIT: I_Quit(); M_QuitResponse('y'); -- 2.54.0 From b883d02abb4b972af761f94e7aa677d6d3dd7c13 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 7 Sep 2023 19:28:53 +0300 Subject: [PATCH 2/2] Use P_AddWadFile directly instead of command so non-ansii file names also supported --- src/sdl/i_video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 09ed77658..d08b267f0 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -59,6 +59,7 @@ #endif #include "../doomstat.h" +#include "../p_setup.h" #include "../i_system.h" #include "../v_video.h" #include "../m_argv.h" @@ -1296,7 +1297,7 @@ void I_GetEvent(void) break; case SDL_DROPFILE: dropped_filedir = evt.drop.file; - COM_BufInsertText(va("addfile \"%s\"", dropped_filedir)); + P_AddWadFile(dropped_filedir); SDL_free(dropped_filedir); // Free dropped_filedir memory break; case SDL_QUIT: -- 2.54.0