MegaGlest / megaglest-source

MegaGlest real-time strategy game engine (cross-platform, 3-d)
http://megaglest.org/
355 stars 90 forks source link

FreeBSD, runtime error related with haptic support #105

Closed filux closed 8 years ago

filux commented 8 years ago

Since switching to SDL2 I had a problem during launch game binary (FreeBSD 10.2 - latest stable) because of error like: SDL not built with haptic (force feedback) support. Game can't be successfully launched and by this impossible is test of the status for issues #72 and #73 .

Error is pretty clear and for users mean: ~ "broken sdl2 port", so

Then I found this bug report which seems to be close to true: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200854

So Imo if it is possible we need something like:

If [ not BSD ]; then SDL_INIT_HAPTIC; fi

or for now MG is not supporting BSD anymore (I am curious how bsd-trolls will see this xD).

monwarez commented 8 years ago

One thing I does not understand, why MegaGlest need force feedback ? For disabling HAPTIC , you can apply this patch

--- source/shared_lib/include/platform/sdl/platform_main.h.orig 2016-03-27 01:19:15 UTC
+++ source/shared_lib/include/platform/sdl/platform_main.h
@@ -666,8 +666,14 @@ int mainSetup(int argc, char **argv) {
             }
        }
        else {
+                auto failTimer =       (SDL_Init(SDL_INIT_TIMER) < 0);
+                auto failAudio =       (SDL_Init(SDL_INIT_AUDIO) < 0);
+                auto failVideo =       (SDL_Init(SDL_INIT_VIDEO) < 0);
+                auto failJoy   =       (SDL_Init(SDL_INIT_JOYSTICK) < 0);
+                auto failGC    =       (SDL_Init(SDL_INIT_GAMECONTROLLER) < 0);
+                auto failEvents=       (SDL_Init(SDL_INIT_EVENTS) < 0);
                 if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
-                if(SDL_Init(SDL_INIT_EVERYTHING) < 0)  {
+                if(failTimer || failAudio || failVideo || failJoy || failGC || failEvents)  {
                        if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
                        std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n";
                        return 3;
filux commented 8 years ago

Well as I know MG doesn't need it (at least yet) but simple "init all" is very tempting :smiley: when all works on linux & windows & macos where are done most/all of our tests.

Do you know something about: does someone is working on adding HAPTIC support for BSD? and how advanced is such work?

monwarez commented 8 years ago

I made a port update for 3.12.0: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205485 , with the previous patch. From what I understand, the problem with HAPTIC support is that its use some GNU/Linux specific events (I suppose in kernel space ?), and I know that FreeBSD is not intended to be a GNU/Linux OS. I think it will be necessary to add HAPTIC support in SDL2 code directly. Update: version 3.12.0 are on the port with patch to not load HAPTIC module The final patch used for HAPTIC are here

monwarez commented 8 years ago

Do you have this issue with the version 3.12.0 on the port ? issues: https://github.com/MegaGlest/megaglest-source/issues/72, and https://github.com/MegaGlest/megaglest-source/issues/73

filux commented 8 years ago

Hehe, I am not a FreeBSD user :). Feel free to comment those issues about, can you reproduce them or not. Two voices are better than 1 ;). ...and v3.12.0 is based on later commit than tests were done :).

My last test was done ~ creation date of this issue and was related only with this issue.

monwarez commented 8 years ago

I am sure that I don't have issue https://github.com/MegaGlest/megaglest-source/issues/73 (maybe it was OpenAL fault after all) , for the other https://github.com/MegaGlest/megaglest-source/issues/72 , I need to launch it on a terminal to see if error pop up. After some quick test I don't have issue https://github.com/MegaGlest/megaglest-source/issues/72