it's alive! not pretty but alive! also remove the fork() spawner
This commit is contained in:
parent
df9cf1c14a
commit
3c5b3ae4e9
1 changed files with 0 additions and 34 deletions
|
@ -84,40 +84,6 @@ void spawn_doom_posix_spawn(ControllerContext &ctx)
|
|||
ctx.dooms.emplace_back(ds);
|
||||
}
|
||||
|
||||
// nng does not like this at all and panics (for good reasons)
|
||||
void spawn_doom_fork(ControllerContext &ctx)
|
||||
{
|
||||
auto pid = fork();
|
||||
|
||||
if (pid < 0)
|
||||
{
|
||||
log_error("Could not spawn doom: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid == 0) // doomchild
|
||||
{
|
||||
log_info("doomchild %d cleaning the room", getpid());
|
||||
ImGui::DestroyContext();
|
||||
log_info("doomchild %d cleanup done", getpid());
|
||||
|
||||
const char *const argv[] = { DOOM_EXECUTABLE, nullptr };
|
||||
execvp(DOOM_EXECUTABLE, const_cast<char *const *>(argv));
|
||||
}
|
||||
else if (pid > 0) // doomparent
|
||||
{
|
||||
DoomState ds;
|
||||
ds.id = pid;
|
||||
ds.texture = SDL_CreateTexture(ctx.renderer, SDL_PIXELFORMAT_RGB888,
|
||||
SDL_TEXTUREACCESS_STREAMING, DoomScreenWidth, DoomScreenHeight);
|
||||
if (!ds.texture)
|
||||
dp_sdl_fatal("SDL_CreateTexture");
|
||||
|
||||
log_info("Spawned new doom, pid=%d", ds.id);
|
||||
ctx.dooms.emplace_back(ds);
|
||||
}
|
||||
}
|
||||
|
||||
inline void spawn_doom(ControllerContext &ctx)
|
||||
{
|
||||
spawn_doom_posix_spawn(ctx);
|
||||
|
|
Loading…
Reference in a new issue