Bennu Game Development

English Forums => News and Releases => Topic started by: EugeneP on August 19, 2010, 08:01:05 AM

Title: Haiku OS port
Post by: EugeneP on August 19, 2010, 08:01:05 AM
Is there Benuu port for Haiku OS?
Title: Re: Haiku OS port
Post by: EugeneP on August 19, 2010, 08:06:02 AM
Why I'm asking:
I successfully build latest Bennu for Haiku OS ( BeOS free open source remake http://www.haiku-os.org/ )
Fenix had full support of TARGET_BEOS and most of this code is still there, so I had only one minor problem.

And... er... I do not know what to do with this build :)
Is anyone here interested? Maybe someone already supports Haiku port and I just could not find it?
Title: Re: Haiku OS port
Post by: josebita on August 19, 2010, 08:50:59 AM
Hi!
I wrote that TARGET_BEOS code quite some time ago. I believe there was someone asking for this, yes, and I do try Haiku builds from time to time, too. Maybe you could PM me a copy of the build so I can upload it to the main BennuGD page as an unofficial build.

Also, just for reference: Did you have to do anything special to build the code? Any source changes? I assume you've created a GCC4 build, right? Any comments? :)
Title: Re: Haiku OS port
Post by: EugeneP on August 19, 2010, 10:12:48 AM
Yes, it is gcc4 build of course :)

Generally I followed "porting tips".
I have one build problem: a dependence on libm (is it really needed I wonder?) I simply removed it from modules/configure.in
And there was runtime problem with loading modules. Haiku returns really strange Dl_info from ldaddr (it is probably bug), so I add one check to loadlib.h
[code language="c"]#ifndef TARGET_BEOS
// On Haiku OS dladdr returns empty strings in info structure
// so condition below is always false
   if ( strcmp( ptr, handle->fname ) )
   {
       __dliberr = "Symbol not found (2)." ;
       return NULL;
   }
#endif [/code]

Here is my build: download (~400k) (http://uwolke.ru/s_haiku/dirty-bennu-build/bennugd-haiku-gcc4.zip)
Here is modified files, build scripts, required 3d-party packages and small "readme":  download (~12M) (http://uwolke.ru/s_haiku/dirty-bennu-build/bennugd-haiku-make-kit.zip)

I have not checked the build deeply, but it  runs packman and galaxian with no visible problems.
Title: Re: Haiku OS port
Post by: josebita on August 19, 2010, 10:36:28 AM
Thanks a lot! I'll upload your package ASAP.
Title: Re: Haiku OS port
Post by: josebita on August 19, 2010, 10:46:37 AM
I've tested your binaries in VirtualBox and they seem to be working just as advertised :) Just FYI, I'll strip the binaries before uploading, ok?
Title: Re: Haiku OS port
Post by: EugeneP on August 19, 2010, 10:48:51 AM
Not a problem :)
I think someone more wise should review my scripts anyway.
Title: Re: Haiku OS port
Post by: EugeneP on August 20, 2010, 05:47:27 AM
I've made some testing.
There are some joystick problems - it is 100% Haiku bug.
There is no scaling when going full screen. This probably could be fixed on bennu side.
No other issues yet.

I'll try to make popular bennu games running on Haiku, that would be nice addition to haikuware :)
Title: Re: Haiku OS port
Post by: josebita on August 20, 2010, 09:25:28 AM
Great to know :)

I'll try to upload your binaries this evening, sorry for the delay.
Title: Re: Haiku OS port
Post by: josebita on August 21, 2010, 01:13:20 PM
Uploaded to the main downloads page.
Title: Re: Haiku OS port
Post by: EugeneP on August 27, 2010, 05:07:08 AM
Problem with dladdr() have been corrected in Haiku r38373, so it is possible now  to build unmodified Bennu sources for Haiku.
Give me some time and I provide a build script  ;)
Title: Re: Haiku OS port
Post by: SplinterGU on August 27, 2010, 05:26:05 AM
great! really great!

