<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>soledad penadés &#187; sdl</title>
	<atom:link href="http://soledadpenades.com/tag/sdl/feed/" rel="self" type="application/rss+xml" />
	<link>http://soledadpenades.com</link>
	<description>repeat 4[fd 100 rt 90]</description>
	<lastBuildDate>Sun, 29 Jan 2012 23:03:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Breakpoint demolog, days 29-30: back to the insidious bug</title>
		<link>http://soledadpenades.com/2010/03/05/breakpoint-demolog-days-29-30-back-to-the-insidious-bug/</link>
		<comments>http://soledadpenades.com/2010/03/05/breakpoint-demolog-days-29-30-back-to-the-insidious-bug/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 01:45:20 +0000</pubDate>
		<dc:creator>sole</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[demoscene]]></category>
		<category><![CDATA[frustration]]></category>
		<category><![CDATA[pulseaudio]]></category>
		<category><![CDATA[sdl]]></category>
		<category><![CDATA[wav]]></category>

		<guid isPermaLink="false">http://soledadpenades.com/?p=2449</guid>
		<description><![CDATA[I have spent three four hours trying to find out what was wrong when I left this &#8220;on hold&#8221; a few days ago. I haven&#8217;t progressed too much&#8230; there&#8217;s something silly here but I can&#8217;t quite point where and the sound is not being output properly (there are gaps between samples and everything sounds like [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent <del datetime="2010-03-05T01:33:04+00:00">three</del> four hours trying to find out what was wrong when I left this &#8220;on hold&#8221; a few days ago. I haven&#8217;t progressed too much&#8230; there&#8217;s something silly here but I can&#8217;t quite point where and the sound is not being output properly (there are gaps between samples and everything sounds like stuttering).</p>
<p>I added a simple class for dumping to WAV that I had done a few months ago, just to discard it was not SDL&#8217;s fault (it wasn&#8217;t, although PulseAudio gave me a couple of false alarms with its <em>I&#8217;m going to sound distorted without you expecting it</em> moments).</p>
<p>I am pretty sure that the bug is super ridiculously simple to fix (not that easy to find), and I have been staying here against the will of my sleepy, heavy eyelids, just in case the &#8220;A-HA!! moment&#8221; decided to materialise, but it hasn&#8217;t happened. So I guess it&#8217;s time to call it a day&#8230; and come back to this tomorrow :-(</p>
]]></content:encoded>
			<wfw:commentRss>http://soledadpenades.com/2010/03/05/breakpoint-demolog-days-29-30-back-to-the-insidious-bug/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Breakpoint demolog, day 17: building for windows (from linux)</title>
		<link>http://soledadpenades.com/2010/02/19/breakpoint-demolog-day-17-building-for-windows-from-linux/</link>
		<comments>http://soledadpenades.com/2010/02/19/breakpoint-demolog-day-17-building-for-windows-from-linux/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 00:38:46 +0000</pubDate>
		<dc:creator>sole</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[cross compiling]]></category>
		<category><![CDATA[demoscene]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[makefile]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[sdl]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[wine]]></category>

		<guid isPermaLink="false">http://soledadpenades.com/?p=2392</guid>
		<description><![CDATA[Today I decided to do something different. And I thought: Okay, I&#8217;ll try and sort out this compiling for windows issue, so that I can focus on the rest of more important things without having to worry about it any more. And guess what&#8230;? I think I managed to do it :-) Roughly, these are [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://soledadpenades.com/files/demoscene/bp2010/20100218.png" alt="Windows and Linux executables, rotating a triangle and generating a sine wave audio stream" /></p>
<p>Today I decided to do something different. And I thought: <q>Okay, I&#8217;ll try and sort out this compiling for windows issue, so that I can focus on the rest of more important things without having to worry about it any more.</q></p>
<p>And guess what&#8230;? I think I managed to do it :-)</p>
<p>Roughly, these are the steps I followed, just in case someone else wants to compile for windows with opengl and sdl support, using [ubuntu] linux:</p>
<ul>
<li>install mingw (I did it with Synaptic Package Manager so that I didn&#8217;t have to go through the ./configure and ./make hell)</li>
<li>get the dev libraries from sdl for windows/mingw &#8211;<a href="http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz">this file</a>&#8211; or check their <a href="http://www.libsdl.org/download-1.2.php">downloads</a> page</li>
<li>uncompress the file and locate the <strong>bin</strong>, <strong>include</strong> and <strong>lib</strong> folders within, and&#8230;
<ul>
<li>copy <strong>bin/SDL.dll</strong> to the folder where your win32 .exe will go &#8212; so that the exe can pick and load the dll when executing</li>
<li>copy the <strong>include</strong> and <strong>lib</strong> folders to a folder in your project&#8217;s src folder &#8212; or anywhere you&#8217;ve got access to! For example: project/src/libs/sdl/</li>
</ul>
</li>
<li>now in your main.cpp, include SDL&#8217;s header files like this:
<div class="syhi_block"><code><span style="color: #339900;">#include &lt;SDL/SDL.h&gt;</span><br />
<span style="color: #339900;">#include &lt;SDL/SDL_opengl.h&gt;</span></code></div>
</li>
<li>And the makefile could be something like this too:
<div class="syhi_block"><code>WINDOWS_SDL = ./libs/sdl/windows<br />
<br />
windows:<br />
&nbsp; &nbsp; &nbsp; &nbsp; i586-mingw32msvc-g++ -I$(WINDOWS_SDL)/include -L$(WINDOWS_SDL) \<br />
main.cpp $(WINDOWS_SDL)/libSDL.dll.a -o ../test.exe\<br />
&nbsp;-lmingw32 -lSDLmain -lSDL -mwindows -lopengl32 -Wl,-R.</code></div>
</li>
</ul>
<p>(ugly hard line returns added by me so that you can see all parameters in one go).</p>
<p>This assumes you are invoking make from the src folder. The output will go to the parent folder. But well, the most important things that need to be highlighted are the bunch of switches you need to include in order to get the program to link: </p>
<p><strong>-I$(WINDOWS_SDL)/include</strong> &#8212; this tells the compiler where to look for additional header files. This way it can find &lt;SDL/SDL.h&gt; and you do not need to modify the file or add #define&#8217;s when building for linux.</p>
<p><strong> -L$(WINDOWS_SDL)</strong> &#8212; pretty much the same but tells the compiler to look for static libraries in the WINDOWS_SDL folder too</p>
<p><strong>$(WINDOWS_SDL)/libSDL.dll.a</strong> &#8212; links the library into our binary!</p>
<p><strong>-lmingw32 -lSDLmain -lSDL -mwindows -lopengl32 -Wl,-R.</strong> &#8212; these are magic &#8211; remove any of them and the linker will complain about missing symbols ;)</p>
<p>I still have to test this in a real windows machine; so far I have just tried with Wine. The output is a little jerky and a bit slower than the native (64 bit) counterpart, but I guess this will do much better than compiling in Virtual Box and testing with Wine :D</p>
<p>I&#8217;ll try to upload a test .exe when I test it on a real windows box myself, so that you can test it and see if it works in your computer (if you want, of course!). It&#8217;s ages since I compiled anything for win, and I truly wonder whether it will work with Vista/7&#8230; my <a href="http://soledadpenades.com/projects/demoscene/vslpx-by-xplsv/">last demo</a> for Windows was done in 2005 and XP was in full glory back then :P</p>
]]></content:encoded>
			<wfw:commentRss>http://soledadpenades.com/2010/02/19/breakpoint-demolog-day-17-building-for-windows-from-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;Scene Of The Girls&#8221; sources released</title>
		<link>http://soledadpenades.com/2009/06/29/scene-of-the-girls-sources-released/</link>
		<comments>http://soledadpenades.com/2009/06/29/scene-of-the-girls-sources-released/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 12:01:57 +0000</pubDate>
		<dc:creator>sole</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[bass]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[demoscene]]></category>
		<category><![CDATA[fmod]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[ppg]]></category>
		<category><![CDATA[pygtk]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://soledadpenades.com/?p=1083</guid>
		<description><![CDATA[We released this demo approximately 6 years ago. Then I was using windows and I didn&#8217;t worry about other platforms actually. Nowadays I&#8217;m using linux and get horrified with the mere thought of having to use windows again, but my demos didn&#8217;t work too well with wine. Since I still hadn&#8217;t lost the code, what [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/imgs/ppg01_07.jpg" alt="Scene of the girls" /></p>
<p>We released this demo approximately 6 years ago. Then I was using windows and I didn&#8217;t worry about other platforms actually. Nowadays I&#8217;m using linux and get horrified with the mere thought of having to use windows again, but my demos didn&#8217;t work too well with wine. Since I still hadn&#8217;t lost the code, what about doing a portable version which works in my computer? So that&#8217;s what I have done with <a href="http://soledadpenades.com/projects/demoscene/scene-of-the-girls-ppg/">Scene Of The Girls</a>.</p>
<h3>Things that I have learnt</h3>
<p>I expect most of you to feel skeptical about the idea of taking sources 6 years old and trying to make them work in a completely different system. But it has been an interesting experience and I have learnt a lot meanwhile. </p>
<h4>BASS is way better than fmod</h4>
<p>This is kind of ironic. At the beginning, I used <a href="http://un4seen.com/">BASS</a>. Then when I began coding for Mac I had to use <a href="http://www.fmod.org/">fmod</a>, because it was the only available multiplatform library. I wasn&#8217;t too happy with the sound quality (specially for modules) but that was all that we had. I then found out that BASS was available for MacOS, so I switched back to BASS. But then I wanted to code for linux and BASS wasn&#8217;t available, so I switched again to fmod. I tried with fmod3.75 and then I noticed that I couldn&#8217;t capture the demo with it, so I moved to the newer fmodex, which did allow me to capture the demo, with audio.</p>
<p>And there was a big &#8220;but&#8221;: the latency. There was a considerable amount of time between the &#8220;BOOM&#8221; in the music and the images reacting. Funnily it wasn&#8217;t that the images were happening with delay; it was that the music happened to sound too late for what was being shown in the screen. You saw torus shaking, and a quarter of a second later, there was a bassdrum kick. Something was decidedly wrong. I copied the code to a usb pen stick, and compiled everything on my powerbook with MacOSX, just to dismiss any possible ALSA+Pulseaudio+whatever latency issue. After all, supposedly MacOSX sound drivers have a very good latency. But the problem was still there. I tried on mrdoob&#8217;s laptop (a Macbook running Linux) and the latency was still there. Luckily before I began to code my own sound/module playing library I thought of having a look at the BASS site again, just in case they happened to have released a linux version and oh joy! there it was!</p>
<p>I then proceeded to change <em>once again</em> my Music.h/cpp wrapper. I congratulate myself each time I have to change the wrapper, because thanks to having the wrapper I don&#8217;t have to change every other call in the code. Then I ran the demo again, in linux, and the latency had gone away! YEAH! Even more, the song sounds WAY BETTER, because BASS interprets properly the resonant filters the song uses. That was a supercool moment!</p>
<p>So unfortunately for the fmod guys, sorry, but there&#8217;s something wrong in your library. Although to be honest, the fmod API is nicer and doesn&#8217;t make you think of bytes when what you want to know is how many seconds have elapsed, but is the price you have to pay for no delays.</p>
<h4>GLC: a .kkapture alternative for linux</h4>
<p>Normally one would capture a demo with .kkapture&#8230; if he happened to be using windows. Us linux-ers are left out without any alternative&#8230; or not! Because I found <a href="http://nullkey.ath.cx/projects/glc/wiki">glc</a>. It can capture opengl windows along with its associated audio and it works very well actually. I used it for capturing the demo and <a href="http://www.youtube.com/watch?v=Mk1Fe-T-W5U">publishing it</a> in youtube, after encoding it to mp4 with <a href="http://github.com/sole/demoscene/blob/c6593f34b1e915e90b0b2c92849265da33b55616/releases/ppg/ppg_01_sotg/encode.sh">this script</a>.</p>
<h4>getopt_long is confusing, but very rewarding</h4>
<p>To date I had only used a very basic style of argument parsing. I decided I would have something better, and I used getopt_long for it. This allowed me to add a lot of configuration options which before had been hardcoded in the demo and forced me to recompile each time I wanted to test a different parameter. You can see how I used it in the parse_arguments function in <a href="http://github.com/sole/demoscene/blob/c6593f34b1e915e90b0b2c92849265da33b55616/releases/ppg/ppg_01_sotg/src/main.cpp">main.cpp</a>.</p>
<h4>PyGTK is very cool</h4>
<p>This also set the path clear for the next thing I wanted: a nice launcher for people who do not want to type in a series of config options to launch the demo. I made the launcher with pygtk, and verified it works on any vanilla ubuntu (as I suspected, pygtk comes by default with the system because several basic applications depend on it).</p>
<p>So I just open that GTK window with some checkboxes and pulldown lists and let the user choose what he wants, and it builds up the config settings for the executable, and calls it. And when developing, one just had to press the up arrow to get the last typed in command and relaunch the demo using those very same parameters, instead of having to select them manually in the launcher dialogue. Simple linux style, I like it!</p>
<h4>VBlank is off by default, whatever they say</h4>
<p>I had lots of tearing in my app, even in window mode. I checked the <a href="http://www.libsdl.org/cgi/docwiki.cgi/SDL_GLattr">SDL docs</a> and they mentioned an GL attribute (SDL_GL_SWAP_CONTROL) that could be activated but was <em>deprecated</em>, and <em>activated</em> by default. I tried it anyway, explicitly setting it to true and surprise! the tearing and flickering went away!</p>
<h3>And now&#8230;</h3>
<p>I guess I&#8217;ll continue releasing the remaining sources, once I get them to work here and wipe up extremely confusing stuff. The main goal is to let someone else learn from the code just as I did when looking at the code of other demos and specially sites like NeHe. There aren&#8217;t superclever tricks in this demo, it is all fairly basic and if you want to code an opengl demo, it should be a good basis, at least for experimenting and changing things here and there. So come on, play with the code, experiment with it and make something better. And let me know afterwards!</p>
]]></content:encoded>
			<wfw:commentRss>http://soledadpenades.com/2009/06/29/scene-of-the-girls-sources-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Damn geeks (and more)</title>
		<link>http://soledadpenades.com/2008/09/17/damn-geeks-and-more/</link>
		<comments>http://soledadpenades.com/2008/09/17/damn-geeks-and-more/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 15:58:23 +0000</pubDate>
		<dc:creator>sole</dc:creator>
				<category><![CDATA[Comment]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[geeks]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://soledadpenades.com/?p=762</guid>
		<description><![CDATA[Let&#8217;s continue the IT fun saga , although it has been suspended for around five months, shame on holidays and all that ;-) Damn geeks First, we have a bit of a desperate cry by a certain Solomon Grundy: Damn geeks. They&#8217;ve screwed up everything. They can&#8217;t even get something as simple as the Internet [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s continue the <a href="http://soledadpenades.com/2008/04/01/incendiary-fun/">IT fun saga </a>, although it has been suspended for around five months, shame on holidays and all that ;-)</p>
<h3>Damn geeks</h3>
<p>First, we have a bit of a desperate cry by a certain Solomon Grundy:</p>
<blockquote><p>
Damn geeks. They&#8217;ve screwed up everything. They can&#8217;t even get something as simple as the Internet right. No wonder 70% of financial application are still coded in COBOL and don&#8217;t use the Internet as their primary avenue of communications.
</p></blockquote>
<p>from <a href="http://www.theregister.co.uk/2008/09/16/critical_vulnerability_demo_pulled/comments/#c_320974">the comments</a> at <q>Adobe yanks speech exposing critical &#8216;clickjacking&#8217; vulns</q>. By the way, why do the Register guys <strong>have anchors</strong> for each individual comment, but <strong>do not show</strong> them? I had to use the very helpful Web Developer Toolbar <em>once again</em> for revealing anchors in the page (<em>Information &#8212; Display anchors</em>, just in case you need it). <em>Damn geeks!</em></p>
<p>So yes, that&#8217;s quite serious. It seems there&#8217;s no way things can be done properly when <em>the internet factor</em> is in the mix. When in doubt, simply blame the <a href="http://en.wikipedia.org/wiki/Postel%27s_law">Robustness principle</a>: <q>Be liberal in what you accept, and conservative in what you send</q>.</p>
<h3>Googleskepticism or just plain common sense?</h3>
<p>Following the release of Google&#8217;s Chrome, one had the immediate feeling that it was going to be a big news &#8212; not only appearing at generalist media but even prompting our families to ask us about <em>that new system Google has released for competing against Bill&#8217;s</em> (literally). I wasn&#8217;t impressed at all by the <em>G-move</em> neither did feel immediately compelled to download and test it (besides my computer doesn&#8217;t run Windows anyway), so I just ignored the complete commotion. But it seems Ted Dziuba got a bit more irritated with all the publicity and media fueled bullshit and/or plain lies and simply ended up <a href="http://www.theregister.co.uk/2008/09/08/dziuba_chrome/">exploding</a>:</p>
<blockquote><p>I understand the argument that as web applications proliferate, the desktop operating system becomes less important, and emphasis is placed on the browser. That&#8217;s all well and good, but let&#8217;s be realistic here.<strong> It&#8217;s a fucking web browser.</strong> It runs JavaScript a bit faster than other web browsers. That doesn&#8217;t add up to a Windows killer.</p>
<p>[...]</p>
<p>People are calling Chrome a cloud operating system because it is a &#8220;platform for running web apps&#8221;. <strong>It renders HTML and interprets Javascript, you know, like every fucking browser made since 1995.</strong> It&#8217;s also got Google Gears built in. Great. I&#8217;ll alert Tim Berners-Lee.
</p></blockquote>
<p>(emphasis added by me)</p>
<p>He also notes the big amount of nonsense that Michael Arrington managed (once again) to produce for the occasion, with allusions to the new and upcoming hot keyword &#8211; cloud computing. I would suggest Ted &#8211;and any of you&#8211;, only one thing: do not read Techcrunch, for your own mental health.</p>
<h3>On confusing people</h3>
<p>Only two words: <a href="http://www.theregister.co.uk/2008/09/16/microsoft_sdl_initiatives/">Microsoft SDL</a>.</p>
<p>Why did they have to use an acronym which is so well established is something that I can&#8217;t understand. Furthermore, Microsoft SDL doesn&#8217;t stand up for anything remotely related to media or games. Do not even think they are ditching DirectX for <em>the true <a href="http://libsdl.org/">SDL</a></em>. In fact, <em>their</em> SDL is the deceptively boring acronym of <em>Secure Development Lifecycle</em>. Which, coming from Microsoft, absolutely deserves a place on the IT fun saga with a special award in the &#8220;Irony&#8221; category!</p>
]]></content:encoded>
			<wfw:commentRss>http://soledadpenades.com/2008/09/17/damn-geeks-and-more/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PSP joystick &amp; buttons</title>
		<link>http://soledadpenades.com/2008/09/02/psp-joystick-buttons/</link>
		<comments>http://soledadpenades.com/2008/09/02/psp-joystick-buttons/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 10:30:24 +0000</pubDate>
		<dc:creator>sole</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[psp]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://soledadpenades.com/?p=745</guid>
		<description><![CDATA[Following the installation of the toolchain, I decided to make a little program to get some information about the PSP&#8217;s interface, from the programmers point of view. That is, it would use SDL&#8217;s joystick functions to find out how many axis and buttons and which codes did they report to the program. Although it might [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/imgs/psp_01_buttons.jpg" alt="test output" /></p>
<p>Following the <a href="http://soledadpenades.com/2008/09/01/installing-the-psp-toolchain-in-ubuntu/">installation of the toolchain</a>, I decided to make a little program to get some information about the PSP&#8217;s interface, from the programmers point of view. That is, it would use SDL&#8217;s joystick functions to find out how many axis and buttons and which codes did they report to the program. Although it might seem useless it is an easy exercise in checking events and it could even be the base for a future game.</p>
<p>I first tested the program on my computer, using a Logitech USB pad that I have for playing emulators. I intended to use it for <em>real games</em> but I still haven&#8217;t found one which doesn&#8217;t use the mouse. By the way, the pad works flawlessly in linux, just in case you were looking for a compatible joystick for your linux box.</p>
<p>The pad reported as having six axes, where the axes corresponded to the two analog joysticks and one digital joystick (two axes per joystick: vertical and horizontal), so I was expecting to find a very similar result in the PSP, but with four axes since it only has two joysticks.</p>
<p><img src="/imgs/logitech_pad.jpg" alt="Logitech dual action pad" /></p>
<p>Instead, I got an interesting result: two axes only, and the rest were buttons! PSP is reporting the digital joystick as simply four isolated buttons. This, although being surprising, also makes much easier to program simple stuff where you just need to react when a button has been pressed, instead of having to check the value of the axis which is reporting motions, and deduct the appropriate intended direction from there.</p>
<p>I also noticed that the analog joystick can sometimes have a very erratic behaviour, reporting movements while no one is even touching the console. It might be because it&#8217;s not a brand new PSP and maybe there&#8217;s some dirt or something in the controls &#8230; or maybe we were experiencing a earthquake and nobody noticed? :)</p>
<p>For the record, these are the reported SDL button codes, so you can look for an <strong>SDL_JOYBUTTONDOWN</strong> type of event, and compare <strong>event.jbutton.button</strong> to the following values to decide what to do:</p>
<p>Left: 7<br />
Right: 9<br />
Up: 8<br />
Down: 6<br />
L: 4<br />
R: 5<br />
Triangle: 0<br />
Square: 3<br />
Circle: 1<br />
Cross: 2<br />
start: 11<br />
select: 10</p>
<p>I didn&#8217;t manage to read the other buttons, they seem to be out of the reach of SDL. Maybe it&#8217;s got something to do with kernel/user mode, but it doesn&#8217;t worry me for the time being.</p>
<p>If you want to try this at home &#8211; worry not, it&#8217;s safe and harmless! Here&#8217;s the <a href="http://github.com/sole/snippets/blob/master/psp/log_buttons/main.c">source code</a>. You&#8217;ll notice I also used the balls and hats functions, but I must confess that while I suspect that <em>balls</em> is referring to trackballs, I have no idea what <em>hats</em> is referring to. If anybody knows, let me know in the comments so that I can stop imagining a little Mexican hat dressing a gamepad :-D</p>
<p>Here&#8217;s also a possible sample output, using my logitech pad and pressing buttons and moving sticks randomly:</p>
<div class="syhi_block"><code>Index: 0<br />
Name: Logitech Logitech Dual Action<br />
Num axes: 6<br />
Num balls: 0<br />
Num hats: 0<br />
Num buttons: 12<br />
// moving the digital stick<br />
Axis motion: j index = 0 axis = 5 value = -32767<br />
Axis motion: j index = 0 axis = 5 value = 0<br />
Axis motion: j index = 0 axis = 5 value = 32767<br />
Axis motion: j index = 0 axis = 5 value = 0<br />
Axis motion: j index = 0 axis = 4 value = -32767<br />
Axis motion: j index = 0 axis = 4 value = 0<br />
Axis motion: j index = 0 axis = 4 value = 32767<br />
Axis motion: j index = 0 axis = 4 value = 0<br />
// moving analog sticks, note the values aren't &quot;all, minus all or nothing&quot; here<br />
// you should get similar values with the psp's analog stick<br />
Axis motion: j index = 0 axis = 0 value = 337<br />
Axis motion: j index = 0 axis = 0 value = 1013<br />
Axis motion: j index = 0 axis = 0 value = 2026<br />
Axis motion: j index = 0 axis = 0 value = 4053<br />
Axis motion: j index = 0 axis = 0 value = 5742<br />
Axis motion: j index = 0 axis = 0 value = 7094<br />
Axis motion: j index = 0 axis = 0 value = 10134<br />
Axis motion: j index = 0 axis = 0 value = 13174<br />
Axis motion: j index = 0 axis = 0 value = 15877<br />
Axis motion: j index = 0 axis = 0 value = 19593<br />
Axis motion: j index = 0 axis = 0 value = 22633<br />
Axis motion: j index = 0 axis = 0 value = 26349<br />
Axis motion: j index = 0 axis = 0 value = 30741<br />
Axis motion: j index = 0 axis = 0 value = 32767<br />
Axis motion: j index = 0 axis = 1 value = -1014<br />
Axis motion: j index = 0 axis = 1 value = -3379<br />
Axis motion: j index = 0 axis = 1 value = -4392<br />
Axis motion: j index = 0 axis = 1 value = -5743<br />
Axis motion: j index = 0 axis = 1 value = -7432<br />
Axis motion: j index = 0 axis = 1 value = -9121<br />
Axis motion: j index = 0 axis = 1 value = -11486<br />
Axis motion: j index = 0 axis = 1 value = -13175<br />
Axis motion: j index = 0 axis = 1 value = -14189<br />
Axis motion: j index = 0 axis = 1 value = -16553<br />
Axis motion: j index = 0 axis = 1 value = -19932<br />
Axis motion: j index = 0 axis = 1 value = -22296<br />
Axis motion: j index = 0 axis = 1 value = -25337<br />
Axis motion: j index = 0 axis = 1 value = -28039<br />
Axis motion: j index = 0 axis = 1 value = -32767<br />
Axis motion: j index = 0 axis = 0 value = 25673<br />
Axis motion: j index = 0 axis = 0 value = 16890<br />
Axis motion: j index = 0 axis = 0 value = 8445<br />
Axis motion: j index = 0 axis = 0 value = 3378<br />
Axis motion: j index = 0 axis = 0 value = 1013<br />
Axis motion: j index = 0 axis = 0 value = 0<br />
Axis motion: j index = 0 axis = 1 value = -31755<br />
Axis motion: j index = 0 axis = 1 value = -27026<br />
Axis motion: j index = 0 axis = 1 value = -22296<br />
Axis motion: j index = 0 axis = 1 value = -13851<br />
Axis motion: j index = 0 axis = 1 value = -3379<br />
Axis motion: j index = 0 axis = 1 value = 0<br />
Axis motion: j index = 0 axis = 2 value = 3040<br />
Axis motion: j index = 0 axis = 2 value = 7769<br />
Axis motion: j index = 0 axis = 2 value = 10472<br />
Axis motion: j index = 0 axis = 3 value = -3041<br />
Axis motion: j index = 0 axis = 2 value = 13512<br />
Axis motion: j index = 0 axis = 3 value = -5068<br />
Axis motion: j index = 0 axis = 2 value = 16215<br />
Axis motion: j index = 0 axis = 3 value = -10473<br />
Axis motion: j index = 0 axis = 2 value = 19593<br />
Axis motion: j index = 0 axis = 3 value = -17229<br />
Axis motion: j index = 0 axis = 2 value = 22971<br />
Axis motion: j index = 0 axis = 3 value = -24661<br />
Axis motion: j index = 0 axis = 2 value = 26011<br />
Axis motion: j index = 0 axis = 3 value = -32767<br />
Axis motion: j index = 0 axis = 2 value = 28038<br />
Axis motion: j index = 0 axis = 2 value = 30741<br />
Axis motion: j index = 0 axis = 2 value = 31078<br />
Axis motion: j index = 0 axis = 2 value = 30065<br />
Axis motion: j index = 0 axis = 2 value = 28038<br />
Axis motion: j index = 0 axis = 2 value = 22295<br />
Axis motion: j index = 0 axis = 2 value = 15539<br />
Axis motion: j index = 0 axis = 2 value = 9458<br />
Axis motion: j index = 0 axis = 2 value = 3040<br />
Axis motion: j index = 0 axis = 2 value = 0<br />
Axis motion: j index = 0 axis = 2 value = -676<br />
Axis motion: j index = 0 axis = 2 value = -2365<br />
Axis motion: j index = 0 axis = 2 value = -3041<br />
Axis motion: j index = 0 axis = 2 value = -3716<br />
Axis motion: j index = 0 axis = 2 value = -4392<br />
Axis motion: j index = 0 axis = 2 value = -5068<br />
Axis motion: j index = 0 axis = 2 value = -7432<br />
Axis motion: j index = 0 axis = 2 value = -11148<br />
Axis motion: j index = 0 axis = 2 value = -13513<br />
Axis motion: j index = 0 axis = 2 value = -16216<br />
Axis motion: j index = 0 axis = 2 value = -18580<br />
Axis motion: j index = 0 axis = 2 value = -19932<br />
Axis motion: j index = 0 axis = 2 value = -21621<br />
Axis motion: j index = 0 axis = 3 value = -31755<br />
Axis motion: j index = 0 axis = 3 value = -27363<br />
Axis motion: j index = 0 axis = 3 value = -22972<br />
Axis motion: j index = 0 axis = 3 value = -19594<br />
Axis motion: j index = 0 axis = 3 value = -16216<br />
Axis motion: j index = 0 axis = 3 value = -15202<br />
Axis motion: j index = 0 axis = 3 value = -11824<br />
Axis motion: j index = 0 axis = 2 value = -19932<br />
Axis motion: j index = 0 axis = 3 value = -10135<br />
Axis motion: j index = 0 axis = 2 value = -18580<br />
Axis motion: j index = 0 axis = 3 value = -8784<br />
Axis motion: j index = 0 axis = 2 value = -14864<br />
Axis motion: j index = 0 axis = 3 value = -6419<br />
Axis motion: j index = 0 axis = 2 value = -8108<br />
Axis motion: j index = 0 axis = 3 value = -3041<br />
Axis motion: j index = 0 axis = 2 value = -676<br />
Axis motion: j index = 0 axis = 3 value = -1014<br />
Axis motion: j index = 0 axis = 2 value = 0<br />
Axis motion: j index = 0 axis = 3 value = 0<br />
// buttons!<br />
Pressed button 0<br />
Pressed button 1<br />
Pressed button 3<br />
Pressed button 2<br />
Pressed button 2<br />
Pressed button 1<br />
Pressed button 7<br />
Pressed button 5<br />
Pressed button 6<br />
Pressed button 4<br />
Pressed button 5<br />
Pressed button 4<br />
Pressed button 6<br />
Pressed button 9<br />
Pressed button 8</code></div>
 <p><a href="http://soledadpenades.com/?flattrss_redirect&amp;id=745&amp;md5=4eb0dee67a78723223350cee3bc337d5" title="Flattr" target="_blank"><img src="http://soledadpenades.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://soledadpenades.com/2008/09/02/psp-joystick-buttons/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

