Alright, I keep running into this problem, I know it's not too complicated but here goes:
I am adding more to sg57's game, blah blah blah, and one of the new "things' is that after 100 kills another "weapon" is added, well, I have made a .png for the new weapon, and I have added that to the OSL_IMAGE area. Maybe because I am not familiar with his style of coding, I can't figure out where the part of the code is that he has his drawing code for the first weapon. It looks like this for the springphysics and also the springobject(how the object moves and etc):
and then there is the rdrawline area that looks like this:
And since this is probably an easy question, I feel nooby, but I don't really care, as I will be learning something newer. :p
Reply if you need to see more of the code, thanks.
02-14-2008, 11:56 PM
Xsjado7
Hey guys,
iv never really messed with pointers but i was reading about them last night and i dont think im quite understanding them.
First of all, how does
Code:
int *my_int;
differ from
Code:
int my_int;
?
Also, i dont see how they differ from normal ints. If you do
Code:
int my_int;
int *my_int2;
my_int = *my_int2;
its the same as
Code:
int my_int, my_int2;
my_int = my_int2;
isnt it?
02-15-2008, 03:43 AM
yaustar
Code:
int *my_int;
Allocates memory on the stack to store a memory address that 'points' to an int.
Code:
int my_int;
Allocates memory on the stack to store an int datatype.
Code:
int anInt = 0;
int * pInt = &anInt;
pInt now contains the value of the memory address of anInt.
Code:
*pInt = 5;
Dereferences pInt so now we are accessing what pInt was pointing to. anInt is now 5.
Code:
pInt = new int;
Allocated memory on the heap for an int datatype and the address is now stored in pInt.
Code:
*pInt = 6;
The int on the heap that the pInt is pointing to is now 6. anInt remains at 5 because pInt is no longer is storing the address of pInt.
int main()
{
int anInt = 5;
AddMe( &anInt );
//anInt is now 6
return 0;
}
02-15-2008, 05:00 AM
Xsjado7
Thanks for clearing that up Yaustar. I got a better understanding of them now, thanks again :D
02-15-2008, 05:25 AM
yaustar
Zitat:
Zitat von Xsjado7
Thanks for clearing that up Yaustar. I got a better understanding of them now, thanks again :D
Wait until you get to pointers to pointers to pointers :P.
Code:
int *** pppInt = NULL;
02-15-2008, 06:04 AM
Xsjado7
:eek: ...cant wait...
02-15-2008, 11:59 AM
SG57
Zitat:
Zitat von spike021
Alright, I keep running into this problem, I know it's not too complicated but here goes:
I am adding more to sg57's game, blah blah blah, and one of the new "things' is that after 100 kills another "weapon" is added, well, I have made a .png for the new weapon, and I have added that to the OSL_IMAGE area. Maybe because I am not familiar with his style of coding, I can't figure out where the part of the code is that he has his drawing code for the first weapon. It looks like this for the springphysics and also the springobject(how the object moves and etc):
and then there is the rdrawline area that looks like this:
And since this is probably an easy question, I feel nooby, but I don't really care, as I will be learning something newer. :p
Reply if you need to see more of the code, thanks.
It's not my style of coding, rather how OSlib does it's drawing. Check in the main function for oslStartDrawing()function being called. I try to do ALL my drawing-only code there, no thinking or input at all as the time it takes oslStartDrawing and oslEndDrawing to be called is where you'll earn your FPS (using OSlib). So calling it multiple times in a function or anywhere else will start to bog the FPS down. That physics function and drawline function are just to make it more readable within the main loop. (also, what happened to the formatting?)
P.S. sorry if you answered this yourself already, i went to the last thread and read what I missed while I was away ;)
02-15-2008, 12:35 PM
spike021
Zitat:
Zitat von SG57
It's not my style of coding, rather how OSlib does it's drawing. Check in the main function for oslStartDrawing()function being called. I try to do ALL my drawing-only code there, no thinking or input at all as the time it takes oslStartDrawing and oslEndDrawing to be called is where you'll earn your FPS (using OSlib). So calling it multiple times in a function or anywhere else will start to bog the FPS down. That physics function and drawline function are just to make it more readable within the main loop. (also, what happened to the formatting?)
P.S. sorry if you answered this yourself already, i went to the last thread and read what I missed while I was away ;)
Basically, I am just going to use OSlib to do the drawing, but I thought that I may just try within the code itself, but I see that won't work too well, so when I am back from school, I will get down to it.
And then I will just do what you said and check back in the function for what I am looking for, and it almost is working so hopefully not too much longer.
02-15-2008, 02:26 PM
Auraomega
Is there a way I can use an if statement in the way shown below (the code of course doesn't work, but it gives the idea better than I can explain)
as my code uses 9 of these, so my code is going to get messy if I do the above.
Thanks.
-Aura
02-15-2008, 02:47 PM
Archaemic
Code:
switch(somestring[someplace]) {
case '#': stuff; break;
case '/': stuff; break;
...
default: otherstuff; break;
}
Switch statements are your friend!
If you want to just have it be one thing for all cases, then just do this:
Code:
switch(somestring[someplace]) {
case '#': case '/':
stuff;
break;
...
default: otherstuff; break;
}
02-15-2008, 02:51 PM
SG57
No, you may be thinking of something like -
Code:
if(somestring[someplace] == ('#' || '/')) break;
But that doesn't work either. I believe it's saying
"if somestring[someplace]'s ASCII char value is true to ((if the value of the ASCII char '#' is true to 1 return true else false) OR (if the value of the ASCII char '/' is true to 1 return true else false))"
02-15-2008, 03:15 PM
Auraomega
Thanks Archaemic, I use switches a lot, but I've never come across the 2nd method which would probably suit my case a lot better.
@SG57
I basically want to check if a variable is equal to something, or to something else, 9 times over, all giving the same outcome (hence why I didn't use switches first), and in the shortest possible code to make life easier.
-Aura
-= Double Post =-
Ah, that didn't work, now I remember the other reason I didn't use switches... any breaks insides of switches count as a break from the switch, and not from an exterier while loop. So its back to the drawing board, unless there is another feature I am missing? (I never did work out what the continue was for).
This is slowing me down so much, but if someone could test out the physics game for me because I fixed it and it should definitely work now.
All that is needed is for it to be compiled, and then to play it to 100 kills. That is when a new ball should pop out and you should be able to use it.
If anyone is interested, PM for the download. Or reply back here.
02-15-2008, 04:23 PM
Auraomega
Zitat:
Zitat von SG57
Not sure what you mean there Aura.
Ignore me, I think I'm in dumb mode today... I forgot to place the stuff into the default case which is why the problems occured. I think I'll go sleep now and hopefully be in a more intelligent mood :p
-Aura
02-15-2008, 05:03 PM
SG57
I still love you Aura ;)
02-16-2008, 07:48 AM
yaustar
Zitat:
Zitat von Auraomega
Is there a way I can use an if statement in the way shown below (the code of course doesn't work, but it gives the idea better than I can explain)
Hi, i have been recently endeavoring into the whole PRX part of PSP and was wondering of which kernel command's i would have to use to be able to make a messagebox appear in the XMB :).
Thank's.
02-16-2008, 09:29 PM
SG57
daniel_was_here is such a loser haha get on irc k?
While waiting for a response we can test around til' we get it if you like
02-17-2008, 05:03 AM
Judas
Zitat:
Zitat von xdwhx
Hi, i have been recently endeavoring into the whole PRX part of PSP and was wondering of which kernel command's i would have to use to be able to make a messagebox appear in the XMB :).
Thank's.
I believe there's a library called VSHBlit that does that for you. Made by PSPJunkie I think.
02-17-2008, 07:06 AM
yaustar
Zitat:
Zitat von SG57
yaustar - From your experience, would you inline that function? I'm still having a little trouble judging when to myself :(
Yeah, it is small enough to inline so I would if I remember to.
02-17-2008, 01:13 PM
SG57
:)
Alright thanks yaustar. (I dunno if you can release any info or not, but at your job - does it require you to optimize completely? so much so you have to inline? I'm just curious, I dunno if it violates a contract or something that you've signed so :()
02-17-2008, 02:07 PM
BlackShark
Zitat:
Zitat von SG57
:)
Alright thanks yaustar. (I dunno if you can release any info or not, but at your job - does it require you to optimize completely? so much so you have to inline? I'm just curious, I dunno if it violates a contract or something that you've signed so :()
lol.
02-17-2008, 04:10 PM
yaustar
Zitat:
Zitat von SG57
:)
Alright thanks yaustar. (I dunno if you can release any info or not, but at your job - does it require you to optimize completely? so much so you have to inline? I'm just curious, I dunno if it violates a contract or something that you've signed so :()
Not really. Since I work at a high level area, micro optimisations such as inlining code will barely make a dent in the CPU usage compared to the rest of the system.
I inline where I can for things like getters and setters but I don't give it much priority with anything else. I do have to be careful and aware with my algorithms though especially anything with large loops.
Also optimisations don't stop with performance, data usage is also an issue in games.
Eh, it just couldn't resolve the hostname. Judging by where it was when it failed, you should have everything installed already except for PSPLink.
02-17-2008, 10:38 PM
SG57
As Arch said, that's a common problem that isn't a problem ;)
If you intend to use PSPLink, you can install it via typing
Code:
make && make release
in the PSPlink folder in psptoolchain (build/ i think).
If not don't worry about it too much.
02-17-2008, 10:44 PM
Archaemic
Or you can just run "./toolchain.sh 9" :p
02-17-2008, 10:57 PM
Anti-QuickJay
can psplink work on 3.90 m33?
02-17-2008, 10:58 PM
Archaemic
Well, it works on 3.80 M33, and they didn't really change much between 3.80 and 3.90, so probably yes.
02-17-2008, 11:57 PM
Xsjado7
Just a quick thread, whats the name of the main thread used in games. The one that exports the int Main() function? thanks
02-18-2008, 01:18 AM
SilverSpring
Zitat:
Zitat von Xsjado7
Just a quick thread, whats the name of the main thread used in games. The one that exports the int Main() function? thanks
Not sure what you mean by "exports the main() function", only module_start() is exported by the game not the main() function itself.
But I think what you're looking for is "user_main", the name of the main thread. It's the same on all games (well it should be anyway), it's set from the Sony SDK's crt.
02-18-2008, 04:35 AM
Xsjado7
lol i was in a rush and the word export came to mind for some reason. What i meant is which thread starts/runs the main() function. thanks for answering that :D
02-18-2008, 05:42 AM
SilverSpring
Zitat:
Zitat von Xsjado7
lol i was in a rush
Yea I figured as much, especially the part when you wrote "Just a quick thread". I presume you mean "Just a quick question" :p.
02-18-2008, 08:38 AM
Slasher
This should be an easy one...
How do I update my toolchain?
02-18-2008, 08:56 AM
tommydanger
Assuming your toolchain isn't that much outdated(~1year) i.e. uses the new style toolchain
use
sh ./toolchain 6
6 updates the pspsdk
in case your really want to just update your toolchain go into that directory and type svn co if you got it straight from the svn server
02-18-2008, 08:57 AM
hibbyware
./toolchain.sh
But if you dont want to update everything then pick what you want to update and add the number from this list,