Seite 36 von 340 ErsteErste ... 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 86 136 ... LetzteLetzte
Zeige Ergebnis 1.051 bis 1.080 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; Ok, I need some help. I have been trying to compile this remote example that I found, but I keep ...

  
  1. #1051
    Give It All
    Points: 18.200, Level: 85
    Level completed: 70%, Points required for next Level: 150
    Overall activity: 23,0%

    Registriert seit
    Jan 2006
    Ort
    United States
    Beiträge
    3.899
    Points
    18.200
    Level
    85
    Downloads
    0
    Uploads
    0

    Standard

    Ok, I need some help.

    I have been trying to compile this remote example that I found, but I keep getting a parse error:




    Below I will post the code:

    Zitat Zitat von main.c

    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>
    #include <psphprm.h>

    PSP_MODULE_INFO("Remote Code Display", 0, 1, 1);

    #define printf pspDebugScreenPrintf

    /* 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;
    }




    int main() {
    pspDebugScreenInit();
    SetupCallbacks();

    u32 remoteButtons;

    printf("Please Press The Pause Key");

    while(1) {

    sceHprmPeekCurrentKey(&re moteButtons);

    if(remoteButtons & PSP_HPRM_PLAYPAUSE){
    break;
    }
    }

    printf("Pause Key Pressed");


    sceKernelSleepThread();

    return 0;
    }
    Can anyone help me?



    Core 2 Duo E8400 @ 3.6ghz (Multiplier: 9x; Bus: 400mhz; FSB: 1600mhz;)
    GeForce 9800 GTX+ 512 MB (Core: 850mhz; Memory: 1200mhz; Shader: 2100mhz;)
    ASUS P5K Pro Motherboard
    Patriot Extreme (2x2GB) / OCZ HPC (2x1GB)
    6GB Total Dual Channel RAM (DDR2 1066mhz)
    OCZ GameXstream 700w
    2x Seagate 250GB HD (RAID0)

  2. #1052
    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 LMelior
    How about acos?
    thanks, that's what I wanted.

    However I thought I knew how I would do what I wanted. but then i realised that was no where near close to working

    Basically what I want is:
    I Have the X and Y position of the player. and I have the X and Y position of a mummy. And I want the mummy to be rotated so that it's always looking towards the player.
    As I said I tried do figure out how to do it with cos, sin and tan. But I just can't figure out how to do it (I'll be the first to admit that cosine etc isn't my strongest point though). I just want to get the amount of degrees it should be rotated. Anyone got any tips on how to do it?


  3. #1053
    Points: 3.997, Level: 40
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    7
    Points
    3.997
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Sorry for hijacking but I was wondering fi there was any way to install the toolchain on a mac and sucessfully compile a file?

  4. #1054
    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

    xart actually made a small 'compilable' envirorment out of Xcode for TIFF games...

    ...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. #1055
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    372
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Um.. a small question here. How come something that is capable of running in 333MHz can't emulate another thing that only needs about 7 MHz for playing and about 4 Mhz for sound??

  6. #1056
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von waterbottle
    thanks, that's what I wanted.

    However I thought I knew how I would do what I wanted. but then i realised that was no where near close to working

    Basically what I want is:
    I Have the X and Y position of the player. and I have the X and Y position of a mummy. And I want the mummy to be rotated so that it's always looking towards the player.
    As I said I tried do figure out how to do it with cos, sin and tan. But I just can't figure out how to do it (I'll be the first to admit that cosine etc isn't my strongest point though). I just want to get the amount of degrees it should be rotated. Anyone got any tips on how to do it?
    That would be arctangent. I'm pleasantly surprised that C has the MATLAB function "atan2" (although I shouldn't have been, since it's really the other way around) which is exactly what you need. The regular atan only accepts one argument, y/x, but since it can't distinguish if and when the variables are negative or not, it will only return an angle in the correct quadrant about half of the time. atan2 accepts 2 arguments, atan2(y,x), and uses the signs to determine the correct quadrant.

    Sorry for the long-winded explanation, I was just excited. :ROFL:

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

    SETINEL - Link?

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


  8. #1058
    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 LMelior
    That would be arctangent. I'm pleasantly surprised that C has the MATLAB function "atan2" (although I shouldn't have been, since it's really the other way around) which is exactly what you need. The regular atan only accepts one argument, y/x, but since it can't distinguish if and when the variables are negative or not, it will only return an angle in the correct quadrant about half of the time. atan2 accepts 2 arguments, atan2(y,x), and uses the signs to determine the correct quadrant.

    Sorry for the long-winded explanation, I was just excited. :ROFL:
    thanks.

    but when I try to compile I get the error:

    Code:
    /usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libm.a(w_atan2.o): In fu
    nction `atan2':
    ../../../../../newlib/libm/math/w_atan2.c:110: undefined reference to `__errno'
    ../../../../../newlib/libm/math/w_atan2.c:107: undefined reference to `__errno'
    collect2: ld returned 1 exit status
    I took a look in 'w_atan2.c' and it seems like errno is a variable that hasn't been defined. Should I just define it? (if I should what should it be defined as? double?).


  9. #1059
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GmDude66
    Ok, I need some help.

    I have been trying to compile this remote example that I found, but I keep getting a parse error:




    Below I will post the code:



    Can anyone help me?
    You know you can copy and paste code from the bash shell right?
    1. Right click on the top of the bash shell window
    2. Go down to Edit -> Mark
    3. Select you Text
    4. Press Enter

    Congradulations, you just copied text

  10. #1060
    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

    Yesterday I was trying to set up my psp dev environment, after learning a bit of C++ of course. So when I type in "./toolchain.sh" I get a message something like "make sure you have gnu make installed". What should I do, is there like a packaged cygin pack with all the right files you need. If not how can I install gnu make.
    Thx!

  11. #1061
    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

    Zitat Zitat von cloudpjff7
    Yesterday I was trying to set up my psp dev environment, after learning a bit of C++ of course. So when I type in "./toolchain.sh" I get a message something like "make sure you have gnu make installed". What should I do, is there like a packaged cygin pack with all the right files you need. If not how can I install gnu make.
    Thx!
    You need to install all of the 'devel' category in cygwin.

    Run the setup.exe again and select to install all the 'devel' category.

    (You don't actually need all of the 'devel' category, but you need most so you might as well select them all)

    See my tutorial here if you need a walkthrough: http://insomniac.0x89.org/index.php?id=56

    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

  12. #1062
    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 Waterbottle
    Zitat Zitat von LMelior
    That would be arctangent. I'm pleasantly surprised that C has the MATLAB function "atan2" (although I shouldn't have been, since it's really the other way around) which is exactly what you need. The regular atan only accepts one argument, y/x, but since it can't distinguish if and when the variables are negative or not, it will only return an angle in the correct quadrant about half of the time. atan2 accepts 2 arguments, atan2(y,x), and uses the signs to determine the correct quadrant.

    Sorry for the long-winded explanation, I was just excited. :ROFL:
    thanks.

    but when I try to compile I get the error:

    Code:
    /usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libm.a(w_atan2.o): In fu
    nction `atan2':
    ../../../../../newlib/libm/math/w_atan2.c:110: undefined reference to `__errno'
    ../../../../../newlib/libm/math/w_atan2.c:107: undefined reference to `__errno'
    collect2: ld returned 1 exit status
    I took a look in 'w_atan2.c' and it seems like errno is a variable that hasn't been defined. Should I just define it? (if I should what should it be defined as? double?).
    looking a bit further I also found errno.c (in C:\cygwin\home\MyName\psp toolchain\newlib-1.13.0\newlib-1.13.0\newlib\libc\errno)

    The errno variable is stored in the reentrancy structure. This
    function returns its address for use by the macro errno defined in
    errno.h.
    I tried just adding an include for errno.h, but that didn't help any.
    Anyone know how to include errno so it gets defined?


  13. #1063
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Just for the record, the undefined reference is __errno, not errno.
    I think it might have something to do with the std though. You could try to change it to c99.


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  14. #1064
    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 homer
    Just for the record, the undefined reference is __errno, not errno.
    I think it might have something to do with the std though. You could try to change it to c99.
    hmm, how should I do that?


  15. #1065
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    In the makefile, add -std=c99 to the CFLAGS.


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  16. #1066
    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 homer
    In the makefile, add -std=c99 to the CFLAGS.
    didn't help :/

    Does it make a difference that it's a prx?


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

    some problems
    when i press the Up or down button it doesnt do anything(it dont do x++ or x--)
    (i want that x only one goes up by press or holding the up button)
    Code:
    $ make kxploit
    psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o mai
    n.c
    main.c: In function 'vermenigvuldigen':
    main.c:48: warning: initialization makes integer from pointer without a cast
    main.c:49: warning: initialization makes integer from pointer without a cast
    main.c:53: warning: comparison between pointer and integer
    main.c:58: warning: assignment makes integer from pointer without a cast
    main.c:61: warning: assignment makes integer from pointer without a cast
    main.c:65: warning: comparison between pointer and integer
    main.c:69: warning: assignment makes integer from pointer without a cast
    main.c:72: warning: assignment makes integer from pointer without a cast
    main.c:94: warning: implicit declaration of function 'menu'
    main.c: At top level:
    main.c:106: warning: conflicting types for 'menu'
    main.c:94: warning: 'menu' declared inline after being called
    main.c:94: warning: previous implicit declaration of 'menu' was here
    de source
    Code:
    #include <math.h>//rekenmachine
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>//controls
    
    
    #define printf pspDebugScreenPrintf
    PSP_MODULE_INFO("calculator",0,0,1);
    /* 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 y = 0;
    int x =0;
    
    SceCtrlData pad;
    inline void vermenigvuldigen()
    {
    
    printf("Druk op pijltje naar boven/beneden om de waarde van het eerste getal te veranderen :%i\n",x);
    printf("Druk op pijltje naar links/rechts om de waarde van het tweede getal te veranderen :%i\n",y);
    char upPressed = "false"; // This initializes "upPressed" //
    char downPressed = "false";
    while(1) {
             sceCtrlReadBufferPositive(&pad, 1);//start controls
             if(pad.Buttons & PSP_CTRL_UP) {
                          if (upPressed == "false") { 
                            x++;
                            pspDebugScreenClear();
                            vermenigvuldigen(); 
                            }
                           upPressed = "true";
                           }
                           else {
                           upPressed = "false";
                           }
               
            if(pad.Buttons & PSP_CTRL_DOWN) {
                          if (downPressed == "false") { 
                            x--;
                            pspDebugScreenClear();
                            vermenigvuldigen(); 
                            downPressed = "true";
                           }
                           else {
                           downPressed = "false";
                           }
                           }
     
    
             if(pad.Buttons & PSP_CTRL_RIGHT) {
                            y++;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                   
                                    
                            } 
                       if(pad.Buttons & PSP_CTRL_LEFT) {
                            y--;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                    
                                    
                            } 
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                            pspDebugScreenClear();
                            printf("het product is: %i\n",x*y); 
                            menu();                
                            }            
                     if(pad.Buttons & PSP_CTRL_TRIANGLE) {
                     printf(" deze functie is nog niet af");        
                        vermenigvuldigen(); 
                        } 
                  
          
    }
    }  
    
    inline void menu()
    { 
    
           
           printf( "   ______   _______   _        ______     \n");  
           printf(  "  |  ____| |  ___  | | |      |  ____|      v0.01 Beta test   \n");
           printf(  "  | |      |  | |  | | |      | |               by roel      \n");
           printf(  "  | |____  |  ---  | | |____  | |____         (HALLO007)\n");
           printf(  "  |______| |__| |__| |______| |______|  -=[RP]=- Productions  \n\n\n");
           printf("welkom bij de beta release van calculator als je van bewerking wilt veranderen moet je driehoekje induwen\n\n\n");
    vermenigvuldigen();       
    }
    
    
    
    int main(void)
    {
    pspDebugScreenInit();
    SetupCallbacks();
    menu();
    }

  18. #1068
    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 hallo007
    some problems
    when i press the Up or down button it doesnt do anything(it dont do x++ or x--)
    (i want that x only one goes up by press or holding the up button)
    Code:
    $ make kxploit
    psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o mai
    n.c
    main.c: In function 'vermenigvuldigen':
    main.c:48: warning: initialization makes integer from pointer without a cast
    main.c:49: warning: initialization makes integer from pointer without a cast
    main.c:53: warning: comparison between pointer and integer
    main.c:58: warning: assignment makes integer from pointer without a cast
    main.c:61: warning: assignment makes integer from pointer without a cast
    main.c:65: warning: comparison between pointer and integer
    main.c:69: warning: assignment makes integer from pointer without a cast
    main.c:72: warning: assignment makes integer from pointer without a cast
    main.c:94: warning: implicit declaration of function 'menu'
    main.c: At top level:
    main.c:106: warning: conflicting types for 'menu'
    main.c:94: warning: 'menu' declared inline after being called
    main.c:94: warning: previous implicit declaration of 'menu' was here
    de source
    Code:
    #include <math.h>//rekenmachine
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>//controls
    
    
    #define printf pspDebugScreenPrintf
    PSP_MODULE_INFO("calculator",0,0,1);
    /* 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 y = 0;
    int x =0;
    
    SceCtrlData pad;
    inline void vermenigvuldigen()
    {
    
    printf("Druk op pijltje naar boven/beneden om de waarde van het eerste getal te veranderen :%i\n",x);
    printf("Druk op pijltje naar links/rechts om de waarde van het tweede getal te veranderen :%i\n",y);
    char upPressed = "false"; // This initializes "upPressed" //
    char downPressed = "false";
    while(1) {
             sceCtrlReadBufferPositive(&pad, 1);//start controls
             if(pad.Buttons & PSP_CTRL_UP) {
                          if (upPressed == "false") { 
                            x++;
                            pspDebugScreenClear();
                            vermenigvuldigen(); 
                            }
                           upPressed = "true";
                           }
                           else {
                           upPressed = "false";
                           }
               
            if(pad.Buttons & PSP_CTRL_DOWN) {
                          if (downPressed == "false") { 
                            x--;
                            pspDebugScreenClear();
                            vermenigvuldigen(); 
                            downPressed = "true";
                           }
                           else {
                           downPressed = "false";
                           }
                           }
     
    
             if(pad.Buttons & PSP_CTRL_RIGHT) {
                            y++;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                   
                                    
                            } 
                       if(pad.Buttons & PSP_CTRL_LEFT) {
                            y--;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                    
                                    
                            } 
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                            pspDebugScreenClear();
                            printf("het product is: %i\n",x*y); 
                            menu();                
                            }            
                     if(pad.Buttons & PSP_CTRL_TRIANGLE) {
                     printf(" deze functie is nog niet af");        
                        vermenigvuldigen(); 
                        } 
                  
          
    }
    }  
    
    inline void menu()
    { 
    
           
           printf( "   ______   _______   _        ______     \n");  
           printf(  "  |  ____| |  ___  | | |      |  ____|      v0.01 Beta test   \n");
           printf(  "  | |      |  | |  | | |      | |               by roel      \n");
           printf(  "  | |____  |  ---  | | |____  | |____         (HALLO007)\n");
           printf(  "  |______| |__| |__| |______| |______|  -=[RP]=- Productions  \n\n\n");
           printf("welkom bij de beta release van calculator als je van bewerking wilt veranderen moet je driehoekje induwen\n\n\n");
    vermenigvuldigen();       
    }
    
    
    
    int main(void)
    {
    pspDebugScreenInit();
    SetupCallbacks();
    menu();
    }

    Code:
    #include <math.h>//rekenmachine
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>//controls
    
    
    #define printf pspDebugScreenPrintf
    PSP_MODULE_INFO("calculator",0,0,1);
    /* 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 y = 0;
    int x =0;
    
    char upPressed = "false"; // This initializes "upPressed" //
    char downPressed = "false";
    
    SceCtrlData pad;
    inline void vermenigvuldigen()
    {
    
    printf("Druk op pijltje naar boven/beneden om de waarde van het eerste getal te veranderen :%i\n",x);
    printf("Druk op pijltje naar links/rechts om de waarde van het tweede getal te veranderen :%i\n",y);
    
             sceCtrlReadBufferPositive(&pad, 1);//start controls
             if(pad.Buttons & PSP_CTRL_UP) {
                          if (upPressed == "false") { 
                            pspDebugScreenClear();
                            x++;
                            }
                           upPressed = "true";
                           }
                           else {
                           upPressed = "false";
                           }
               
            if(pad.Buttons & PSP_CTRL_DOWN) {
                          if (downPressed == "false") { 
                            pspDebugScreenClear();
    	          x--;
                            downPressed = "true";
                           }
                           else {
                           downPressed = "false";
                           }
                           }
     
    
             if(pad.Buttons & PSP_CTRL_RIGHT) {
                            y++;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                   
                                    
                            } 
                       if(pad.Buttons & PSP_CTRL_LEFT) {
                            y--;
                                                   
                            pspDebugScreenClear();
                            printf("Druk op pijltje naar boven/beneden om de waarde van het tweede getal te veranderen :%i\n",y);                    
                                    
                            } 
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                            pspDebugScreenClear();
                            printf("het product is: %i\n",x*y); 
                            menu();                
                            }            
                     if(pad.Buttons & PSP_CTRL_TRIANGLE) {
                     printf(" deze functie is nog niet af");        
                        vermenigvuldigen(); 
                        } 
                  
    }  
    
    inline void menu()
    { 
    
           
           printf( "   ______   _______   _        ______     \n");  
           printf(  "  |  ____| |  ___  | | |      |  ____|      v0.01 Beta test   \n");
           printf(  "  | |      |  | |  | | |      | |               by roel      \n");
           printf(  "  | |____  |  ---  | | |____  | |____         (HALLO007)\n");
           printf(  "  |______| |__| |__| |______| |______|  -=[RP]=- Productions  \n\n\n");
           printf("welkom bij de beta release van calculator als je van bewerking wilt veranderen moet je driehoekje induwen\n\n\n");
    vermenigvuldigen();       
    }
    
    
    
    int main(void)
    {
    pspDebugScreenInit();
    SetupCallbacks();
    
    while (1) {
    menu();
    flipScreen();
    sceDisplayWaitVblankStart();
    }
         
    }
    try that. couple of errors in your original code:

    1. use a main loop in your main function. (easier as well as faster)
    2. youre not flipping anything...
    3.why are you calling the function everytime you press a button??? once is enough.
    --------------------------------------------------------------------------------------

  19. #1069
    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

    Zitat Zitat von Insomniac197
    You need to install all of the 'devel' category in cygwin.

    Run the setup.exe again and select to install all the 'devel' category.

    (You don't actually need all of the 'devel' category, but you need most so you might as well select them all)

    See my tutorial here if you need a walkthrough: http://insomniac.0x89.org/index.php?id=56
    Thanks man seems to be working installing toolchain as we speak!!! :Jump:

    Damn This is taking forever to install toolchain

  20. #1070
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von waterbottle
    I tried just adding an include for errno.h, but that didn't help any.
    Anyone know how to include errno so it gets defined?
    Sorry, I'm not very good at C but I would like to know if you get it worked out. To show my noobness, errno sounds like some error checking, so I would just try to comment it out. :)

    But actually you could always try a workaround...see if just plain old "atan" compiles okay. If it does, you could check for the correct quadrant yourself, e.g. if x is negative then angle = angle + 180 degrees. Or however you are supposed to fix the angle (I don't remember offhand).

  21. #1071
    QJ Gamer Platinum
    Points: 25.089, Level: 95
    Level completed: 74%, Points required for next Level: 261
    Overall activity: 18,0%

    Registriert seit
    Sep 2005
    Ort
    Edinburgh, UK
    Beiträge
    2.388
    Points
    25.089
    Level
    95
    Downloads
    0
    Uploads
    0

    Standard

    hallo007: your problem is that you're using 'char' for upPressed and downPressed, and then assigning the address of a string literal ("false") to it. You should be getting lots of compiler warnings about that, and it's always best to try to investigate those to avoid this sort of problem.

    To make what you're trying to do work, use 'char*' for those variables instead, which would work.

    But what you're doing is somewhat strange. Better yet, is to make these variables truly boolean, since that's what you really want to do. There is no boolean type in C, so you'd need to use int, e.g.:

    Code:
    #define TRUE 1
    #define FALSE 0
    
    int upPressed = FALSE;
    
    ...
    
            if(pad.Buttons & PSP_CTRL_UP) {
                          if (!upPressed) { 
                            x++;
                            pspDebugScreenClear();
                            vermenigvuldigen(); 
                            }
                           upPressed = TRUE;
                           }
                           else {
                           upPressed = FALSE;
                           }
    
    ...

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

    dam it's still doing x+1,2,3,4,5,6,.... when you hold the up button
    inline void vermenigvuldigen()
    {
    int upPressed = FALSE; // This initializes "upPressed" //
    int downPressed = FALSE;
    printf("Druk op pijltje naar boven/beneden om de waarde van het eerste getal te veranderen :%i\n",x);
    printf("Druk op pijltje naar links/rechts om de waarde van het tweede getal te veranderen :%i\n",y);
    while(1) {
    sceCtrlReadBufferPositive (&pad, 1);//start controls
    if(pad.Buttons & PSP_CTRL_UP) {
    if (!upPressed) {
    x++;
    pspDebugScreenClear();
    vermenigvuldigen();
    }
    upPressed = TRUE;
    }
    else {
    upPressed = FALSE;
    }


    if(pad.Buttons & PSP_CTRL_DOWN) {
    if (!downPressed) {
    x--;
    pspDebugScreenClear();
    vermenigvuldigen();
    }
    downPressed = TRUE;
    }
    else {
    downPressed = FALSE;
    }




    if(pad.Buttons & PSP_CTRL_RIGHT) {
    y++;

    pspDebugScreenClear();
    vermenigvuldigen();

    }
    if(pad.Buttons & PSP_CTRL_LEFT) {
    y--;

    pspDebugScreenClear();
    vermenigvuldigen();

    }
    if(pad.Buttons & PSP_CTRL_CROSS) {
    pspDebugScreenClear();
    printf("het product is: %i\n",x*y);
    menu();
    }
    if(pad.Buttons & PSP_CTRL_TRIANGLE) {
    printf(" deze functie is nog niet af");
    vermenigvuldigen();
    }

    }
    }
    the compille warnings





    main.c: In function 'vermenigvuldigen':
    main.c:100: warning: implicit declaration of function 'menu'
    main.c: At top level:
    main.c:112: warning: conflicting types for 'menu'
    main.c:100: warning: 'menu' declared inline after being called
    main.c:100: warning: previous implicit declaration of 'menu' was here

  23. #1073
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Pretty sure this would work:
    Code:
     inline void vermenigvuldigen()
    {
    int upPressed = FALSE; // This initializes "upPressed" //
    int downPressed = FALSE;
    printf("Druk op pijltje naar boven/beneden om de waarde van het eerste getal te veranderen :%i\n",x);
    printf("Druk op pijltje naar links/rechts om de waarde van het tweede getal te veranderen :%i\n",y);
    while(1) {
    sceCtrlReadBufferPositive (&pad, 1);//start controls
    if(pad.Buttons & PSP_CTRL_UP) {
    if (!upPressed) {
    x++;
    pspDebugScreenClear();
    vermenigvuldigen();
    upPressed = TRUE;
    }
    }
    else {
    upPressed = FALSE;
    }
    
    
    if(pad.Buttons & PSP_CTRL_DOWN) {
    if (!downPressed) {
    x--;
    pspDebugScreenClear();
    vermenigvuldigen();
    downPressed = TRUE;
    }
    }
    else {
    downPressed = FALSE;
    }
    
    
    
    
    if(pad.Buttons & PSP_CTRL_RIGHT) {
    y++;
    
    pspDebugScreenClear();
    vermenigvuldigen();
    
    }
    if(pad.Buttons & PSP_CTRL_LEFT) {
    y--;
    
    pspDebugScreenClear();
    vermenigvuldigen();
    
    }
    if(pad.Buttons & PSP_CTRL_CROSS) {
    pspDebugScreenClear();
    printf("het product is: %i\n",x*y);
    menu();
    }
    if(pad.Buttons & PSP_CTRL_TRIANGLE) {
    printf(" deze functie is nog niet af");
    vermenigvuldigen();
    }
    
    }
    }
    EDIT: Just tested it, worked fine.


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  24. #1074
    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 LMelior
    Sorry, I'm not very good at C but I would like to know if you get it worked out. To show my noobness, errno sounds like some error checking, so I would just try to comment it out. :)

    But actually you could always try a workaround...see if just plain old "atan" compiles okay. If it does, you could check for the correct quadrant yourself, e.g. if x is negative then angle = angle + 180 degrees. Or however you are supposed to fix the angle (I don't remember offhand).
    got it to work using atan instead of atan2,
    mummyrot = atan(((mummyy-*pposy)/(mummyx-*pposx))*-1);
    if(mummyx-*pposx<0) mummyrot += 180.0f*(3.1415/180);

    thanks for all the help :)


  25. #1075
    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

    thnx homer;)

  26. #1076
    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

    yes......got my pspdev environment all set up. Well now I am having trouble with including, I don't know what to include its a little different for coding for a pc or mac. I am learning C++ do you reccomend me switching to C or am I good. Any help or tutorials on that kind of stuff:Cry: :Cry:

  27. #1077
    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

    A few extra includes are necessary, as well as some restrictions to what is able to be included... All basic general libraries are there (math, std*) but anything like MP3 playing, OGG playing , SDL_*, etc. requires you to install them from the svn. (svn co svn://svn.ps2dev.org/psp/trunk/__________).

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


  28. #1078
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von waterbottle
    got it to work using atan instead of atan2,
    mummyrot = atan(((mummyy-*pposy)/(mummyx-*pposx))*-1);
    if(mummyx-*pposx<0) mummyrot += 180.0f*(3.1415/180);

    thanks for all the help :)
    Ah, so my memory serves me correctly! Excellent! Just wondering...not that it matters, but did you notice that you multiply pi by 180 and then divide by 180? Strange that you had to multiply by -1 in atan, too. Oh well, I'm glad it works. :)

  29. #1079
    QJ Gamer Blue
    Points: 4.464, Level: 42
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    146
    Points
    4.464
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard EBOOT Graphics

    Is there an easy way to get the icon/background of a homebrew game (What you see on the xmb)? Is there a function in C that can accomplish this?

    P.S. I just realized that it is possible (irshell does it), but now I need to find out how to do it in c.
    Geändert von Cheater (10-05-2006 um 03:46 AM Uhr)

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

    Yes. You can extract all of it from either the % folder eboot, or a 'true' 1.0 BEOOT. Not qite sure how, may just want to test my taking a small blan eboot, add an image to it, open the image up in a hex editor and find its start and last hex, search through the eboot for hte start hex, mark it, search for hte end hex, mark it. Now you should be able to copy and paste all in between into a text document and rename it to .png and have it still work meaning you can do the same on the PSP...

    P.S. I actually havent any evidecne or proof that works, just an idea I had, so if it doesnt work, sorry.

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



 

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

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