Posts Tagged ‘gsKit’

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?

Still about gsKit and interlaced mode

May 14, 2008

GsKit is the latest  – and as I heard – the more optimized graphic library for the PS2. Other libs have neat things not present in gsKit but it’s the currently supported official lib.

I’ve been looking at the uLaunchELF4.12 sources and I saw pretty things 🙂
I’ve already noticed uLaunchELF could open a non-interlaced screen mode (but not pure low resolution!) and I looked in to see how it manage to do it with gsKit.

Function setupGS(gs_vmode) is pretty interesting : it allows to setup all the mambo-jambo to setup a screen in gsKit, where gs_vmode = GS_MODE_PAL ou GS_MODE_NTSC. There the lines :

 // Interlace Init
  gsGlobal->Interlace = GS_INTERLACED;
  gsGlobal->Field     = GS_FIELD;
  gsGlobal->Interlace = GS_NONINTERLACED;
  gsGlobal->Field     = GS_FRAME;

where settings->interlace is uLaunchELF specific and acting like a boolean (in fact is a integer data type), this show the gsGlobal settings needed to enable or disable the interlace mode. I wasn’t aware of the gsGlobal ->Field thing…

Another useful function at uLaunchELF source is the updateScreenMode() which shows how to change on-the-fly the current screen mode. Basically, it calls the not-so-documented SetGsCrt() gsKit’s function:

SetGsCrt(gsGlobal->Interlace, gsGlobal->Mode, gsGlobal->Field);

I’m sure you can find the uLaunchELF sources out there, but if not, look here :
uLaunchELF4.12 binaries and sources

This includes pre-compiled binaries and sources.