jeudi 10 juillet 2008

Information is key

Not much material advances since my last post; other things have taken my time. Moving my brother, getting a new ISP, etc.

Still, I have done some googling to find a nice tutorial series I had stumbled upon earlier: Tony Saveski's "Playstation 2 basics" tutorial. The operational parts of it are almost obsolete (he uses Naplink) but most of the contents seems good. The writing is good and the typesetting is really good. Probably TeX-generated. And I found it in good company at this wordpress site.

Off to some light reading :-P

mardi 17 juin 2008

Remote connection and configuring ps2link

To connect remotely to the PS2, I had outlined 2 steps:
  1. launch the ps2link.elf on the memory card
  2. use ps2client (included in the toolchain) to connect to it
Simple? No.
  • The included doc does not explain how the ps2client works
  • Once launched, ps2client does not give feedback (it is not hung up)
Since I was not even sure ps2link was working, I downloaded the Xlink client for Windows from the Loaders page of ps2dev.org. I discovered the ominous messages on the TV display were indicating a problem: ps2link was initializing with a wrong IP adress. When starting, ps2link gets it's IP configuration from an IPCONFIG.DAT file found in the same directory it is situated. It also uses the information from a second EXTRACONF.DAT file. That's not documented of course...

I quickly solved the problem by editing the IPCONFIG.DAT file on my memory card. The file has 2 lines: first is IP config (adress, netmask, ?) and second points to the EXTRACONF.DAT file.

As of now, I have the following files in my memory card's BOOT directory:
The BOOT.ELF is the boot manager I use to launch ps2link.elf. BOOT2.ELF is the Aura for laura demo. The IRX files are support files for the boot manager and ps2link.

The modus operandi to access remotely to the PS2 is this:
  1. Start the PS2 holding the R1 button to launch the loader
  2. Use the loader to browse to and start ps2link.elf; ps2link starts with the 192.168.2.23 IP (which I specified)
  3. Start Xlink on Windows and configure the IP as 192.168.2.23
Through Xlink, I can now start ELF files directly from my PC . I can have some console output, and I can send executables to each unit of the PS2 and peek around in the memory and registers. That's good, but it is not in my Ubuntu development virtual machine so I will try to find a GUI program for ps2client.

SDK finally compiled

After much lost time and frustration, I resorted to asking a newbie question to the ps2dev forums.

Result: the compilation failed because I was missing important packages on my Ubuntu install. The essential package to download by apt-get is build-essential. Once I had all the subpackages associated, the build went smoothly.

On a side note, I was given an Ethernet/modem adapter last week. Huzzah!

Next step: try ps2link to ensure remote-debugging access to the PS2 through the network.

jeudi 29 mai 2008

I can't get no... compilation

Setting up the SDK is proving to be an exercise in frustration. The ps2toolchain-20070626.tar.bz2 file, which is supposedly a nice packaged installation script, does not work.

Not at all.

Let's see what I have done for now: I started with an Ubuntu VMware appliance. My Windows install is almost hosed, so I won't setup there to be forced into a reinstall cycle soon after. The appliance has it's own virtual filesystem, so I get to start with a preconfigured environment.

The README states that I need a few packages, so I get them through apt-get. That was the easy part. Then I try to start the toolchain.sh file: it complains about some environment vars that are unset.

I'll skip all the efforts wasted on trying to add the variables to my startup script (which does not exist in Ubuntu), since that was not what was to be done.

The README should have stated that it is the toolchain-sudo.sh script that takes care of everything! This second script downloads the necessary packages, installs them, etc. Only, it does not. After downloading and installing some packages, it halts with an error:
*** The command 'gcc -o conftest -g -O2 conftest.c' failed.
*** You must set the environment variable CC to a working compiler.

mardi 20 mai 2008

A little pothole on the road to success

I recieved the Memor32 card in the mail, and while I couldn't get the Ethernet adapter quick I started fiddling with the exploit anyway.

