The above video goes away if you are a member and logged in, so log in now!

 Would you like to get all the newest Gaming News fromQJ.NET in your email each day? Want to learn more about the team who brings you the QJ news?

This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; o alright thanx i understand now. -= Double Post =- how would i make a fraction, i use the division ...

 Tweet
1. o alright thanx i understand now.
-= Double Post =-
how would i make a fraction, i use the division sign, but the answer always just comes out to 0, even for 1/4*2

2. You are probably using integers instead of floats. 1/2 will be 0 but 1.0f/2.0f will be 0.5f.

3. o alright thanx, man you are like the c++ god, lol thanx

4. hey if i type a decimal in, like .5 why does the program give me some rediculous number, and then closes.

double pi, a;
double result;
double r;

cout <<" The Formula for the area of a circle is: " <<endl;
Sleep (500);

cout << " 3.14 x R^2" <<endl;
Sleep (500);

Sleep (500);
// process:
pi = 3.141593;
a = 2;

result= pi* pow(r,2);

// print out the result:
cout <<" Your area is "<< result <<endl;

Sleep (1000);

this is the code

5. Originally Posted by Blackbelttcon
hey if i type a decimal in, like .5 why does the program give me some rediculous number, and then closes.

double pi, a;
double result;
double r;

cout <<" The Formula for the area of a circle is: " <<endl;
Sleep (500);

cout << " 3.14 x R^2" <<endl;
Sleep (500);

Sleep (500);
// process:
pi = 3.141593;
a = 2;

result= pi* pow(r,2);

// print out the result:
cout <<" Your area is "<< result <<endl;

Sleep (1000);

this is the code
Why are you putting in loads of Sleep()s?

6. Code:

...

Console input is expecting an integer, but you enter a float, it goes bang.

There are a number of ways to fix this, one of them is to change radius to be of double datatype. Another is to take the user input as a string and use stringstreams to parse the entered data.

7. ook so instead of having

have this

-= Double Post =-
Originally Posted by JaSo PsP
Why are you putting in loads of Sleep()s?

it makes the sentences comeout in a pattern, so its not just appearing.

8. are there any tutorials for patching something in the RAM?

9. Originally Posted by vodkkaa
are there any tutorials for patching something in the RAM?
What exactly do you want to do? Because if you already know what to patch, all you have to do is open up the ram, and write your patch from x to y bytes, then close it.

10. You don't "open" the RAM...you just create a pointer to the location in memory you want to patch. All of user-mode memory (partition 2) is directly r/w in user-mode.

11. How do you play a .pmf file?

I'm just getting started in C, but for my 1st order of business, I would like to make a 3.XX compatible Cintro.

Thanks,

~shizzy

12. Originally Posted by Mr_Shizzy
How do you play a .pmf file?

I'm just getting started in C, but for my 1st order of business, I would like to make a 3.XX compatible Cintro.

Thanks,

~shizzy
http://dl.qj.net/index.php?pg=12&fid=7926

That's got the source code in the archive.

13. ^^^ Cool. Thanks, this should be easy.
All I should have to do is, recompile it for 3.XX kernel.

14. Originally Posted by vodkkaa
are there any tutorials for patching something in the RAM?
Code:
So for example, if I wanna nop something in a module...
Code:
That kills the two first instructions from the module code. Not really useful but when combined with some reversing it'll be great :)

15. Or you could have just...
Code:
int * ptr = (int*)0x00000000;
Replacing 0x00000000 with the address that you want the pointer to point to instead of calling another function( _sw). Then just do what you must.
Code:
*ptr = 1234;

16. _sw is actually a macro--it does it directly in assembly instead of letting C(++) handle it however it sees fit.

17. Code:
char x;
int i;
char z;
for(i = 0x8A000000,x = 0,z = 0; i + x != 0x8BC00000;x++)
{
if(((_lb(i+x) == 82)) && ((_lb((i+x)+1) == 47)) && ((_lb((i+x)+2) == 85)))
{
_sb(0,i+x);
//_sb(0,(i+x)+1);
z++;
if(z == 3)
}
}
can someone explain this peice of code to me

18. Originally Posted by vodkkaa
Code:
char x;
int i;
char z;
for(i = 0x8A000000,x = 0,z = 0; i + x != 0x8BC00000;x++)
{
if(((_lb(i+x) == 82)) && ((_lb((i+x)+1) == 47)) && ((_lb((i+x)+2) == 85)))
{
_sb(0,i+x);
//_sb(0,(i+x)+1);
z++;
if(z == 3)
}
}
can someone explain this peice of code to me
Well, it's a perfect example of ugly code looking code.

Coolj gave you that?
It searches through memory in the Slim PSP for the text R/U and replaces it with null bytes.

19. Originally Posted by Moca
Coolj gave you that?
It searched through memory in the Slim PSP for the text R/U and replaces it with null bytes.
yeah but it means nothing to me because I cant make heads or tails of it. For example if I wanted to look throught the RAM for ms0 instead of R/U, what would the code look like.

20. Originally Posted by vodkkaa
yeah but it means nothing to me because I cant make heads or tails of it. For example if I wanted to look throught the RAM for ms0 instead of R/U, what would the code look like.
vodkkaa, that's because the code it very ugly, and wastes time.

Code:
if(((_lb(i+x) == 82)) && ((_lb((i+x)+1) == 47)) && ((_lb((i+x)+2) == 85)))
I don't know why coolj or HellDashX, whichever of them made this, added so many unneeded parenthesis. Also, if you read the conditions that they set, you would see that the program would never reach the code.
Code:
This is a bad piece of code to learn from considering that it has other issues. The if statement should only be true 1 time, unless if there are other instances of the text R/U in memory. It would only set the letter R to a null byte, and needlessly search through memory until the condition set in the loop becomes false.

MaTiAz and myself have stated how you would edit a byte in memory, given that you know its address.

21. so how would I go about finding the adresses in RAM. Would I have to dump the ram then find it with a hexeditor.

22. Is there some sort of available function which prevents the backlight from dimming if no buttons are pressed?

23. Originally Posted by vodkkaa
so how would I go about finding the adresses in RAM. Would I have to dump the ram then find it with a hexeditor.
That's what I've seen people doing up to now... And it's pretty boring to do that, but I don't know of any better way.

good luck m8 :)

24. Originally Posted by placo23
That's what I've seen people doing up to now... And it's pretty boring to do that, but I don't know of any better way.

good luck m8 :)
what do I use to dump the RAM in the XMB. is there some sort of plugin or something

25. Originally Posted by vodkkaa
what do I use to dump the RAM in the XMB. is there some sort of plugin or something
I guess you can use PSPLink to do that can't ya?

Cheers

26. im trying to install the cygwin and the psp toolchain on my friends PC, but when i try to install the toolchain i get this:
ERROR: Set \$PSPDEV befor continuing
.../depends/check-pspdev.sh: Failed

27. Set \$PSPDEV before continuing.
It's pretty clear.

28. Do something like:

set PSPDEV=X:/pspdev set PATH=%PATH%;%PSPDEV%/bin set PSPSDK=X:/pspdev/psp/sdk cmd

replace x's for the correct drive

29. nevermind

30. Originally Posted by Slasher
Is there some sort of available function which prevents the backlight from dimming if no buttons are pressed?
Call this function each loop:

Code:
scePowerTick(0);
You'll also need to include psppower.h and link -lpsppower.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

All times are GMT -8. The time now is 05:29 PM.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY