Porting Arkanoid to the Pandora. Here’s How.

arka

Recently you may have noticed (for various reasons) the long article from Dredd on how to port an application to the Pandora, where he was showing us how to compile the Dillo Web Browser for our beloved device. This time, we are to port, from start to end, a game made for PC to the Open Pandora. Just like in the previous article, all steps, including the preparation of the environment,  compilation, packaging, and code customization will be reviewed and explained. We will be working on the remake of Arkanoid by Clément CORDE.

Note: This is guest post by PtitSeb, one of the most active porters on the Pandora. Enough said, he knows his stuff. 

Build 0 – First Compilation

Preparing the compilation environment

You need a Pandora, but also:

  • The code::blocks PND (an up-to-date version that you can find in the repo). The cdevtools PND can also be used, but somes scripts (which make life easy) will be missing.
  • A SDCard with an Ext2 partition.
  • A Paint software for the icon (mtPaint for Pandora for example).
  • The SnapSnap PND, to take screenshot on the Pandora.

téléchargement

Why use an Ext2 partition: The Fat32 partitions are handy. They can be read by all OS, including Windows. But they have limits under Linux. You cannot do symbolic link (symlink) and manage advanced rights. Linux attributes are not supported. So, for serious development, you need an Ext2 partition. You can use Gpart on the Pandora for that, it works very well.

It’s always simpler to give a name to the partitions. Mine is called “SEBEXT”. In this partition, I try not to overload the root folder, so I created a “sources” folder where all my sources will go. In a pure Unix world, it should be called “src” (but I come from a Dos & Windows world).

Grab and compile

First step, grab the sources.

The simplest way to do that is, once you know the exact location of the package, to get it from the command line of code::blocks PND. The page where all Clément’projects are stored is here: http://oldschoolprg.x10.mx/projets.php. To grab the sources, just do:

cd /media/SEBEXT/source
wget http://oldschoolprg.x10.mx/downloads/Breaker_src3264.tar.gz

So you have the sources now. We will now extract the archive, and we’ll take a look at the newly created “break3264” folder.

tar xzf Breaker_src3264.tar.gz
cd breaker3264
ls

Don’t rush trying to compile, the future PND has to be planned first. Here, we will call it Arka. So, know that this PND, when it will launch on a Pandora, will be alwys mounted at the same place. For this one, it will be “/mnt/utmp/Arka”.

It’s not mandatory to have both the name of the folder and the name of the PND the same, here “Arka”, but it’s easier.

Let’s get back to the sources. So what’s inside breaker3264?

940dc75f-4f94-42e2-9264-3aa5a22fd2b7

We found: a Makefile, no configure, a handful of .c and .h, two folders (gfx and sfx) with game data, some readme files (do you read them? You should, there might be important info, to make the port easier) and a high.scr.

So no configure here, it will be just a make.

So, first try to compile. Just use “make” and see what happens.

make

No worries, it won’t go far. This Makefile is for Windows, it won’t find SDL. So, some modification of the Makefile are needed.

mousepad Makefile &

I use mousepad, but feel free to use any editor you like (tips: the & at the end is for launching the software without waiting for the launched application to end).

A Makefile is a series of rules that describe how to build something using other things

The first step is to define some Variables, to make it easy to maintain and modify. The main thing is that make will build the TARGET, and in this case this is a program named breaker. To build breaker, we need OBJECTS, and it’s a list of “.o” files, each one also created using CC (and CC is gcc), with CFLAGS and LIBS as options.

The compiler (and the linker) used is gcc. No problem here. But the CFLAGS line is to be adapted.

9b539b65-ebaf-453e-8277-773b51646d45

