Advertising (This ad goes away for registered users. You can Login or Register)

The state of libraries on the PSP.

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Strangelove
Posts: 286
Joined: Thu Nov 25, 2010 6:32 pm

The state of libraries on the PSP.

Post by Strangelove » Mon Feb 07, 2011 4:48 pm

Recently I've been experimenting a bit with creating homebrew for the PSP. There is one particular aspect of it I want to talk about, and that's the state of libraries (and toolkits) on the PSP.

1. My experience:

The first thing I tried was to download the official toolkit+sdk from ps2dev. It compiled just fine with a few easy tweaks to the build scripts. Tried compiling a few "hello world" apps.

Then I felt the need for additional libraries to make homebrew programming more convenient, and let's face it, only using the standard c library and the native PSP library would mean reinventing the wheel no matter what the educational value is. The ps2dev repository has a number of modified libs you can build and install, but that means you have to spend time manually downloading the packages and run the commands, sure I could do that

... or I could just download the newest minpspw 0.11.1 which installs all the add-on libraries you'll ever need. Awesome! Installing was a breeze and I quickly started to make something a little more interesting than "hello world" apps.

The first thing I did was to create my own graphics routines from scratch for the purpose of familiarizing myself with the PSP, I also read a lot of documentation but that's beside the point. Then next I felt I knew enough about the PSP to start developing in a more convenient manner, so decided to use of the game libraries that's available for the PSP. This is where the trouble started.

2. Oh noes!

There's a couple of ways to write homebrew efficiently for the PSP. There is about 4 major ones: SDL, Allegro, OSlib and triEngine. I've tried 2 of them.

First I tried SDL and wrote a simple "hello world". *crash* Quadruple-checked that is was no error of mine and it wasn't. I tested a known good example as well, same result. No gotchas in the code, SDL was simply broken.

Oh well... then I went on to test OSlib (mod) and the results were much better I could init graphics and draw stuff on the screen. But pixels doesn't do it for me so next I tried loading a PNG and blit it to the screen. I got some linker errors. The OSlib that's included in minpspw 0.11.1 assumes an old version of libpng and minpspw uses libpng 1.4. Tried manually patching oslib, build and install a fixed version but for some reason the function just returned error.

At that point I've spent days and by then I've pretty much had it! I removed minpspw and installed 0.10. Tried again and the homebrew finally worked, with pictures! T_T *happy tears*

3a. The what, why and wherefore art thou. :P

So what have I learned spending a few days battling with the tools and libraries available for the PSP?

First I have one observation about minpspw. It's built a little like the original toolchain in that it's basically just a collection of scripts to build the development stuff from. But there are some important differences. minpspw packages or devkits if you will, is basically a script which downloads the last sources for a library etc. and applies a patch to it, then builds and installs. For a good number of packages it takes the sources from svn trunk and that IMO represents a problem.

Since a source code repository can change at any time it may randomly introduce errors in functionality and FTBS issues. This is something that can be easily avoided by either inslude a tarball of the sources in the minpspw repo or by making the devpak download a given revision. This will keep errors from sneaking in unnoticed, and hopefully the maintainer performs a check on the sanity of the applied patch should he upgrade the devpak.

I also feel that that it would be beneficial to better decouple the devpaks from the core toolkit. Since the devpaks may be buggy it should be easy to fix, rebuild and install them without having to either manually running commands on the source and copy files, or as in my case rip out the entire minpspw and install a previous working version.

But enough with the constructive critique, minpspw deserves praise for being super-easy to install, being patched with all the latest source updates and the build system is cool. ;)

3b. Them dusty libraries.

If you look at the state of the development software you will also notice that much of it hasn't changed the slightest the last couple of years (!). Indeed the glorious era of the PSP homebrew scene took a little nap after the last 5.50 CFWs and up until quite recently with the 6.xx HENs.

It seems like the original toolchain works pretty well, mostly since the compiler etc. versions haven't changed and there hasn't been found any major bugs in it AFAIK.

The PSP SDK also works well because Sony's API is stable. However I know there's a good number of newly discovered API calls that isn't supported in it. That's truly a loss for the whole PSP scene IMO. To put it like this: If theoretically the SDK was complete there wouldn't really be much of a need for support libraries like libpng, libz, jpeg, intrafont, heck perhaps even newlib (?). Sizes of homebrew would shrink many times.

