Note, Vol Up, Vol Down Button Input?

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
darksaboteur
Posts: 18
Joined: Tue Dec 11, 2007 8:44 pm
Location: Australia
Contact:

Note, Vol Up, Vol Down Button Input?

Post by darksaboteur »

Hi,
I was wondering how to get Note, Vol Up, Vol Down input.
In pspctrl.h I noticed "@note PSP_CTRL_HOME, PSP_CTRL_NOTE, PSP_CTRL_SCREEN, PSP_CTRL_VOLUP, PSP_CTRL_VOLDOWN, PSP_CTRL_DISC, PSP_CTRL_WLAN_UP, PSP_CTRL_REMOTE, PSP_CTRL_MS can only be read in kernel mode"

I have no idea how to achieve this so I was hoping someone would take pity on me and post an example?

The code for my application can be found at svn://nicksplace.com.au/public/UniMote

Thanks,
Darky
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

You need to run your app in kernel mode.

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
User avatar
darksaboteur
Posts: 18
Joined: Tue Dec 11, 2007 8:44 pm
Location: Australia
Contact:

Ok

Post by darksaboteur »

I figured that would be the case.
Is there any disadvantages to this? The application is not designed for 1.5, I use it under a 5.xx kernel. It won't affect any of the my existing code?
Would you be able to point me to some examples of how to do this?

Sorry for the all the questions

Thanks,
Darky
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

where you define the module, which maybe 0, 1, 0 or something change the firstt number to:

0x800 for vsh mode (those buttons will work in this mode) or,
0x1000 for kernal.
User avatar
darksaboteur
Posts: 18
Joined: Tue Dec 11, 2007 8:44 pm
Location: Australia
Contact:

Doesn't Work

Post by darksaboteur »

After adding 0x800 to PSP_MODULE_INFO("UniMote", 0x800, 1, 1);
I get "The game could not be started (80020148)"

Thanks,
Darky
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi! :)

To use a kernel function in 3.x code you need to put the kernel calls in a prx.
See here for a sample:
http://forums.ps2dev.org/viewtopic.php?t=12441

Ciaooo
Sakya
User avatar
darksaboteur
Posts: 18
Joined: Tue Dec 11, 2007 8:44 pm
Location: Australia
Contact:

Having A Few Troubles...

Post by darksaboteur »

Ok, I have tried to make a prx and am failing :(
I get 'main.cpp:(.text+0x1064): undefined reference to `setSamplingCycle(int)'
setSamplingCycle(int) is the function I created the in prx.
I have followed the samples and looked around on the net to no avail.
I can post full source if anyone is interested...

Thanks again,
Darky
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

This is the clearest example of making a kernel mode PRX for a user mode application. If you can't figure it out from this, you aren't ready to work on this yourself.

http://forums.ps2dev.org/viewtopic.php?p=58653#58653
User avatar
darksaboteur
Posts: 18
Joined: Tue Dec 11, 2007 8:44 pm
Location: Australia
Contact:

Post by darksaboteur »

I have read many samples and tutorials and they all work.
Interestingly if I rename main.c to main.cpp in the samples they get the same error my application gets during compilation. (mine is cpp).
So it seems to be related to it being a cpp application?
Does it need something different in the makefile or something along those lines?

Thanks again,
Darky
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

If you look at the main.cpp in Basilisk II PSP, you'll see that parts of the PSP init junk has to be wrapped in extern "C" { } to work correctly... like the callback setup junk. You simply cannot change the main from C to C++ and have it work.

Look at some of the PSP C++ apps out.
Post Reply