Friday, July 25, 2008

How to Prepare Your PSP Background Images?


For this hack, you're going to need 12 images (one for each month of the year). If you want your background image to stay the same year round, you're still going to need 12 separate, but identical, image files (or you will need to continually keep changing the date on your PSP to the one month containing the background picture you want).

You will need to use whatever image editing software you have on hand to convert your images to 24-bit Windows bitmap files less than or equal to 300 x 170 resolution. I've seen recommendations online stating that you need to keep the images less than or equal to 150KB in size as well; this is probably the ideal, but I've made this work with a few files weighing in closer to 200KB in size. The main issue here is that larger file sizes will take longer to load on your PSP, and the larger the size, the more you risk the image either not loading or, worse, crashing your PSP.

Once you have converted the images into 300 x 170 pixel images, you will want to rename them with two digits followed by .BMP for each of the 12 months of the year. For example, whatever image you want for January needs to be named 01.BMP, and whatever file you want for November needs to be 11.BMP. You should have files named 0112, all ending in .BMP, when you are finished.

Preparation for PSP Background Image Modification

You already know how to get your favorite color in the background of your PSP, but wouldn't you rather put your own custom images in there?

Thanks to the great movement of homebrew software for the PSP thriving on the Internet, you can now replace the default color backgrounds on your Version 1.01.5 PSP with pictures of your choosing. Be warned, however, that if you choose to employ this method, there is no turning back. Changing the images is a permanent change. You can replace them later with newer images, if you like, but if you want to return the PSP to its default background set, you're either going to have to do some slightly more advanced hacking to back up the original images before you do this hack, or dig around on the Internet for someone else's copies of the images.

