QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

MathOps - A simple example

This is a discussion on MathOps - A simple example within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hey, for everyone who has finished doing Yeldarb's first two tutorials. I wrote a really simple program to help learn ...

Reply
 
LinkBack Thread Tools
Old 08-08-2005, 08:16 AM   #1
 
OmahaStylee's Avatar
 
Join Date: Aug 2005
Location: Where you live!
Posts: 133
Trader Feedback: 0
Default [RELEASE] MathOps - A simple example

Hey, for everyone who has finished doing Yeldarb's first two tutorials. I wrote a really simple program to help learn more functions, and to just practice. I think you guys would really appreciate it, and hopefully it can help you be on your way to creating your own program. There is a lot more information in the readme file, but if you still need help or anything, email me at OmahaStylee@gmail.com. Have fun!

http://www.sr-films.com/psp/MathOps_v0.1.zip
__________________
[center][img]http://i3.photobucket.com/albums/y96/HomelessJamaican/Other/er_banner_waves.jpg[/img][/center]
[COLOR=Navy][FONT=Tahoma][CENTER][B]Yes I am a noob, but I'll get there.[/B] [/CENTER][/FONT][/COLOR]
OmahaStylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2005, 08:27 AM   #2
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

thanks
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2005, 08:28 AM   #3
 
OmahaStylee's Avatar
 
Join Date: Aug 2005
Location: Where you live!
Posts: 133
Trader Feedback: 0
Default

Soadnation, I didn't have time to scan completely through your code, but one thing that really stood out is this.
Code:
 // My second PSP program - Hello World(advanced)

/*
This was made by Mitch Pordon.
It is a simple program that says
different thing with different key strokes.
*/
// Starting Code

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <string.h>
PSP_MODULE_INFO("Communication",0,1,1);

#define printf pspDebugScreenPrintf

/* 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;
}

int main()
{
//Active Controlls
SceCtrlData pad;

sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while(1){
// Set it up to read the Controls
sceCtrlReadBufferPositive(&pad, 1);
//End
pspDebugScreenInit();
SetupCallbacks();

pspDebugScreenSetXY(0,0);
printf("Hit 'R' then 'L' then left");
/*Start if's*/
When using if() or while() functions, you need to use brackets to
show what is included in the function. Also, no semicollon.
Code:
if (pad.Buttons & PSP_CTRL_RTRIGGER) {
/*Start writing the screen(first time)*/
pspDebugScreenSetXY(0,7);
printf("Hello World!");
/* End writing to the screen(First time)*/
}

if (pad.Buttons & PSP_CTRL_LTRIGGER) {
/*start writing to the screen(second time)*/
pspDebugScreenSetXY(0,14);
printf("How's it going?");
/*End writing to screen(second time)*/
}
if (pad.Buttons & PSP_CTRL_DOWN) {
/*Start writing to screen(Last time)*/
pspDebugScreenSetXY(0,21);
printf("See you later!");
/*End writing to screen(last time)*/
}
sceKernelSleepThread();
return 0;

}
__________________
[center][img]http://i3.photobucket.com/albums/y96/HomelessJamaican/Other/er_banner_waves.jpg[/img][/center]
[COLOR=Navy][FONT=Tahoma][CENTER][B]Yes I am a noob, but I'll get there.[/B] [/CENTER][/FONT][/COLOR]
OmahaStylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2005, 08:48 AM   #4
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

How do you round numbers?
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2005, 11:28 AM   #5
 
Join Date: Jun 2005
Posts: 375
Trader Feedback: 0
Default

thank you for helping me. i didnt read your source close enough., that wasnt the only problem though. it kept saying there was an error with the last line. i got fed up with it and for some strange reason i decided to put 1 more "}"
at the end. and it worked. im guesing i had an open one somehwere in the code. now i just gota put it on my psp

ok i piut it on my psp and nothing happens. the screen shows up and writing apears. but when i hit the button the writing that is suppos to shoiw doesnt.
soadnation is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2005, 06:32 PM   #6
 
OmahaStylee's Avatar
 
Join Date: Aug 2005
Location: Where you live!
Posts: 133
Trader Feedback: 0
Default

Quote:
Originally Posted by soadnation
thank you for helping me. i didnt read your source close enough., that wasnt the only problem though. it kept saying there was an error with the last line. i got fed up with it and for some strange reason i decided to put 1 more "}"
at the end. and it worked. im guesing i had an open one somehwere in the code. now i just gota put it on my psp

ok i piut it on my psp and nothing happens. the screen shows up and writing apears. but when i hit the button the writing that is suppos to shoiw doesnt.
Well, all I can say is keep error checking. Just change things, look for things that don't make sense. And if all else fails, start over. I started over twice when making MathOps.
__________________
[center][img]http://i3.photobucket.com/albums/y96/HomelessJamaican/Other/er_banner_waves.jpg[/img][/center]
[COLOR=Navy][FONT=Tahoma][CENTER][B]Yes I am a noob, but I'll get there.[/B] [/CENTER][/FONT][/COLOR]
OmahaStylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2005, 07:05 PM   #7
 
Join Date: Jun 2005
Posts: 375
Trader Feedback: 0
Default

why did u have to start over? just wondering.
soadnation is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-10-2005, 02:10 AM   #8
 
OmahaStylee's Avatar
 
Join Date: Aug 2005
Location: Where you live!
Posts: 133
Trader Feedback: 0
Default

Sometimes I just get lost in all of the code and can't remember why I did certain things. So just starting fresh kinda clears it up. Plus once I have the idea of how the script is going to work, I can duplicate it easy.
__________________
[center][img]http://i3.photobucket.com/albums/y96/HomelessJamaican/Other/er_banner_waves.jpg[/img][/center]
[COLOR=Navy][FONT=Tahoma][CENTER][B]Yes I am a noob, but I'll get there.[/B] [/CENTER][/FONT][/COLOR]
OmahaStylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-10-2005, 06:50 AM   #9
 
Join Date: Jun 2005
Posts: 375
Trader Feedback: 0
Default

where did u lkearn the command thing(liie pad.buttons & PSP_CTRL_then the button u want) if u leaned it from a site what site?
soadnation is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-10-2005, 06:49 PM   #10
 
OmahaStylee's Avatar
 
Join Date: Aug 2005
Location: Where you live!
Posts: 133
Trader Feedback: 0
Default

I originally saw the code in Redbluefire's guessing game. Then, I looked in the file that holds the code for control functions and learned all the buttons names.
__________________
[center][img]http://i3.photobucket.com/albums/y96/HomelessJamaican/Other/er_banner_waves.jpg[/img][/center]
[COLOR=Navy][FONT=Tahoma][CENTER][B]Yes I am a noob, but I'll get there.[/B] [/CENTER][/FONT][/COLOR]
OmahaStylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-10-2005, 07:02 PM   #11
 
Join Date: Jun 2005
Posts: 375
Trader Feedback: 0
Default

ok im gona download that then try over
soadnation is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
mathops , simple

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 06:19 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us