karma for you
Title: Re: Haiku OS port
Post by: Drumpi on August 27, 2010, 01:03:27 PM
I don't use Haiku, but i give you a karma, just for made it ;)
Title: Re: Haiku OS port
Post by: EugeneP on September 06, 2010, 08:47:19 PM
I have done some experiments and I think it is better to build slightly patched version of Bennu for Haiku.
Here is a SCRIPT (http://uwolke.ru/_project/bgd-haiku/bennugd-haiku-builder.zip) I promised :)
Launch this script on Haiku with installed SDL and working internet. It will download sources from svn, will patch it and will build a package. More detailed README is inside.

(http://uwolke.ru/_project/bgd-haiku/bennu-at-haiku-2.png) (http://uwolke.ru/_project/bgd-haiku/bennu-at-haiku-2.png)

I started small page about the port ( http://uwolke.ru/node/7 ) and I'll try to keep it up to date (both, port and page :) ).

If anyone want to make a Bennu game run on Haiku, he may use one (http://uwolke.ru/_project/bgd-haiku/echo-bgd-haiku.zip) of test (http://uwolke.ru/_project/bgd-haiku/aggressivepong-bgd-haiku.zip) packs I prepared to examine this port.

Unfortunately there is a bug which probably make many mouse-based games unplayable. Be warned.
Title: Re: Haiku OS port
Post by: SplinterGU on September 06, 2010, 08:57:48 PM
Great EugeneP! Karma for you.

You can explain difference in your port vs. official version?

Thanks.
Title: Re: Haiku OS port
Post by: josebita on September 06, 2010, 11:49:12 PM
Thanks! Any chance of getting this into haikuports?
Title: Re: Haiku OS port
Post by: EugeneP on September 07, 2010, 05:01:14 AM
Quote from: josebita on September 06, 2010, 11:49:12 PM
Thanks! Any chance of getting this into haikuports?

Yes. As soon as I learn how to use HaikuPorter.
Title: Re: Haiku OS port
Post by: josebita on September 07, 2010, 07:35:48 AM
Great! Thanks a lot!

PS: Splinter, the changes are in the script. He's basically not linking against libm (as its functionality is included in libroot in Haiku, but we don't really need to explicitly link against it as SDL relies on it).
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 10:53:54 AM
then no changes in code?
Title: Re: Haiku OS port
Post by: EugeneP on September 07, 2010, 11:17:37 AM
Quote from: SplinterGU on September 07, 2010, 10:53:54 AM
then no changes in code?

Code with no changes will be compiled successfully but won't work. The problem in POSIX [not]compliance of Haiku dl-* functions. Work on this problem is being done but I decided that it is better to make a workaround for now (until next Haiku release).

This is my "patch" to avoid problems:

[code language="bash"]#removing dependence on libm
sed -i 's/ -lz -lm/ -lz/' modules/configure.in
#problems with dladdr on Haiku
sed -i 's/strcmp( ptr, handle->fname )/0/' core/include/loadlib.h[/code]

Literally changing 2 lines. This is kind of ugly but does trick for now.
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 11:28:46 AM
please, let me know the return of "uname -a" command in your haiku os.

thanks.
Title: Re: Haiku OS port
Post by: EugeneP on September 07, 2010, 11:34:47 AM
uname -a
Haiku shredder 1 r38492 Sep 1 2010 10:51:51 BePC Haiku

----edit---

It's a gcc4 hybrid.

there should not be any problems on Haiku past R1-rc1
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 04:24:29 PM
one question more

if you run "./configure" ... what say in "Your machine:" ?

you can use "./configure |grep Your"

thanks
Title: Re: Haiku OS port
Post by: EugeneP on September 07, 2010, 06:24:31 PM
Your machine: i586 haiku

host system type: i586-pc-haiku
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 08:53:54 PM
thanks!
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 09:15:38 PM
I have a question.

what TARGET_* you set?
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 09:19:57 PM
can you tell me that value give  ptr and handle->fname in loadlib.h when bennugd do strcmp?

this strcmp is needed.
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 09:27:12 PM
Can you update the svn and test it directly? without script.

I need the info in loadlib of ptr and handle->fname, for complete the port.

I suggest:


printf ("ptr:[%] handle->fname:[%s]\n", ptr, handle->fname ); fflush(stdout);


thanks.

PS: I add TARGET_HAIKU and new OS_ID = OS_HAIKU
Title: Re: Haiku OS port
Post by: josebita on September 07, 2010, 09:57:51 PM
I believe it's in the spirit of Haiku to be used as BeOS, so maybe having OS_ID OS_HAIKU=OS_BEOS should be appropriate.
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 10:11:35 PM
you are sure?

I think that BeOS for old versions... HAIKU for new versions... but maybe I wrong.
Title: Re: Haiku OS port
Post by: josebita on September 07, 2010, 10:32:17 PM
Haiku aims to be completely compatible (both at binary and at source code level) with BeOS R5, even if in some areas it's much more robust. I believe you should treat them both as the same thing.

As there is no other BeOS-like OS anymore, I'd suggest using TARGET_HAIKU in the source code and introducing OS_HAIKU but with the same value as OS_BEOS, so that older games that may be using TARGET_BEOS are treated the same as newer ones.
Title: Re: Haiku OS port
Post by: SplinterGU on September 07, 2010, 11:33:37 PM
I don't understand... if BEOS is same that HAIKU then what is the point of this port?
Title: Re: Haiku OS port
Post by: josebita on September 07, 2010, 11:46:31 PM
BeOS is dead and the current BennuGD C code doesn't work in Haiku as the code to support BeOS that has been inherited from Fenix doesn't compile directly on Haiku, even if the binary versions of Fenix I compiled then should work in today's Haiku.

Remember that when I created that code, Fenix still used static Makefiles for compilation. That's why eugeneP has had to touch the compilation scripts and the code in order to get the code working again.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 01:19:48 AM
I don't understand... well, I'll that haiku use beos code.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 01:28:32 AM
please... test again...
Title: Re: Haiku OS port
Post by: EugeneP on September 08, 2010, 03:49:29 AM
Wait a second :)

1) I used TARGET_BEOS, and as josebita I think osid for Haiku and BeOS should be the same.

2)  Yes, I know this check is needed, but dladdr fails to find some symbols on Haiku. The easy way which I used is to drop this check and hope no one defines ambiguous functions. The middle way is to fix bug in Haiku - I reported it and some fixes were done, but problem is not resolved completely, I am searching for source of bug. The hard way is to add Haiku specific code to loadlib.h. Well, whenever I get spare time...

