PSP_CTRL_VOLUP

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

Moderators: cheriff, TyRaNiD

Post Reply
steffven
Posts: 28
Joined: Mon May 19, 2008 7:37 pm

PSP_CTRL_VOLUP

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&#40;"testlib", 0x1006, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

int getvolup&#40;&#41;
&#123;
	SceCtrlData libpad; 
	sceCtrlPeekBufferPositive&#40;&libpad, 1&#41;;
	
	if&#40;libpad.Buttons & PSP_CTRL_VOLUP&#41;
	&#123;  
		return 1;
	&#125; else
	&#123;
		return 0;
	&#125;
&#125;

int module_start&#40;SceSize args, void *argp&#41; 
&#123;
	return 0;
&#125;

int module_stop&#40;&#41;
&#123;
	return 0;
&#125;
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&#40;0&#41;;
and at the end of the function

Code: Select all

pspSdkSetK1&#40;k1&#41;;
Image
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.
Image
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.
Image
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.
Post Reply