How to integrate a new game into dbox

Games, Plugins, Utils, Tools, 3rdParty, etc...
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

How to integrate a new game into dbox

Beitrag von the_moon »

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
Homar
Senior Member
Beiträge: 1278
Registriert: Mittwoch 5. September 2001, 00:00

Beitrag von Homar »

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
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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?
Homar
Senior Member
Beiträge: 1278
Registriert: Mittwoch 5. September 2001, 00:00

Beitrag von Homar »

May you should post your Makefile.am.
Lets have a look on it :wink:
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

..../plugins/Makefile.am

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
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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
Erleuchteter
Beiträge: 521
Registriert: Dienstag 21. Mai 2002, 12:53

Beitrag von Router-Fan »

die rechte auf 755 gesetzt ?
Homar
Senior Member
Beiträge: 1278
Registriert: Mittwoch 5. September 2001, 00:00

Beitrag von Homar »

Hi,

i think it must be on output on console, so try to read your bootlog on executing your plugin.

btw. if you use the curl-libs, you have to write in your solitair.cfg, like tetris.cfg.
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

Homar hat geschrieben: Hi,

i think it must be on output on console, so try to read your bootlog on executing your plugin.
sorry, where is the bootlog, where can i find it.

Homar hat geschrieben: btw. if you use the curl-libs, you have to write in your solitair.cfg, like tetris.cfg.
thanks, i will test it.
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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
Erleuchteter
Beiträge: 521
Registriert: Dienstag 21. Mai 2002, 12:53

Beitrag von Router-Fan »

null modem seriell kabel between dbox and pc and then bootlog with dbox bootmanager

then look at the serielle console in bootmanager when your game start
Homar
Senior Member
Beiträge: 1278
Registriert: Mittwoch 5. September 2001, 00:00

Beitrag von Homar »

...and change the plugin-name in solitair.cfg :-P

Try to make a bootlog!

- make an serial connection between your dbox and pc;
- start a terminal program like DBM (Dbox Boot Manager);
- and look on serial-console during bootup;
- mark the hole log and post here;

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

Beitrag von the_moon »

Hm there is realy problem with my game, because tetris compiled together with solitair is working, but solitair not! :evil:
So I have to check all wht i have. :-?
the_moon
Einsteiger
Einsteiger
Beiträge: 223
Registriert: Samstag 25. Januar 2003, 11:18

Beitrag von the_moon »

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" :lol:


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
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:

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)
Homar
Senior Member
Beiträge: 1278
Registriert: Mittwoch 5. September 2001, 00:00

Beitrag von Homar »

I don et know !!!

Maybe you make your own probs, ecause of your errorhandling.
Try to uncommend it and recompile.

Or compile the hole libs:

cd $HOME/tuxbox-cvs/cdk
make libs

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

Beitrag von the_moon »

Thank You!!!!

all works now, but very slow (graphic part) and key mapping is wrong.
I will rewrite drawing funtions and tune the plugin, then i will share binaries, in order that other users can test the game. Only after this i will send sources to you or other for check in.

Thank you again.