Seite 202 von 340 ErsteErste ... 102 152 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 252 302 ... LetzteLetzte
Zeige Ergebnis 6.031 bis 6.060 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; Zitat von myschoo im not using pspdebug altogether #include <pspkernel.h> #include <pspdisplay.h> #include <pspgu.h> #include <stdio.h> #include <pspctrl.h> #include <string.h> ...

  
  1. #6031
    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 myschoo
    im not using pspdebug altogether

    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <stdio.h>
    #include <pspctrl.h>
    #include <string.h>
    #include <pspiofilemgr.h>
    #include "blit.h"

    am i missing something? :/
    You cant proceed w/ using blit and USE_KERNEL_LIBS.

    im afraid u might have to ditch status system totally or stop using Kmode only funcs.



  2. #6032
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    blit.c works with kernel mode... but then when i wanted to use stdio.h file functions, it didnt compile and my problems started -_-

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

    Zitat Zitat von myschoo
    im not using pspdebug altogether

    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <stdio.h>
    #include <pspctrl.h>
    #include <string.h>
    #include <pspiofilemgr.h>
    #include "blit.h"

    am i missing something? :/


    Have you tried
    Code:
    include# <pspsysmem.h>
    ?

    This is the header that contains sceKernelMaxFreeMemSize, so it would only be logical to include that if its not working...

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

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

  4. #6034
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    yeah i did it... same error... strange

  5. #6035
    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

    -lpspuser
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  6. #6036
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    nope

  7. #6037
    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

    Weird. sceKernelMaxFreeMemSize is in pspuser, so that should have fixed it...
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  8. #6038
    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 Archaemic
    Weird. sceKernelMaxFreeMemSize is in pspuser, so that should have fixed it...
    Use_kernel_libs flag discards -lpspuser. (=_=)

  9. #6039
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    strange.... i will probably have to rewrite file system to use only sceIo functions :/

  10. #6040
    QJ Gamer Blue
    Points: 4.031, Level: 40
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 91,0%

    Registriert seit
    Feb 2007
    Ort
    Florida
    Beiträge
    214
    Points
    4.031
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    I'm trying to figure out how to make a varible stay 0 ONLY if no buttons are being pressed...I can't figure out how to do that..Can anyone help?

    If I try, the varible will always be 0, so there's gotta be someway..

  11. #6041
    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 MrChaos
    I'm trying to figure out how to make a varible stay 0 ONLY if no buttons are being pressed...I can't figure out how to do that..Can anyone help?

    If I try, the varible will always be 0, so there's gotta be someway..
    Did u miss my post few pages back?

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

    Zitat Zitat von MrChaos
    I'm trying to figure out how to make a varible stay 0 ONLY if no buttons are being pressed...I can't figure out how to do that..Can anyone help?

    If I try, the varible will always be 0, so there's gotta be someway..

    I've been using this in an app I've been working on, not sure if this is what you want though...

    Code:
    int button;         //global
    SceCtrlData pad;    //another global, can be used here, or made local
    
    void buttoncheck(SceSize args, void* argp)
    {
         //sceCtrlData pad;                   //un-comment if using as a local
         while(1){
         sceCtrlReadBufferPositive(&pad, 1);
         if(pad.Buttons & 0xFFFF) button = 1;
         sceCtrlReadBufferNegatve(&pad, 1);   //only use if required
         if(pad.Buttons & 0xFFFF) button = 0; // ||   || ||  ||
         sceKernelDelayThread(10000);         //make sure other threads get processing time
                 }
    }
    
    void buttoncheckinit(SceSize args, void* argp)
    {
         SceUID buttonchect = sceKernelCreateThread("buttoncheck", buttoncheck, 0x30, 0x10000, 0, NULL);
         sceKernelStartThread(buttoncheckt, args, argp);
    }
    
    int main(SceSize args, void* argp)
    {
        buttoncheckinit(args, argp);
        
        //rest of code here
    }
    -Aura
    Last.fm | Deviant Art | First working OS picture

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

  13. #6043
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    code:

    sprintf(buffer,"Hello");
    printf("%s",buffer);
    sprintf(buffer,"Hi");
    printf("%s",buffer);
    result:

    Hello
    Hillo


    but i need:

    Hello
    Hi


    does anyone know how to clear buffer? i tried free(buffer) but that just freezes my app

  14. #6044
    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

    Zitat Zitat von myschoo
    code:



    result:

    Hello
    Hillo


    but i need:

    Hello
    Hi


    does anyone know how to clear buffer? i tried free(buffer) but that just freezes my app
    I'm not sure, but putting
    Code:
    buffer = "";
    may do the trick, I think you can also NULL it, but again, I'm not totally sure.

    Alternatively, you could do...
    Code:
    sprintf(buffer,"Hello");
    printf("%s",buffer);
    sprintf(buffer,"Hi");
    printf("%0.2s",buffer);
    which will only give the first 2 letters, this probably will get tedious and if you're using variable length, then its not going to really be suitable, but I do know for a fact that works.

    As for free(buffer) not working, thats freeing up the memory, when you then try and sprint, it has nowhere to actually store the value and causes a buffer overflow.

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

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

  15. #6045
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    thx i will try it ;)

    also tried to use memset and still same problem o_O

  16. #6046
    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

    Zitat Zitat von myschoo
    thx i will try it ;)

    also tried to use memset and still same problem o_O
    While I think about it, if you put
    Code:
    sprintf(buffer, "Hi\0");
    it should also work, seeing as \0 is the NULL flag, and I'm pritty sure variables stop reading once they reach a NULL flag.

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

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

  17. #6047
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    sprintf(buffer,"Hello");
     printf("%s",buffer);
    memset(buffer, 0, sizeof(buffer));
     sprintf(buffer,"Hi");
     printf("%s",buffer);

  18. #6048
    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

    or bzero(buffer , sizeof(buffer) );

  19. #6049
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    txh both of u.. it works

  20. #6050
    QJ Gamer Green
    Points: 4.824, Level: 44
    Level completed: 37%, Points required for next Level: 126
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    317
    Points
    4.824
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    code:



    result:

    Hello
    Hillo


    but i need:

    Hello
    Hi


    does anyone know how to clear buffer? i tried free(buffer) but that just freezes my app
    u could've just done
    Code:
    strcpy(buffer,"Hello");
    printf("%s",buffer);
    strcpy(buffer,"Hi");
    printf("%s",buffer);
    Current releases:
    Icon Action Replacer v1.5- latest release
    Current projects:
    PSP C++ IDE - Currently v1.6
    RPG Paradise - Latest version at my website

  21. #6051
    QJ Gamer Bronze
    Points: 4.912, Level: 44
    Level completed: 81%, Points required for next Level: 38
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    90
    Points
    4.912
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    edit: my bad, read wrong >_>, sorry about that

  22. #6052
    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

    Zitat Zitat von nataku92
    That's exactly what he was doing originally... But it didn't work since "Hi" didn't completely replace the "Hello" before it.
    If you actually bothered to read both peices of code properly you would notice that the original used sprintf, and that uses strcpy.

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

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

  23. #6053
    Points: 11.498, Level: 70
    Level completed: 62%, Points required for next Level: 152
    Overall activity: 50,0%

    Registriert seit
    Dec 2005
    Ort
    LBC
    Beiträge
    516
    Points
    11.498
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspballer07
    u could've just done
    Code:
    strcpy(buffer,"Hello");
    printf("%s",buffer);
    strcpy(buffer,"Hi");
    printf("%s",buffer);

    or even simpler:

    Code:
    printf("%s\n", "Hello");
    printf("%s", "Hi");
    or

    Code:
    printf("Hello\n");
    printf("Hi");

  24. #6054
    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

    Zitat Zitat von califrag
    or even simpler:

    Code:
    printf("%s", "Hello");
    printf("%s", "Hi");
    Code:
    printf("Hello");
    printf("Hi");
    would be even simplier, but I doubt anyone is going to want their program to just say
    Hello
    Hi
    The string is going to have different values store in it no doubt, which makes both of the above useless.

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

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

  25. #6055
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    ^^^^^^^^^^^^^^
    listen to him ;)

  26. #6056
    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 go about streaming an mp3? The only good peice of source code I've found for playing music loads it directly to memory, and needless to say, an mp3 takes a big chunk of the PSPs RAM.

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

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

  27. #6057
    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 Auraomega
    How would I go about streaming an mp3? The only good peice of source code I've found for playing music loads it directly to memory, and needless to say, an mp3 takes a big chunk of the PSPs RAM.

    -Aura
    Manually Keep filling libmad's stream decoding buffer as it exhausts.

    -4m psp

  28. #6058
    QJ Gamer Green
    Points: 4.824, Level: 44
    Level completed: 37%, Points required for next Level: 126
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    317
    Points
    4.824
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega
    How would I go about streaming an mp3? The only good peice of source code I've found for playing music loads it directly to memory, and needless to say, an mp3 takes a big chunk of the PSPs RAM.

    -Aura
    psp-programming.com has a tut for that
    Current releases:
    Icon Action Replacer v1.5- latest release
    Current projects:
    PSP C++ IDE - Currently v1.6
    RPG Paradise - Latest version at my website

  29. #6059
    QJ Gamer Blue
    Points: 4.031, Level: 40
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 91,0%

    Registriert seit
    Feb 2007
    Ort
    Florida
    Beiträge
    214
    Points
    4.031
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega

    I've been using this in an app I've been working on, not sure if this is what you want though...

    Code:
    int button;         //global
    SceCtrlData pad;    //another global, can be used here, or made local
    
    void buttoncheck(SceSize args, void* argp)
    {
         //sceCtrlData pad;                   //un-comment if using as a local
         while(1){
         sceCtrlReadBufferPositive(&pad, 1);
         if(pad.Buttons & 0xFFFF) button = 1;
         sceCtrlReadBufferNegatve(&pad, 1);   //only use if required
         if(pad.Buttons & 0xFFFF) button = 0; // ||   || ||  ||
         sceKernelDelayThread(10000);         //make sure other threads get processing time
                 }
    }
    
    void buttoncheckinit(SceSize args, void* argp)
    {
         SceUID buttonchect = sceKernelCreateThread("buttoncheck", buttoncheck, 0x30, 0x10000, 0, NULL);
         sceKernelStartThread(buttoncheckt, args, argp);
    }
    
    int main(SceSize args, void* argp)
    {
        buttoncheckinit(args, argp);
        
        //rest of code here
    }
    -Aura
    That may be what I need, but what would be the use for sceCtrlReadBufferNegative ?

  30. #6060
    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

    Zitat Zitat von MrChaos
    That may be what I need, but what would be the use for sceCtrlReadBufferNegative ?

    I wasn't sure if you wanted it so that it registers a 1 ONLY when a button is being pressed or not. If you want a 1 to register only when a button is pressed, then when nothing is pressed the negative kicks in, and allows the code under it to run. As I said, only use if you need it

    Zitat Zitat von pspballer07
    psp-programming.com has a tut for that
    I checked on there about 5 minutes before posting here, the only tutorial I could find was for loading it all into RAM, which isn't really suitable.

    Zitat Zitat von Mr305
    Manually Keep filling libmad's stream decoding buffer as it exhausts.

    -4m psp
    How would I go about doing that? Limiting how much is read should be easy, but updating everytime its running low, not sure how I should do that...

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

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


 

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:14 PM Uhr.

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