The “-O3” defines the speed optimization level. “3” is the maximum of speed optimizations. You can go from “-O0” (almost nothing) to “-O3” (maximum optimization), and there is also a “-Os” to optimize the final size instead of speed. Each level adds a new set of individual optimization options (some -fsomething switches). With gcc 4.7 and later, there is also a “-Ofast”, that is a shortcut to “-O3 -ffast-math”, and this one can be very useful on the Pandora, as it enables some unsafe math optimizations, using the NEON engine (NEON can do math calculation on more than 1 value at a time, but float point calculations are only processed with single precision only, and therefore does not follow strict IEEE standards). So don’t use this flag for serious software, but for games, it’s usually a good idea. Another thing to add is to mention the target system processor. So add a “-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp” (you can add a “-march=armv7-a” also). A “-pipe” helps to avoid writing temporary files on temps, but it uses more memory (not an issue here, but for some -very- large sources, you may need to remove the “-pipe” and redirect the TMP variable to some tmp folder on your Ext2 partition).

The “-Wall” parameter activates all warnings.

The “-I” and “-L” following define folders where Includes and Libraries files are located. Here, we could change that to the main codeblocks ones (they are “-I/mnt/utmp/codeblocks/usr/include” and “-L/mnt/utmp/codeblocks/usr/lib”), but we just need SDL, so we can use “sdl-config” to automatically set the correct flags, with the “–cflags” and “–libs” parameters (you can try those in the command line to see what is needed). To execute a program and use the result, you have to use back quote (Fn-h on the Pandora keyboard).

