Programming The PS2
This is not a full example, but it is better than nothing. Eventually, I hope to have example code for using the vector units, controllers, and other PS2-specific devices.
The included PS2 libraries are C++ libraries. All of these examples are C++ examples. I heard you can use C++ libraries in PERL, but I've never done it and don't even know if this is true. Since PERL was written in C++, this doesn't seem impossible.
The PS2 C++ files are located in /usr/include/ps2s/. The doc files are in /usr/doc/PlayStation2/.
The "Hello, World" program
This program just sees if anything will compile and run. First, go to a text editor (the basic text editor in KDE is my favorite) and create a file called first.cc (or something like that). From what I could gather from "man gcc", C++ files have to have .cc, .C, or .cxx as the extension.
Also, if you want it to look in the include directory for an included file, you have to put the name in quotation marks. If you put it in pointy brackets, it will look in the directory that the file is in. I believe there is a parameter you can pass to the g++ that will reverse this, but I don't really care about that, so I haven't tried it out.
The program should look something like this:
#include "iostream"
int main() {
cout << "Hello, world\n";
return 0;
}
After you do that, go to the directory where first.cc is located and type:
g++ -o first -I /usr/include ./first.cc
From what I can gather, g++ is more of a C++ compiler than gcc. The "-o first" tells g++ to output a file called "first", the "-I" tells the g++ where the include directory is, and "./first.cc" is the file to be compiled.
Now run it with "./first". It should output "Hello, world" and a new line.
Yes, that's all I've got now. Hopefully, I'll get some more up later.
Click here to go back to the PS2 section's index, or click here to go to the main index.