How to integrate a new game into dbox
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
How to integrate a new game into dbox
Hi,
i compiled a new game, and now i will put it into dbox. The one way is to recompile cramfs but it is to long way, because i'd like jast test it and may be often Is there a simple way? I read that it possible to copy a plugin into /var/tuxbox/plugins directory, but it didn't work on my DBOX. Neutrino does not find my plugin.
Thanks
			
			
									
						
										
						i compiled a new game, and now i will put it into dbox. The one way is to recompile cramfs but it is to long way, because i'd like jast test it and may be often Is there a simple way? I read that it possible to copy a plugin into /var/tuxbox/plugins directory, but it didn't work on my DBOX. Neutrino does not find my plugin.
Thanks
- 
				Homar
 - Senior Member
 - Beiträge: 1278
 - Registriert: Mittwoch 5. September 2001, 00:00
 
do you know how to handle a yadd ??
At first, before you make an image of your compilation, try to boot your yadd over network.
I have write some sample-scripts. Please try to read read these scripts. There you can see some explations about the directory-structure.
After them, you need some tools to boot your dbox over the network.
Please tell us witch plattform and OS in use.
cya
edit: put your game and the config-file into lib/tuxbox/plugin not var/tuxbox/plugin
			
			
									
						
										
						At first, before you make an image of your compilation, try to boot your yadd over network.
I have write some sample-scripts. Please try to read read these scripts. There you can see some explations about the directory-structure.
After them, you need some tools to boot your dbox over the network.
Please tell us witch plattform and OS in use.
cya
edit: put your game and the config-file into lib/tuxbox/plugin not var/tuxbox/plugin
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
Yes it works, but my game doesn't work. 
 I striped the game.so file and both game.so and game.cfg placed into /lib/tuxbox/plugins directory in cd.cramfs via flashtool. After cramfs instalation i can select the game in "Games" menu (Neutrino), but if i push "OK" button nothing happens. :/. I created an global object which in constructor opens /tmp/game.log" for writting and some outputs to the log file. Hmm there is no log file in /tmp/ directory! Is there a logging functionlity in Neutrino, how can I see, why the game was no started?
Thanks
			
			
									
						
										
						Thanks
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
I jast compiled untill plugins, not complete CDK. Then i found in HOME/dbox2/cdkroot/lib/tuxbox/plugins my compiled game.so, game.cfg and game.lo. The game.so was not stripped! And I have a question about game.lo. What can i do with game.lo, why do i need it? Perhaps this is may problem, why the game.so was not started?
			
			
									
						
										
						- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
..../plugins/Makefile.am
.../plugins/fx2/solitair
			
			
									
						
										
						Code: Alles auswählen
AUTOMAKE_OPTIONS = gnu
SUBDIRS = \
	include tuxmail tuxtxt fx2
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
	tuxbox-plugins.pc.../plugins/fx2/solitair
Code: Alles auswählen
INCLUDES = -I$(srcdir)/../lib -I$(top_srcdir)/include
noinst_LTLIBRARIES = solitair.la
solitair_la_SOURCES = \
	Block.cpp \
	Buffer.cpp \
	Card.cpp \
	ErrorHandler.cpp \
	Foundation.cpp \
	GameTable.cpp \
	Hand.cpp \
	HandSlot.cpp \
	Slot.cpp \
	Table.cpp \
	TableSlot.cpp \
	Tableau.cpp \
	Wastepile.cpp \
	somain.cpp \
	cards.cpp \
	cards_res.cpp
solitair_la_LDFLAGS = -rpath $(PLUGINDIR) -module -avoid-version @CURL_LIBS@ -lz
install-exec-local:
	install -d $(PLUGINDIR)
	$(LIBTOOL) install solitair.la $(PLUGINDIR)
	install -m 0644 $(srcdir)/solitair.cfg $(PLUGINDIR)
uninstall-local:
	-rm $(PLUGINDIR)/solitair.so
	-rm $(PLUGINDIR)/solitair.cfg
	-rmdir $(PLUGINDIR)- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
solitair/somain.cpp
			
			
									
						
										
						Code: Alles auswählen
int solitair_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile )
{
	struct timeval	tv;
	int 			rc = 0;
	int				x;
	int				i;
	int				fd;
	FILE			*fp;
	char			*line;
	char			*p;
	CErrorHandler::Notify( "Create table...\r\n" );
	CTable table;
	CErrorHandler::Notify( "Initialize FB...\r\n" );
	if ( FBInitialize( 720, 576, 8, fdfb ) < 0 )
		return -1;
	CErrorHandler::Notify( "Setup palette...\r\n" );
	Set_8Bit_Pal();
	CErrorHandler::Notify( "Initialize input...\r\n" );
	if ( RcInitialize( fdrc ) < 0 )
		return -1;
//	KbInitialize();
//	Fx2ShowPig( 480, 400, 176, 144 );
	CErrorHandler::Notify( "Start table...\r\n" );
	rc = table.Run();
//	Fx2StopPig();
	CErrorHandler::Notify( "Close RC...\r\n" );
	RcClose();
	CErrorHandler::Notify( "Close FB...\r\n" );
	FBClose();
	return rc;
}
extern "C"
{
	int plugin_exec( PluginParam *par )
	{
		int		fd_fb=-1;
		int		fd_rc=-1;
		CErrorHandler::Notify( "Enter in plugin_exec...\r\n" );
	
		for( ; par; par=par->next )
		{
			if ( !strcmp(par->id,P_ID_FBUFFER) )
				fd_fb=_atoi(par->val);
			else if ( !strcmp(par->id,P_ID_RCINPUT) )
				fd_rc=_atoi(par->val);
			else if ( !strcmp(par->id,P_ID_NOPIG) )
				fx2_use_pig=!_atoi(par->val);
			else if ( !strcmp(par->id,P_ID_PROXY) && par->val && *par->val )
				proxy_addr=par->val;
			else if ( !strcmp(par->id,P_ID_HSCORE) && par->val && *par->val )
				hscore=par->val;
			else if ( !strcmp(par->id,P_ID_PROXY_USER) && par->val && *par->val )
				proxy_user=par->val;
		}
		CErrorHandler::Notify( "Execute solitair...\r\n" );
		return solitair_exec( fd_fb, fd_rc, -1, 0 );
	}
}- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
And I created an global object which opens the /tmp/solitair.log file. It means that if the game.so is loaded in to memory the the file should be created in /tmp dir. But this is not the case!
			
			
									
						
										
						Code: Alles auswählen