The “-D” parameter is used to define a … define (for all condition compilation, those #ifdef lnes in c/c++ code), so we will create a “-DHAVE_PANDORA”, so we can alter code just for the Pandora (everything between #ifdef HAVE_PANDORA and #endif will compile only on the Pandora, and will be ignored for other compilations).

So, 2 lines have to be modified n the Makefile:

CFLAGS = -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -pipe -Ofast `sdl-config --cflags` -s -DNDEBUG -DHAVE_PANDORA
LIBS = `sdl-config --libs`

Note that you can keep the original lines using a sharp “#” in front of the line (and it’s good practice to keep track of what is modified)

In this Makefile, there is no install section, so the installation will be manual.

The “configure” case : Linux software is often based on autotool. So you’ll find a script named “configure” that handle the Makefile configuration. In that case, you will launch the script with “./configure –help” to see what options are available, and at least use the “–prefix=” to set installation folder. If Arka had used it, we would had use “./configure –prefix=/mnt/tmp/Arka” to just define the target folder. Note that sometimes, the “configure” script is missing, but a “autogen.sh” is present. Use it to generate a “configure” then.

Setup is done. Now it’s time to build. So let’s make it, for real this time.

make

And that’s it… A couple of seconds later, the compilation ends… on an error. Nothing bad, and the linker (gcc) even hints on what to do to fix it. A library is mising. “libm”, handling maths. So we just have to add it in the Makefile. The line LIBS is modified to the following:

LIBS = `sdl-config –libs` -lm

To add a library to the linker, you simply use “-l” and the name of the lib, without “lib”.

make

This time, it’s done !

45099784-eaec-4c2d-ad3b-4e50c6c00387

Note that make has only processed the remaining part (the link part). It has not compiled the sources, since it was not needed, as nothing had changed. That can be a pretty big deal for large projects (LibreOffice, for example, took 3 full days to compile).

Note that if you feel make is missing something (for example, you changed some flags in CFLAGS), and if you want to recompile everything from scratch, use the “make clean” instruction instead to remove all previous compilation, or, with a software using a “configure” file, use “make distclean” to also remove traces of “configure”.

So, we finally have a program, “breaker”, created and ready for testing. Let’s test it:

./breaker

It works !

But it’s not fullscreen. Before packaging it into a PND, we need to address that. The Pandora screen being small enough, there is no point to run games inside windows.

 

Build 01 – My first PND

How to Fit to the Pandora

Going Fullscreen

Going Fullscreen is not always a simple matter. In fact, depending of the libraries used, it can be very complicated (X11 for example). Here, it’s SDL, and the windows are of fixed size (640×480). The Pandora screen is 800×480, so there is no need to modify anything, it fits the screen just nicely.

For Arka, there are 2 ways to force fullscreen mode.

  • Source code modification (F10 can be used to switch Windows/Fullscreen, so why not force Fullscreen only…)
  • …or the otheway is to use the modified SDL lib from notaz. The magical SDL is highly optimized (fastest driver for the Pandora currently) and forces Fullscreen automatically. So there is no need to code anything, a linux command is enough.

We simply use the following to define the proper SDL driver:

export SDL_VIDEODRIVER="omapdss"

Try “./breaker” to test again. Magic, isn’t it?

Note that you can change the size of the screen, with “export SDL_OMAP_LAYER_SIZE=”640×480″”, or let the driver find the best mode by itself.

f0f60351-848e-4561-a0d1-785e10e6677a

 

The PND

Now, we have everything we need for a first PND. There is no “make install” here, so the copy will have to be done manually.

Let’s first create the folder where all PND file will be stored. It’s called Arka.

mkdir /media/SEBEXT/sources/Arka

That’s it. Now, we will simulate a PND (the sudo command will require you to enter your password, since the Super User is the only user that can do certain things, like creating a folder there, or using the mount command)

sudo mkdir /mnt/utmp/Arka
sudo mount -n --bind /media/SEBEXT/sources/Arka /mnt/utmp/Arka

There, a nice mount point (don’t launch the mount command inside /mnt/utmp/Arka, it won’t work), that looks like a mounted PND. A PND is actually more complicated, it’s the union between the ISO of the PND (PND is a sort of disk image) and the folder “appdata” of the PND. No union here, just a simple mount point, but that’s enough for the building part.

Important thing to note is that, here, we have all read/write permission on everything in the PND folder. That will not be the case on a real PND stored on a Fat32 SDCard (the most common case). To make things simple, consider that everything that is inside the PND is basically Read/Only!

Let’s copy all files inside the future PND.

cd /media/SEBEXT/source/breaker3264 
cp breaker /mnt/utmp/Arka/ 
cp high.scr /mnt/utmp/Arka/ 
cp *.txt /mnt/utmp/Arka/ 
cp sfx /mnt/utmp/Arka/sfx -r 
cp gfx /mnt/utmp/Arka/gfx -r

The « configure » case: Software with configure have automated script for installation. In that case, if the “–prefix” was correctly done, a simpe “make install” will copy everything that is needed in the right folder.

The packaging process can now begin…

 

Making a PND

It’s easy to copy files, but for a PND, 3 things are still missing: an Icon, a PXML and a run script.

Let’s start with the icon. No magic here. There is no icon in the sources, so you have to draw one yourself. Use mtPaint for example, and draw a beautiful icon. It must be in 32bits PNG file format. Prepare a 96 x 96 pixels square image. That should work well. Name it “icon.png” and save it just inside /mnt/utmp/Arka.

For the PXML file (describing the PND contents), and the launch script, you can either copy/paste some existing one, or use a script to create them.

There are 2 versions of them. One comes from the Pandora firmware, the other can be found inside the code::blocks PND (originally from the Sebt3 Linux cross-compiling image). Both works well, but we will use Sebt3’s script in this case.

To launch the easy creation, you just go inside the folder, and launch genpxml (if you want the firmware’s one, use /usr/pandora/scripts/genpxml.sh).

cd /mnt/utmp/Arka 
genpxml

Now, look inside your folder, new folders and files have been created. The previews folder will contains screenshots, while scripts contain the launch script. And you see the PXML.xml as well.

Let’s begin with this one. Edit-it, with mousepad for example.

mousepad PXML.xml

There will be quite a few fields to alter. The “application-id” can be modified. Once published in the repo, you cannot alter it. So don’t put a version number inside the ID, and take care of it’s uniqueness. The author, website, title and description have to be adjusted also. Same for category and sub-category.

For version, your are free to put whatever you want. But I suggest you respect some rules in versionning so that end-users can easily track the versions if you upgrade. I use the 3 first number to put the version of the software I port, and 4th number is for me, that’s the Build number, and it’s just an increment, starting at 01 when I first publish it on the repo.

My PXML, once edited, looks like that:

<?xml version="1.0" encoding="UTF-8"?> <PXML xmlns="http://openpandora.org/namespaces/PXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PXML_schema.xsd">
<!-- please see http://pandorawiki.org/PXML_specification for more information before editing, and remember the order does matter --> 
<application id="Arka-breaker-ptitSeb" appdata="Arka">
<exec command="scripts/breaker.sh"/>
<title lang="en_US">Arka</title>
<author name="ptitSeb" website="http://oldschoolprg.x10.mx/projets.php"/>
<version major="1" minor="0" release="0" build="01"/>              
<!--This programs version-->
<osversion major="1" minor="0" release="0" build="0"/>                 
<!--The minimum OS version required-->
<description lang="en_US">Arkanoid Remake by Clement CORDE. This is a remake of Arkanoid, the classic Breakout. This is not a faithful reconstitution of the Original. Gameplay may differ. There is more than 30 levels to clear, with many options falling. As a bonus, you can choose your starting level (but only in the first 12 levels). There are 2 graphics modes (cycle with F9) + windows/fullscreen (F10), but using Notaz highly optimized SDL, you won't see any differences.</description>
<icon src="/mnt/utmp/Arka/icon.png"/>
<!--
<previewpics>
<pic src="previews/breaker.png"/>
</previewpics>
-->
<!--<info name="breaker documentation" type="text/plain" src="/mnt/utmp/Arka/readme.txt"/>-->
<categories>
<!-- http://standards.freedesktop.org/menu-spec/latest/apa.html -->
<category name="Game">
<subcategory name="ArcadeGame"/
</category>
</categories>
<!--
<associations>
<association name="Deinterlaced Bitmap Image" filetype="image/bmp" exec="-f %s"/>
<association name="Style sheet system crasher" filetype="text/css" exec="-f %s"/>
</associations>
-->
<!--<clockspeed frequency="600"/>-->
</application>
</PXML>

Now the launch script, which is scripts/breaker.sh, to be edited with mousepad for example.

a9048d24-ab02-48d0-8b14-c26e8b8b19cd

Not much to do, just add the export to use notaz’s driver for SDL, and that it.

But…

Libraries dependencies

Before building the PND, we have to take care of the dependencies. Now, code::blocks PND is mounted, and with it, many libraries not in the firmware are accessible. Problem is, without codeblocks PND, how to still have thoses new libraries, and which ones? You can do by trial and error (build a PND, try it without codeblocks, see the pnd_out to have the name of the lib, repackage…), you can use ldd (list the libraries used by a software, type ldd breaker to see all libs used by breaker), or you can use a (very crude) script that will copy all libs that are not fetched from the firmware.

We will put all those libraries inside a new lib folder.

cd /mnt/utmp/Arka
mkdir lib
cd lib
copy_libs.sh ../breaker
cd ..

The script will copy all those libraries not available in the firmware. You can still remove some copied libs anyway, it’s up to you (to reduce the size of the PND, or to specifically use the one from the firmware, like libGLES_CM for example). Here, we can remove libSDL-1.2.so.0.

HiScores

All good? Not quite. There is still one problem. Because the PND is basically Read/Only for most, the HiScore file (named high.scr) will not be writable. To avoid this, we have to first create a new folder “home” with the launch script (it will be writable, because not inside the PND), and force the Hiscore file to go inside it. To force the file in, we can either modify the source code, and add a “home/” in front of the “high.scr”, or we can create a symbolic link inside the PND. There is only one file to write, so we will use the link trick this time.

cd /mnt/utmp/Arka
mkdir home
cp high.scr home/
mv high.scr high
ln -s home/high.scr high.scr

There, the high.scr is now a symbolic link to the real high.scr inside the home folder. We keep the original high.scr with a new name, for the initializing phase in the launch script. Do an “ls -l” to see the link in action.

Now, some cleaning, because home must not be in the PND, but created at launch time.

cd /mnt/utmp/Arka
rm home -r

We can now package, at last !

d35a7608-3c10-4dcb-887a-fb0e2d46ebe4

Scripts and environment

The launch script have to define the folder with all the libraries we copied earlier. It’s the “LD_LIBRARY_PATH” environment variable. Note that it’s already defined in the launch script.

Don’t forget to create home if it doesn’t exist, and put the copy of the high.scr file also.

My launch script looks like that:

#!/bin/sh
export PATH=":${PATH:-"/usr/bin:/bin:/usr/local/bin"}"
export LD_LIBRARY_PATH="/mnt/utmp/Arka/lib:${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"
export HOME="/mnt/utmp/Arka" XDG_CONFIG_HOME="/mnt/utmp/Arka"
if [ -d /mnt/utmp/Arka/share ];then 
export XDG_DATA_DIRS=/mnt/utmp/Arka/share:$XDG_DATA_DIRS:/usr/share
fi
export SDL_AUDIODRIVER="alsa"
export SDL_VIDEODRIVER="omapdss"
cd $HOME
if [ ! -e home ]
then
mkdir home
cp high home/high.scr
fi
-e "$HOME/scripts/pre_script.sh" ] && . $HOME/scripts/pre_script.sh
if [ -e "$HOME/scripts/post_script.sh" ];then
./breaker $*
. $HOME/scripts/post_script.sh
else
exec ./breaker $*
fi

