| View previous topic :: View next topic |
| Author |
Message |
ils
Joined: 12 Apr 2005 Posts: 6
|
Posted: Mon May 23, 2005 11:47 am Post subject: Library Usage Help (Newbie) |
|
|
i'm aware there is alot of library list in other thread.
but how can i use them ?
i search every source code (nem's hello world for example) but can't find it in .c/.h file. but found it @ ASM Code.
anyone can explain this ? i understand ASM a little (very very little)
how can i link C/H file to an ASM code ?
thanks. |
|
| Back to top |
|
 |
alonetrio

Joined: 15 May 2005 Posts: 34
|
Posted: Tue May 24, 2005 4:55 am Post subject: |
|
|
you can find very simple code sample, like plot a dot, display pic, etc... that i code to help coder to start at http://www.psp.to/download.php
hope it will help you a few.
AloneTrio |
|
| Back to top |
|
 |
ils
Joined: 12 Apr 2005 Posts: 6
|
Posted: Wed May 25, 2005 11:22 am Post subject: |
|
|
yeah, thanks.
but i manage to understand it a little (well, thanks to many sources that everyone share, i can compare 1 with another)
right now i'm trying to use button in my program. but it didn't work :( |
|
| Back to top |
|
 |
ils
Joined: 12 Apr 2005 Posts: 6
|
Posted: Wed May 25, 2005 6:24 pm Post subject: |
|
|
ok, need help here..
i tried a few hours to use button/pad but didn't work.
i copy/paste RIN's (GBC emulator) PAD.H as follow
typedef struct _ctrl_data
{
u32 frame;
u32 buttons;
u8 analog[4];
u32 unused;
} ctrl_data_t;
and create variable name "pad"
in my xmain (main function), i code :
sceCtrlInit(0); //same as RIN's
while(1) { // always run
sceCtrlRead(pad, 1);
if (pad.buttons == CTRL_UP)
pgPrint(1,1, color, "UP Button");
}
but it didn't respon anything.
any suggestion ? (sorry if i'm not clear describing it) |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Jun 04, 2005 7:39 am Post subject: |
|
|
| ils wrote: | and create variable name "pad"
in my xmain (main function), i code :
sceCtrlInit(0); //same as RIN's
while(1) { // always run
sceCtrlRead(pad, 1);
if (pad.buttons == CTRL_UP)
pgPrint(1,1, color, "UP Button");
}
but it didn't respon anything.
any suggestion ? |
There are many possible errors. If you have declared "pad" not as a pointer, you have to write "sceCtrlRead(&pad, 1)" (note the "&"). And if you are using nem's original code, you have to call pgScreenFlipV() after the pgPrint. And would be better to call "sceCtrlSetAnalogMode(0)" after the "sceCtrlInit(0)", to be sure you are in digital mode. And finally you should mask the buttons you need:
| Code: |
sceCtrlInit(0);
sceCtrlSetAnalogMode(0);
ctrl_data_t ctrl;
while(1) {
sceCtrlRead(&ctrl, 1);
if (ctrl.buttons & CTRL_UP) {
pgPrint4(0, 0, 0xffff, "UP Button");
pgScreenFlipV();
break;
}
}
sceKernelSleepThread();
|
|
|
| Back to top |
|
 |
ils
Joined: 12 Apr 2005 Posts: 6
|
Posted: Mon Jun 06, 2005 11:47 am Post subject: |
|
|
ok thanks!
i finally can use the buttons now :) |
|
| Back to top |
|
 |
|