mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 14:38:51 +02:00
384 lines
11 KiB
Plaintext
384 lines
11 KiB
Plaintext
From 1cb3637fae9bca7ba8662e5854c0b2aed82aad5b Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sat, 15 Sep 2018 22:09:15 +1000
|
|
Subject: Fix build for haiku
|
|
|
|
|
|
diff --git a/src/celengine/astro.cpp b/src/celengine/astro.cpp
|
|
index 989dead..bc2b52f 100644
|
|
--- a/src/celengine/astro.cpp
|
|
+++ b/src/celengine/astro.cpp
|
|
@@ -522,7 +522,7 @@ const char* astro::Date::toCStr(Format format) const
|
|
cal_time.tm_sec = (int)seconds;
|
|
cal_time.tm_wday = wday;
|
|
cal_time.tm_gmtoff = utc_offset;
|
|
-#if defined(TARGET_OS_MAC) || defined(__FreeBSD__)
|
|
+#if defined(TARGET_OS_MAC) || defined(__FreeBSD__) || defined(__HAIKU__)
|
|
// tm_zone is a non-const string field on the Mac and FreeBSD (why?)
|
|
cal_time.tm_zone = const_cast<char*>(tzname.c_str());
|
|
#else
|
|
diff --git a/src/celengine/glext.cpp b/src/celengine/glext.cpp
|
|
index 0f04423..5326029 100644
|
|
--- a/src/celengine/glext.cpp
|
|
+++ b/src/celengine/glext.cpp
|
|
@@ -12,10 +12,10 @@
|
|
|
|
#ifndef _WIN32
|
|
// Assume that this is a UNIX/X11 system if it's not Windows or Mac OS X.
|
|
-#ifndef TARGET_OS_MAC
|
|
+#if !defined(TARGET_OS_MAC) && !defined(__HAIKU__)
|
|
#include "GL/glx.h"
|
|
#include <dlfcn.h>
|
|
-#endif /* ! TARGET_OS_MAC */
|
|
+#endif /* ! TARGET_OS_MAC || HAIKU */
|
|
#endif /* ! _WIN32 */
|
|
|
|
#include "glext.h"
|
|
@@ -306,7 +306,7 @@ extern QGLContext* glctx;
|
|
|
|
#else
|
|
|
|
-#ifndef TARGET_OS_MAC
|
|
+#if !defined(TARGET_OS_MAC) && !defined(__HAIKU__)
|
|
#if defined(_WIN32)
|
|
|
|
#define GET_GL_PROC_ADDRESS(name) wglGetProcAddress(name)
|
|
@@ -692,9 +692,11 @@ static void InitExt_EXT_swap_control()
|
|
|
|
static void InitExt_GLX_SGI_video_sync()
|
|
{
|
|
+#if defined(GET_GL_PROC_ADDRESS)
|
|
glx::glXGetVideoSyncSGI = (glx::PFNGLXGETVIDEOSYNCSGIPROC) GET_GL_PROC_ADDRESS("glXGetVideoSyncSGI");
|
|
glx::glXWaitVideoSyncSGI = (glx::PFNGLXWAITVIDEOSYNCSGIPROC) GET_GL_PROC_ADDRESS("glXWaitVideoSyncSGI");
|
|
glx::glXGetRefreshRateSGI = (glx::PFNGLXGETREFRESHRATESGIPROC) GET_GL_PROC_ADDRESS("glXGetRefreshRateSGI");
|
|
+#endif
|
|
}
|
|
|
|
|
|
diff --git a/src/celutil/unixdirectory.cpp b/src/celutil/unixdirectory.cpp
|
|
index 9a1b054..dda19e0 100644
|
|
--- a/src/celutil/unixdirectory.cpp
|
|
+++ b/src/celutil/unixdirectory.cpp
|
|
@@ -11,19 +11,19 @@
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
+#if !defined(__HAIKU__)
|
|
#include <wordexp.h>
|
|
+#endif
|
|
#include "directory.h"
|
|
|
|
using namespace std;
|
|
|
|
|
|
-#ifdef TARGET_OS_MAC
|
|
-#ifdef QT_CORE_LIB
|
|
+#if defined(__HAIKU__) || defined(TARGET_OS_MAC) && defined(QT_CORE_LIB)
|
|
// Crash on Mac OS X / Qt4 version when calling wordfree.
|
|
// This seems to happen only with Leopard.
|
|
#define WORDEXP_PROBLEM
|
|
#endif
|
|
-#endif
|
|
|
|
class UnixDirectory : public Directory
|
|
{
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From 2efebe98af6ad5a8ee7ffbb79aeb9297a59e8271 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sat, 15 Sep 2018 22:31:57 +1000
|
|
Subject: Add missing headers
|
|
|
|
|
|
diff --git a/src/celengine/image.cpp b/src/celengine/image.cpp
|
|
index a36b9c1..3f94565 100644
|
|
--- a/src/celengine/image.cpp
|
|
+++ b/src/celengine/image.cpp
|
|
@@ -67,6 +67,10 @@ extern "C" {
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <string.h>
|
|
+#endif
|
|
+
|
|
using namespace std;
|
|
|
|
|
|
diff --git a/src/celengine/texture.cpp b/src/celengine/texture.cpp
|
|
index 0775204..5500143 100644
|
|
--- a/src/celengine/texture.cpp
|
|
+++ b/src/celengine/texture.cpp
|
|
@@ -29,6 +29,10 @@
|
|
#include <cstdio>
|
|
#include <cassert>
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <string.h>
|
|
+#endif
|
|
+
|
|
#ifndef _WIN32
|
|
#ifndef TARGET_OS_MAC
|
|
#include <config.h>
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From daf6a9be27322ed45c81f709728c2c9b64d8a0db Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sat, 15 Sep 2018 22:55:24 +1000
|
|
Subject: Add missing header
|
|
|
|
|
|
diff --git a/src/celmath/intersect.h b/src/celmath/intersect.h
|
|
index 38fb01f..44791ff 100644
|
|
--- a/src/celmath/intersect.h
|
|
+++ b/src/celmath/intersect.h
|
|
@@ -15,7 +15,7 @@
|
|
#include "ray.h"
|
|
#include "sphere.h"
|
|
#include "ellipsoid.h"
|
|
-
|
|
+#include "mathlib.h"
|
|
|
|
template<class T> bool testIntersection(const Ray3<T>& ray,
|
|
const Sphere<T>& sphere,
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From 204164c0c62a43ddc21655f3318ad59d778391af Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sat, 15 Sep 2018 23:47:31 +1000
|
|
Subject: Fix for png16
|
|
|
|
|
|
diff --git a/src/celestia/imagecapture.cpp b/src/celestia/imagecapture.cpp
|
|
index 92602da..c2c2520 100644
|
|
--- a/src/celestia/imagecapture.cpp
|
|
+++ b/src/celestia/imagecapture.cpp
|
|
@@ -181,7 +181,7 @@ bool CaptureGLBufferToPNG(const string& filename,
|
|
// png_init_io(png_ptr, out);
|
|
png_set_write_fn(png_ptr, (void*) out, PNGWriteData, NULL);
|
|
|
|
- png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
|
|
+ png_set_compression_level(png_ptr, PNG_Z_DEFAULT_COMPRESSION);
|
|
png_set_IHDR(png_ptr, info_ptr,
|
|
width, height,
|
|
8,
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From 1492101fa45a846b28e210bd4dc11afca7d6707d Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 16 Sep 2018 13:12:37 +1000
|
|
Subject: Disable GLSL shaders. Add window size and position for Haiku.
|
|
|
|
|
|
diff --git a/src/celestia/glutmain.cpp b/src/celestia/glutmain.cpp
|
|
index 4b14167..9c1ed7f 100644
|
|
--- a/src/celestia/glutmain.cpp
|
|
+++ b/src/celestia/glutmain.cpp
|
|
@@ -24,6 +24,9 @@
|
|
#include <Carbon/Carbon.h>
|
|
#include <GLUT/glut.h>
|
|
#endif
|
|
+#ifdef __HAIKU__
|
|
+#include <Screen.h>
|
|
+#endif
|
|
#include <celengine/celestia.h>
|
|
#include <celmath/vecmath.h>
|
|
#include <celmath/quaternion.h>
|
|
@@ -432,12 +435,13 @@ static void dirFixup(char *argv0) {
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
+#ifndef __HAIKU__
|
|
setlocale(LC_ALL, "");
|
|
setlocale(LC_NUMERIC, "C");
|
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
|
textdomain(PACKAGE);
|
|
-
|
|
+#endif
|
|
#ifdef MACOSX
|
|
#define BUNDLEONLY 1
|
|
#ifndef BUNDLEONLY
|
|
@@ -495,12 +499,27 @@ int main(int argc, char* argv[])
|
|
}
|
|
|
|
glutInit(&argc, argv);
|
|
+#ifdef __HAIKU__
|
|
+ BScreen screen(B_MAIN_SCREEN_ID);
|
|
+ int screenWidth = screen.Frame().Width();
|
|
+ int screenHeight = screen.Frame().Height();
|
|
+ int winWidth = screenWidth >= 1024 ? 800 : 640;
|
|
+ int winHeight = screenHeight >= 768 ? 600 : 480;
|
|
+ int winPosX = (screenWidth - winWidth ) / 2;
|
|
+ int winPosY = (screenHeight - winHeight ) / 2;
|
|
+ glutInitWindowSize(winWidth, winHeight);
|
|
+ glutInitWindowPosition(winPosX, winPosY);
|
|
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
|
+ mainWindow = glutCreateWindow("Celestia");
|
|
+ Resize(winWidth, winHeight);
|
|
+#else
|
|
glutInitWindowSize(480, 360);
|
|
glutInitWindowPosition(0, 0);
|
|
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
|
mainWindow = glutCreateWindow("Celestia");
|
|
|
|
Resize(480, 360);
|
|
+#endif
|
|
glutReshapeFunc(Resize);
|
|
glutDisplayFunc(Display);
|
|
glutIdleFunc(Idle);
|
|
@@ -517,7 +536,9 @@ int main(int argc, char* argv[])
|
|
|
|
// GL should be all set up, now initialize the renderer.
|
|
appCore->initRenderer();
|
|
-
|
|
+#ifdef __HAIKU__
|
|
+ appCore->getRenderer()->getGLContext()->setRenderPath(GLContext::GLPath_Basic);
|
|
+#endif
|
|
// Set the simulation starting time to the current system time
|
|
time_t curtime=time(NULL);
|
|
appCore->start((double) curtime / 86400.0 + (double) astro::Date(1970, 1, 1));
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From 64b8b223eb1128f81ca816a82632f50c0b4f73c3 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 16 Sep 2018 13:34:04 +1000
|
|
Subject: Use system type defs
|
|
|
|
|
|
diff --git a/src/celutil/basictypes.h b/src/celutil/basictypes.h
|
|
index 560b39b..e2200c6 100644
|
|
--- a/src/celutil/basictypes.h
|
|
+++ b/src/celutil/basictypes.h
|
|
@@ -13,13 +13,16 @@
|
|
typedef unsigned int uint;
|
|
|
|
// Fixed size types
|
|
+#ifdef __HAIKU__
|
|
+#include <SupportDefs.h>
|
|
+#else
|
|
typedef int int32;
|
|
typedef unsigned int uint32;
|
|
typedef short int16;
|
|
typedef unsigned short uint16;
|
|
typedef char int8;
|
|
typedef unsigned char uint8;
|
|
-
|
|
+#endif
|
|
#ifdef _MSC_VER
|
|
// MS Visual C++ does not include stdint.h
|
|
typedef __int64 int64;
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From b773b49085ab7d8f5e5c9e386062ff07fe58da4f Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 16 Sep 2018 20:00:58 +1000
|
|
Subject: Fix build for x86 arch
|
|
|
|
|
|
diff --git a/src/celengine/cmdparser.cpp b/src/celengine/cmdparser.cpp
|
|
index e2daf31..32fe5de 100644
|
|
--- a/src/celengine/cmdparser.cpp
|
|
+++ b/src/celengine/cmdparser.cpp
|
|
@@ -713,8 +713,8 @@ Command* CommandParser::parseCommand()
|
|
cmd = new CommandRenderPath(glcpath);
|
|
}
|
|
else if (commandName == "splitview")
|
|
- {
|
|
- unsigned int view = 1;
|
|
+ {
|
|
+ double view = 1;
|
|
paramList->getNumber("view", view);
|
|
string splitType;
|
|
paramList->getString("type", splitType);
|
|
@@ -724,7 +724,7 @@ Command* CommandParser::parseCommand()
|
|
}
|
|
else if (commandName == "deleteview")
|
|
{
|
|
- unsigned int view = 1;
|
|
+ double view = 1;
|
|
paramList->getNumber("view", view);
|
|
cmd = new CommandDeleteView(view);
|
|
}
|
|
@@ -734,7 +734,7 @@ Command* CommandParser::parseCommand()
|
|
}
|
|
else if (commandName == "setactiveview")
|
|
{
|
|
- unsigned int view = 1;
|
|
+ double view = 1;
|
|
paramList->getNumber("view", view);
|
|
cmd = new CommandSetActiveView(view);
|
|
}
|
|
diff --git a/src/celengine/dds.cpp b/src/celengine/dds.cpp
|
|
index a09fc76..9105474 100644
|
|
--- a/src/celengine/dds.cpp
|
|
+++ b/src/celengine/dds.cpp
|
|
@@ -198,7 +198,7 @@ Image* LoadDDSImage(const string& filename)
|
|
Image* img = new Image(format,
|
|
(int) ddsd.width,
|
|
(int) ddsd.height,
|
|
- max(ddsd.mipMapLevels, 1u));
|
|
+ max((uint32)ddsd.mipMapLevels, (uint32)1u));
|
|
if (img == NULL)
|
|
return NULL;
|
|
|
|
diff --git a/src/celengine/render.cpp b/src/celengine/render.cpp
|
|
index 56d0c21..140e7a2 100644
|
|
--- a/src/celengine/render.cpp
|
|
+++ b/src/celengine/render.cpp
|
|
@@ -1537,7 +1537,7 @@ static void computeOrbitSectionBoundingVolumes(Renderer::CachedOrbit& orbit)
|
|
|
|
Renderer::OrbitSection section;
|
|
section.firstSample = samplesPerSection * i;
|
|
- unsigned int lastSample = min((unsigned int) orbit.trajectory.size() - 1, section.firstSample + nSamples + 1);
|
|
+ unsigned int lastSample = min((unsigned int) orbit.trajectory.size() - 1, (unsigned int)(section.firstSample + nSamples + 1));
|
|
|
|
// Set the initial axis and origin of the capsule bounding volume; they will be adjusted
|
|
// to contain all points in the trajectory. The length of the axis may change, but the
|
|
--
|
|
2.19.0
|
|
|
|
|
|
From b6fcb045a3665123d91855df2cdf8b0037679823 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 16 Sep 2018 20:51:42 +1000
|
|
Subject: Fix crash on mesh render
|
|
|
|
|
|
diff --git a/src/celengine/mesh.cpp b/src/celengine/mesh.cpp
|
|
index 38f32bf..2fc1277 100644
|
|
--- a/src/celengine/mesh.cpp
|
|
+++ b/src/celengine/mesh.cpp
|
|
@@ -509,6 +509,7 @@ Mesh::render(const std::vector<const Material*>& materials,
|
|
// the possibility of deleting the original data. We can always map
|
|
// read-only later on for things like picking, but this could be a low
|
|
// performance path.
|
|
+#ifndef __HAIKU__
|
|
if (!vbInitialized && isVBOSupported())
|
|
{
|
|
vbInitialized = true;
|
|
@@ -526,7 +527,7 @@ Mesh::render(const std::vector<const Material*>& materials,
|
|
}
|
|
}
|
|
}
|
|
-
|
|
+#endif
|
|
if (vbObject != 0)
|
|
{
|
|
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbObject);
|
|
--
|
|
2.19.0
|
|
|