Now, let’s build this PND.

But first, we are done with the fake PND. We have to unmount before proceeding.

cd /media/SEBEXT/sources
sudo umount /mnt/utmp/Arka

Building a PND

To build a PND, there is also a script, don’t panic. It’s called pnd_make.sh, and it’s inside the firmware.

/usr/pandora/scripts/pnd_make.sh -d Arka -p Arka.pnd -i Arka/icon.png -c

We create a PND, based on the folder Arka (the -d parameter), named Arka.pnd (the -p parameter), with icon Arka/icon.png (the -i parameter), and using squashfs compression (the -c parameter).

Just copy it in your “pandora/menu” folder, with your other PND, and you good to go!

Testing

To test a freshly created PND, you should:

1. Avoid testing the PND on Ext2 partition.

2. Try the PND without codeblocks mounted. Quit codeblocks is not always enough. You can force codeblocks to cleanly unmount by creating a dummy file named clean_pnd inside appdata/codeblocks/init (that’s for build < 10, for build 10 and later, the clean unmount at exit is the default behavour).

Another solution, faster, is to just unmount codeblocks’ libraries, with “sudo ldconfig”. After testing, you then have to mount the libraries again, with “sudo ldconfig -f /mnt/utmp/codeblocks/ld.so.cfg

b7f686ac-4c3d-4976-adc8-40862ca545c2

 

