OpenBOR on MAC

O Ilusionista

Captain 100K
Hi guys. I can run OpenBOR in Mac by using Wine app, and it works great.
But there is a way to make it run in OSX natively? We would need to compile it for OSX, right?
There is any info about it?

Or someone know any app which could convert OpenBOR to a OSX app? The only one I know, WineBottler, can just convert a standalone .exe, not an entire folder. I haven't tested Wineskin thought.
 
SX ported OpenBOR to OS X a long time ago, but there hasn't been a Mac build since he left for the simple reason that neither of the remaining developers uses a Mac, and it isn't easy to cross-compile to OS X.  So I don't know if the port still compiles or works, but the code is still there.

If you'd like to try compiling it yourself, I can direct you to the source code if you don't already know how to get it.
 
I've done some tests witht his (after Plombo's instructions) and this is what I got:

The build environment was set succesfully. The source code says it was done using XCode 3.1 and I have Xcode 8, dunno if we will have trouble.
But I have some issues with SVN when I execute the build command:

"This client is too old to work with the working copy at '/Users/XXXXX' (format 31).
You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change"


When I try to access the game using a SVN tool, I got this error

oHw03Wu.png


I've sent an email to SX, but dunno if he will reply.
 
It sounds like you just need to install a newer version of Subversion?

Or you could remove the calls to "svn" from version.sh
 
Hi! I'm new here... I have a Macbook, so, I'd like to know if you guys have any news about  the port to Mac OS! Thanx in advance!
 
If people are still interested I can try and build the code tomorrow and see what happens.
 
Will do..... this may take a couple of days based on my schedule but I will look into it.
 
