It’s easiest to start with C, but C++ can also be used if you know what you are doing. You will need to know the language quite well, especially the use of pointers. Starting to program on the PSP if you have no prior programming experience is going to be an uphill struggle, it’s not impossible but it will take some major effort from you. Also do not expect your general C/C++ questions to be answered by the PSdev community, it is aimed tightly at programming esoteric hardware, not as a general game/software development group. For more basic questions, or questions about how to program games in general, head over to sites like Gamedev.net.
Download Cygwin if you are on Windows. This package will allow you to run the unix-based software used in the creation of psp programs.
As well as the default install you will also need the following utilities installed:
At the moment this consists of a script which can be downloaded from www.oopo.net. Download the script, extract it and execute it. (See the README file include with the toolchain script for more information on its usage.) After downloading a bunch of files, patching them, and compiling the source you will have a full PSP toolchain and the latest version PSPSDK installed. Here is a brief example of the process:
NOTE: You must have Subversion and subsequently bzip2 installed to use this toolchain shell script
tar xfvz psptoolchain-20051023.tgz cd psptoolchain chmod a+x ./toolchain.sh ./toolchain.sh
It will take a long time to download and build all the software from scratch, from half an hour to a couple hours depending on the speed of your internet connection and the processing power of your computer. Between files there may be a pause, so even if the first file has got to 100% and nothing much seems to be happening, leave the window open! you have a lot more to go. When it is done, you will have to add the following lines to your startup configuration:
## PSPDEV PATH SETTINGS export PATH="/usr/local/pspdev/bin:$PATH"
Under Cygwin, this will be your ‘c:\cygwin\home\<username>\.bashrc’ file. You can edit it with a standard text editor and add those lines to the end of it.
Running “psp-gcc -v” in the command line should produce something along the lines of:
$ psp-gcc -v Using built-in specs. Target: psp Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0 Thread model: single gcc version 4.0.0
*Note: If it complains about not finding psp-gcc*
This means that your path variable is not set properly. The best way to do this on windows is to right click on My Computer, Properties, Advanced, Environmental Varibles and edit the Path variable to look something like “C:\cygwin\bin;C:\cygwin\usr\local\pspdev\bin”, if you don’t have one you might need to create the entry.
After this is done you will need to close and restart cygwin, it should now work.
Congratulations, you’re now ready to get started on your own PSP programs! Be sure to visit the forums at http://forums.ps2dev.org for more information.
The emulator is actually pretty shoddy and only implements some *very* basic functions. Do not expect it to execute any program. In all likelyhood the program will run on your PSP.
Apparently a kernel thread needs to run here and the user game thread is not letting it. The aforementioned functions will let the kernel run; but also sceKernelDelayThread(0) has been known to work.
The default heap size for PRXs is 64kb. Redefine it by placing the PSP_HEAP_SIZE_KB macro after your PSP_MODULE_INFO.