Build 02 – Source Code Modifications

Pandora buttons support

To be able to use the pandora’s buttons inside Arka, no magic, we have to code. It’s an SDL program, so we first need how to use Pandora’s button with it. There are just standard keys in fact, and here are the codes for them:

(Start) SDLK_LALT (Y) SDLK_PAGEUP
(Select) SDLK_LCTRL (A) SDLK_HOME
(L) SDLK_RSHIFT (B) SDLK_END
(R) SDLK_RCTRL (X) SDLK_PAGEDOWN

And the DPad are just the arrows (SDLK_UP and so on).

Here, you have to understand how the program works to make those kind of modifications (and don’t forget that, the less you change, the less you break).

You usualy start with the main.c to see how it begins.

So, open it, using mousepad (which will ask for a codepage, choose Windows-1252, it’s a french Windows program) or codeblocks.

Look for the “event loop” (it begins at line 28), and analyse everything. I’ll give here a way to add the buttons, but there are probably better or smarter ways to do it. It just works, and it’s quite simple…

For Arka, we want to be able to move in the main menu with the DPad, validate with buttons, play with DPad and buttons too, and also use the shoulder buttons to move the paddle faster.

We need more variables to handle this. So we first need to modify the “includes.h” to add a few. We will make all our modifications between “#ifdef Pandora” and “#endif”.

