Re: [AD] Porting Allegro to a new system

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2007-01-01, Bobby Ferris <baf@xxxxxxxxxx> wrote:
> I'm helping with the effort of porting Allegro to the Nintendo DS.

Great.

> The main problem at the moment is the lack of a 'dummy' system driver
> collection.

It would not be hard for someone (or me) to make a dummy port, but I
don't know if it will be that useful.  There would still be a lot of
blanks to fill in anyway.

> The platform drivers are so platform specific and jumbled up 
> that I can't find a basic general layout of a system driver. Are there 
> any docs that explain pretty well how the whole driver system for 
> Allegro works,

There's not that much to it actually.  Each driver is just table of
function pointers, and drivers are mainly listed in static tables, of
type _DRIVER_INFO[].

Take the Windows port.  In src/win/wsystem.c there is a table called
_system_driver_list which lists two possible system drivers that can be
used: system_directx and system_none.

At the end of system_directx are some methods called gfx_drivers,
digi_drivers, etc.  Most of these are NULL, in which case the
platform-independent code will search in tables called _gfx_driver_list,
_digi_driver_list, etc. for the drivers (see the code for set_gfx_mode,
install_sound, etc).  These driver lists are exactly the same as for
_system_driver_list.

Now, if those methods are _not_ NULL, then they must return similar
driver lists, but which could be built up dynamically.  The Windows port
does it for digital sound drivers, for example, with the function
_get_win_digi_driver_list.


Caveat: the _foo_driver_lists are in some ports written by a set of
macros which look like:

    BEGIN_GFX_DRIVER_LIST
    GFX_DRIVER_BEOS
    END_GFX_DRIVER_LIST

> or some secret dummy driver that shows how to basically 
> do stuff (like init the graphics mode and make the BITMAP to return) or 
> do you have to spend hours trying to figure out what's done from the 
> platform specific drivers? I just want a basic outline of what you 
> should do, and what is expected for return values, etc, without 
> concerning myself with the internal workings of other systems.

Unfortunately it's not that well documented, but it should not take
"hours" for the most part.  Your best bet is probably to read the
platform-independent files (src/*.c) and see how the driver methods are
called and in what context, then delve into one of the drivers if you
need clarification.  Use grep and and ask questions.

If Angelo is still reading this, he'd probably be the best person to
ask, as he's probably done the most ports of all.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/