Porting t-engine to OpenBSD

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
rapenne-s
Yeek
Posts: 13
Joined: Sun Nov 27, 2016 11:41 am

Porting t-engine to OpenBSD

#1 Post by rapenne-s »

Hi,

I made some work to build t-engine on OpenBSD, the compilation works now but when I execute the binary, I get a blank window, nothing happen except that the binary use 100% of a cpu.

Code: Select all

/usr/ports/pobj/t-engine4-src-1.4.9/t-engine4-src-1.4.9% ./t-engine 
WebCore config: library(/libte4-web.so) spawn(/cef3spawn)
Loading WebCore: Failed loading /libte4-web.so: File not found
[CPU] Detected 4 CPUs
OpenAL device available: OpenAL Soft (default OpenAL Soft)
Available video driver: x11
Available video driver: dummy
NO SELFEXE: bootstrapping from CWD
Creating save thread
===top 2
Booting T-Engine from: /proc
SelfExe gave us app directory of:	/
Creating particles thread 0
Creating particles thread 1
Creating particles thread 2
[DO RESIZE] Requested: 800x600 (0, 0); zoom 100%
[DO RESIZE] Got: 800x600 (0, 0)
OpenGL max texture size: 8192
OpenGL max texture size: 8192
Upgrading black texture to size 64
Running lua loader code...
[ACTION => closing the window manually]
Cleaning up!
Terminating!
Webcore shutdown complete
SDL shutdown complete
OpenAL shutdown complete
Thanks for having fun!
I only had to patch one file for the code because OpenBSD doesn't have sysctlbyname, which is harmless

Code: Select all

--- src/getself.c.orig	Mon Nov 28 12:08:24 2016
+++ src/getself.c	Mon Nov 28 12:10:00 2016
@@ -57,8 +57,14 @@ int get_number_cpus()
 {
 	int count;
 	size_t size=sizeof(count);
+	int name[2];
+	name[0] = CTL_HW;
+	name[1] = HW_NCPU;
 	
-	if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)) return 1;
+	if (sysctl(name, 2, &count, &size, NULL, 0) < 0 {
+	  count = 1;
+	}
+
 	return count;
 }
I have tried to compile the game with the default lua instead of luajit but I still get the same behaviour. My computer is able to run games like minecraft so the graphics capability should be ok to start the game.

Am I doing something wrong ? Do I need to do something else to start the game ?

When I use the OpenBSD ktrace tool to look at system calls, I see this a LOT (ktrace is producing 23 Mb of text running the game for ONE second), this would explain the cpu usage and why it's hanging, but I'm not sure about why it's doing this.

Code: Select all

[..this is only a very little portion of the traces, this part is getting repeated indefinitely..]
 20859 t-engine CALL  select(5,0x7f7ffffd7550,0,0,0x9f1dbfb73a0)
 20859 t-engine STRU  struct timeval { 0 }
 20859 t-engine STRU  struct fd_set { 4 }
 20859 t-engine STRU  struct fd_set { }
 20859 t-engine RET   select 0
 20859 t-engine CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7ffffd7760)
 20859 t-engine STRU  struct timespec { 522529.616377936 }
 20859 t-engine RET   clock_gettime 0
 20859 t-engine CALL  recvmsg(4,0x7f7ffffd6dd0,0)
 20859 t-engine RET   recvmsg -1 errno 35 Resource temporarily unavailable
 20859 t-engine CALL  select(5,0x7f7ffffd7550,0,0,0x9f1dbfb73a0)
 20859 t-engine STRU  struct timeval { 0 }
 20859 t-engine STRU  struct fd_set { 4 }
 20859 t-engine STRU  struct fd_set { }
 20859 t-engine RET   select 0
 20859 t-engine CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7ffffd7760)

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Porting t-engine to OpenBSD

#2 Post by darkgod »

Those lines are the culprits:

Code: Select all

Booting T-Engine from: /proc
This is the selfexe path being wrong, look at the bsd code in getself.c it must be broken, it should return the path to the executable
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

rapenne-s
Yeek
Posts: 13
Joined: Sun Nov 27, 2016 11:41 am

Re: Porting t-engine to OpenBSD

#3 Post by rapenne-s »

darkgod wrote:Those lines are the culprits:

Code: Select all

Booting T-Engine from: /proc
This is the selfexe path being wrong, look at the bsd code in getself.c it must be broken, it should return the path to the executable
indeed, it seems FreeBSD has some patches for this. I'll look how to fix this :)

rapenne-s
Yeek
Posts: 13
Joined: Sun Nov 27, 2016 11:41 am

Re: Porting t-engine to OpenBSD

#4 Post by rapenne-s »

rapenne-s wrote:
darkgod wrote:Those lines are the culprits:

Code: Select all

Booting T-Engine from: /proc
This is the selfexe path being wrong, look at the bsd code in getself.c it must be broken, it should return the path to the executable
indeed, it seems FreeBSD has some patches for this. I'll look how to fix this :)
OpenBSD doesn't have a way to find the path of a running executable. As it's bundled from ports, I will hard code the path, this won't be a problem.

I have more success running the game on OpenBSD than on Windows :mrgreen: :mrgreen:

rapenne-s
Yeek
Posts: 13
Joined: Sun Nov 27, 2016 11:41 am

Re: Porting t-engine to OpenBSD

#5 Post by rapenne-s »

I am happy to announce that now ToME is available in OpenBSD packages
http://cvsweb.openbsd.org/cgi-bin/cvswe ... mes/tome4/

Post Reply