No libdoc for FW 6.xx.

The state of add-on libraries seems to be even worse. The port of SDL hasn't really been touched for 3-4 years so it's more or less unmaintained.

OSlib hasn't been updated for 4 years. The mod version is in a better state, having last been touched about a year ago. It still can use some love.

The triEngine seems new and sparkly but I haven't tried it.

4. The outfall ...

That was quite a rant. Hopefully it will spark some discussion. It seems to me like the PSP scene is suffering from bit-rot, and I was wondering what you think about that. It doesn't seem like many library authors are actively maintaining their code, and it's not fair to expect the minpspw author to provide support in form of patches, testing etc. for the whole community. One solution I think would be a centralized repository of all the interesting sources, with many people to review patches. Or is that far fetched? The PSP is soon dead anyways etc.? Your opinions please.
Advertising
"If you have specific questions ... don't hesitate to ask as the more generic the question is the more philosophic the answer will be" - PSPWizard

Sand3r
Posts: 49
Joined: Sun Oct 24, 2010 10:48 am
Location: Belgium, Europe
Contact:

Re: The state of libraries on the PSP.

Post by Sand3r » Wed Feb 09, 2011 12:35 pm

Yeah, I feel exact the same way.

I was also looking for a nice and easy-to-use graphics library, and ended up with OSLib. Sure, it's fine and it does it's job, but as you said, it surely has to be revised sometime. Did you try drawing text with a font of your own? I couldn't accomplish that, nor with the 'default' graphics.h from someone's popular tutorial. So I ended up with drawing my text in the desired font with an image editor and created an image out of it. Those images are what I use now to display some simple text.

One the one hand, it's really stupid libs, code samples, but also tutorials aren't updated anymore. Some people say that's because of the scene is dying. But, now, with all these LCFW, isn't the scene all vivid? And what about the big contest? I want to compete and I have something to show, but when you see how I managed to do certain things, it would be inferior to homebrews of others.

On the other hand, why would you care updating all the code? PSP is near to its death (NGP, no devkits are given away, so no more games developed).
It's just a huge pity for the people who want to stick to the 'original' PSP and want to make something their own, now it's a lot calmer.
Advertising
* PSP 3004 - 6.35 PRO B5
* Creator of CubeMania - Genesis competition 2011

jetdrone
Posts: 20
Joined: Wed Dec 01, 2010 7:54 am
Contact:

Re: The state of libraries on the PSP.

Post by jetdrone » Thu Feb 10, 2011 9:52 am

Hi,

You are right, the state of the Homebrew SDK is not the most desirable, in the last iterations on the MinPSP project i've tried to avoid more and more SVN repositories and build release versions of libs, of course as you can see i pack around 45 libs and i do this in my very little spare time. This means that i cannot do proper testing, yes i compiled the stable SDL, linked against SDL-Dogs, it worked on my PSP so i assume (which is a bad thing i know) everything is OK.

Same for triEngine, it the demos run, and for OSlib i just thought it was OK, it isn't (mostly because OSLib has its own linpng and all other libs, which have been modified and i expected no to, and modified the build scripts to use just the default ones instead of duplicating them allover.

I've worked on getting more libs and features such as support for Objective C, support for D but again this is a solo job, i created several patches and threads on ps2dev forums to merge my stuff back but it never happen.

Of course if you want to help and improve things, you are always welcome to the MinPSP project, please suggest alternatives to the build, fixes, etc...

In what regards the huge binary blob :) it was originally just a installer with the SDK and a separate installer for each lib, people start asking to merge and i ended up with one big thing, of course i can do it again separated or with just a basic set of libs, but for that i would like to have some suggestions...

Strangelove
Posts: 286
Joined: Thu Nov 25, 2010 6:32 pm

Re: The state of libraries on the PSP.

Post by Strangelove » Thu Feb 10, 2011 6:09 pm

Now that's a surprise...

I'm have to say I have a lot of respect for this undertaking of yours, it's something the PSP community needs, and by the looks of it, I have to conclude that many libraries and other projects are now essentially unmaintained.