So, at line 69, just after “s32          nFadeVal            // 0 = Noir / 256 = couleurs finales” and before ”} ;”, add:

#ifdef HAVE_PANDORA
s16     nKeyUp, nKeyDown, nKeyLeft, nKeyRight;  // emulate mouse with keyboard
s16     nKeyFastLeft, nKeyFastRight;            // to go faster left or right
#endif

That define our new variables.

Inside main.c, there is already a event loop for keyboard (to handle F10 for fullscreen, F9 to use simple or double resolution and P for the pause).

So we will add our own events.

Line 84 for the “key press”, after “SDL_ShowCursor(SDL_ENABLE);                      // Affiche le pointeur de la souris.” and the 2 “}” and before “break ;”, add:

#ifdef HAVE_PANDORA

if (gVar.pKeys[SDLK_PAGEDOWN] || gVar.pKeys[SDLK_HOME])
{
gVar.nMouseButtons |= MOUSE_BtnLeft;
}
if (event.key.keysym.sym == SDLK_UP)
gVar.nKeyUp=1;
if (event.key.keysym.sym == SDLK_DOWN)
gVar.nKeyDown=1;
if (event.key.keysym.sym == SDLK_LEFT)
gVar.nKeyLeft=1;
if (event.key.keysym.sym == SDLK_RIGHT)
gVar.nKeyRight=1;
if (event.key.keysym.sym == SDLK_RSHIFT)
gVar.nKeyFastLeft=2;
if (event.key.keysym.sym == SDLK_RCTRL)
gVar.nKeyFastRight=2;
#endif

And a bit further, for the “key released” event, just between “SDL_KEYUP” and “break ;”, add:

#ifdef HAVE_PANDORA
if (event.key.keysym.sym == SDLK_UP)
gVar.nKeyUp=0;
if (event.key.keysym.sym == SDLK_DOWN)
gVar.nKeyDown=0;
if (event.key.keysym.sym == SDLK_LEFT)
gVar.nKeyLeft=0;
if (event.key.keysym.sym == SDLK_RIGHT)
gVar.nKeyRight=0;
if (event.key.keysym.sym == SDLK_RSHIFT)
gVar.nKeyFastLeft=0;
if (event.key.keysym.sym == SDLK_RCTRL)
gVar.nKeyFastRight=0;
#endif

And that’s it for the keys events. So here, using (B) or (X) buttons will be the same as a left click. No further code will be needed for the buttons.

We will now add some code for the Up/Down in the menu.

It’s in menu.c, line 206, just after “case MENU_State_Input :”, add:

#ifdef HAVE_PANDORA

// Moving the bar with the keyboard

if (gVar.nKeyUp==1)
{ gVar.nKeyUp=0; if (gMenu.nChoix) gMenu.nChoix--; elsegMenu.nChoix=NBELEM(gpMenuItems_Main) - 1; CursorInit();   // Slt parce que c'est plus joli. nWait = 12; // Sfx. Sfx_PlaySfx(FX_Menu_Move, e_SfxPrio_10); } if (gVar.nKeyDown==1) { gVar.nKeyDown=0;

if (gMenu.nChoix<NBELEM(gpMenuItems_Main) - 1)
gMenu.nChoix++;
else
gMenu.nChoix=0;
CursorInit();   // Slt since it looks better.
nWait = 12;

// Sfx.
Sfx_PlaySfx(FX_Menu_Move, e_SfxPrio_10);
}

#endif

It’s just some copy/paste of the mouse handling, with some slight modifications to use the keyboard instead of the mouse.

