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 

danzeff keyboard help

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



Joined: 27 Sep 2007
Posts: 3

PostPosted: Mon Oct 08, 2007 12:42 pm    Post subject: danzeff keyboard help Reply with quote

i am trying to make a homebrew application that you have to guess the capitals of all 50 states.
this is my source code


#include <String.h>
#include <Stdlib.h>
#include <Stdio.h>
#include <Time.h>
PSP_MODULE_INFO("States", 0, 1, 1);


/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}
char State[50][255] = {"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"};

char Capital[50][255] = {"Montgomery",
"Juneau",
"Phoenix",
"Little Rock",
"Sacramento",
"Denver",
"Hartford",
"Dover",
"Tallahassee",
"Atlanta",
"Honolulu",
"Boise",
"Springfield",
"Indianapolis",
"Des Moines",
"Topeka",
"Frankfort",
"Baton Rouge",
"Augusta",
"Annapolis",
"Boston",
"Lansing",
"St. Paul",
"Jackson",
"Jefferson City",
"Helena",
"Lincoln",
"Carson City",
"Concord",
"Trenton",
"Santa Fe",
"Albany",
"Raleigh",
"Bismarck",
"Columbus",
"Oklahoma City",
"Salem",
"Harrisburg",
"Providence",
"Columbia",
"Pierre",
"Nashville",
"Austin",
"Salt Lake City",
"Montpelier",
"Richmond",
"Olympia",
"Charleston",
"Madison",
"Cheyenne"};
int main() {
pspDebugScreenInit();
SetupCallbacks();

srand(time(0));

int NumCorrect = 0;
int NumIncorrect = 0;

while(true)
{
int RandNum = rand() % 49;

if(!strlen(State[RandNum]))
{
while(!strlen(State[RandNum]))
{
RandNum = rand() % 49;
}
}

char Answer[255];
char Buffer[255];

sprintf(Buffer, "What is the capital of %s?", State[RandNum]);
puts(Buffer);
gets(Answer);

if(!strcmp(Answer, Capital[RandNum]))
{
NumCorrect ++;

if(NumCorrect == 50)
{
puts("You guessed all 50 state capitals!\n"
"You win!!! (-:");

system("pause");

exit(EXIT_SUCCESS);
}

strcpy(State[RandNum], "");
strcpy(Capital[RandNum], "");
printf("%s, was correct! Excellent Job!\n", Answer);
}
else
{
NumIncorrect ++;

if(NumIncorrect == 3)
{
puts("You got three (3) answers incorrect.\n"
"You lose!!! )-:");

system("pause");

exit(EXIT_SUCCESS);
}

printf("%s, was incorrect. The correct answer was %s.\n", Answer, Capital[RandNum]);
}

printf("Your score is:\n"
"Correct : %i\n"
"Incorrect : %i\n\n", NumCorrect, NumIncorrect);

system("pause");
system("cls");
}

system("pause");

return(0);
}
i am actually porting it to the psp

i have the files for the danzeff keyboard could someone explain to me how i would use the keyboard with this program

thank you i nadvance
Back to top
View user's profile Send private message
qwerty6523



Joined: 27 Sep 2007
Posts: 3

PostPosted: Mon Oct 08, 2007 1:00 pm    Post subject: plz help Reply with quote

can someone plz just tell me how to use the danzeff keyboard
Back to top
View user's profile Send private message
Archaemic



Joined: 18 Mar 2007
Posts: 38

PostPosted: Mon Oct 08, 2007 1:30 pm    Post subject: Reply with quote

Impatient much. None of those system calls will work because they are dependent on an MS-DOS environment. system should never be used unless you really know what you are doing, and even then you probably shouldn't be using it. I don't think you even can use it on the PSP, but I have not tried.

I don't know how to use the danzeff keyboard library, though, so I can't help on that. I'd imagine it should be pretty easy to figure out if you look at the header file.

E] Wow, I just looked a little deeper at that...wow, so much wrong. None of those stdout functions will output anything because you don't have an stdout handler installed (nor should you need to given what you're doing). Also, header names are not capitalized. This is CASE SENSITIVE on a Unix environment (like Cygwin), and also, something%49 will return a value between 0 and 48...not what you're looking for. And that's just scratching the surface of the problems.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Mon Oct 08, 2007 5:58 pm    Post subject: Reply with quote

Man, that source is rubbish! I suspect trolldom based on that and the user name.
Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
cloudhunter



Joined: 17 Aug 2006
Posts: 86

PostPosted: Tue Oct 09, 2007 2:40 am    Post subject: Re: plz help Reply with quote

qwerty6523 wrote:
can someone plz just tell me how to use the danzeff keyboard


It looks like you have a lot to learn about programming on the PSP. Look at the SDK samples and other apps that use danzeff.

Cloudy
_________________
:)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
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