mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
90 lines
2.9 KiB
Plaintext
90 lines
2.9 KiB
Plaintext
From 9acf9fc7d783c31a3b395dad12991586d8411f54 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Mon, 6 May 2024 23:58:20 +1000
|
|
Subject: Fix for Haiku
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index df850c4..e891a0a 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1080,6 +1080,8 @@ if (WIN32)
|
|
elseif (APPLE)
|
|
find_library(COCOA Cocoa REQUIRED)
|
|
list(APPEND DEPENDENCIES_LIBRARIES ${COCOA})
|
|
+elseif (HAIKU)
|
|
+ list(APPEND DEPENDENCIES_LIBRARIES network)
|
|
else()
|
|
list(APPEND DEPENDENCIES_LIBRARIES dl)
|
|
endif()
|
|
diff --git a/extern/imgui_patched/backends/imgui_impl_opengl3_loader.h b/extern/imgui_patched/backends/imgui_impl_opengl3_loader.h
|
|
index 7ca72e3..1fd86a7 100644
|
|
--- a/extern/imgui_patched/backends/imgui_impl_opengl3_loader.h
|
|
+++ b/extern/imgui_patched/backends/imgui_impl_opengl3_loader.h
|
|
@@ -669,7 +669,9 @@ static int open_libgl(void)
|
|
libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
|
if (!libgl)
|
|
return GL3W_ERROR_LIBRARY_OPEN;
|
|
+#ifndef __HAIKU__
|
|
*(void **)(&glx_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB");
|
|
+#endif
|
|
return GL3W_OK;
|
|
}
|
|
|
|
@@ -678,8 +680,10 @@ static void close_libgl(void) { dlclose(libgl); }
|
|
static GL3WglProc get_proc(const char *proc)
|
|
{
|
|
GL3WglProc res;
|
|
+#ifndef __HAIKU__
|
|
res = glx_get_proc_address((const GLubyte *)proc);
|
|
if (!res)
|
|
+#endif
|
|
*(void **)(&res) = dlsym(libgl, proc);
|
|
return res;
|
|
}
|
|
diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp
|
|
index 690cff7..3013614 100644
|
|
--- a/src/gui/tutorial.cpp
|
|
+++ b/src/gui/tutorial.cpp
|
|
@@ -29,6 +29,7 @@
|
|
#include "../utfutils.h"
|
|
#else
|
|
#include <dirent.h>
|
|
+#include <sys/stat.h>
|
|
#endif
|
|
|
|
enum FurnaceCVObjectTypes {
|
|
@@ -583,13 +584,15 @@ void FurnaceGUI::initRandomDemoSong() {
|
|
if (de==NULL) break;
|
|
if (strcmp(de->d_name,".")==0) continue;
|
|
if (strcmp(de->d_name,"..")==0) continue;
|
|
- if (de->d_type==DT_DIR) {
|
|
+ struct stat info;
|
|
+ stat(de->d_name, &info);
|
|
+ if (S_ISDIR(info.st_mode)) {
|
|
String newPath=demoPath;
|
|
newPath+=DIR_SEPARATOR_STR;
|
|
newPath+=de->d_name;
|
|
logW("adding subdir %s",newPath);
|
|
subDirs.push_back(newPath);
|
|
- } else if (de->d_type==DT_REG && strstr(de->d_name,".fur")!=NULL) {
|
|
+ } else if (S_ISREG(info.st_mode) && strstr(de->d_name,".fur")!=NULL) {
|
|
String newPath=demoPath;
|
|
newPath+=DIR_SEPARATOR_STR;
|
|
newPath+=de->d_name;
|
|
@@ -625,7 +628,10 @@ void FurnaceGUI::initRandomDemoSong() {
|
|
if (de1==NULL) break;
|
|
if (strcmp(de1->d_name,".")==0) continue;
|
|
if (strcmp(de1->d_name,"..")==0) continue;
|
|
- if (de1->d_type==DT_REG && strstr(de1->d_name,".fur")!=NULL) {
|
|
+
|
|
+ struct stat info;
|
|
+ stat(de1->d_name, &info);
|
|
+ if (S_ISREG(info.st_mode) && strstr(de1->d_name,".fur")!=NULL) {
|
|
String newPath=i;
|
|
newPath+=DIR_SEPARATOR_STR;
|
|
newPath+=de1->d_name;
|
|
--
|
|
2.43.2
|
|
|