forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Library Usage Help (Newbie)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ils



Joined: 12 Apr 2005
Posts: 6

PostPosted: Mon May 23, 2005 11:47 am    Post subject: Library Usage Help (Newbie) Reply with quote

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
View user's profile Send private message
alonetrio



Joined: 15 May 2005
Posts: 34

PostPosted: Tue May 24, 2005 4:55 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ils



Joined: 12 Apr 2005
Posts: 6

PostPosted: Wed May 25, 2005 11:22 am    Post subject: Reply with quote

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
View user's profile Send private message
ils



Joined: 12 Apr 2005
Posts: 6

PostPosted: Wed May 25, 2005 6:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Jun 04, 2005 7:39 am    Post subject: Reply with quote

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
View user's profile Send private message
ils



Joined: 12 Apr 2005
Posts: 6

PostPosted: Mon Jun 06, 2005 11:47 am    Post subject: Reply with quote

ok thanks!
i finally can use the buttons now :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group