Discuss the development of new homebrew software, tools and libraries.
	Moderators:  cheriff , TyRaNiD 
			
		
		
			
				
																			
								superman6143 							 
									
		Posts:  4 Joined:  Fri Aug 29, 2008 2:55 pm 
		
						
					
													
						
									
						Post 
					 
								by superman6143  Fri Aug 29, 2008 2:58 pm 
			
			
			
			
			i need help with this code i made it wont read the button press
Code: Select all 
// 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);
		}
	}
}
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								J.F. 							 
									
		Posts:  2906 Joined:  Sun Feb 22, 2004 11:41 am 
		
						
					
						 
													
						
									
						Post 
					 
								by J.F.  Fri Aug 29, 2008 6:08 pm 
			
			
			
			
			No, you just don't know how to program... your main loop does a declaration of a function, not a function. :P
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								superman6143 							 
									
		Posts:  4 Joined:  Fri Aug 29, 2008 2:55 pm 
		
						
					
						 
													
						
									
						Post 
					 
								by superman6143  Fri Aug 29, 2008 6:36 pm 
			
			
			
			
			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
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								whistler 							 
									
		Posts:  39 Joined:  Tue Mar 04, 2008 7:08 am 
		
						
					
						 
													
						
									
						Post 
					 
								by whistler  Fri Aug 29, 2008 7:01 pm 
			
			
			
			
			change
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
								jean 							 
									
		Posts:  489 Joined:  Sat Jan 05, 2008 2:44 am 
		
						
					
						 
													
						
									
						Post 
					 
								by jean  Fri Aug 29, 2008 7:08 pm 
			
			
			
			
			There's nothing PSP related in your inability to write code.
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								hlide 							 
									
		Posts:  739 Joined:  Sun Sep 10, 2006 2:31 am 
		
						
					
						 
													
						
									
						Post 
					 
								by hlide  Fri Aug 29, 2008 7:08 pm 
			
			
			
			
			and be careful not to get closer to our local noobs' eater :) (someone should recognize himself ;P).
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								superman6143 							 
									
		Posts:  4 Joined:  Fri Aug 29, 2008 2:55 pm 
		
						
					
						 
													
						
									
						Post 
					 
								by superman6143  Fri Aug 29, 2008 7:56 pm 
			
			
			
			
			i did what you said it ran but when i press x is still dont shut off
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								Hellcat 							 
									
		Posts:  83 Joined:  Wed Jan 24, 2007 2:52 pm 
		
						
					
						 
													
						
									
						Post 
					 
								by Hellcat  Fri Aug 29, 2008 8:03 pm 
			
			
			
			
			Carefully check any compiler errors or warnings.
			
			
									
									
						 
		 
				
		
		 
	 
				
				
		
		
			
				
																			
								J.F. 							 
									
		Posts:  2906 Joined:  Sun Feb 22, 2004 11:41 am 
		
						
					
						 
													
						
									
						Post 
					 
								by J.F.  Sat Aug 30, 2008 6:01 am 
			
			
			
			
			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(). :)
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								moonlight 							 
									
		Posts:  567 Joined:  Wed Oct 26, 2005 7:46 pm 
		
						
					
						 
													
						
									
						Post 
					 
								by moonlight  Sat Aug 30, 2008 8:10 am 
			
			
			
			
			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.
 
		 
				
		
		 
	 
				
		
		
			
				
								jbit 							 
						Site Admin 			
		Posts:  293 Joined:  Sat May 28, 2005 3:11 amLocation:  København, Danmark
				Contact: 
				
			 
				
		 
		
						
					
						 
													
						
									
						Post 
					 
								by jbit  Sat Aug 30, 2008 8:23 am 
			
			
			
			
			Learn C, then learn PSP architecture, then learn how to program PSP.