Open main menu

Difference between revisions of "HOWTO-Backends"

3,179 bytes added ,  00:50, 12 February 2006
Adding meat to the backends HOWTO
(First skeleton for backends HOWTO)
 
(Adding meat to the backends HOWTO)
Line 1: Line 1:
=== Introduction ===
=== Introduction ===
This page is meant as a mini-HOWTO which roughly outlines the steps needed to add a new backend (port) to ScummVM.  
This page is meant as a mini-HOWTO which roughly outlines the steps needed to add a new backend (port) to ScummVM. Before you embark on this quest, however, you should first check if one of the existing backends already suits your needs. In particular the SDL backend already supports many platforms, since SDL itself is quite portable.


But if you have determined that a new backend is what you need, the following should hopefully help you a bit with that. Feedback is welcome :-).


=== Steps ===
I will assume that you are at least roughly familiar with ScummVM, and have a fresh checkout of our Subversion repository. Note that it's strongly adviced to base your work on the current development version of ScummVM, and not on a release version. This will ease integration of your work.
TODO
 
 
=== Overview ===
Essentially, you will have to implement a subclass of the OSystem class. Our Doxygen documentation is your friend and should hopefully explain enough about this, see here: http://scummvm.org/docs/doxygen/html/classOSystem.php.
 
You also need to either hook yourself into the regular ScummVM build system, or provide your own. Finally, you need to make ScummVM aware of your new backend by updating a couple source files
 
 
=== Step by step ===
In the following I assume your port is named "foobar" (very clever, isn't it? :-).
 
# Create a new backends/ subdirectory matching your engines name, i.e. <tt>backends/foobar/</tt>
# Populate the new directory as you need to. If you want to use our regular build system, you will want to provide <tt>backends/foobar/module.mk</tt> file. Take a look at <tt>backends/sdl/module.mk</tt> for an example.
# Subclass OSystem. You could copy the content of <tt>backends/null/null.cpp</tt> to <tt>backends/foobar/foobar.cpp</tt> to get a skeleton. As you progress, it might be helpful to look at other backends to learn how they do things.
# If appropriate, edit <tt>configure</tt> to add your backend (this is only necessary if you are going to use the "./configure && make" build system).
# Modify <tt>common/system.cpp</tt> and <tt>backends/intern.h</tt> to make it aware of your backend. Mostly, this means telling it about your OSystem factory function (I'll leave the code there to document itself, if you don't understand it, ask us on IRC or on our mailing list).
# Modify <tt>backends/intern.h</tt> if you want to set a custom default sample rate.
 
That's it. The difficult part is of course writing the OSystem subclass. More on that in the next section!
 
 
=== Subclassing OSystem ===
TODO: This section is meant to give some specific hints on creating a useful OSystem subclass. For now I can't really think of anything useful besides the obvious, and besides what we already say in other places... Take a look at http://scummvm.org/docs/doxygen/html/classOSystem.php which contains lots of useful information. Also take a look at null.cpp to see what you have to implement, and peek at the SDL backend (which is our main backend and thus kind of a reference for all the others). And finally, take a look at <tt>common/system.h</tt> to see which methods are pure abstract, and thus *must* be implemented by you. Oh and of course: You can always talk to us on IRC or via email :-).




=== Misc notes ===
=== Misc notes ===
There is [[Small Devices Backend]] in the works which is planned to be common for all devices with limited resources.
There is [[Small Devices Backend]] in the works which is planned to be common for all devices with limited resources. If you are working on a backend for such a system, you may want to take a look on that page!
1,079

edits