As I said initially, no one could ask you to take the task of maintaining the libraries upon yourself, it's an inhuman task. Without community support it's unrealistic as well. That was what led me to suggest that someone take it upon themself to host a central repository for libraries, where many people can contribute their fixes and improvements and you'd have people with the time to review the changes. People got fixes... but nowhere to send them. It's a shame!

With regards to minpspw. I already think you do many things right. Such as patching libraries where the maintainer doesn't, have a focus on the core tools, and improving the build system etc.

But of course most things can be improved. As you've probably guessed by now I do care about the state of at least what I consider is the core parts of the development tools, as well as the most commonly used libraries. I can't promise to contribute, but I'm interested, so don't be surprised if you hear from me in that regard.
"If you have specific questions ... don't hesitate to ask as the more generic the question is the more philosophic the answer will be" - PSPWizard

jetdrone
Posts: 20
Joined: Wed Dec 01, 2010 7:54 am
Contact:

Re: The state of libraries on the PSP.

Post by jetdrone » Fri Feb 11, 2011 11:18 am

If someone would like to help, it would be nice to have some kind of unit tests for all libs. Say write an hello world for each that I could compile after each build and then run on the PSP itself to assert that atleast they work.

Or help in some other way, like reviewing patches, providing alternatives, providing build environments, yes i do not own a MAC, so someone else needs to build it for me, yes my linux distro is ubuntu, so other distros are not really tested, i still use windows XP so no Vista or 7 are tested...

So many things could be done to help :)

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: The state of libraries on the PSP.

Post by wololo » Fri Feb 11, 2011 1:39 pm

I don't advertise it much because I don't have time to correctly package it, but Wagic is using JGE++.
JGE++ stopped being officially maintained byr Dr.Watson in 2007, but we do maintain and improve it for Wagic.

One of its major strengths is the multi-platform compatibility: PSP/Windows/Linux/maemo. iOS support is work in progress. Basically you write your code once, and you easily get support for many platforms, assuming your compiling environment is set up for all these types of hardware.

Then again, we use old stuff here and there... and this library is focused on 2D rendering.

But it might be interesting for people: http://code.google.com/p/wagic/source/b ... runk%2FJGE
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

Kasumi
Posts: 20
Joined: Sat Feb 19, 2011 3:53 am

Re: The state of libraries on the PSP.

Post by Kasumi » Tue Mar 01, 2011 9:02 am

Hopefully a post in this slightly old topic is okay.

I too, am currently hung up on libraries. When I did program for the PSP regularly (3 years ago?) I used a modified "graphics.c"/graphics.h" that included swizzling, and loading pngs included in the actual eboot. It seems the load png function included in that crashes on png_read_row when it's compiled as .prx. Works fine as an .elf At first I thought it was that I hadn't updated my sdk in a while, but that doesn't seem to be it. That's a curiosity, but doesn't bother me too much.