If you have a PSP with Version 2.0 of the firmware, Sony has added a Wallpaper setting to your PSP so that you can do this without any hacking. Simply navigate to Settings Theme Settings, hit the X button, scroll down to Wallpaper, hit the X button again, and choose Use. Navigate to any picture under Photo on your PSP and hit the X button to view the photo. While viewing, hit the Triangle button to bring up the control panel. Navigate to the second control on the top row, "Set as Wallpaper," and hit the X button. The image you were viewing is now the wallpaper image for your PSP.
  • A Sony PSP running Version 1.5 of the firmware until the homebrew community figures a way past the roadblocks Sony put in place in later versions of the firmware, this hack will only work on PSPs running v1.5.
  • PSPersonalizethis is the homebrew app that makes the hack work. The file doesn't have a home page on the Web, but you should find it easily enough in the popular PSP homebrew sites; a quick Google search for "PSPersonalize" should turn it up, and you can also look for a link to the files on the site I've set up to go along with this book (http://www.psphacksthebook.com).
  • A Memory Stick and some way to copy files from your computer to your Memory Stick .
  • Some basic image editing software.
  • Some images.

Thursday, July 17, 2008

Add a JavaScript Keyboard to Your PSP Web Portal


Make your web surfing activities a whole lot easier by providing an alternate QWERTY keyboard in place of the PSP's internal keypad, making your PSP-based web surfing as simple as Up-X-Down-X-Down-Right-X-Down-Down-Down-X.

Getting online is the easy part! Once there, you quickly discover that web surfing is not as simple as typing in a URL or clicking on a link. Since the PSP is missing a standard keyboard, you are forced to use its internal keypad that has even less functionality than a cell phone. If you are planning on using the browser hack for more than just goofing around, then this form of data entry quickly gets old.

To help overcome this challenge, I offer you a JavaScript keyboard that not only provides you with an easy-to-use QWERTY keyboard with all your standard alphanumeric characters, but also gives you some extra features, such as one-button http:// entry and a URL checker to make sure that you typed everything correctly before attempting to load the URL.

JavaScript in PSP


The PSP's web browser is no slouch; although it's not as feature-laden as the latest desktop browsers, it holds its own pretty well. If you know a little HTML, CSS, and JavaScript, you can create DHTML applications that run right in the browser. For example, here's a short program that draws a chunky version of the Mandelbrot Set, one of the most famous fractals (objects that exhibit self-similarity at various levels of detail but with an organic irregularity): Download the sample script here

You can save this as an HTML file on your PSP's memory stick, navigate to it with the 2.0 firmware's web browser, wait a minute or two, and then see the fractal displayed (albeit rather crudely) on your PSP's screen.

In fact, you could combine DHTML with Perl to create a read-only copy of your address book, calendar, or favorite recipes on your PSP. Create some attractive styles to present the data, use JavaScript to create navigation features, and use Perl to extract the data and dump it into an HTML file that acts as the back-end database for your styles and scripts.

Using the LuaPlayer


If C and C++ aren't your thing, and you're feeling a little rusty in the coding arena, then you'll most likely want to check out the LuaPlayer (http://www.luaplayer.org/). To work with LuaPlayer, all you need is a PSP running Version 1.0 or 1.5 of the firmware, and a text editor on your computer. The LuaPlayer site features a rather good step-by-step tutorial (http://www.luaplayer.org/tutorial/index.html) to this PSP scripting language that walks you through creating a basic "Hello World" test program, working with images, working with animation, and an introduction to coding for the controls on the PSP. There are several sections not yet complete in the tutorial, but considering the amount of people in the PS2Dev Forums (http://forums.ps2dev.org/viewforum.php?f=21) who are using this tool to easily program for the PSP, you can most likely find some guidance with a few carefully placed questions.

One of the advantages of using Lua is that you can test applications on a computer running Windows before you deploy them to your PSP. This eliminates the need to copy your source code over to your PSP every time you make a change. Instead, you can do all your testing and debugging on your PC, and send it to your PSP when you are ready to play it. For more information on the Windows version of Lua Player, see http://forums.ps2dev.org/viewtopic.php?p=22332#22332.

Here's a simple Lua program that runs on the PSP. You should save it as script.lua, and follow the instructions included with the Lua Player to run it on your PSP. This is a program that draws an @ character onscreen at the specified x/y coordinates. You can move the directional pad to move the character and leave a trail. Download the sample script here

Saturday, July 12, 2008

ScriptScribbler PSP Programming Tutorials


ScriptScribbler (http://www.scriptscribbler.com) currently offers three tutorials by Brad Dwyer on programming for the PSP, and it looks as though there will continue to be more tutorials forthcoming in the future. The first section of the tutorial (http://www.scriptscribbler.com/psp/tutorials/lesson01.htm) walks you through setting up a development environment on Windows. The second section walks you through creating your first program
(http://www.scriptscribbler.com/psp/tutorials/lesson02.htm), a basic "Hello World" program for the PSP. The third section, serving as a programming primer, is currently the most useful (http://www.scriptscribbler.com/psp/tutorials/lesson03.htm), as it serves as a "crash course in the basics of C programming for the PSP."

What is exactly PS2Dev.org ?


The PS2Dev Network (http://www.ps2dev.org) has a plethora of information for developing for both the PSP and PS2. When you first start clicking around on the site, you'll probably head straight to the PSP Tutorial section (http://ps2dev.org/psp/Tutorials) and find yourself staring at an empty page. Don't panic. Most of the information you would want to find has made its way over to the PS2Dev Network wiki (http://wiki.ps2dev.org/). If you navigate to the Programming FAQ section of the wiki (http://wiki.ps2dev.org/psp:programming_faq), you'll find a section called "How do I get started in PSP programming?" Here you will be confronted with the cost of entry into the world of PSP programming: familiarity with C or C++.

If you are on Windows, you will need to download Cygwin (http://www.cygwin.com/), which will allow you to compile the Unix programs needed to code for the PSP. If you are on Mac OS X or Linux, you should be able to compile the PSPSDK and PSP tool chain, as long as all the necessary dependencies are in place. Both of these tools are available via the PS2Dev Net-work's PSP Project page (http://ps2dev.org/psp/Projects).

Do you love your PSP?

If you think you have the chops to code your own app for the PSP, this tips will show you where to get started.

Do you love your PSP?, but you're disappointed that it doesn't have a program for easily viewing all of your recipes? A paint-by-numbers program? An advanced statistical analysis tool? A PSP port of Snood? Why not code your own application?

Unfortunately, the buy-in price to be a Sony-certified programmer for the PSP is a bit beyond most of us mere mortals, so the only real way to get into coding for the PSP is to dive right in to the homebrew scene. Fortunately, there's lots of very valuable information online for the would-be PSP coder, and there's a very active community of other coders working away in their free time to make the PSP a vibrant homebrew platform.

Homebrew applications can't be loaded on a PSP without some trickery, and it's a given that the most recent (2.0, as of this writing) version of the firmware is immune to such trickery. So, if you want to run true homebrew applications, you're going to need to make sure that you get your hands on a PSP running Version 1.0 or 1.5 of the firmware. If you're a cracking savant, however, please by all means figure out a way to run homebrew on later firmware versionsthe Internet will herald your name far and wide.

But, if you're not inclined to invoke the trickery needed to load homebrew, you're running the latest firmware, or you just want to do some elementary programming, you're not out of luck. The PSP web browser is powered by JavaScript, HTML, and CSS, the technologies that come together to give you Dynamic HTML (DHTML). With these, you can write some simple and attractive applications that run right on your PSP's web browser.

Friday, July 4, 2008

Control iTunes from Your PSPControl iTunes from Your PSP

If you are on a Mac, you can use your PSP as a remote control for iTunes.

If you're running Mac OS X, you can easily use your PSP as a remote control for iTunes via a program called PatioTunes (http://www.mindola.com/patiotunes/; $15 USD). Unfortunately, no similar package was available for Windows at the time of this writing.

Originally, I wanted this hack to be a full-fledged remote control, using the PSP's IR port to control my home entertainment system. Unfortunately, so far, this hack has proved to be a bit beyond my abilities. Phillip Torrone has also been working on an IR remote solution for the PSP, and if either of us ever figure it out, we'll post the results on the book's web site.


Download, install, and launch PatioTunes. The program will launch and tell you where you need to point the browser on your PSP. If you're on a PSP running Version 2.0, this will work like a charm. If you're using "Find Yourself a PSP Web Browser" on another version of the firmware, you'll need to make sure that you've created your own portal so that you can redirect the browser to a local address on your local area network.

If you launch PatioTunes' Preferences, you can set the refresh rate for the PatioTunes' interface in your PSP's browser. You can also adjust the port over which the connection occurs, in case there are any conflicting ports or special restrictions on your network.

Launch the browser of your choice on your PSP and navigate to the URL that PatioTunes provided for you. If you are on Version 2.0 firmware, then I recommend that you add a quick bookmark to the PatioTunes main page. There are three tabs in the upper-right corner of the page: Playlists, Artists, and Search. Playlists lists all the different playlists in your iTunes Music Library, but no songs will appear until you actually select a playlist and then click the little gray arrow icon to the right of the drop-down menu. The Artist menu displays all the songs by the currently playing artist.

The Search menu lets you search through your iTunes Music Library, either by song title, artist, album, or a combination of the three. One nice feature is that after you conduct a search, it is added to a temporary playlist called "PatioTunes Search."

There are minimal controls at the bottom of each page, featuring previous track, next track, and play/pause. You can also use PatioTunes to remotely create a playlist or increase the volume in iTunes.

This is a great little application that you can really make shine by either connecting your computer to your entertainment system, or by using AirPort Express and AirTunes to stream music playing from your iTunes Music Library to your stereo. All it's lacking, and a feature that I'd like to see in the next version, is an album artwork feature that would display the album cover associated with the currently playing track.

Now you can stroll around your house, browsing the Web on your PSP, and switch over to PatioTunes whenever you want to change the currently playing track. Have fun!

Controlling Winamp with your PSP


Another web server you could set up is a plug-in for Winamp called BrowseAmp (http://www.browseamp.com/). This program will set up a mini web server that uses the same kind of special URLs to send commands to the Winamp player running on your computer. I've put together a skin that looks good on the PSP screen. You can find it posted on my site (http://psphacks.blogspot.com).

I have a lot more ideas on how to improve this system. Right now, navigation is clunky because every button press causes the page to refresh. This is the same reason why PSP IRC (http://pspirc.com/) keeps refreshing the entire screen. I want to explore sending the commands to the WACI using an IFrame or XMLHTTPRequest object, but as far as I know, these basic HTML features are not implemented in the Wipeout Pure browser.

Controlling Audio/Video Equipments with your PSP


By using a controller device called the WACI NX (http://www.waciworld.com/), you could turn on the TV, turn on the Xbox, switch to the correct input on the TV, and send the Play command to XBMC, all in one button press on your PSP.

So far, I have the ability to turn my lights on and off, and I have full control (play, stop, pause, and menu) of my DVD player, TiVo, and high-definition TV, all wirelessly from my PSP. I can also send commands to my pre-2.0 PC running Winamp to tell it to play, stop, and pause my music, or even browse my playlists.

To do most of the controlling, I used this tiny web-server control box called the WACI NX. It's great because it has an HTTP and FTP server and uses regular HTML to issue the commands, making it the perfect match for my pre-2.0 PSP, which does not support any fancy JavaScript or DHTML. The PSP talks to the WACI NX via WiFi through the network. In turn, the WACI emits the IR signal to the TV through one of my IR emitters, just as though I had pressed the button on the remote.

The WACI NX has a built-in IR Learner, so you can grab all of your remotes, learn all the button commands, and save them in the WACI to be played back and emitted later. You could even do macros so it sends out a sequence of button presses with a specified delay between each button press.

The pages it hosts are constructed using layers and tags. I put an image map on the graphics and created some HTML pages with special links, which are crafted so that when the PSP highlights and clicks on a spot on the image map, it instructs the WACI NX server to send an IR signal to my A/V equipment or triggers its relays to cut power on the lights.

The actual links are name value pairs going to a script I made on the WACI NX.

http://192.168.1.102/rpcpost.asp?method=IRSend&Param1=1&Param2=DVD&Param3=Play


That script is written to execute the IR Send and then redirect back to the referring page. To change which command I run, I just change the URL string in my link.

I'm sure that if you rigged something up, you could do something similar with special software that runs on your PC. However, by using the WACI, I have a dedicated piece of hardware whose only function is to send commands to my stuff, no matter which interface I create to control it. Unlike Sony, which hides its protocols, the WACI NX has an open protocol that you can access from just about any web programming language. I can program using Flash, ASP, HTML, JavaScript, C#, C++, and Java. It's great for developers, and fairly simple to get started using the provided sample code. For more info on the WACI NX, you could check out WACI World (http://www.waciworld.com/).