static FILE* output;
CErrorHandler eh;
bool CErrorHandler::Error = false;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CErrorHandler::CErrorHandler()
{
	if( output == NULL )
	{
		output = fopen( "/tmp/solitair.log", "w" );
	}
}
CErrorHandler::~CErrorHandler()
{
	if( output != NULL )
	{
		fclose( output );	
	}
}- 
				Router-Fan
 - Erleuchteter

 - Beiträge: 521
 - Registriert: Dienstag 21. Mai 2002, 12:53
 
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
sorry, where is the bootlog, where can i find it.Homar hat geschrieben: Hi,
i think it must be on output on console, so try to read your bootlog on executing your plugin.
thanks, i will test it.Homar hat geschrieben: btw. if you use the curl-libs, you have to write in your solitair.cfg, like tetris.cfg.
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
Code: Alles auswählen
/lib/tuxbox/plugins > ll
-rw-r--r--    1 500      100            99 Jan  1  1970 _tuxtxt.cfg
-rwxr-xr-x    1 500      100         65008 Jan  1  1970 _tuxtxt.so
-rw-r--r--    1 500      100            89 Jan  1  1970 lcdcirc.cfg
-rw-r--r--    1 500      100           121 Jan  1  1970 lemmings.cfg
-rwxr-xr-x    1 500      100         77004 Jan  1  1970 lemmings.so
lrwxrwxrwx    1 500      100            15 Jan  1  1970 libfx2.so -> ../../libfx2.so
-rw-r--r--    1 500      100            88 Jan  1  1970 master.cfg
-rw-r--r--    1 500      100           133 Jan  1  1970 mines.cfg
-rw-r--r--    1 500      100            85 Jan  1  1970 outdoor.cfg
-rw-r--r--    1 500      100           130 Jan  1  1970 pacman.cfg
-rw-r--r--    1 500      100            93 Jan  1  1970 satfind.cfg
-rw-r--r--    1 500      100           109 Jan  1  1970 snake.cfg
-rw-r--r--    1 500      100           124 Jan  1  1970 soko.cfg
-rwxrwxrwx    1 500      100           124 Jan  1  1970 solitair.cfg
-rwxrwxrwx    1 500      100        159380 Jan  1  1970 solitair.so
-rw-r--r--    1 500      100            81 Jan  1  1970 tank.cfg
-rw-r--r--    1 500      100           171 Jan  1  1970 tetris.cfg
-rw-r--r--    1 500      100            82 Jan  1  1970 tuxmail.cfg
-rw-r--r--    1 500      100           124 Jan  1  1970 tuxnews.cfg
-rw-r--r--    1 500      100           130 Jan  1  1970 vierg.cfg
-rw-r--r--    1 500      100           108 Jan  1  1970 yahtzee.cfg
/lib/tuxbox/plugins > cat solitair.cfg
pluginversion=1
name=Lemmings
desc=ohhh noooo
depend=libfx2.so,/lib/libcurl.so.2
type=1
needfb=1
needrc=1
needlcd=0
pigon=0
/lib/tuxbox/plugins >- 
				Router-Fan
 - Erleuchteter

 - Beiträge: 521
 - Registriert: Dienstag 21. Mai 2002, 12:53
 
- 
				Homar
 - Senior Member
 - Beiträge: 1278
 - Registriert: Mittwoch 5. September 2001, 00:00
 
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18
 
Ha ha, 
you had it right, that i should rename the game
, because at first time i copied the solitair into /var/tuxbox/pluginds not in /lib/.... and second time i copied solitair with wrong name to the /lib/... folder. And in "Games" menu i tried always to start "Solitair" not the "lemmings"  
 
So, i tested it with bootlog, and here is the result
I don't know th reason, but the curl librariy needs libssl and libssl needs libcrypto. Do you know, why it is so, because if i start tetris, there is no problems while loading of libcurl. Like this:
			
			
									
						
										
						you had it right, that i should rename the game
So, i tested it with bootlog, and here is the result
Code: Alles auswählen
ins] try load shared lib : libfx2.so
[CPlugins] try load shared lib : /lib/libcurl.so.2
libssl.so.0.9.7: cannot open shared object file: No such file or directory[CPlug
Code: Alles auswählen
ins] try load shared lib : libfx2.so
[CPlugins] try load shared lib : /lib/libcurl.so.2
[CPlugins] try exec...
avia_gt_gv: set_input_mode (mode=2)
avia_gt_gv: set_input_size (width=720, height=576)- 
				the_moon
 - Einsteiger

 - Beiträge: 223
 - Registriert: Samstag 25. Januar 2003, 11:18