Skip to content

Commit

Permalink
Add support for viz_noxserver on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
mwydmuch committed Dec 15, 2023
1 parent 527a934 commit 5f65993
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/lib/ViZDoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace vizdoom {

this->MQDoom->send(MSG_CODE_CLOSE);

#ifdef OS_LINUX
#ifdef OS_POSIX
if(0 == kill(this->doomProcessPid, 0)){
bpr::child doomProcess(this->doomProcessPid);
bpr::terminate(doomProcess);
Expand Down Expand Up @@ -1415,7 +1415,7 @@ namespace vizdoom {
this->doomArgs.push_back("+viz_window_hidden");
this->doomArgs.push_back("1");

#ifdef OS_LINUX
#ifdef OS_POSIX
if (this->noXServer){
this->doomArgs.push_back("+viz_noxserver");
this->doomArgs.push_back("1");
Expand Down Expand Up @@ -1464,7 +1464,7 @@ namespace vizdoom {
void DoomController::launchDoom() {
try {
bpr::child doomProcess = bpr::execute(bpri::set_args(this->doomArgs), bpri::inherit_env());
#ifdef OS_LINUX
#ifdef OS_POSIX
this->doomProcessPid = doomProcess.pid;
#endif
bpr::wait_for_exit(doomProcess);
Expand Down
6 changes: 5 additions & 1 deletion src/lib/ViZDoomController.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ namespace vizdoom {
/* OSes */
#ifdef __linux__
#define OS_LINUX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#elif _WIN32
#define OS_WIN
#elif __APPLE__
#define OS_OSX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#endif

class DoomController {
Expand Down Expand Up @@ -329,7 +333,7 @@ namespace vizdoom {

b::thread *doomThread;

#ifdef OS_LINUX
#ifdef OS_POSIX
pid_t doomProcessPid;
#endif

Expand Down

0 comments on commit 5f65993

Please sign in to comment.