Why doesnt this work please?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
colourcode
Posts: 19
Joined: Mon Jun 08, 2009 10:38 pm

Why doesnt this work please?

Post by colourcode »

Using a programming guide to learn and have created this
//Hello World - My first app for the psp

/*
This Program was created by Oliver Davies on the 9th June 2009.
It is a simple "Hello World" application.
*/

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#
PSP_MODULE_INFO("Hello World", 0, 1, 1);

#define printf pspDebugScreenPrintf

int counter = 0
int i = 0;
SceCtrlData pad;

printf("Press [X] To Start the Timer");

while(1) {

sceCtrlReadBufferPositive(&pad, 1);

if(pad.Buttons & PSP_CTRL_CROSS {
break;
}
}

while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE) {
break;
}

pspDebugScreenClear();

printf("Press [O] To Stop the Timer\n");
printf("Counter: %i", counter);

counter++;

for(i=0; i<5; i++) {
sceDisplayWaitVblankStart();
}
}

pspDebugScreenClear();
printf("Counter Finished.");
printf("Final Count: %i", counter);
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

int main() {

pspDebugScreenInit();
SetupCallbacks();



sceKernelSleepThread();

return 0;
}

why doesnt it work pleaese?
PSP Coding total n00b Please Help!!!!!!!!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Use code tags. And that's not a valid C file. Please learn to program in C FIRST before trying to program the PSP.
colourcode
Posts: 19
Joined: Mon Jun 08, 2009 10:38 pm

Post by colourcode »

ok, i admit defeat, wheres the best place to learn?

Or by book?
PSP Coding total n00b Please Help!!!!!!!!
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

colourcode wrote:ok, i admit defeat, wheres the best place to learn?

Or by book?
http://en.wikibooks.org/wiki/C_Programming

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
Post Reply