First thing I did was to head back to ps2dev.org to get the exploit package. They had "PS2 eXploit Made Easy" right on the site, which is pre-configured to be used with 600 US and Euro Playstation games, including mine. Next, I imported the exploit (.max format) with the Memor32 savegame manager and uploaded it in the memory card. Finally, I put the card and the game in my PS2 and started it. Huzzah! The exploit works and I am facing a DOS-style explorer!

I had a lot of fun foraging in the save-games (which are really folders of files) and exploring the game CD, but that became old quick since I couldn't load a demo. If I changed the disc in the drive, the menu refused to show it's content, and I didn't know how to start an ELF executable except by using PS2link and the network adapter. Bummer.

Off I went to Google, and while searching for another way to start an ELF I found out that there is a firmware patch for the Memor32 that lets me directly load an ELF executable from the memory card. It even works without a game in the drive!

Here is how it works: once the firmware is patched, you have to create a BOOT directory in the Savegame Manager's savegame directory. Then you copy an ELF file into the BOOT directory and rename it to BOOT.ELF. After that you start the Savegame Manager and a new BOOT savegame appears on the "Computer" side. Restore the BOOT savegame to the card. Once done, put back the card in the PS2 and reboot while holding the R1 button.

I tried first with a demo from ScoopaDoopa called "Aura for Laura": success! I bask in the glory of the demo.

From now on the workflow to start a program is simplified to the following steps:
  • Copy the ELF in the BOOT savegame as BOOT.ELF/BOOT2.ELF/BOOT3.ELF/BOOT4.ELF
  • Restore the BOOT savegame to the Memor32
  • Put the memory card in the PS2 and power it on
  • Press R1/R2/L1/L2 (depending which boot.elf I want started) while the PS2 starts until the wanted program starts
Next step: start fiddling with the SDK while I wait for the Ethernet adapter.

mardi 13 mai 2008

Starting up

This is more of a lab book than a real blog. I am going to post my progress with Playstation 2 development from the ground up.

Why?
Some may wonder why I start fiddling with an aging platform instead of going for the XBox 360, Wii or Playstation 3. Well, I have 2 good reasons for that: one, I am a cheap bastard and I have most of the stuff on hand and two, this is my first experience with a console so I wanted something that is well-known and with the homebrew SDK ironed out.

The setup:
I have an old-style "fat" PS2, unmodified and without a hard drive or network adapter. I have a friend that has an adapter gathering dust and that is willing to give it away, but eBaying could land me an example for cheap. The adapter will let me access the Playstation remotely to execute code or use a console program to execute shell commands(?) I will probably add a hard drive soon to expand my options but for now it is superfluous.

To inject my homebrew code in the Playstation's memory, I need to bypass the copy-protection features that prevents running unauthorized discs. Since I have no love for soldering modchips, I will use the "PS2 Independence Exploit" to do that. In a nutshell, that exploit uses a "feature" of the PS1 subsystem to execute some arbitrary boot code from a memory card. PS2link is one of the possibilities, and the basis of the PS2DEV toolchain. NOTE: this will NOT work on "slim" PS2's.

The first acquisition:
Which brings me to my first official acquisition: the Memor32 memory card with USB port. This card looks nifty: you can upload and download save files between it and a computer (Windows, Mac or Linux) . This is totally untested for homebrew dev (this toy is still new on the market), but to me this looks like the best way to put the Independence Exploit on a memory card without doing swap tricks or soldering.

Next step: waiting for the postman, then doing a test run of a precompiled demo ELF.

The workflow should look like this:
  1. Make an Independence memory file for an original PS1 game I have on hand
  2. Upload the memory file from (1) on the Memor32
  3. Put the PS1 game and Memor32 card in the PS2
  4. Push Power on the PS2
  5. Use a PC client (PS2EXEC for Win32) to upload the ELF to the PS2 through the network
  6. Bask in the demo-ey glory of it all.