And then, back to the gameplay. It’s inside breaker.c, all way down, in the main function “void BreakerGame(void)”. There are many steps.

The first is the starting level choice. At line 1302, just after “case e_Game_SelectLevel” and before “if (nWait) nWait– ;”, add:

#ifdef HAVE_PANDORA

// Selection du niveau au clavier
if (gVar.nKeyLeft==1)
{
gVar.nKeyLeft=0;
if (gBreak.nLevel)
gBreak.nLevel--;
else
gBreak.nLevel=LEVEL_SELECT_Max;
BreakerInit();
gBreak.nPhase = e_Game_SelectLevel;
nWait = 12;
}

if (gVar.nKeyRight==1)
{
gVar.nKeyRight=0;
if (gBreak.nLevel<LEVEL_SELECT_Max)
gBreak.nLevel++;
else
gBreak.nLevel=0;
BreakerInit();
gBreak.nPhase = e_Game_SelectLevel;
nWait = 12;
}

#endif

For the game itself, it’s a function a bit before “Brk_MovePlayer()” which handle that. Line 1209, just after “i = gVar.nMousePosX ;” and before “nXMin = i – pSpr->nPtRefX ;”, add:

#ifdef HAVE_PANDORA
 // for the keys
 i += gVar.nKeyRight*2 + gVar.nKeyFastRight*2;
 i -= gVar.nKeyLeft*2 + gVar.nKeyFastLeft*2;
 #endif

…and for the mouse pointer to follow the keys movements, add, 5 lines further, before the end of the function:

#ifdef HAVE_PANDORA

if (i != gVar.nMousePosX) SDL_WarpMouse(i, gVar.nMousePosY);

#endif

And that’s it. A “make” later, you get a new version of breaker that handle Pandora’s buttons.

Screenshots

Before launching a new PND build, there is one point missing: screenshots. At least one screenshot should be included in a PND, since it shows up in minimenu and in the repo, and every end-user wants to see what the software looks like before downloading it.

For screenshots, just use SnapSnap PND. It includes a timer mode, so it can be used with any software (well, almost).

df535205-e028-4b96-898d-60079338e03f

To use it, launch the “SnapSnap Timer”, choose 20 or 30 seconds (60sec doesn’t seem to work), close the zenity message that appears, wait for the Dialog Box. When it shows up, close it with the cross buttons up-right, not the OK (as it ends the timer). Then launch the game. Screenshots will be saved in the first SD card (note that SnapSnap may not find the SD card if the Left SD card has 2 partitions), in the folder Screenshots. After a few minutes of gameplay, quit the game, and kill SnapSnap (using a long keypress on the Pandora button, then kill the “watch” application).

Choose a few screenshots, make the first one the most impressive of your collection (you can rename preview1.png, preview2.png, …), and move them to the previews folder of the PND.

Last modifications of the PXML

You just have to add the new screenshots in the PXML, there is specific place for that. Just remove the comments (the “</–” and the “–>”), and duplicate/remove the line depending the number of screenshots you want to share.

Also, don’t forget to update the Build number, and the description to add the default mapping of keys.

And that’s it, just rebuild the PND and test it.

preview1

Congratulations, you now have a customized version for the Pandora, and you have reached the end of this long tutorial. It is now up to you to go and port awesome apps for the Pandora!

Leave a Reply

17 Comments on "Porting Arkanoid to the Pandora. Here’s How."

avatar
  Subscribe  
newest oldest most voted
Notify of
Antartica
Guest

Some little “bugfixes” to the tutorial…

In “Grab and compile”:

when you give some instructions for autotools, it says

“./configure –prefix=/mnt/tmp/Arka”

instead of
“./configure –prefix=/mnt/utmp/Arka”

(notice the “u” in /mnt/utmp/Arka).

In “Pandora buttons support”

The paragraph that says

We will make all our modifications between “#ifdef Pandora” and “#endif”.

