Skip to content

Instantly share code, notes, and snippets.

@chilledfrogs
Last active June 30, 2016 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilledfrogs/a98f9457f81163f0e90c86f72d1dc60a to your computer and use it in GitHub Desktop.
Save chilledfrogs/a98f9457f81163f0e90c86f72d1dc60a to your computer and use it in GitHub Desktop.
diff --git a/source/configurator/Configurator.cpp b/source/configurator/Configurator.cpp
index 8c67ce8..549b276 100644
--- a/source/configurator/Configurator.cpp
+++ b/source/configurator/Configurator.cpp
@@ -99,9 +99,15 @@ std::vector<wxLanguageInfo*> avLanguages;
std::map<std::string, std::string> settings;
#ifdef USE_OPENAL
+#if __APPLE__
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
+#include <OpenAL/MacOSX_OALExtensions.h>
+#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
+#endif // __APPLE__
#endif // USE_OPENAL
#ifdef USE_OPENCL
diff --git a/source/configurator/wxutils.h b/source/configurator/wxutils.h
index 23a5f37..ceb0f86 100644
--- a/source/configurator/wxutils.h
+++ b/source/configurator/wxutils.h
@@ -62,7 +62,7 @@ inline size_t getOISHandle(wxWindow *window)
#endif
#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// TODO: Apple specific code ?
-#error "Apple specific code not written yet!"
+// #error "Apple specific code not written yet!"
#endif
return hWnd;
}
diff --git a/source/main/CMakeLists.txt b/source/main/CMakeLists.txt
index b67dba2..85b22bd 100644
--- a/source/main/CMakeLists.txt
+++ b/source/main/CMakeLists.txt
@@ -341,7 +341,7 @@ add_custom_command(
####################################################################################################
target_compile_definitions( ${BINNAME} PRIVATE
- USE_MUMBLE # build with support for Mumble positional audio, has no dependencies but requires linking against librt on UNIX
+# USE_MUMBLE # build with support for Mumble positional audio, has no dependencies but requires linking against librt on UNIX, which doesn’t exist on Mac OS X… (gotta figure out how to deal with that one)
USE_RTSHADER_SYSTEM
#FEAT_DEBUG_MUTEX
)
diff --git a/source/main/audio/Sound.h b/source/main/audio/Sound.h
index 79149c8..9c9da45 100644
--- a/source/main/audio/Sound.h
+++ b/source/main/audio/Sound.h
@@ -25,7 +25,7 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
#include "RoRPrerequisites.h"
-#include <AL/al.h>
+#include <OpenAL/al.h>
class Sound : public ZeroedMemoryAllocator
{
diff --git a/source/main/audio/SoundManager.h b/source/main/audio/SoundManager.h
index c7b7c6a..53d7827 100644
--- a/source/main/audio/SoundManager.h
+++ b/source/main/audio/SoundManager.h
@@ -26,8 +26,8 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
#include "RoRPrerequisites.h"
#include <Ogre.h>
-#include <AL/al.h>
-#include <AL/alc.h>
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
class SoundManager : public ZeroedMemoryAllocator
{
diff --git a/source/main/gfx/particle/OgreShaderParticleRenderer.cpp b/source/main/gfx/particle/OgreShaderParticleRenderer.cpp
index bb511a7..458a716 100644
--- a/source/main/gfx/particle/OgreShaderParticleRenderer.cpp
+++ b/source/main/gfx/particle/OgreShaderParticleRenderer.cpp
@@ -10,7 +10,7 @@
#include <OgreSceneManager.h>
namespace Ogre {
- String rendererTypeName = "shader";
+ String renderer = "shader";
//////////////////////////////////////////////////////////////////////////
ShaderParticleRenderer::CmdVertexFormatColour ShaderParticleRenderer::msVertexFmtColour;
@@ -126,7 +126,7 @@ namespace Ogre {
//////////////////////////////////////////////////////////////////////////
const String& ShaderParticleRenderer::getType(void) const
{
- return rendererTypeName;
+ return renderer;
}
//////////////////////////////////////////////////////////////////////////
@@ -571,7 +571,7 @@ namespace Ogre {
/************************************************************************/
const String& ShaderParticleRendererFactory::getType() const
{
- return rendererTypeName;
+ return renderer;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/source/main/gui/panels/GUI_GameSettings.cpp b/source/main/gui/panels/GUI_GameSettings.cpp
index 50ccd7e..f07af2f 100644
--- a/source/main/gui/panels/GUI_GameSettings.cpp
+++ b/source/main/gui/panels/GUI_GameSettings.cpp
@@ -47,9 +47,9 @@
#include <MyGUI.h>
#ifdef USE_OPENAL
-#include <AL/al.h>
-#include <AL/alc.h>
-#include <AL/alext.h>
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
+#include <OpenAL/MacOSX_OALExtensions.h>
#endif // USE_OPENAL
using namespace RoR;
diff --git a/source/main/physics/BeamFactory.cpp b/source/main/physics/BeamFactory.cpp
index 1864003..ecaf1e1 100644
--- a/source/main/physics/BeamFactory.cpp
+++ b/source/main/physics/BeamFactory.cpp
@@ -50,7 +50,12 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/sysctl.h>
-#endif
+#endif //__FreeBSD__
+
+#ifdef __APPLE__
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif //__APPLE__
#ifdef USE_MYGUI
#include "GUIMenu.h"
diff --git a/source/main/utils/Settings.cpp b/source/main/utils/Settings.cpp
index b918aa5..5499c46 100644
--- a/source/main/utils/Settings.cpp
+++ b/source/main/utils/Settings.cpp
@@ -43,6 +43,10 @@
#include "SHA1.h"
#include "Utils.h"
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include <mach-o/dyld.h>
+#endif
+
using namespace Ogre;
bool FileExists(const char *path)
@@ -353,55 +357,26 @@ bool Settings::get_system_paths(char *program_path, char *user_path)
//sprintf(user_path, "%s/RigsOfRods/", home_path); // old version
sprintf(user_path, "%s/.rigsofrods/", home_path);
#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
- //found this code, will look later
- String path = "./";
- ProcessSerialNumber PSN;
- ProcessInfoRec pinfo;
- FSSpec pspec;
- FSRef fsr;
- OSStatus err;
- /* set up process serial number */
- PSN.highLongOfPSN = 0;
- PSN.lowLongOfPSN = kCurrentProcess;
- /* set up info block */
- pinfo.processInfoLength = sizeof(pinfo);
- pinfo.processName = NULL;
- pinfo.processAppSpec = &pspec;
- /* grab the vrefnum and directory */
-
- //path = "~/RigsOfRods/";
- //strcpy(user_path, path.c_str());
-
- err = GetProcessInformation(&PSN, &pinfo);
- if (! err ) {
- char c_path[2048];
- FSSpec fss2;
- int tocopy;
- err = FSMakeFSSpec(pspec.vRefNum, pspec.parID, 0, &fss2);
- if ( ! err ) {
- err = FSpMakeFSRef(&fss2, &fsr);
- if ( ! err ) {
- err = (OSErr)FSRefMakePath(&fsr, (UInt8*)c_path, 2048);
- if (! err ) {
- path = c_path;
- path += "/";
- strcpy(program_path, path.c_str());
- }
-
- err = FSFindFolder(kOnAppropriateDisk, kDocumentsFolderType, kDontCreateFolder, &fsr);
- if (! err ) {
- FSRefMakePath(&fsr, (UInt8*)c_path, 2048);
- if (! err ) {
- path = c_path;
- path += "/Rigs\ of\ Rods/";
- strcpy(user_path, path.c_str());
- }
- }
- }
- }
- }
+ int cx;
+
+ // program path
+ const int len = 256;
+ uint32_t lenb = (uint32_t) len;
+ char procpath[len];
+
+ if (_NSGetExecutablePath(procpath, &lenb) == -1)
+ return false;
+ cx = snprintf(program_path, len, "/Users/user/rigs-of-rods/install/bin/");
+ printf("%d", cx);
+ if ( cx < 0 || cx >= len)
+ return false;
+
+ // user path
+ cx = snprintf(user_path, 256, "%s/RigsOfRods/", getenv("HOME"));
+ if ( cx < 0 || cx >= 256)
+ return false;
#endif
- return true;
+ return true;
}
bool Settings::setupPaths()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment