Posts Tagged ‘loading image’

Still about gsKit and interlaced mode – part 2

May 15, 2008

So I took the findings mentioned at my last post and did a simple gsKit screen setup. Additionally a BMP picture is load and shown at a non-interlaced screen.

I started by going into the main() of uLaunchELF and setupGS() and put all their gsKit screen init code into a unique example source file. Surprisely enough, I’ve found that the non-interlaced screen mode of gsKit is … well, not I was expecting :). In other words, it’s a 640×512 / 640×480 resolution screen mode for PAL or NTSC systems respectively, but only the odd (or even, I didn’t invertigated exactly) lines are displayed, resulting in a half vertical resolution non-interlaced screen.

So, in fact, the example loads a 640×480 image but shows only 240 lines of it :). What a waste of memory…

That’s the interlace handling on the gsKit side. Now I see how uLaunchELF interface code could be generic, having only one font for both screen modes. The only way to set up a lower resolution screen mode is in fact changing the gsKit sources, as I did for lsdlDoom PS2 port.

I leave you now the example sources and compiled binaries, for those who aren’t developers or still struggling to have the SDK set up.


About the example : I also used the ROMFS system to have embedded the BMP image into the ELF. Consider this as an extra example 🙂 .
So, to compile it, you must have the romfs project on the ps2dev\ps2sdk-ports path. Point your SVN client to svn:// and get it.

So, the example BMP is included at the romdisk directory and by doing a “make -f Makefile.romfs romdisk.o” you get the ROMFS object file. Finally, a “make” should bake the rest of this cooking.

As another extra, try putting a 640×480 BMP image named “picture.bmp” in the root of a USB drive and plug it into the PS2 before running show_bmp_ule.elf or show_bmp_ule_interlaced.elf.
Your image will be shown instead of the supplied example image 🙂 .

As you see, you have four examples in one go : how to setup gsKit like uLaunchELF does, how to display a picture, how to embed files into an ELF, and how to load the USB drivers and get files from it. Not bad, huh?