PAlib

From devkitPro
Revision as of 17:35, 27 March 2010 by Wintermute (talk | contribs) (Reverted edits by Demosthenes2k8 (Talk); changed back to last version by Wintermute)
Jump to navigation Jump to search

In the early days of Nintendo DS development, while libnds was still building the low level support code, a library appeared with the goal of making things easier for novice programmers. This library, called PAlib ( standing for Programmer's Arsenal ), set out to provide a comprehensive set of wrapper functions which would allow someone with only the most basic knowledge of programming to get the skeleton of a DS game up and running quickly.

Making the tools used for homebrew programming more accessible to a wider range of skillsets is a laudable goal - one that is shared wholeheartedly by devkitPro. Unfortunately PAlib has not kept pace with the toolchain and library releases from devkitPro, resulting in a situation where users are being advised to replace the latest releases with old binaries which are no longer supported. For this reason devkitPro will not provide support to users attempting to get PAlib working. If you have followed the instructions given on the PAlib site and other sites whose tools depend on PAlib then we strongly advise that you uninstall completely and start over from scratch without replacing the PAlib parts.

At the time of writing PAlib depended on devkitPro releases of devkitARM and libnds which were almost two years old, many improvements and bugfixes have been applied to the tools in that time. Since then work was done to allow PAlib to be used with devkitARM without breaking the official releases - unfortunately they still haven't got to the point where the library will work with the most up to date toolchain. Using only official devkitPro releases will also help ensure that you can update your tools and reap the benefits of our quality control without causing major issues in the projects you've already started.

At the time of writing we have plans to further improve the accessibility of the tools and libraries we release. Unfortunately it will not be possible to ensure that 3rd party releases remain compatible with our tools and the integrity of those tools will be placed in question if you install anything not released by devkitPro inside, or make modifications to, the file system provided by the automated installer.

If you require assistance with our tools then please use the official support forums and the irc channels listed in the Community Portal page.

There appears to be a general myth around that somehow using PAlib is easier than using libnds which hasn't been true for quite some time. Something we've tried to do with libnds as it matured was to add wrappers and simple APIs where it made sense to do so while still maintaining the low level access for more experienced programmers.

One piece of code which illustrates how much easier it can be with libnds than with PAlib is the ubiquitous hello world example.

With PAlib the example given is this :-

// Includes
#include <PA9.h>       // Include for PA_Lib
 
// Function: main()
int main(int argc, char ** argv)
{
	PA_Init();    // Initializes PA_Lib
	PA_InitVBL(); // Initializes a standard VBL

	PA_InitText(1, 2); // Tell it to put text on screen 1, background number 2
	PA_OutputSimpleText(1, 1, 1, "Hello World !");  // Print the desired text on screen 1, with coordinate 1, 1

	// Infinite loop to keep the program running
	while (1)
	{
		PA_WaitForVBL();
	}
	
	return 0;
} // End of main()


With libnds, hello world looks like this :-

#include <nds.h>
#include <stdio.h>

//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------

	consoleDemoInit();

	printf("Hello World!");

	while(1) {
		swiWaitForVBlank();
	}

}

With the exception of the nds header include, consoleDemoInit function and the infinite loop the libnds version is identical to a simple hello world for almost any other platform you care to name.