From f18530783b5dfb5ab193f953ad077a2acb9e7372 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Tue, 9 Jun 2020 23:51:56 +1000 Subject: Fix for Haiku diff --git a/dreamchess/src/dreamchess.c b/dreamchess/src/dreamchess.c index ea6cee7..cf5d776 100644 --- a/dreamchess/src/dreamchess.c +++ b/dreamchess/src/dreamchess.c @@ -508,6 +508,16 @@ int main(int argc, char **argv) { game_set_engine_error(comm_init(temp2)); } else game_set_engine_error(comm_init(option->string)); +#elif defined(__HAIKU__) + char temp[PATH_MAX]; + if (!strcmp(option->string, "dreamer") || !strcmp(option->string, "Dreamer")) { + strcpy(temp, realpath(argv[0], NULL)); + char *ptr = strrchr(temp, '/'); + if (ptr)*ptr=0; + strcat(temp, "/dreamer"); + game_set_engine_error(comm_init(temp)); + } else + game_set_engine_error(comm_init(option->string)); #else game_set_engine_error(comm_init(option->string)); #endif -- 2.26.0 From 4ee8dfe7f7c0226cb8713825291bdaa6c9730be7 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 25 Sep 2019 21:05:23 +1000 Subject: Kill process on quit diff --git a/dreamchess/src/comm_unix.c b/dreamchess/src/comm_unix.c index 489b57f..5331e05 100644 --- a/dreamchess/src/comm_unix.c +++ b/dreamchess/src/comm_unix.c @@ -105,6 +105,11 @@ void comm_exit(void) { } } +void app_exit(int err) { + kill(getpid(), SIGKILL); + exit(0); +} + void comm_send_str(const char *str) { if (init_ok) pipe_unix_send(str); diff --git a/dreamchess/src/gui/get_move.c b/dreamchess/src/gui/get_move.c index 083ab27..12c593a 100644 --- a/dreamchess/src/gui/get_move.c +++ b/dreamchess/src/gui/get_move.c @@ -63,7 +63,7 @@ int get_move(void) { while (SDL_PollEvent(&event)) if (event.type == SDL_QUIT) /* FIXME */ - exit(0); + app_exit(0); } while (SDL_PollEvent(&event)) { @@ -71,7 +71,7 @@ int get_move(void) { if (event.type == SDL_QUIT) /* FIXME */ - exit(0); + app_exit(0); if (event.type == SDL_MOUSEMOTION) set_mouse_pos(event.motion.x, event.motion.y); diff --git a/dreamchess/src/gui/ui_sdlgl.c b/dreamchess/src/gui/ui_sdlgl.c index 161aadb..e002c2f 100644 --- a/dreamchess/src/gui/ui_sdlgl.c +++ b/dreamchess/src/gui/ui_sdlgl.c @@ -175,7 +175,7 @@ static int poll_event(gg_event_t *event) { if (sdl_event.type == SDL_QUIT) /* FIXME */ - exit(0); + app_exit(0); if ((sdl_event.type == SDL_KEYDOWN && sdl_event.key.keysym.mod & KMOD_ALT && sdl_event.key.keysym.sym == SDLK_RETURN) || -- 2.26.0 From 87f3bb55e1c6cba9b26705cead757388f473dec8 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 25 Sep 2019 22:51:33 +1000 Subject: Fix settings dir diff --git a/dreamchess/src/dir.c b/dreamchess/src/dir.c index 57ce5b1..dfbaaa7 100644 --- a/dreamchess/src/dir.c +++ b/dreamchess/src/dir.c @@ -107,7 +107,11 @@ int ch_userdir(void) { #else /* !_WIN32 */ +#ifdef __HAIKU__ +#define USERDIR "./config/settings/dreamchess" +#else #define USERDIR ".dreamchess" +#endif #include #include -- 2.26.0