should say

We will make all our modifications between “#ifdef HAVE_PANDORA” and “#endif”.

That’s all 🙂

Thanks for a great tutorial!
(Wow, I’m starting to love pandoralive, good work all of you!)

Dredd
Member

well spotted! also a bugfix to your nick, should say “Antarctica” 😉 j/k

AFAIK
Member

Thanks for the great post!

Say, did you miss [ at -e "$HOME/scripts/pre_script.sh" ] && . $HOME/scripts/pre_script.sh in your launch script or I’ve just read something wrong?

FZERO
Guest

Great article. Great game.

ptitSeb
Member

@Antartica: yes you are right, that’s 2 mistake. Also note that “–” (i.e. double dash) looks like simple dash , so beware of that.

@AFAIK: yes, you can add this so the pre script is execute, and if you do that, don’t forget the also the post script.

ptitSeb
Member

@AFAIK: Yes, I read to fast, the “[” is just missing. add it or the PND will not launch.

Dredd
Member

Thanks for the great post ptitSeb! I did not read through it yet, but I will do so soon and expect learn a lot.

I am a little sad that the adjective you used for my article is “long”… and yet your article is considerably longer! How about “pioneering”, “lavishly illustrated”, “unprecedented”, “cat-free”, or “tedious”…? 😉

ptitSeb
Member
@Dredd: indeed, you pionneered in long articled, and yours was unprecedentedly lavishly illustrated and complelty cat free. But I think I’ll keep tedious for mine 😉 It’s interesting to see the differences in habit, for example, to create a fake PND, you use ls, I use mount. That’s a very good think to have 2 tutorials as the differences show there are many ways to get the same results. So I suggest every one interrested in porting to look a both porting article, as there is no “good” way to do it, but many valid way. Just build your own… Read more »
klapse
Guest

Fullscreen with this version requires Notaz’s SDL, but not everyone has it installed. It would be useful to change the SDL init to use fullscreen as well, no?

ptitSeb
Member
@klpase: Yes, the Fullscreen can be obtained with some code modification. But the notaz SDL is by default on all Pandora (I assume it’s not default on N900), and I wanted to show in this tutorial that they are many ways to do the same things. So yes, it is easly doable by code, and there is already the Fullscreen/Windowed code inside the program (you can swtich with F9), so you can force fullscreen to true by default, you can even forbid or remove the handling of “F9” in code. I wanted to see as many aspect in as few… Read more »
Steven Craft
Guest

Interesting read, thanks for posting!

Both tutorials so far are about a million miles away from how I’ve gone about porting, predominantly due to the fact I build on Windows in a non *nix environment (e.g. not cygwin). But both articles certainly make it all seem quite simple :o)

Good work!

Dredd
Member

I’ve read through this article now, it’s good! thanks ptitSeb.

I would be interested to read “port by cross-compiling” articles, too.
I set up a cross-compiler environment (on Linux), but have not used it yet.
Also “porting via Debian / slackware” might be interesting.

AFAIK
Member

It compiled, compiled!
I’ve got INSTEAD to run and it works, it’s alive!

But now there are some problems, as the mouse cursor isn’t warping to words when I press tab (but then jumps at them as soon as I touch a nub) with default SDL driver, and looks really bad with notaz’s one (and I can’t use nubs as mouse control there)

Looks like I’ll have to get some sleep and look what can I do in the code, I hope it isn’t that hard… =)

ptitSeb
Member

A comment about Ext2 partition and creating folder in it’s root. You will probably face some right permission issue, because the partition is owned by root, not you.

So something like:

sudo mkdir sources
sudo chown yourname sources

will be needed.

trackback

[…] 5. Porting Arkanoid to the Pandora. Here’s How. […]

trackback

[…] But you should be all set to make a PND package from there. You can check the last steps from the Arkanoid tutorial or the Dillo tutorial, that should be sufficient. Or bug me in the comments if you are stuck […]