3) Actually testing could be done by anyone on virtual machine or real hardware using latest builds ( http://www.haiku-files.org ) I'll do some testing in few hours.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 04:40:33 AM
you can update svn and build the last svn version without your script? please?
Title: Re: Haiku OS port
Post by: EugeneP on September 08, 2010, 06:46:01 AM
Quote from: SplinterGU on September 08, 2010, 04:40:33 AM
you can update svn and build the last svn version without your script? please?

SVN compiled successfully with no code modifications.

Doing autoreconf is yet required before configure (as described in http://ports.haiku-files.org/wiki/PortingTips )

[code language="bash"]libtoolize --force --copy --install
autoreconf -i[/code]

Unfortunately compiled bgdi fails to run a game ( I tested Adventures of Echo only ). Wait for few hours and I provide detailed report.

As I remember there were sets of complex tests for Fenix which allows to verify every language feature. Is there something like that for Bennu? Standard test would be useful now.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 10:37:29 AM
this have your changes, but TARGET_BEOS that use SVN version and I guess that you don't use it.

then Haiku is different that BeOS.

I continue thinking that need an OS_HAIKU, because all bennu's (and then Fenix) code for BEOS seem doesn't works in haiku.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 10:54:01 AM
EDIT: Please give more data... you said that you used TARGET_BEOS, but you don't tell me that you use it in your script.

well, I'm check yours script now, I'm see in bgd-configure.sh you use it.

then svn code must works exactly as works your patched version, you only forget tell me about this "-L/boot/system/lib"

but I don't think that this is the problem.

please, let me clear, your patched version works but the svn version don't works?
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 11:02:14 AM
I now add -L/boot/system/lib to configure.in

try again... but this must works same that works your version.
Title: Re: Haiku OS port
Post by: EugeneP on September 08, 2010, 12:19:45 PM
Oh, sorry :( I was not careful enough, svn r173 works fine. b^___^d

Also I suggest small changes to loadlib.h (diff attached) to avoid call buggy dladdr at all.

-L/boot/system/lib is not needed actually. it's an artefact form the very first tries.
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 12:29:00 PM
:(

I need revert changes.
Title: Re: Haiku OS port
Post by: EugeneP on September 08, 2010, 03:05:30 PM
Lets be calm in main svn branch. Debugging by forum posts in spare time is not the best development practice.

You need live Haiku to test everything by yourself. I'm going to make virtual machine installation to quick test svn builds. Which would you prefer? VirtualBox or Qemu?
Title: Re: Haiku OS port
Post by: FreeYourMind on September 08, 2010, 03:36:40 PM
VirtualBox for all members, thanks  ;D
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 04:22:30 PM
I can't allow me more time for this now...

I already add a fix for avoid use dladdr.

thanks for all.

Haiku is already supported in the bennugd code.
Title: Re: Haiku OS port
Post by: EugeneP on September 08, 2010, 08:07:49 PM
Thank you for all your efforts. Results are great!

These games ( taken mostly from bennupack ) runs:

Adventures of Echo
Apocalypso
Aggressive Pong
CarreraSo-o
Carretera Peligrosa - Violeta
defendorx
Duck Gun - Javi
Energy
EEEEK! EEEEEK! HOOOOOOK!!!
Exploss
FenixLand
hiperbomb
JustFantasy
kakao
Last2007Game
Nazcadreams
NoFPGmatamata
Ofustris
Puzsion
SonicGates2
Space Invaders 2 - Jose
SquareAnihilation
Tetriss
Zomg


There is some mouse problem (probably came from SDL) which makes games like Puzsion or EEEEK! EEEEEK! HOOOOOOK!!! barely playable. Fixing it is my top priority for now, bughunt is starting.

Here is ARCIVE (118M) (http://uwolke.ru/_project/bgd-haiku/bennu-game-pack-for-haiku-01.zip) containing all these games and menu shortcuts. (unpack to /boot for install)
Archive does not contain bennu, but expects it installed in /boot/apps/bennugd (precompled bennu (http://uwolke.ru/_project/bgd-haiku/bennugd-r165-haiku-gcc4.zip))
Title: Re: Haiku OS port
Post by: SplinterGU on September 08, 2010, 10:33:02 PM
thanks you!

please guys, do a karma gift to EugeneP.

About mouse bug, let me know details.

One question, all this games have sources?

thanks again.
Title: Re: Haiku OS port
Post by: FreeYourMind on September 08, 2010, 10:56:05 PM
Maybe not... I don't see any game of Geca soft in this list  ;D
This is a joke, of course, Karma Up.  ;)
Title: Re: Haiku OS port
Post by: EugeneP on September 09, 2010, 03:47:37 AM
Most of these games are examples from here -->http://code.google.com/p/colombiandevelopers/downloads/list (http://code.google.com/p/colombiandevelopers/downloads/list), the sources are available.

I am writing test case on mouse issue.

2 FreeYourMind: Geca Blaster2 runs smoothly :)
Title: Re: Haiku OS port
Post by: FreeYourMind on September 09, 2010, 06:41:36 AM
Can you try 'Skull' ?
What message apears at the detection of SO ?
Thanks :)
Title: Re: Haiku OS port
Post by: EugeneP on September 09, 2010, 08:32:26 AM
I have found why mouse moves so jerky. Cleaning event queue in libsdlhandler is called on Haiku more frequently than do_mouse_events(), so most mouse events are thrown away.

I suggest small workaround: disabling queue cleaning (patch attached). Someone who knows Bennu core better than me should probably find nicer solution.

Other small bugs are non-fatal, most of Bennu games runs on Haiku now. I am totally happy. ^________________^
(http://forum.bennugd.org/index.php?action=dlattach;topic=1575.0;attach=1468) (http://forum.bennugd.org/index.php?action=dlattach;topic=1575.0;attach=1468)
Title: Re: Haiku OS port
Post by: SplinterGU on September 09, 2010, 03:49:29 PM
thanks! karma!

I'll check your fix.
Title: Re: Haiku OS port
Post by: SplinterGU on September 09, 2010, 04:15:19 PM
I've check your fix...

I can't add it to official version, this is neccesary because in other ways, lot of events that we don't use, will be queued.

I need think in a better method for only remove pending event that haven't control.
Title: Re: Haiku OS port
Post by: Lt_Henry on October 04, 2010, 10:56:15 AM
HMFS!!! I was working on Haiku port just before summer, and I came several times to module import bug. What an annoying bug... great job EugeneP. :D
Title: Re: Haiku OS port
Post by: EugeneP on October 07, 2010, 02:21:30 AM
Tanks :)
Latest svn binaries are uploaded (see here (http://uwolke.ru/node/7))
Also I made package of few games prepared for Haiku (bennu game pack (http://uwolke.ru/_project/bgd-haiku/bennu-game-pack-for-haiku-01.zip) ~100Mb)

There is one small non-technical problem. I want nice Bennu icon. Vector icons are preferable in Haiku. I could not find any official icon, so I made one, but I am not skilled in arts :/

HERE IS (http://uwolke.ru/_project/bgd-haiku/bennu-haiku.svg) icon I created. Maybe someone can suggest a better variant?