My other problem with it, is that I want something faster. I settled for 32x32 tiles in my last project so I could have a one layer background and ~300 sprites without dropping frames. I'd like to be able to do a full screen of multiple layers of 16x16 tiles, without my program slowing down. Perhaps doing ~2,500 blits a frame is a lot to ask, but I'd like to do a game somewhat like this (without the battles). (Look at 2:19-2:50 to see what I mean, if you're not familiar with the game.)

The modifications to graphics.c I have took away my ability to draw to an image to another image (everything must go directly to the screen), so I can't even draw only a new column when scrolling right, etc. I have to draw everything every frame.

I suppose I'm technically still shopping around for graphics libraries, as I haven't tried them all. But at this point I'm hoping I can actually learn to use the GU functions create my own set of blitting functions. I'm sure I'll quickly quit. :lol: I'm only familiar with programming for much simpler graphics hardware. (IE: Nintendo Entertainment System's PPU)

RNB_PSP
Posts: 138
Joined: Mon Jan 17, 2011 9:18 pm
Location: In your dreams.....

Re: The state of libraries on the PSP.

Post by RNB_PSP » Tue Mar 01, 2011 10:23 am

Kasumi wrote:Hopefully a post in this slightly old topic is okay.

I too, am currently hung up on libraries. When I did program for the PSP regularly (3 years ago?) I used a modified "graphics.c"/graphics.h" that included swizzling, and loading pngs included in the actual eboot. It seems the load png function included in that crashes on png_read_row when it's compiled as .prx. Works fine as an .elf At first I thought it was that I hadn't updated my sdk in a while, but that doesn't seem to be it. That's a curiosity, but doesn't bother me too much.
Yes! I'm not the only one with that problem. Got it working though(prx and elf) after I formatted my MS. Though it's not working again and I'm to lazy reight now to format my MS again.
I suppose I'm technically still shopping around for graphics libraries, as I haven't tried them all. But at this point I'm hoping I can actually learn to use the GU functions create my own set of blitting functions. I'm sure I'll quickly quit. :lol: I'm only familiar with programming for much simpler graphics hardware. (IE: Nintendo Entertainment System's PPU)
I'm starting to get hang of the gu(atleast I can now draw images <= 512x512) by reading oslib mod's source(oslDrawImageSimple).

@thread:
I truly believe the problem lies inside the current SDK, as only one(but super great) person is doing all the maintaining, updating, bugfixing, etc. I wish I know something to help Heimdall.
Image
Image

ChaoticXSinZ
Posts: 49
Joined: Sat Jan 22, 2011 11:37 pm

Re: The state of libraries on the PSP.

Post by ChaoticXSinZ » Tue Mar 01, 2011 10:47 pm

Minpsp does indeed help in alleviating some of the problems with the libraries but, like jetDrone said, it's a one man project mostly. Also many projects haven't been updated in quite some time. This results in some frustrating times when you try to use these libraries and they end up not working.

Personally, for the first version of my app I used SDL (and all it's 'plugin' libraries) and they worked well for the most part. I then moved on to SDL/OpenGL after I got the hang of it mostly. Now I'm working on my latest app using straight sceGu. I can't recall how long I spent some times trying to get a single thing to work the way I wanted it too. But thankfully, after a lot of trial and error as well as help from others I've gotten rendering with sceGu down (for at least my purposes). I can render texts, shapes, and images (even those > 512×512). Using some library to wrap everything for me (like OSLib) would have probably made it much easier but I have to admit that all in all it's a learning experience. Sure it's frustrating, but it does feel good in the end :)

Oh and a few things about minpsp: (given that my emails don't seemed to be working with a mail delivery subsystem error]
This is all for v 0.10
- The pspsh binary packaged with the ubuntu 64 bit deb doesn't seem to work. I wasn't able to type anything in so I just compiled my own version. Also, something I've noticed that doesn't seem to be included in minpsp is the remotejoy program. The one provided requires some options such as port, ip, mapfile, device etc Thus I just compiled Remote Joy SDL for PSP myself from the svn.

Here is a copy of the emails I tried to send to pmlopes AT jetcube.eu:
I've been working with TinyXML in creating an XML based UI for my PSP app. I
had some problems with using the TinyXML library provided with minpspw.
Thus, I tried out downloading the latest version from upstream's sourceforge
and it worked. So it seems there are some bugs in the version provided with
minpsp which have been fixed upstream. For now I'm bundling TinyXML with my
app and just compiling it with my own makefile. I do hope you update it
soon.
Something I noticed is that, at least in the ubuntu 64bit deb, intrafont won't work without the libccc.h file. A quick fix is downloading it yourself and placing it in the same folder as intraFont.h (/opt/pspsdk/psp/sdk/include/ on my system). Hope it gets updated in the next version. Thanks for all the work.
Sorry for hijacking the thread :P

Kasumi
Posts: 20
Joined: Sat Feb 19, 2011 3:53 am

Re: The state of libraries on the PSP.

Post by Kasumi » Tue Mar 01, 2011 11:34 pm

It is often nice to know it's not you. :) This only really bothers me because I'm a genesis contest hopeful, and I worry about who could run my game. It probably won't be a problem though, I don't anticipate many judges only having original firmware.

Honestly, I'm looking to write functions to do three things:

1. Loading pngs.
2. Blitting small Xpixel by Ypixel areas of the png to the screen. (Tiles) (Fast, so I could draw thousands of tiles each frame)
3. Blitting small Xpixel by Ypixel areas of the png to the screen with Alpha Channel. (Sprites)

Text would be nice, but could be accomplished with #3. I do wish there was a magic solution, but I suppose I'm all for learning. The genesis deadline isn't getting further away, though. :(

Post Reply

Return to “Programming and Security”