Seite 93 von 340 ErsteErste ... 43 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 143 193 ... LetzteLetzte
Zeige Ergebnis 2.761 bis 2.790 von 10174

C/C++ Programming Help Thread

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; I've found what I was doing wrong ! I was using the tiff changeBuffer function......

  
  1. #2761
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    I've found what I was doing wrong !
    I was using the tiff changeBuffer function...



  2. #2762
    QJ Gamer Silver
    Points: 14.087, Level: 77
    Level completed: 10%, Points required for next Level: 363
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Germany
    Beiträge
    926
    Points
    14.087
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard Re: C/C++ Programming Help Thread

    Zitat Zitat von SG57
    Raphael & Insomniac [& yaustar] - This gives me a slow, dark green (from cube i drew after it ) blob it looks like. Im sure it is theh sky box, but doesnt have hte texture and doesnt look right as it is dark green, even with GL_DECAL or GL_REPLACE....

    Code:
    ...
    Im thinking of getting rid of the scaling, along with translation call in the function, and using the verticies points for where to place them, and to 'scale' them (i wont actually scale htem, rather just build the sky box the size it is, without scaling a 1x1x1 cube).
    You really should change that code. As it is, it is predestinated to be slow (even on PC) and cause problems.
    Do the tesselation for each side of the skybox, so that you avoid all those texture swaps. They are very costly and should be avoided whereever possible!
    Also I'm not sure about your tesselation algorithm, since I don't know what STEP is supposed to be as well as why you step i and j by 5. Also your coordinates seem off.
    Say you want to subdivide a big QUAD into 4x4 parts with constant z (front or back of skybox):
    Code:
    glBindTexture(GL_TEXTURE_2D,mytex);
    glScalef( width, height, length );
    glBegin(GL_QUADS); // dunno if multi-quads within one GL_QUADS block is possible on PSPGL
    for (i=0;i<4;i++)
     for (j=0;j<4;j++)
     {
        glTexture2f( j/4.0f, i/4.0f ); glVertex3f( j/4.0f, i/4.0f, 1.0f );
        glTexture2f( (j+1)/4.0f, i/4.0f ); glVertex3f( (j+1)/4.0f, i/4.0f, 1.0f );
        glTexture2f( (j+1)/4.0f, (i+1)/4.0f ); glVertex3f( (j+1)/4.0f, (i+1)/4.0f, 1.0f );
        glTexture2f( j/4.0f, (i+1)/4.0f ); glVertex3f( j/4.0f, (i+1)/4.0f, 1.0f );
     }
    glEnd();
    You should be able to adopt that code to create side and top/bottom quads too and also change the subdivision depth. To optimize that for drawing speed, you could also use TRIANGLE_STRIP to create one row of the subdivision, but I'll leave that to you to figure out if you want.
    Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
    Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
    Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
    Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.

  3. #2763
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    I am trying to make my first prx , but i he isnt working , no errors or warnings
    Spoiler for main:

    Code:
    #include <pspdebug.h>
    #include <pspctrl.h>
    #include <string.h>
    #include <malloc.h>
    #include <stdio.h>
    #include <pspdisplay.h>
    #include <pspkernel.h>
    #include <assert.h>
    #include <stdlib.h>
    #include <psppower.h>
    
    #define printf pspDebugScreenPrintf
    
    
    PSP_MODULE_INFO("hello world", 0x1000, 1, 1);
    
    
    int main()
    {
        pspDebugScreenInit();
        
    while(1)
    {
            pspDebugScreenSetXY(0,0);
            printf("hello");
            }
    	return 0;
                }
    void* getModuleInfo(void)
    {
    	return (void *) &module_info;
    }



    Spoiler for exports:

    # Define the exports for the prx
    PSP_BEGIN_EXPORTS

    # These four lines are mandatory (although you can add other functions like module_stop)
    # syslib is a psynonym for the single mandatory export.
    PSP_EXPORT_START(syslib, 0, 0x8000)
    PSP_EXPORT_FUNC_HASH(modu le_start)
    PSP_EXPORT_VAR_HASH(modul e_info)
    PSP_EXPORT_END

    # Export our function
    PSP_EXPORT_START(MyLib, 0, 0x0001)
    PSP_EXPORT_FUNC_HASH(getM oduleInfo)
    PSP_EXPORT_END

    PSP_END_EXPORTS



    Spoiler for makefile:
    TARGET = file1
    OBJS = main.o
    BUILD_PRX=1
    # Define the name of our custom exports (minus the .exp extension)

    PRX_EXPORTS=exports.exp
    USE_KERNEL_LIBS=[1,0]
    USE_PSPSDK_LIBC = 1
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    LIBS = -lpsppower




    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak

  4. #2764
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    RAphael -

    #define STEP (1.0f/256.0f)

    My textures are 256x256, and I had 5 as an interval, because it was slow, and still is, and doesnt work. Ill use your code their and adopt it to fit my needswhen i get home from school. But honestly, shouldn't I just be able to make some minor number tweaks to that right there. For each side of the cube, id change values, but that right there is a base framework to use? Or should I change that to be exact andforget about scaling? My first skybox function did that... MAde huge quads, they culled very easily.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  5. #2765
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard Need some help...stuck at splash screen!

    Code:
    int i; 
    char* tempstr;
    char number;
    tempstr= "Trial and error since 2 days";
    initGraphics();
    for(i=0;i<255;i++)
    {
    Color mycolor=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    sprintf(number,"The value of I must be shown here but it doesn't %i",i);
    }
    flipScreen();
    Compiles fine. I either get a black screen or Just the centered text in white colorNO CHANGE IN COLOR DURING LOOP happens! but what I want [Go from black to white using RGB. Doesn't happen].

    sprintf yields no result.
    Please Help :Cry: ASAP,better.
    I've already charged psp 2wice for this.

  6. #2766
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mr305
    Code:
    int i; 
    char* tempstr;
    char number;
    tempstr= "Trial and error since 2 days";
    initGraphics();
    for(i=0;i<255;i++)
    {
    Color mycolor=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    sprintf(number,"The value of I must be shown here but it doesn't %i",i);
    }
    flipScreen();
    Compiles fine. I either get a black screen or Just the centered text in white colorNO CHANGE IN COLOR DURING LOOP happens! but what I want [Go from black to white using RGB. Doesn't happen].

    sprintf yields no result.
    Please Help :Cry: ASAP,better.
    I've already charged psp 2wice for this.
    The first argument of sprintf is char*, therefor you need to pass the address of number (&number). But you would get an overflow. You should use an array.

    I believe it doesn't change color because you only flip the screen after drawing all of them, therefore only the last one drawn will be shown.

    Also sprintf won't print anything to the screen, printf does that.

    try
    Code:
    int i; 
    char* tempstr;
    tempstr= "Trial and error since 2 days";
    initGraphics();
    for(i=0;i<255;i++)
    {
    Color mycolor=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    printf("The value of I must be shown here but it doesn't %i",i);
    flipScreen();
    }


  7. #2767
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Waterbottle
    The first argument of sprintf is char*, therefor you need to pass the address of number (&number). But you would get an overflow. You should use an array.

    I believe it doesn't change color because you only flip the screen after drawing all of them, therefore only the last one drawn will be shown.

    Also sprintf won't print anything to the screen, printf does that.

    try
    Code:
    int i; 
    char* tempstr;
    tempstr= "Trial and error since 2 days";
    initGraphics();
    for(i=0;i<255;i++)
    {
    Color mycolor=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    printf("The value of I must be shown here but it doesn't %i",i);
    flipScreen();
    }
    Thanx for reply, be here I'll post the result. PLEASE :o
    Q: i don think DebugScreenPrintf, which needs debugscreeninit, works after initgraphics.

  8. #2768
    QJ Gamer Blue
    Points: 3.624, Level: 37
    Level completed: 83%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    67
    Points
    3.624
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Ok, so here is my problem :

    I've just began learning C++ for the PSP.

    I've been playing around and having succesfull attempts (making the USB Mass Storage example as a prx as I still don't know anything concerning threads ^^)

    But i've saw that the prx loader calls "void *getModuleInfo(void);" to import getModuleInfo from the loaded prx.

    I need the prx to clear the screen.
    But if i call pspDebugScreenClear(); withtout calling pspDebugScreenInit(); , the screen isn't cleared.
    The problem if that if i call pspDebugScreenInit(); , the prx loader can't take back the control of the debug screen.

    So I created a function in the prx_loader :
    Spoiler for function:
    void* clearDebugScreen(void)
    {
    pspDebugScreenSetXY(0, 0);
    pspDebugScreenClear();
    }


    and then, in the prx i add "void *clearDebugScreen(void);" and then in my main procedure, i call "clearDebugScreen()" somewhere. This is what the prx loader does. Ok ?
    Now here's the problem, the prx_loader compiles fine, but the prx complains about : "main.c.text+0x230): undefined reference to `clearDebugScreen'"
    I tought this was due to the fact that I was trying to compile as a prx, but I tried changing the makefile so it can be an elf, but I get the same error

    Any idea ?

  9. #2769
    Developer
    Points: 14.558, Level: 78
    Level completed: 27%, Points required for next Level: 292
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    166
    Points
    14.558
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mr305
    Code:
    int i; 
    char* tempstr;
    char number;
    tempstr= "Trial and error since 2 days";
    initGraphics();
    for(i=0;i<255;i++)
    {
    Color mycolor=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    sprintf(number,"The value of I must be shown here but it doesn't %i",i);
    }
    flipScreen();
    Compiles fine. I either get a black screen or Just the centered text in white colorNO CHANGE IN COLOR DURING LOOP happens! but what I want [Go from black to white using RGB. Doesn't happen].

    sprintf yields no result.
    Please Help :Cry: ASAP,better.
    I've already charged psp 2wice for this.
    Code:
    int i; 
    char tempstr[] = "Trial and error since 2 days";
    char number[100];
    Color mycolor;
    initGraphics();
    for(i=0;i<255;i++)
    {
    color=RGB(i,i,i);
    printTextCentered(136,tempstr,mycolor);
    sprintf(number,"The value of I must be shown here but it doesn't %d",i);
    }
    flipScreen();
    1.)char* tempstr; is a pointer to a char, to output your tempstr you need to allocate memory for it, like:char tempstr[] = "Trial and error since 2 days";
    which is now a char _array_!
    2.)char number; how is it supposed to store a string? you have to allocate memory for it to to store your string
    3.) Do never declare variables inside a loop! never it's very bad programming behaviour, declare it before the loop
    4.) to show an int, use %d

  10. #2770
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von tommydanger
    1.)char* tempstr; is a pointer to a char, to output your tempstr you need to allocate memory for it, like:char tempstr[] = "Trial and error since 2 days";
    which is now a char _array_!
    2.)char number; how is it supposed to store a string? you have to allocate memory for it to to store your string
    3.) Do never declare variables inside a loop! never it's very bad programming behaviour, declare it before the loop
    4.) to show an int, use %d
    I tried to resolve issues:

    Code:
    int main(void)
    {
    int i; 
    SceCtrlData pad;
    char* tempstr= "text here"; 
    
    
    Code:
    IF I TRY , char* tempstr[100 ]= "text here";
    main.c:22: error: invalid initializer
    main.c:29: warning: passing argument 2 of 'printTextCentered' from incompatible
    pointer type
    main.c:30: warning: passing argument 1 of 'sprintf' makes pointer from integer without a cast
    int number; Color mycolor; initGraphics(); for(i=0;i<255;i++) { mycolor=RGB(i,i,i); printTextCentered(136,tempstr,mycolor); sprintf(number,"The number i is %d",i); } flipScreen(); } }
    All I get is a BLACK screeen! :Argh:

  11. #2771
    QJ Gamer Blue
    Points: 3.624, Level: 37
    Level completed: 83%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    67
    Points
    3.624
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Ok, nevermind, I figured it out with lookking at the MyLib.s

    I created a file MyLib2.s

    Does having that line (STUB_START "MyLib",0x00090000,0x0001 0005) in both files can conflict (for the second I only changed "MyLib" to "MyLib2") ?

    EDIT : Oh noes, it compile, but it doesn't run the function

  12. #2772
    Developer
    Points: 14.558, Level: 78
    Level completed: 27%, Points required for next Level: 292
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    166
    Points
    14.558
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    well, how you are supposed to see the text "The number i is $anynumber" without printing to the screen? :P
    hint: read the usage of sprintf again ;)

  13. #2773
    QJ Gamer Silver
    Points: 14.087, Level: 77
    Level completed: 10%, Points required for next Level: 363
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Germany
    Beiträge
    926
    Points
    14.087
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    #define STEP (1.0f/256.0f)

    My textures are 256x256, and I had 5 as an interval, because it was slow, and still is, and doesnt work. Ill use your code their and adopt it to fit my needswhen i get home from school. But honestly, shouldn't I just be able to make some minor number tweaks to that right there. For each side of the cube, id change values, but that right there is a base framework to use? Or should I change that to be exact andforget about scaling? My first skybox function did that... MAde huge quads, they culled very easily.
    Well, that would obviously be slow with 255x255 = 65k subdivisions, since you'd render 6x 65k = 360k+ quads = 700k triangles... too much for the PSP.
    Even with a step of 5 you have 51x51 = 250 divisions, meaning 250x6x2 = 3k triangles. Pretty much for just a skybox. Try something lower, like 16x16 and step up until the culling problems disappear. Just use the code as I gave you and make that 4's a #define to easily change the subdivision depth.
    Then do that code snippet 6 times for each of the cube faces (apply the coordinates accordingly). It should work.
    Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
    Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
    Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
    Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.

  14. #2774
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    That's what i am planning to do. As for a skybox texture, I was wondering...

    If I do use a 16x16 skybox texture, than rather than have a horribly pixelated and blurry 'sky', I should probably make it reptitivly place the texture upon the object, instead of scaling it. I know how to do it, change the properties of the texture from GL_LINEAR to something else, ill google it when i code later today...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  15. #2775
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    I think Raphael meant 16x16 subdivisions with your 256x256 texture...

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

  16. #2776
    QJ Gamer Blue
    Points: 3.642, Level: 37
    Level completed: 95%, Points required for next Level: 8
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    99
    Points
    3.642
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys. I have a question (first question at qj! please respond kindly!). Currently, i am on the 4th tutorial at psp-programming.com (very good site), and i wanted to know, is there an easier way for image processing? This is my code (with comments i added to help me); please respond by telling me which part is not necessary (besides the comments of course):
    Spoiler for Spoiler for Simple Image Processing:

    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    #include "graphics.h"
    #define printf pspDebugScreenPrintf
    #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
    PSP_MODULE_INFO("Image Display Program", 0, 1, 1);
    /* Same as:
    int Max(int X, int Y) {
    if(X>Y) {
    return X
    } else {
    return Y
    }
    } */

    /* 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);
    sceKernelRegisterExitCall back(cbid);

    sceKernelSleepThreadCB();

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

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

    return thid;
    }



    /* Main Loop */

    int main() {
    char buffer[200];
    Image* black;

    pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();

    /* Load your images */
    sprintf(buffer, "black.png");
    black = loadImage(buffer);
    /* If image loading fails, print out result of failure */
    if (!black) {
    //Image load failed
    printf("Image load failed!\n");
    } else {

    int x = 0;
    int y = 0;
    sceDisplayWaitVblankStart ();

    while (x < 480) {
    while (y < 272) {
    /* Blit your variable image on the screen. First two for loading parts of image,
    second two for length and width of image, third variable, last two set x and y*/
    blitAlphaImageToScreen(0 ,0 ,480 , 272, black, x, y);
    /* Define height of image */
    y += 272;
    }
    /* Define length of image */
    x += 480;
    /* This line used to reset Y for letting X be alone*/
    y = 0;
    }
    /* Print out image memory; put image memory in effect */
    flipScreen();
    }

    sceKernelSleepThread();
    return 0;
    }


    Edit: Never mind. I fixed it. Wasn't hard. Sorry. However, now i have a newer question. How do i use a background for a counter? What i mean is, how do i combine the 3rd and 4th tutorial to use a simple image while having a counter? Thanks, help is appreciated. :)
    Geändert von Xylem (02-14-2007 um 08:11 PM Uhr)

  17. #2777
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Xylem - Either set the Debug console's framebuffer address to match that of the graphic's library, or just use the graphics library text porinting function:
    Code:
    printTextScreen( x,y, string, color);
    An example:
    Code:
    #define green 0x0000FF00L
    
    int main() {
      Image * background = Image.load("background.png");
      int counter = 0;
      char counter_buffer[5];
    
      for(;;) { // indefinate loop
        screen:blit(0,0,background);
        printTextScreen( 227,131,counter_buffer, green);
    
        sceDisplayWaitVblank(); // or w/e the function is called
        flipScreen();
    
        if(counter>9999) { counter=0; } else { counter++; } // this prevents a buffer overflow, as well with the next line
        snprintf(counter_buffer,4,"%i",counter);
      }
      return 0;
    }

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  18. #2778
    QJ Gamer Green
    Points: 9.253, Level: 64
    Level completed: 68%, Points required for next Level: 97
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Australia - A.C.T.
    Beiträge
    1.517
    Points
    9.253
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    how do you get txt to print on the xmb, tryed the testprx but nothing seems to happen when loaded in the xmb. can any one help??

  19. #2779
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    ----other code---
    TRIED this buffer = itoa (rand,status,10);
    Tried this too itoa (rand,status,10);
    
    --other code that uses status---
    How do I convert a int type to a char or char*?
    I get these errors:
    [CODE]
    main.o: In function `main':
    main.c.text+0x168): undefined reference to `itoa'
    main.c.text+0x1c4): undefined reference to `itoa'
    collect2: ld returned 1 exit status
    [CODE]

    I also tried

    Code:
    extern "C"
    {
    #include <stdio.h> 
    #include <stdlib.h>
    }
    Please help!

  20. #2780
    QJ Gamer Silver
    Points: 7.385, Level: 57
    Level completed: 18%, Points required for next Level: 165
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Finland
    Beiträge
    752
    Points
    7.385
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mafia1ft
    how do you get txt to print on the xmb, tryed the testprx but nothing seems to happen when loaded in the xmb. can any one help??
    Use the text blitter from the devhook VSHEX.
    wheeee =:D

  21. #2781
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mr305
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    ----other code---
    TRIED this buffer = itoa (rand,status,10);
    Tried this too itoa (rand,status,10);
    
    --other code that uses status---
    How do I convert a int type to a char or char*?
    I get these errors:
    [CODE]
    main.o: In function `main':
    main.c.text+0x168): undefined reference to `itoa'
    main.c.text+0x1c4): undefined reference to `itoa'
    collect2: ld returned 1 exit status
    [CODE]

    I also tried

    Code:
    extern "C"
    {
    #include <stdio.h> 
    #include <stdlib.h>
    }
    Please help!
    Google misleads !! :Argh: :Argh: :Argh:
    sprintf() 's the king.
    I guess done with scoring system!

  22. #2782
    Developer
    Points: 12.154, Level: 72
    Level completed: 26%, Points required for next Level: 296
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Dubuque
    Beiträge
    423
    Points
    12.154
    Level
    72
    My Mood
    Lurking
    Downloads
    1
    Uploads
    0

    Standard

    itoa won't work in Linux/Cygwin because it's not ANSI C so their stdlib doesn't have it.

    If you really need itoa though, like if you are working with non-base 10 numbers, you can just write your own and include it in your program.
    Code:
    /**
    	
     * Ansi C "itoa" based on Kernighan & Ritchie's "Ansi C"
    	
     */
    	
    void strreverse(char* begin, char* end) {
    	
    	char aux;
    	
    	while(end>begin)
    	
    		aux=*end, *end--=*begin, *begin++=aux;
    	
    }
    	
    void itoa(int value, char* str, int base) {
    	
    	static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";
    	
    	char* wstr=str;
    	
    	int sign;
    	
    
    	
    	// Validate base
    	
    	if (base<2 || base>35){ *wstr='\0'; return; }
    	
    
    	
    	// Take care of sign
    	
    	if ((sign=value) < 0) value = -value;
    	
    
    	
    	// Conversion. Number is reversed.
    	
    	do *wstr++ = num[value%base]; while(value/=base);
    	
    	if(sign<0) *wstr++='-';
    	
    	*wstr='\0';
    	
    
    	
    	// Reverse string
    	
    	strreverse(str,wstr-1);
    	
    }
    Geändert von jsharrad (02-15-2007 um 09:45 AM Uhr)
    PSP Demo Videos (updated 11/29/08)
    MinerPSP Coder

  23. #2783
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    how do you instal the psp-newlib
    the normal
    ./bootstrap; ./configure; make; make install
    isnt working

  24. #2784
    QJ Gamer Green
    Points: 9.253, Level: 64
    Level completed: 68%, Points required for next Level: 97
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Australia - A.C.T.
    Beiträge
    1.517
    Points
    9.253
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von MaTiAz
    Use the text blitter from the devhook VSHEX.
    can some plz give me a hello world exemple, that would be great because i don't realy understand what you mean by use the text blitter from devhook.

  25. #2785
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    just download the source and you will see

  26. #2786
    QJ Gamer Green
    Points: 9.253, Level: 64
    Level completed: 68%, Points required for next Level: 97
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Australia - A.C.T.
    Beiträge
    1.517
    Points
    9.253
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    where can i download the source?

  27. #2787
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    it is within the devhook SDK

  28. #2788
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    hello, guys, I'm pretty new to C so please go easy on me (or not, what ever is cool) im trying to compile using Dev-CPP but when I do i get but one error
    Code:
    *** No rule to make target `main.o', needed by `irda.elf'.  Stop.
    as you might see, im just trying to compile one of the examples in the SDK, it DOES compile from command line so I'm pretty sure my environment is set up right, any suggestions?
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  29. #2789
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    there isnt a main.c

  30. #2790
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    mmm, weird, maybe Cygwin cant see it from Dev-CPP or something... Thanks hallo007

    EDIT sweet, got it to work, (stupid me, didn't have the project.dev in the same directory as the main.c and makefile. just draged and droped that in, made sure the that Dev-CPP could find the makefile again, hit the compile and boom, got an eboot (and others) thanks again Hallo007

    -= Double Post =-
    here I go again with another crazy n00b question...

    im trying to follow this tut here...http://www.psp-programming.com/tutorials/c/lesson04.htm
    and i need to download the zlib and libpng using cygwin and
    svn checkout svn://svn.pspdev.org/psp/trunk/libpng
    command but cygwin doesn't seem to reconize the svn command, is there any other place i can get these two libraries?
    Geändert von BlackShark (02-15-2007 um 11:45 PM Uhr) Grund: Automerged Doublepost
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:27 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .