Skip to content

Commit

Permalink
Add Haiku support
Browse files Browse the repository at this point in the history
  • Loading branch information
win8linux authored and xtreme8000 committed Apr 1, 2022
1 parent 738d87d commit 5087d4c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/common.h
Expand Up @@ -59,6 +59,10 @@
#define OS_APPLE
#endif

#ifdef __HAIKU__
#define OS_HAIKU
#endif

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/file.c
Expand Up @@ -49,6 +49,10 @@ void file_url(char* url) {
sprintf(cmd, "xdg-open %s", url);
system(cmd);
#endif
#ifdef OS_HAIKU
sprintf(cmd, "open %s", url);
system(cmd);
#endif
}

int file_dir_exists(const char* path) {
Expand Down
3 changes: 3 additions & 0 deletions src/network.c
Expand Up @@ -843,6 +843,9 @@ void read_PacketVersionGet(void* data, int len) {
#ifdef OS_APPLE
char* os = "BetterSpades (Apple) " GIT_COMMIT_HASH;
#endif
#ifdef OS_HAIKU
char* os = "BetterSpades (Haiku) " GIT_COMMIT_HASH;
#endif
#else
#ifdef USE_TOUCH
char* os = "BetterSpades (Android) " GIT_COMMIT_HASH;
Expand Down
11 changes: 10 additions & 1 deletion src/window.c
Expand Up @@ -35,6 +35,10 @@
#include <unistd.h>
#endif

#ifdef OS_HAIKU
#include <kernel/OS.h>
#endif

#ifdef USE_GLFW

static bool joystick_available = false;
Expand Down Expand Up @@ -600,5 +604,10 @@ int window_cpucores() {
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
#endif
return 1;
#ifdef OS_HAIKU
system_info info;
get_system_info(&info);
return info.cpu_count;
#endif
return 1;
}

0 comments on commit 5087d4c

Please sign in to comment.