Go Back   Se7enSins Forums > Other Modifications > Sony Consoles > PSP > PSP Homebrews

PSP Programming C/C++ help

This is a discussion about PSP Programming C/C++ help within the PSP Homebrews section, where you will Find homebrews for your PSP.; I'm doing a bit of programming for the PSP in C/C++, using the pspdev thing for compiling. I'm trying to make a function to print in color. Basically, I call my function, giving it a



Reply
 
LinkBack Thread Tools Display Modes
Old 03-27-2009, 12:51 PM   #1
Novice
  
 
miinaturvat1's Avatar
PSP Programming C/C++ help

I'm doing a bit of programming for the PSP in C/C++, using the pspdev thing for compiling.

I'm trying to make a function to print in color.

Basically, I call my function, giving it a string I want to print, and a RGBA (red, green, blue, alpha) hex color code. Then my function should print the message in that color.

I have some code to do this:

Code:
void    printStuff( long colour, char *message )
{
    int r;
    int g;
    int b;
    int a;
    int c;

    c = colour;

    r = c / 0x01000000 ;
    c -= (r * 0x01000000 );

    g = c / 0x00010000 ;
    c -= (g * 0x00010000 ) ;

    b = c / 0x00000100 ;
    c -= (b * 0x0100 );

    a = c;


    pspDebugScreenSetTextColor((a * 0x1000000) + (b * 0x10000) + (g * 0x100) + (r));
    pspDebugScreenPrintf(message);

}

In theory, if I use:

Code:
printStuff(0xFF7F0FF, "Hello");
...it should print the text "Hello" in orange.

It compiles fine, and when I do the sums on a calculator, it works fine.

But when I run it on the PSP, it doesn't work at all...



I think the problem lies when I'm doing "r = c / 0x01000000 ;", like it can't divide properly or something.

Does anyone know why this doesn't work?

Or, can anyone think of a better way of getting r, g, b and a from the color?

Thanks.

Join Now!

miinaturvat1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downgrading every psp firmware 3.03 and below I Doughboy PSP Modding 4 06-30-2009 09:20 AM
M33 Firware for Noobs I Doughboy PSP Modding 2 06-16-2008 10:26 PM
A small tutorial on How to Hack the PSP MattManiaMaxX PSP Tutorials 18 04-02-2008 12:16 AM
psp mod list avenged PSP Modding 0 02-25-2007 11:50 PM