The following changes are necessary in order to build openbor.  Note that MacPorts does not have libsd2_gfx, thus you will need to build this on your end and place the includes and libs in their respective /opt/local/****

Also... I had to disable -Werror as there are a few warnings being reported under the latest clang compiler.  The build has been uploaded and should be available for download:

http://www.chronocrash.com/forum/index.php?action=tpmod;dl=item325

Code:
diff --git a/engine/Makefile b/engine/Makefile
index 433adde..5c322ab 100644
--- a/engine/Makefile
+++ b/engine/Makefile
@@ -113,16 +113,20 @@ BUILD_SDL_IO    = 1
 BUILD_OPENGL    = 1
 BUILD_LOADGL    = 1
 BUILD_VORBIS    = 1
+BUILD_WEBM      = 1
 BUILDING        = 1
 YASM            = yasm
 CC              = $(PREFIX)gcc
 OBJTYPE         = macho
 INCLUDES        = $(DWNDEV)/include \
-                  $(DWNDEV)/include/SDL \
+                  $(DWNDEV)/include/SDL2 \
                   $(SDKPATH)/usr/include/malloc
 LIBRARIES       = $(DWNDEV)/lib
-ifeq ($(findstring darwin10, $(PREFIX)), darwin10)
-ARCHFLAGS       = -arch i386 -arch x86_64
+ifeq ($(findstring 64, $(MACHINE)), 64)
+TARGET_ARCH     = amd64
+BUILD_AMD64     = 1
+ARCHFLAGS       = -arch x86_64
+CFLAGS         += -DAMD64   
 else
 BUILD_MMX       = 1
 TARGET_ARCH     = x86
@@ -438,8 +442,8 @@ OBJS            = $(MAIN)
 #----------------------------------------------------------------------------------------------------
 
 CFLAGS                += $(addprefix -I", $(addsuffix ", $(INCS))) $(ARCHFLAGS) -D$(TARGET_PLATFORM)
-CFLAGS                += -g -Wall -Werror -fsigned-char -std=gnu99
-
+#CFLAGS               += -g -Wall -Werror -fsigned-char -std=gnu99
+CFLAGS         += -g -Wall -fsigned-char -std=gnu99
 
 ifndef BUILD_DARWIN
 ifdef BUILD_LINUX
@@ -449,7 +453,11 @@ endif
 
 ifndef BUILD_DEBUG
 CFLAGS                += -O2
+ifndef BUILD_DARWIN
 CFLAGS                += -fno-ident -freorder-blocks
+else
+CFLAGS         += -fno-ident
+endif
 ifndef BUILD_AMD64
 CFLAGS         += -fomit-frame-pointer
 endif
@@ -472,7 +480,7 @@ endif
 
 
 ifdef BUILD_DARWIN
-CFLAGS                += -DLINUX -headerpad_max_install_names -isysroot $(SDKPATH)
+CFLAGS                += -DLINUX -isysroot $(SDKPATH)
 endif
 
 
@@ -556,7 +564,7 @@ LIBS           += -Wl,-syslibroot,$(SDKPATH) \
                   -framework Carbon \
                   -framework AudioUnit \
                   -framework IOKit \
-                  -lSDLmain
+                  -lSDL2main
 endif

Code:
diff --git a/engine/environ.sh b/engine/environ.sh
index 4860626..664914a 100755
--- a/engine/environ.sh
+++ b/engine/environ.sh
@@ -399,7 +399,7 @@ case $1 in
    elif test -e "/opt/local/bin"; then
      export DWNDEV=/opt/local
      if test -e "/Applications/Xcode.app/Contents/Developer"; then
-       export SDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
+       export SDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
      else
        export SDKPATH=/Developer/SDKs/MacOSX10.6.sdk
      fi

Code:
diff --git a/engine/openbor.c b/engine/openbor.c
index 5dcdadb..d5d6945 100644
--- a/engine/openbor.c
+++ b/engine/openbor.c
@@ -22068,8 +22068,8 @@ int reset_backpain(entity *ent)
         if (ent->normaldamageflipdir == DIRECTION_RIGHT) ent->direction = DIRECTION_RIGHT;
         else ent->direction = DIRECTION_LEFT;
 
-        if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*abs(ent->velocity.x);
-        else ent->velocity.x = abs(ent->velocity.x);
+        if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*fabs(ent->velocity.x);
+        else ent->velocity.x = fabs(ent->velocity.x);
 
         return 1;
     }
@@ -26380,7 +26380,7 @@ int common_try_wander(entity *target, int dox, int doz)
         mod = -mod;
     }
     //if ((self->sortid / 100) % 2)
-    if (abs(rand32()) % 2)
+    if (rand32() % 2)
     {
         mod = 3 - mod;
     }

Code:
diff --git a/engine/source/utils.c b/engine/source/utils.c
index be3bf89..bf981a2 100644
--- a/engine/source/utils.c
+++ b/engine/source/utils.c
@@ -34,6 +34,11 @@
 #include <sys/stat.h>
 #endif
 
+#ifdef DARWIN
+#include <mach/task.h>
+#include <mach/mach_init.h>
+#endif
+
 #ifdef DC
 #include "dcport.h"
 #endif
@@ -291,12 +296,21 @@ void *checkAlloc(void *ptr, size_t size, const char *func, const char *file, int
 {
     if (size > 0 && ptr == NULL)
     {
+#ifdef DARWIN
+        struct task_basic_info t_info;
+        mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
+        task_info(current_task(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
+        unsigned int usage = t_info.virtual_size;
+#else
+        unsigned int usage = mallinfo().arena;
+#endif
+
         writeToLogFile("\n\n********** An Error Occurred **********"
                        "\n*            Shutting Down            *\n\n");
         writeToLogFile("Out of memory!\n");
         writeToLogFile("Allocation of size %i failed in function '%s' at %s:%i.\n", size, func, file, line);
 #ifndef WIN
-        writeToLogFile("Memory usage at exit: %u\n", mallinfo().arena);
+        writeToLogFile("Memory usage at exit: %u\n", usage);
 #endif
         exit(2);
     }

Code:
./build.sh 10
-------------------------------------------------------
OpenBOR v3.0 Build 4615 - http://www.ChronoCrash.com

All rights reserved.
See LICENSE and README within OpenBOR root for details.

Copyright (c) 2004 - 2017 OpenBOR Team
-------------------------------------------------------
-------------------------------------------------------
        Darwin SDK x86_64 Environment Loaded!
-------------------------------------------------------

Removing All DARWIN Files...
Done!

Compiling DARWIN Port: openbor.c...
Compiling DARWIN Port: openborscript.c...
Compiling DARWIN Port: sdl/joysticks.c...
Compiling DARWIN Port: sdl/control.c...
Compiling DARWIN Port: sdl/sblaster.c...
Compiling DARWIN Port: sdl/timer.c...
Compiling DARWIN Port: sdl/sdlport.c...
Compiling DARWIN Port: sdl/video.c...
Compiling DARWIN Port: sdl/videocommon.c...
Compiling DARWIN Port: sdl/threads.c...
Compiling DARWIN Port: sdl/menu.c...
Compiling DARWIN Port: sdl/opengl.c...
sdl/opengl.c:305:9: warning: incompatible pointer to integer conversion initializing 'GLuint' (aka 'unsigned int') with an expression of
      type 'GLhandleARB' (aka 'void *') [-Wint-conversion]
        GLuint fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
               ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdl/opengl.c:306:20: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glShaderSourceARB(fragmentShader, 1, &fragmentShaderSourceHighQualityRGB, NULL);
                          ^~~~~~~~~~~~~~
sdl/opengl.c:307:21: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glCompileShaderARB(fragmentShader);
                           ^~~~~~~~~~~~~~
sdl/opengl.c:308:16: warning: incompatible pointer to integer conversion assigning to 'GLuint' (aka 'unsigned int') from 'GLhandleARB'
      (aka 'void *') [-Wint-conversion]
        shaderProgram = glCreateProgramObjectARB();
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
sdl/opengl.c:309:20: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glAttachObjectARB(shaderProgram, fragmentShader);
                          ^~~~~~~~~~~~~
sdl/opengl.c:309:35: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glAttachObjectARB(shaderProgram, fragmentShader);
                                         ^~~~~~~~~~~~~~
sdl/opengl.c:310:19: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glLinkProgramARB(shaderProgram);
                         ^~~~~~~~~~~~~
sdl/opengl.c:311:24: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUseProgramObjectARB(shaderProgram);
                              ^~~~~~~~~~~~~
sdl/opengl.c:312:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform1iARB(glGetUniformLocationARB(shaderProgram, "tex"), 0);
                                               ^~~~~~~~~~~~~
sdl/opengl.c:313:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform2fARB(glGetUniformLocationARB(shaderProgram, "texDims"), textureWidth, textureHeight);
                                               ^~~~~~~~~~~~~
sdl/opengl.c:315:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform1fARB(glGetUniformLocationARB(shaderProgram, "scaleFactor"), ceilf(scaleFactor));
                                               ^~~~~~~~~~~~~
sdl/opengl.c:417:24: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUseProgramObjectARB(shaderProgram);
                              ^~~~~~~~~~~~~
sdl/opengl.c:418:47: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        brightnessLocation = glGetUniformLocationARB(shaderProgram, "brightness");
                                                     ^~~~~~~~~~~~~
sdl/opengl.c:420:42: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        gammaLocation = glGetUniformLocationARB(shaderProgram, "gamma");
                                                ^~~~~~~~~~~~~
sdl/opengl.c:436:9: warning: incompatible pointer to integer conversion initializing 'GLuint' (aka 'unsigned int') with an expression of
      type 'GLhandleARB' (aka 'void *') [-Wint-conversion]
        GLuint fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
               ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdl/opengl.c:437:20: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glShaderSourceARB(fragmentShader, 1, &fragmentShaderSourceYUV, NULL);
                          ^~~~~~~~~~~~~~
sdl/opengl.c:438:21: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glCompileShaderARB(fragmentShader);
                           ^~~~~~~~~~~~~~
sdl/opengl.c:439:16: warning: incompatible pointer to integer conversion assigning to 'GLuint' (aka 'unsigned int') from 'GLhandleARB'
      (aka 'void *') [-Wint-conversion]
        shaderProgram = glCreateProgramObjectARB();
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
sdl/opengl.c:440:20: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glAttachObjectARB(shaderProgram, fragmentShader);
                          ^~~~~~~~~~~~~
sdl/opengl.c:440:35: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glAttachObjectARB(shaderProgram, fragmentShader);
                                         ^~~~~~~~~~~~~~
sdl/opengl.c:441:19: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glLinkProgramARB(shaderProgram);
                         ^~~~~~~~~~~~~
sdl/opengl.c:442:24: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUseProgramObjectARB(shaderProgram);
                              ^~~~~~~~~~~~~
sdl/opengl.c:443:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform1iARB(glGetUniformLocationARB(shaderProgram, "tex"), 0);
                                               ^~~~~~~~~~~~~
sdl/opengl.c:444:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform1iARB(glGetUniformLocationARB(shaderProgram, "utex"), 1);
                                               ^~~~~~~~~~~~~
sdl/opengl.c:445:41: warning: incompatible integer to pointer conversion passing 'GLuint' (aka 'unsigned int') to parameter of type
      'GLhandleARB' (aka 'void *') [-Wint-conversion]
        glUniform1iARB(glGetUniformLocationARB(shaderProgram, "vtex"), 2);
                                               ^~~~~~~~~~~~~
25 warnings generated.
Compiling DARWIN Port: sdl/loadgl.c...
Compiling DARWIN Port: source/adpcmlib/adpcm.c...
Compiling DARWIN Port: source/gfxlib/2xSaI.c...
Compiling DARWIN Port: source/gfxlib/bilinear.c...
Compiling DARWIN Port: source/gfxlib/dotmatrix.c...
Compiling DARWIN Port: source/gfxlib/gfx.c...
Compiling DARWIN Port: source/gfxlib/hq2x.c...
Compiling DARWIN Port: source/gfxlib/scale2x.c...
Compiling DARWIN Port: source/gfxlib/scanline.c...
Compiling DARWIN Port: source/gfxlib/simple2x.c...
Compiling DARWIN Port: source/gfxlib/tv2x.c...
Compiling DARWIN Port: source/gamelib/draw.c...
Compiling DARWIN Port: source/gamelib/draw16.c...
Compiling DARWIN Port: source/gamelib/draw32.c...
Compiling DARWIN Port: source/gamelib/font.c...
Compiling DARWIN Port: source/gamelib/translation.c...
Compiling DARWIN Port: source/gamelib/anigif.c...
Compiling DARWIN Port: source/gamelib/bitmap.c...
Compiling DARWIN Port: source/gamelib/screen.c...
Compiling DARWIN Port: source/gamelib/screen16.c...
Compiling DARWIN Port: source/gamelib/screen32.c...
Compiling DARWIN Port: source/gamelib/loadimg.c...
Compiling DARWIN Port: source/gamelib/palette.c...
Compiling DARWIN Port: source/gamelib/packfile.c...
Compiling DARWIN Port: source/gamelib/filecache.c...
Compiling DARWIN Port: source/gamelib/pixelformat.c...
Compiling DARWIN Port: source/gamelib/soundmix.c...
Compiling DARWIN Port: source/gamelib/spriteq.c...
Compiling DARWIN Port: source/gamelib/sprite.c...
Compiling DARWIN Port: source/gamelib/spritex8p16.c...
Compiling DARWIN Port: source/gamelib/spritex8p32.c...
Compiling DARWIN Port: source/gamelib/commands.c...
Compiling DARWIN Port: source/gamelib/models.c...
Compiling DARWIN Port: source/gamelib/transform.c...
Compiling DARWIN Port: source/gamelib/filters.c...
Compiling DARWIN Port: source/stringptr.c...
Compiling DARWIN Port: source/utils.c...
Compiling DARWIN Port: source/stristr.c...
Compiling DARWIN Port: source/omath.c...
Compiling DARWIN Port: source/scriptlib/StackedSymbolTable.c...
Compiling DARWIN Port: source/scriptlib/ScriptVariant.c...
Compiling DARWIN Port: source/scriptlib/SymbolTable.c...
Compiling DARWIN Port: source/scriptlib/Instruction.c...
Compiling DARWIN Port: source/scriptlib/Interpreter.c...
Compiling DARWIN Port: source/scriptlib/ImportCache.c...
Compiling DARWIN Port: source/scriptlib/ParserSet.c...
Compiling DARWIN Port: source/scriptlib/Parser.c...
Compiling DARWIN Port: source/scriptlib/Lexer.c...
Compiling DARWIN Port: source/scriptlib/Stack.c...
Compiling DARWIN Port: source/scriptlib/List.c...
Compiling DARWIN Port: source/preprocessorlib/pp_lexer.c...
Compiling DARWIN Port: source/preprocessorlib/pp_parser.c...
Compiling DARWIN Port: source/preprocessorlib/pp_expr.c...
Compiling DARWIN Port: source/openborscript/animation.c...
Compiling DARWIN Port: source/openborscript/collision_attack.c...
Compiling DARWIN Port: source/openborscript/collision_body.c...
Compiling DARWIN Port: source/openborscript/constant.c...
Compiling DARWIN Port: source/openborscript/index.c...
Compiling DARWIN Port: source/openborscript/layer.c...
Compiling DARWIN Port: source/openborscript/level.c...
Compiling DARWIN Port: source/openborscript/math.c...
Compiling DARWIN Port: source/openborscript/string.c...
Compiling DARWIN Port: source/ramlib/ram.c...
Compiling DARWIN Port: source/randlib/rand32.c...
Compiling DARWIN Port: source/pnglib/pngdec.c...
Compiling DARWIN Port: source/pnglib/savepng.c...
Compiling DARWIN Port: source/webmlib/vidplay.c...
Compiling DARWIN Port: source/webmlib/vorbis.c...
Compiling DARWIN Port: source/webmlib/samplecvt.c...
Compiling DARWIN Port: source/webmlib/yuv.c...
Compiling DARWIN Port: source/webmlib/halloc/halloc.c...
Compiling DARWIN Port: source/webmlib/nestegg/nestegg.c...

Linking DARWIN Port: OpenBOR.elf...
Stripping DARWIN Port: OpenBOR...

Completed DARWIN Port!
OpenBOR is now ready!


Removing All DARWIN Files...
Done!
 
About 6 years ago I had ported the code to run on iOS and if I remember correctly it took less than a week (spare time).  There weren't that many changes and the engine was running well.  The engine utilizes SDL on Linux/Win/OSX and SDL is also available for iOS as static libraries.  The only component I had remaining was to implement the touch joystick which I never got around to do and honestly I gave up because I'm not a fan of touch based joystick gameplay....
 
The android port uses touch screen i also was not a fan but after using it playing mods on the go was a lot of fun if we had a ios port i am sure it would attract a lot more people to openbor.
 
Having OpenBOR in ios would be really cool! And there are ways to install emulators on ios 11 without jailbreak! Here i have uploaded some videos playing OpenBOR(via psp emulator), ps1 and psp games on my no-jailbroken ipad pro:




As you can see, playing OpenBOR via psp emulator sucks when in same time playing ps1 and psp games is great in performence.

ps: Almost forgot to say, nice to see you back SX  :D
 
Back
Top Bottom