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 

New Project

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
superman6143



Joined: 29 Aug 2008
Posts: 4

PostPosted: Fri Aug 29, 2008 2:58 pm    Post subject: New Project Reply with quote

i need help with this code i made it wont read the button press
Code:
// Sibling Snooper

/*
   Created by Justin Kee on 08/28/08
   Scares your sibling when they are snooping through you psp
*/


#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psppower.h>
PSP_MODULE_INFO("Sibling Snooper", 0, 1, 1);
#define printf pspDebugScreenPrintf
/* 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();
   SceCtrlData pad;
   printf("Congrats you just pushed the wrong button. This PSP has crashed and bricked. Bright one!! To save the PSP press X");
   while(1) {
      sceCtrlReadBufferPositive(&pad, 1);
      if(pad.Buttons & PSP_CTRL_CROSS) {
         int scePowerRequestSuspen (void);
      }
   }
}

Back to top
View user's profile Send private message Send e-mail
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Aug 29, 2008 6:08 pm    Post subject: Reply with quote

No, you just don't know how to program... your main loop does a declaration of a function, not a function. :P
Back to top
View user's profile Send private message AIM Address
superman6143



Joined: 29 Aug 2008
Posts: 4

PostPosted: Fri Aug 29, 2008 6:36 pm    Post subject: Reply with quote

oh yeah i forgot to mention i just started programing if i knew exactly how everything goes i dont think i would need help over something as small as this
Back to top
View user's profile Send private message Send e-mail
whistler



Joined: 04 Mar 2008
Posts: 40

PostPosted: Fri Aug 29, 2008 7:01 pm    Post subject: Reply with quote

change

int scePowerRequestSuspend (void); to scePowerRequestSuspend ();
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Aug 29, 2008 7:08 pm    Post subject: Reply with quote

There's nothing PSP related in your inability to write code.
Learn C, then learn PSP architecture, then learn how to program PSP.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Fri Aug 29, 2008 7:08 pm    Post subject: Reply with quote

and be careful not to get closer to our local noobs' eater :) (someone should recognize himself ;P).


EDIT: too late !!!!
Back to top
View user's profile Send private message
superman6143



Joined: 29 Aug 2008
Posts: 4

PostPosted: Fri Aug 29, 2008 7:56 pm    Post subject: Reply with quote

i did what you said it ran but when i press x is still dont shut off
you think it should be when instead of while
Back to top
View user's profile Send private message Send e-mail
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Fri Aug 29, 2008 8:03 pm    Post subject: Reply with quote

Carefully check any compiler errors or warnings.
Got any?
Back to top
View user's profile Send private message
superman6143



Joined: 29 Aug 2008
Posts: 4

PostPosted: Fri Aug 29, 2008 8:04 pm    Post subject: Reply with quote

none
Back to top
View user's profile Send private message Send e-mail
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Aug 30, 2008 6:01 am    Post subject: Reply with quote

Does scePowerRequestSuspen() even do anything? I've never seen it used. For a button test, don't use undocumented functions - try something known to work, like sceKernelExitGame(). :)
Back to top
View user's profile Send private message AIM Address
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat Aug 30, 2008 8:10 am    Post subject: Reply with quote

J.F. wrote:
Does scePowerRequestSuspen() even do anything? I've never seen it used. For a button test, don't use undocumented functions - try something known to work, like sceKernelExitGame(). :)


It causes a sleep mode. But maybe it is scePowerRequestStandby what he really wanted to do.
Back to top
View user's profile Send private message
jbit
Site Admin


Joined: 28 May 2005
Posts: 293
Location: København, Danmark

PostPosted: Sat Aug 30, 2008 8:23 am    Post subject: Reply with quote

Learn C, then learn PSP architecture, then learn how to program PSP.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    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