Compare commits
4 commits
8f2eddec47
...
4c4c45f79b
Author | SHA1 | Date | |
---|---|---|---|
4c4c45f79b | |||
71e823756a | |||
50b8efe9c6 | |||
3f29bbc973 |
2 changed files with 48 additions and 3 deletions
19
README.md
19
README.md
|
@ -1,18 +1,31 @@
|
||||||
# doompanning
|
# doompanning
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@oxmox@chaos.social
|
@oxmox@chaos.social
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
gcc/clang, cmake, ninja, sdl2, doom shareware
|
### Linux / FreeBSD
|
||||||
|
|
||||||
|
gcc/clang, cmake, sdl2, doom shareware
|
||||||
|
|
||||||
See [Dockerfile](Dockerfile) for details.
|
See [Dockerfile](Dockerfile) for details.
|
||||||
|
|
||||||
|
### MSYS2 (ucrt64)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman -S mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-toolchain
|
||||||
|
cd doompanning
|
||||||
|
mkdir build
|
||||||
|
cmake -G"MinGW Makefiles" ..
|
||||||
|
cmake --build . -j
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## State
|
## State
|
||||||
|
|
||||||
Input forwarding to the dooms is currently broken or at least in a bad state.
|
Input forwarding to the dooms is currently broken or at least in a bad state.
|
||||||
Was trying out something, not sure.
|
Was trying out something, not sure.
|
||||||
|
|
||||||
Run [sdl_nyan_demo](external/sdl_nyan/src/sdl_nyan_demo.cc) for the cats.
|
Run [sdl_nyan_demo](external/sdl_nyan/src/sdl_nyan_demo.cc) for the cats.
|
||||||
|
|
||||||
|

|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -119,6 +120,37 @@ char **__environ = environ;
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
inline void spawn_doom(ControllerContext &ctx)
|
inline void spawn_doom(ControllerContext &ctx)
|
||||||
{
|
{
|
||||||
|
(void) ctx;
|
||||||
|
|
||||||
|
// Source: https://learn.microsoft.com/en-us/windows/win32/procthread/creating-processes
|
||||||
|
STARTUPINFO si;
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
|
ZeroMemory(&si, sizeof(si));
|
||||||
|
si.cb = sizeof(si);
|
||||||
|
ZeroMemory(&pi, sizeof(pi));
|
||||||
|
|
||||||
|
char cmdLine[256];
|
||||||
|
snprintf(cmdLine, sizeof(cmdLine), "%s", DOOM_EXECUTABLE);
|
||||||
|
|
||||||
|
// Start the child process.
|
||||||
|
if (!CreateProcess(NULL, // No module name (use command line)
|
||||||
|
cmdLine, // Command line
|
||||||
|
NULL, // Process handle not inheritable
|
||||||
|
NULL, // Thread handle not inheritable
|
||||||
|
FALSE, // Set handle inheritance to FALSE
|
||||||
|
0, // No creation flags
|
||||||
|
NULL, // Use parent's environment block
|
||||||
|
NULL, // Use parent's starting directory
|
||||||
|
&si, // Pointer to STARTUPINFO structure
|
||||||
|
&pi) // Pointer to PROCESS_INFORMATION structure
|
||||||
|
)
|
||||||
|
{
|
||||||
|
log_error("CreateProcess failed (%d)", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info("Spawned new %s, pid=%d", cmdLine, pi.dwProcessId);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void spawn_doom_posix_spawn(ControllerContext &ctx)
|
void spawn_doom_posix_spawn(ControllerContext &ctx)
|
||||||
|
|
Loading…
Reference in a new issue