Seite 234 von 340 ErsteErste ... 134 184 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 284 334 ... LetzteLetzte
Zeige Ergebnis 6.991 bis 7.020 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; Ah, Thanks a bunch......

  
  1. #6991
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Ah, Thanks a bunch...



  2. #6992
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von brethren
    if all you want to do is update the pspsdk component do this -

    ./toolchain.sh 3 6
    I've tried the same as anti a while ago and got the same error.

    Can you tell me what the 3 and 6 stand for?

    Cheers
    Placo23

    Spoiler for Wanna see my Apps?:
    Why not donate and become part of this selected list?
    Spoiler for Donators:
    DarkSeveN - 5.100.000
    --DylanDangles--2.000.000
    Zuiver - 100.000
    AlwaysAmiYumi - 10.338.63

  3. #6993
    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

    The numbers of the scripts to execute. Take a look in the psptoolchain/scripts folder, there you'll see a set of scripts that download, compile and install the different parts needed for setting up the toolchain. If you only need the pspsdk, then it's enough if you only do step 6 (step 3 is only important if newlib or gcc is updated too).
    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.

  4. #6994
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Raphael
    The numbers of the scripts to execute. Take a look in the psptoolchain/scripts folder, there you'll see a set of scripts that download, compile and install the different parts needed for setting up the toolchain. If you only need the pspsdk, then it's enough if you only do step 6 (step 3 is only important if newlib or gcc is updated too).

    Right... got it.. thanks!

    I was trying with the -p at the end but with no success.

    Cheers
    Placo23

    Spoiler for Wanna see my Apps?:
    Why not donate and become part of this selected list?
    Spoiler for Donators:
    DarkSeveN - 5.100.000
    --DylanDangles--2.000.000
    Zuiver - 100.000
    AlwaysAmiYumi - 10.338.63

  5. #6995
    Psp Dev
    Points: 5.664, Level: 48
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Nebraska
    Beiträge
    228
    Points
    5.664
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I just got done installing the template for VC++ and I get an *.o error when I try to compile.

  6. #6996
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    ...

    You can't compile PSP apps using VC++.

    (By the way, I solved my problem earlier)
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  7. #6997
    QJ Gamer Blue
    Points: 4.295, Level: 41
    Level completed: 73%, Points required for next Level: 55
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Homebrewland, CA
    Beiträge
    191
    Points
    4.295
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Hey, I've been in need for a working tutorial for installing the psptoolchain on mac osx leopard for a little while now. I've tried a few previous ones, but they seem to give me errors. Is their a foolproof method?

  8. #6998
    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

    Zitat Zitat von Waterbottle
    Assuming the text file starts with 2 integers containing the x and y size of the map, this should work;
    Code:
    FILE *fp = fopen( "file", "rb" ); // open the file
    unsigned int sizex, sizey, i;
    char **map; // put the map data in this
    fread( &sizex, sizeof(int), 1, fp ); // read the x size of the map into sizex
    fread( &sizey, sizeof(int), 1, fp ); // same with y
    map = (char**) malloc( sizeof(char*) * sizex ); // allocate memory
    for( i = 0; i < sizex; i++ )
    {
       map[i] = (char*) malloc( sizeof(char) * sizey );
    }
    for( i = 0; i < sizex*sizey; i++ )
    {
        map[i/sizey][i%sizey] = fgetc( fp ); // read the data
    }
    using this, would i need to put a space inbetween the intigers for the width and height?
    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.

  9. #6999
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Archaemic
    ...

    You can't compile PSP apps using VC++.

    (By the way, I solved my problem earlier)
    Actually, you can. The simplest way is to use a Makefile project.

  10. #7000
    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 BlackShark
    using this, would i need to put a space inbetween the intigers for the width and height?
    No, but you'd have to put them in binary form there.
    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.

  11. #7001
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    does anyone know why i get this error while running the ./toolchain.sh script, i have all of the relevant paths set i think - here is my cygwin.bat

    Code:
    @echo off
    
    C:
    chdir C:\cygwin\bin
    
    set PSPDEV=/usr/local/pspdev
    set PSPSDK=$PSPDEV/psp/sdk 
    set PATH=$PATH/usr/local/pspdev/bin
    
    bash --login -i
    and i installed every single possible thing for cygwin so i don't think that is what it is

    here is the error

    Code:
    df_to_usi.o libgcc/./_usi_to_df.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde.
    o libgcc/./unwind-sjlj.o libgcc/./gthr-gnat.o libgcc/./unwind-c.o
    psp-ar  rc ./libgcov.a libgcc/./_gcov.o libgcc/./_gcov_merge_add.o libgcc/./_gco
    v_merge_single.o libgcc/./_gcov_merge_delta.o libgcc/./_gcov_fork.o libgcc/./_gc
    ov_execl.o libgcc/./_gcov_execlp.o libgcc/./_gcov_execle.o libgcc/./_gcov_execv.
    o libgcc/./_gcov_execvp.o libgcc/./_gcov_execve.o libgcc/./_gcov_interval_profil
    er.o libgcc/./_gcov_pow2_profiler.o libgcc/./_gcov_one_value_profiler.o
    make[3]: psp-ar: Command not found
    make[3]: psp-ar: Command not found
    make[3]: *** [libgcc.a] Error 127
    make[3]: *** Waiting for unfinished jobs....
    make[3]: *** [libgcov.a] Error 127
    make[3]: Leaving directory `/home/[email protected]/trunk/psptoolchain/build/gcc-4.1.0/bu
    ild-psp/gcc'
    make[2]: *** [stmp-multilib] Error 2
    make[2]: Leaving directory `/home/[email protected]/trunk/psptoolchain/build/gcc-4.1.0/bu
    ild-psp/gcc'
    make[1]: *** [all-gcc] Error 2
    make[1]: Leaving directory `/home/[email protected]/trunk/psptoolchain/build/gcc-4.1.0/bu
    ild-psp'
    make: *** [all] Error 2
    ../scripts/002-gcc-4.1.0-stage1.sh: Failed.
    
    [email protected]@craigs_computer ~/trunk/psptoolchain
    $
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  12. #7002
    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

    Type the following two lines in cygwin and restart it. Then run the toolchain again.
    Code:
    echo "export PSPDEV=/usr/local/pspdev" >> ~/.bashrc
    echo "export PATH=$PATH:$PSPDEV/bin" >> ~/.bashrc
    If that doesn't help, type "echo $PSPDEV" and "echo $PATH" and show us what it printed.
    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.

  13. #7003
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    i typed both of those restarted but it didnt seem to do anything

    i cganged the export to set because that is what cygwin accepts it is export on linux and restarted nothing had changed and here are my echo's for my paths

    Code:
    [email protected]@craigs_computer ~
    $ echo $PSPDEV
    /usr/local/pspdev
    
    [email protected]@craigs_computer ~
    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/bin:/usr/lib/
    lapack
    
    [email protected]@craigs_computer ~
    $
    which seem to be right so why do i get that error ????????????

    also this is my .bashrc file now

    Code:
    export PSPDEV=/usr/local/pspdev
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/$
    set PSPDEV=/usr/local/pspdev
    set PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/bin$
    i checked it out using nano

    i.e. nano ~/.bashrc

    - ill try running the toolchain script again now and come back here if i get the same or a new error thanks
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  14. #7004
    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 FaT3oYCG
    Code:
    [email protected]@craigs_computer ~
    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/bin:/usr/lib/
    lapack
    which seem to be right so why do i get that error ????????????
    Isn't correct. There shouldn't be the literal "$PATH" in there before the /usr/local/pspdev/bin

    also this is my .bashrc file now

    Code:
    export PSPDEV=/usr/local/pspdev
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/$
    set PSPDEV=/usr/local/pspdev
    set PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH/usr/local/pspdev/bin$
    Make that .bashrc file look like this:
    Code:
    export PSPDEV=/usr/local/pspdev
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/pspdev/
    set PSPDEV=/usr/local/pspdev
    set PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/pspdev/bin
    And cygwin should accept export, since it simulates a *NIX environment. If your cygwin bash doesn't accept that, then you haven't set it up correctly.
    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.

  15. #7005
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    In Devhook, the system was rebooted and things were loaded from the memorystick instead of the flash right? Would this be possible to do in the flash, for example to load a different vshmain.prx? I'm looking for a way to load PSPLock only on system startup, and not when a game is exited, and this seems to most fesible way currently. Can anyone help me out?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  16. #7006
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    ok bash rc now looks like what you said

    cygwin.bat changed and now path looks like what you said

    cygwin.bat

    Code:
    @echo off
    
    C:
    chdir C:\cygwin\bin
    
    set PSPDEV=/usr/local/pspdev
    set PSPSDK=$PSPDEV/psp/sdk 
    set PATH=/usr/local/pspdev/bin
    
    bash --login -i
    .bashrc

    Code:
    export PSPDEV=/usr/local/pspdev
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/pspdev/bin:/$
    set PSPDEV=/usr/local/pspdev
    set PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/pspdev/bin:/usr$
    echo's

    Code:
    [email protected]@craigs_computer ~
    $ echo $PSPDEV
    /usr/local/pspdev
    
    [email protected]@craigs_computer ~
    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/pspdev/bin:/usr/lib/lapac
    k
    
    [email protected]@craigs_computer ~
    $
    - running ./toolchain.sh now

    please tell me if its still wrong
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  17. #7007
    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

    I made a simple code to load a 24 bit uncompressed BMP into memory, it works perfectly on my computer but on the PSP it crashes for some reason.

    Code:
    bool Image::loadBMP( const char *path )
    {
         FILE *fp = fopen( path, "r" );
         if( fp == NULL ) return false;
         char header[54];
         fread( header, 54, 1, fp );
    
         // BMP identifier
         if( *(short*)&header[0] != 19778 )
         {
             fclose( fp );
             return false;
         }
    
    
         width = *(unsigned int*)&header[18]; // It crashes here!
    
    
         height = *(unsigned int*)&header[22];
         data = (unsigned char*)malloc( width*height*3 );
         
         fseek( fp, *(unsigned int*)&header[10], SEEK_SET );
         fread( data, width, height*3, fp );
         fclose( fp );
         return true;
    }
    width is declared as an unsigned int in the public scope of the class.


  18. #7008
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    How would I use sctrlKernelExitVSH? I've attempted using it on 3.52 and it just keeps rebooting with the normal pspbtcnf.bin file, and not the custom one I've made, my code is this:

    Code:
    struct SceKernelLoadExecVSHParam param;
        memset(&param, 0, sizeof(param));
        param.size = sizeof(param);
        param.configfile = "/kn/pspbtcnf_P4.bin";
        
        int check = sctrlKernelExitVSH(&param);
    but this just reboots and restarts it like normal, I've tried switching kn to kd, and the bin file to a txt file (incase it works like the old pspbtcnf files), but its not helped at all. Theres very little source code with this command in use, so I can't compare and see what I'm doing wrong, so if anyone knows could you point out my error please?

    Thanks.
    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  19. #7009
    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 Waterbottle
    I made a simple code to load a 24 bit uncompressed BMP into memory, it works perfectly on my computer but on the PSP it crashes for some reason.

    Code:
         if( *(short*)&header[0] != 19778 )
    ...
         width = *(unsigned int*)&header[18]; // It crashes here!
    ...
         height = *(unsigned int*)&header[22];
    ...
         fseek( fp, *(unsigned int*)&header[10], SEEK_SET );
    GCC has problems compiling such code into correct assembly instructions for PSP (or MIPS in general?) [well, actually it sometimes just puts the instructions in wrong order]. Also, you're trying to read an int from an offset that is not word aligned (18, 22 and 10), which will result in a bus error.
    Avoid such pointer 'magic' and do proper casts. If you need to read ints (or shorts) from unaligned addresses, read it byte for byte and connect the single bytes to the wanted data type. Yes, PSP programming is sometimes a pain.
    Alternatively you could just create a packed struct with the header information and read it in one go. In that case the compiler would take care of the unaligned reading.

    PS: That's one of the reasons why everyone knowing about PSP programming suggests beginners to NOT start with PSP programming, but start with coding for PC. Just a generic note, not aimed at you.
    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.

  20. #7010
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Is there a code profiler available for the PSP? is not, how would i go about making one? the articles ive read are platform dependent (as they should be, but that leave the PSP with nothing)
    --------------------------------------------------------------------------------------

  21. #7011
    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

    pspsdk\src\samples\debug\ profiler
    and
    gprof do it's job
    http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html
    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.

  22. #7012
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Hi,Im just trying to learn C++ and as I go on I would like to make a little game for my personal learning and add my knowledge to this game as I progress but It its good to start something out of bad basis.So here is my Code please help me to get it sort out:

    Main.c:
    Spoiler for Main:
    Code:
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include "graphics.h"
    
    PSP_MODULE_INFO("Star Shooter", 0, 1, 1);
    
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
    
    /* 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(void) {
        SetupCallbacks();
        initGraphics();
    
        SceCtrlData pad, lastpad;
    
        sceCtrlReadBufferPositive(&lastpad, 1);
        
        int x = 0;
        int y = 0;
        
        Image* Background;
        Background = loadImage("./Images/Background.png");
        Image* PlayerI;
        PlayerI = loadImage("./Images/PlayerI.png");
        
    
    
        while(1) {
          sceCtrlReadBufferPositive(&pad, 1);
    
          if(pad.Buttons != lastpad.Buttons) {
          lastpad = pad;
    
          if(pad.Buttons & PSP_CTRL_LEFT)
          {
           x = x - 2;
          }
          if(pad.Buttons & PSP_CTRL_RIGHT)
          {
           x = x +2;
          }
          if(pad.Buttons & PSP_CTRL_UP)
          {
           y = y - 2;
          }
          if(pad.Buttons & PSP_CTRL_DOWN)
          {
           y = y + 2;
          }
          
          blitAlphaImageToScreen(0, 0 , 480, 272, Background, 0, 0);
          blitAlphaImageToScreen(0, 0 , 32, 32, PlayerI, x, y);
          
          }
        
        sceDisplayWaitVblankStart();
        flipScreen();
    
        }
        sceKernelSleepThread();
        return 0;
    }

    Makefile:
    Spoiler for Makefile:
    Code:
    TARGET = StarShooter
    OBJS = main.o graphics.o framebuffer.o
    
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    LIBDIR =
    LIBS = -lpspgu -lpng -lz -lm
    LDFLAGS =
    
    EXTRA_TARGETS = EBOOT.PBP
    PSP_EBOOT_TITLE = Star Shooter
    
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak


    Here are all my files:
    http://zereox.googlepages.com/StarShooter.rar

    Thanks again.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  23. #7013
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    What is there to sort out ? There's barely any code minus the callbacks.

  24. #7014
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Raphael
    pspsdk\src\samples\debug\ profiler
    and
    gprof do it's job
    http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html
    holy crap. thats easier than i thought..
    --------------------------------------------------------------------------------------

  25. #7015
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    eldiablov I know but The think is that it compiles but simply doesn't work.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  26. #7016
    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 ZereoX
    eldiablov I know but The think is that it compiles but simply doesn't work.
    "Doesn't work" is as helpful as an refrigerator on the north pole. Learn to properly articulate the exact problem you have and you will get help much sooner the next time.
    Your program has two major issues:
    1. You are only blitting your images at the exact time a button has been pushed or released, hence you will only see something starting from when the first such event occured.
    2. You infinitely loop your main loop, preventing your application from ever exiting (even when home button is pressed). Put a breaking case into your loop.
    If you don't know what to do, try the search function as this is a common problem.
    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.

  27. #7017
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    OK thanks Raphael, I got it fix. Everything works but I don't really understand number 2 I just know that I am able of exiting using the home key.Care to explain a bit more please I'm no so sure to understand the principle behind Infinite loops.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  28. #7018
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Ignore Raphael about the infinite loop thing.
    Even though your program does have an infinite loop - you've set up the callback thread. No matter what your program is doing, you have the option of exiting thanks to the callback thread.
    The callback thread ( SetupCallbacks; ) is essentially the home button exiting.

    As for an infinite loop explanation - basically imagine a loop as reading your code from top to bottom, then going back to the top again.
    Code:
    while(1)
    {
    // Code
    }
    Now imagine this happening without some way of exiting the loop.
    Code:
    while(1)
    {
    // Code
    }
    
    // Some more code
    Your program will never be able to reach 'some more code' without somehow exiting the loop its currently in. You can break the loop and move on with
    Code:
    break;

  29. #7019
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Ok thanks.But as you might see might controls are in a loop if I break and go on i won't be able to move anymore.I either Build everything into that loop or is there a other way?
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  30. #7020
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ZereoX
    Ok thanks.But as you might see might controls are in a loop if I break and go on i won't be able to move anymore.I either Build everything into that loop or is there a other way?
    pretty much


 

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 .