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 

retrieving nickname

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



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Mar 31, 2006 4:54 pm    Post subject: retrieving nickname Reply with quote

Hi Guys,
I want to retrieve the system nickname "Art" in the shortest code
possible. The routine doen't need to accomodate any longer names.
Code:

      deleted embarrasing sample :)


What's wrong with this?
It prints blank space to the screen except for the ":" and "Nickname" strings.
Cheers, Art.


Last edited by Art on Fri Mar 31, 2006 10:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
elz



Joined: 21 Nov 2005
Posts: 3

PostPosted: Fri Mar 31, 2006 8:21 pm    Post subject: Reply with quote

Code:

char nameBuffer[50];
sceUtilityGetSystemParamString(PSP_SYSTEMPARAM_ID_STRING_NICKNAME, nameBuffer, 50);
printf(nameBuffer);
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Mar 31, 2006 10:16 pm    Post subject: Reply with quote

Thanx a lot nameBuffer, that worked a treat :)
I wonder why more homebrew programs aren't personalised this way.
It seems trivial when Sony does it with a game, but would be a new look
for homebrew.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Apr 01, 2006 4:04 pm    Post subject: Reply with quote

Thanx. Well at least as a 'noob' I did something for myself.
Learned the syntax for 1 whole utility function after an hour of stuffing around.
I wanted a true or false condition, I don't know if this is the best way,
and this is homebrew so I access global variables within functions all the time.
Code:

int bob = 0;
char namebuffer[50];

// bob will equal 1 if PSP nickname is "Bob".

void check_nick() {
      char nick[] = "Bob";
      sceUtilityGetSystemParamString(PSP_SYSTEMPARAM_ID_STRING_NICKNAME, namebuffer, 50);
         if(strcmp(namebuffer,nick)==0) {
         bob = 1;
         }
}
Back to top
View user's profile Send private message
polomint



Joined: 11 Mar 2006
Posts: 5
Location: Colne, Lancashire, UK

PostPosted: Sat Apr 01, 2006 6:52 pm    Post subject: Reply with quote

Why not use summat like this instead. it returns true if the nick is correct.

Code:


// check_nick will return true if name is correct

bool check_nick(char* nick) {

  char namebuffer[50];
          sceUtilityGetSystemParamString(PSP_SYSTEMPARAM_ID_STRING_NICKNAME,  namebuffer, 50);
         if(strcmp(namebuffer,nick)==0) {
         return true;
         } else {return false};
}




use it as so ...

Code:
char name[] = "bob";
bool ok = check_nick(name);
if (ok)
{
  // name is ok
} else
{
  // name is not ok
}




Bear in mind, I think i've coded it right, haven't tested it tho, :)
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Apr 01, 2006 7:01 pm    Post subject: Reply with quote

Ok, thanks, I'm still learning as you can see.
I wanted to post something that did the job in case someone else
searched about it later on.
There are already small samples floating around checking MAC Address,
but not the nickname.
Art.
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