Discuss the development of new homebrew software, tools and libraries.
	Moderators: cheriff, TyRaNiD
			
		
		
			- 
				
																			 steffven
- Posts: 28
- Joined: Mon May 19, 2008 7:37 pm
						
					
													
							
						
									
						Post
					
								by steffven » 
			
			
			
			
			Hi,
I want to readout the state of the Volume+ Button.
I already know that I need a kernel prx and I created one with the following value:
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdisplay_kernel.h>
#include <pspctrl.h>
PSP_MODULE_INFO("testlib", 0x1006, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int getvolup()
{
	SceCtrlData libpad; 
	sceCtrlPeekBufferPositive(&libpad, 1);
	
	if(libpad.Buttons & PSP_CTRL_VOLUP)
	{  
		return 1;
	} else
	{
		return 0;
	}
}
int module_start(SceSize args, void *argp) 
{
	return 0;
}
int module_stop()
{
	return 0;
}
But this function always returns 0, but why?
Did I forget anything?
 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 Pirata Nervo
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
						
					
						
		
													
							
						
									
						Post
					
								by Pirata Nervo » 
			
			
			
			
			at the begining of the function
Code: Select all
u32 k1;
k1 = pspSdkSetK1(0);
and at the end of the function

Upgrade your 
PSP 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 steffven
- Posts: 28
- Joined: Mon May 19, 2008 7:37 pm
						
					
						
		
													
							
						
									
						Post
					
								by steffven » 
			
			
			
			
			Thanks, it works now, but everytime i press Volume+, the psp's volume gets increased.
How do i block this input so the volume doesn't change?
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 Pirata Nervo
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
						
					
						
		
													
							
						
									
						Post
					
								by Pirata Nervo » 
			
			
			
			
			I don't really know how you can stop that, you may need to find how the volume+ and volume- buttons work.
			
			
									
									
Upgrade your 
PSP 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 steffven
- Posts: 28
- Joined: Mon May 19, 2008 7:37 pm
						
					
						
		
													
							
						
									
						Post
					
								by steffven » 
			
			
			
			
			Hmm how can i emulate a key press?
I could press the Volume- button virtually or does someone have another idea?
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 Pirata Nervo
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
						
					
						
		
													
							
						
									
						Post
					
								by Pirata Nervo » 
			
			
			
			
			search over the forum, I remember reading something about that.
			
			
									
									
Upgrade your 
PSP 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 steffven
- Posts: 28
- Joined: Mon May 19, 2008 7:37 pm
						
					
						
		
													
							
						
									
						Post
					
								by steffven » 
			
			
			
			
			Hmm can't find anything...
Someone knows how to readout and set the psp's volume?
I could save the current volume and reset it after the key press.