forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Why doesnt this work please?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
colourcode



Joined: 08 Jun 2009
Posts: 19

PostPosted: Wed Jun 10, 2009 5:22 am    Post subject: Why doesnt this work please? Reply with quote

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!!!!!!!!
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Jun 10, 2009 5:29 am    Post subject: Reply with quote

Use code tags. And that's not a valid C file. Please learn to program in C FIRST before trying to program the PSP.
Back to top
View user's profile Send private message AIM Address
colourcode



Joined: 08 Jun 2009
Posts: 19

PostPosted: Wed Jun 10, 2009 5:33 am    Post subject: Reply with quote

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

Or by book?
_________________
PSP Coding total n00b Please Help!!!!!!!!
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Wed Jun 10, 2009 6:04 am    Post subject: Reply with quote

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

Or by book?


http://en.wikibooks.org/wiki/C_Programming
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group