Editing Lesson 05 - Onwards and Upwards

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 8: Line 8:


So here we go, let's start out our program. You'll need to download another zip file for this lesson. You can get it here. You'll need to make a main.c file in the same folder as the files you extract from the zip file.
So here we go, let's start out our program. You'll need to download another zip file for this lesson. You can get it here. You'll need to make a main.c file in the same folder as the files you extract from the zip file.
<pre>
 
#include <pspkernel.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdisplay.h>
Line 15: Line 15:
#include <psppower.h>
#include <psppower.h>


#include "graphics.h"</pre>
#include "graphics.h"
Assuming you have completed the previous lessons, this isn't anything you haven't seen. The only thing that should look new to you is the "psppower.h" include. This file contains the functions we will use to change the PSP's clock speed.
Assuming you have completed the previous lessons, this isn't anything you haven't seen. The only thing that should look new to you is the "psppower.h" include. This file contains the functions we will use to change the PSP's clock speed.


On to some more familiar code:
On to some more familiar code:
<pre>PSP_MODULE_INFO("Background Changer", 0, 1, 1);
PSP_MODULE_INFO("Background Changer", 0, 1, 1);


#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))</pre>
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
Remember how in Lesson 02 we just glossed over this line without explaining what it really did? Well, I think it's time that you learn. The first parameter is your program identifier, so basically your program name. The second parameter allows you to pass attributes. For most of your programs you will just want to use a 0, but if you are making a kernel mode app, you will need to switch this to "0x1000". The third parameter is for the major version, the fourth is minor version. These are just meant to document the version number of your program.
Remember how in Lesson 02 we just glossed over this line without explaining what it really did? Well, I think it's time that you learn. The first parameter is your program identifier, so basically your program name. The second parameter allows you to pass attributes. For most of your programs you will just want to use a 0, but if you are making a kernel mode app, you will need to switch this to "0x1000". The third parameter is for the major version, the fourth is minor version. These are just meant to document the version number of your program.


Now the standard callbacks:
Now the standard callbacks:
<pre>/* Exit callback */
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
int exit_callback(int arg1, int arg2, void *common) {
           sceKernelExitGame();
           sceKernelExitGame();
Line 54: Line 54:
           return thid;
           return thid;
}
}
</pre>
 
==INCOMPLETE==
==INCOMPLETE==
Please note that all contributions to PSP Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PSP Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)