Use SDL_Process to run subprocess

This commit is contained in:
Anonymous Maarten 2024-12-27 23:57:46 +01:00
parent 0806733e69
commit d26a8f4997

View File

@ -31,8 +31,8 @@
#include "scripts.h" #include "scripts.h"
#include <SDL3/SDL_events.h> #include <SDL3/SDL_events.h>
#include <SDL3/SDL_process.h>
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#include <process.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <vec.h> #include <vec.h>
@ -320,9 +320,11 @@ void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p
} }
break; break;
case Extra::ActionType::e_run: case Extra::ActionType::e_run: {
_spawnl(0, "\\lego\\sources\\main\\main.exe", "\\lego\\sources\\main\\main.exe", "/script", &p_pAtom, 0); const char* args[] =
break; {"/lego/sources/main/main.exe", "/lego/sources/main/main.exe", "/script", p_pAtom.GetInternal(), NULL};
SDL_Process* process = SDL_CreateProcess(args, false);
} break;
case Extra::ActionType::e_enable: case Extra::ActionType::e_enable:
assert(p_streamId != DS_NOT_A_STREAM); assert(p_streamId != DS_NOT_A_STREAM);
CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_streamId); CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_streamId);