Seite 276 von 340 ErsteErste ... 176 226 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 326 ... LetzteLetzte
Zeige Ergebnis 8.251 bis 8.280 von 10174

C/C++ Programming Help Thread

This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I decided after many errors to just remove all code relating to my enemy variables and functions, but I still ...

  
  1. #8251
    QJ Gamer Green
    Points: 5.646, Level: 48
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    743
    Points
    5.646
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I decided after many errors to just remove all code relating to my enemy variables and functions, but I still get errors, with most be like the originals from a couple pages ago :Argh: .


    My main.cpp:

    main.cpp#include <oslib/oslib.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <pspctrl.h>

    extern "C" {
    #include "logo.h"
    }

    PSP_MODULE_INFO("Survival (by spike021)", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THRE AD_ATTR_USER | THREAD_ATTR_VFPU);

    float totalhealth, health;

    int mx, my, yyy;

    bool paused;

    OSL_SOUND *music, *music2;
    OSL_IMAGE *player, *menu;

    void oslStopSound(OSL_SOUND *music2);

    health = 250;
    totalhealth = 250;

    ~health;
    ~totalhealth;


    void Keys()
    {
    oslReadKeys();

    if(!paused) {
    //joypad (move player on the screen)
    if (osl_keys->held.down) my += 3;
    if (osl_keys->held.up) my -= 3;
    if (osl_keys->held.left) mx -= 3;
    if (osl_keys->held.right) mx += 3;

    //joystick
    for (int i=24;i<=120;i+=16)
    {
    if (osl_keys->analogX > i) mx+=1;
    if (osl_keys->analogY > i) my+=1;
    if (osl_keys->analogX < -i) mx-=1;
    if (osl_keys->analogY < -i) my-=1;
    }
    }
    }


    int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
    }


    int CallbackThread(SceSize args, void *argp) {
    int cbid;

    cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCall back(cbid);

    sceKernelSleepThreadCB();

    return 0;
    }


    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(int argc, char* argv[])


    {
    oslDrawImage (menu);
    oslPlaySound(music2,0);

    if(PSP_CTRL_START == true)
    {
    oslClearScreen (RGB(0,0,0));
    oslStopSound(music2);
    }
    oslInit(0);
    oslInitGfx(OSL_PF_8888, 1);
    oslInitConsole();
    oslInitAudio();


    music = oslLoadSoundFile("awakeni ng.bgm", OSL_FMT_STREAM);// Sound for game
    music2 = oslLoadSoundFile("dawn.bg m", OSL_FMT_STREAM);// Sound for menu
    oslAssert(music); //Debug: verify it could be loaded
    oslAssert(music2); //Debug: verify it could be loaded

    oslPlaySound(music, 0);

    player = oslLoadImageFile("Pics/player.png", OSL_IN_RAM, OSL_PF_8888);
    menu = oslLoadImageFile("Pics/menu.png" , OSL_IN_RAM, OSL_PF_8888);

    player->x = 135;
    player->y = 240;
    oslDrawImage(player);
    // draw player

    oslDeinitAudio();
    oslQuit();

    return 0;
    }


    I read in google that those to things in red are supposed to fix the errors that I was getting, but I still get the same problems.

    Plus, I realize that some mistakes that I am making are elementary, but there are others that I just don't get from what I, and others know.

    Everytime I try making something and then compile it, I seem to get the same, exact roadblocks


    [QUOTE=Archaemic]
    [size=1]My manwich![/size][/QUOTE]
    [QUOTE=mohaas05]lol i can't say d*ck?[/QUOTE]

  2. #8252
    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

    You can't assign values to a variable except during instantiation outside function scope.
    Code:
    float totalhealth, health;
    
    int mx, my, yyy;
    
    bool paused;
    
    OSL_SOUND *music, *music2;
    OSL_IMAGE *player, *menu;
    
    void oslStopSound(OSL_SOUND *music2);
    
    health = 250;
    totalhealth = 250;
    
    ~health;
    ~totalhealth;
    To
    Code:
    float totalhealth = 200.f, health = 250.f;
    
    int mx, my, yyy;
    
    bool paused;
    
    OSL_SOUND *music, *music2;
    OSL_IMAGE *player, *menu;
    
    void oslStopSound(OSL_SOUND *music2);

  3. #8253
    QJ Gamer Green
    Points: 5.646, Level: 48
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    743
    Points
    5.646
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    You can't assign values to a variable except during instantiation outside function scope.

    Oh, I had forgotten that... I will try compiling once again.... ***crosses fingers***
    -= Double Post =-
    Ah, yaustar. If I could, I would donate points, you did what I could obviously not ;)

    I don't have my PSP atm, but as soon as I do, I will make sure my newly compiled eboot works correctly
    -= Double Post =-
    Ok, I finally got the application to compile(amongst many errors) but it worked :)

    But now, I get the problem, where everytime it is loaded from the memory stick, it freezes, and then the PSP shuts off. I can't figure out why that happens.... would there be any particular reason?
    Geändert von spike021 (03-19-2008 um 08:01 PM Uhr) Grund: Automerged Doublepost
    [QUOTE=Archaemic]
    [size=1]My manwich![/size][/QUOTE]
    [QUOTE=mohaas05]lol i can't say d*ck?[/QUOTE]

  4. #8254
    Points: 4.605, Level: 43
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Canada, Ontario
    Beiträge
    8
    Points
    4.605
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dre361224
    Well I searched about this and found many different things and got confused. I'd like to know how to change the color of a pixel. Is there a function for it or do you have to do it the long way and write your own function? lol

    Thanks in advance guys! :)
    Anybody? :Cry:

  5. #8255
    QJ Gamer Silver
    Points: 8.717, Level: 62
    Level completed: 89%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    Melbourne, Australia
    Beiträge
    1.773
    Points
    8.717
    Level
    62
    My Mood
    Amused
    Downloads
    0
    Uploads
    0

    Standard

    There is a function in the PSPSDK about changing colours ;)
    WHA!?

  6. #8256
    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 spike021
    But now, I get the problem, where everytime it is loaded from the memory stick, it freezes, and then the PSP shuts off. I can't figure out why that happens.... would there be any particular reason?
    Have you actually looked at what your code does?

  7. #8257
    QJ Gamer Green
    Points: 5.646, Level: 48
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    743
    Points
    5.646
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Have you actually looked at what your code does?

    Yeah, but I just don't get what the probem could be... :Argh:

    And I have sent PMs to a couple developers(won't say who), and the help that I have been getting has been a little mum. Although yaustar... you've been a good help, I applaud you ;)

    I have tried making an account at the ps2dev forums, but for some reason, any of the emails that I try to use don't work(supposedly they are banned) I have never registered there in my life

    I may come back here for help, but I really need to think about it first.
    [QUOTE=Archaemic]
    [size=1]My manwich![/size][/QUOTE]
    [QUOTE=mohaas05]lol i can't say d*ck?[/QUOTE]

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

    Given the code you have shown already:
    Code:
    int main(int argc, char* argv[])
    
    
    {
        oslDrawImage (menu);
        oslPlaySound(music2,0);
    
        if (PSP_CTRL_START == true)
        {
            oslClearScreen (RGB(0,0,0));
            oslStopSound(music2);
        }
        oslInit(0);
        oslInitGfx(OSL_PF_8888, 1);
        oslInitConsole();
        oslInitAudio();
    
    
        music = oslLoadSoundFile("awakeni ng.bgm", OSL_FMT_STREAM);// Sound for game
        music2 = oslLoadSoundFile("dawn.bg m", OSL_FMT_STREAM);// Sound for menu
        oslAssert(music); //Debug: verify it could be loaded
        oslAssert(music2); //Debug: verify it could be loaded
    
        oslPlaySound(music, 0);
    
        player = oslLoadImageFile("Pics/player.png", OSL_IN_RAM, OSL_PF_8888);
        menu = oslLoadImageFile("Pics/menu.png" , OSL_IN_RAM, OSL_PF_8888);
    
        player->x = 135;
        player->y = 240;
        oslDrawImage(player);
        // draw player
    
        oslDeinitAudio();
        oslQuit();
    
        return 0;
    }
    How many times does that code actually runs when the games starts? (Clue: Lower then 2)

  9. #8259
    QJ Gamer Green
    Points: 5.646, Level: 48
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    743
    Points
    5.646
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Yep. Now I know what I have done wrong.... I feel like an idiot :o

    Yaustar if I could donate........ ;)
    -= Double Post =-
    I'm still having problems... I guess it wasn't that(I added a while function for the return and everything). There must be something I am still missing.
    Geändert von spike021 (03-20-2008 um 08:13 PM Uhr) Grund: Automerged Doublepost
    [QUOTE=Archaemic]
    [size=1]My manwich![/size][/QUOTE]
    [QUOTE=mohaas05]lol i can't say d*ck?[/QUOTE]

  10. #8260
    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 spike021
    Yep. Now I know what I have done wrong.... I feel like an idiot :o

    Yaustar if I could donate........ ;)
    -= Double Post =-
    I'm still having problems... I guess it wasn't that(I added a while function for the return and everything). There must be something I am still missing.
    Yep but we can't see it because you haven't posted any updated code.

  11. #8261
    QJ Gamer Green
    Points: 5.646, Level: 48
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    743
    Points
    5.646
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Yep but we can't see it because you haven't posted any updated code.




    Code:
    int main(int argc, char* argv[])
    
    
    {
    
    		oslInit(0);					
    		oslInitGfx(OSL_PF_8888, 1); 
    		oslInitConsole();			
    		oslInitAudio();
    
    			SetupCallbacks();
    	
    	
    				music = oslLoadSoundFile("awakening.bgm", OSL_FMT_STREAM);// Sound for game
    				music2 = oslLoadSoundFile("dawn.bgm", OSL_FMT_STREAM);// Sound for menu
    
    	
    				player = oslLoadImageFile("Pics/player.png", OSL_IN_RAM, OSL_PF_8888);
    				menu   = oslLoadImageFile("Pics/menu.png"  , OSL_IN_RAM, OSL_PF_8888);
    	
    	
    while(!osl_quit){	
    
    Keys();
     
    	oslPlaySound(music2,0);
    		oslDrawImage (menu);
    
    oslReadKeys();
    	
    	if (osl_keys->held.start)
    			
    			{
    			oslClearScreen (RGB(0,0,0));
    			oslStopSound(music2);
    			}	
    			
    			
    		oslPlaySound(music, 0);
    
    			
    				player->x = 135;
    				player->y = 240;
    				oslDrawImage(player);
    				// draw player
    		
    
    		
    
    		oslDeinitAudio();
    		oslQuit();
    		
    		return 0;
    	}
    }
    Dam, the forums are creating spaces inbetween letters, just so you know.
    Geändert von spike021 (03-21-2008 um 03:53 PM Uhr)
    [QUOTE=Archaemic]
    [size=1]My manwich![/size][/QUOTE]
    [QUOTE=mohaas05]lol i can't say d*ck?[/QUOTE]

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

    Use the code tag...
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  13. #8263
    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

    Code:
    int main(int argc, char* argv[])
    {
        oslInit(0);
        oslInitGfx(OSL_PF_8888, 1);
        oslInitConsole();
        oslInitAudio();
        SetupCallbacks();
    
        music = oslLoadSoundFile("awakeni ng.bgm", OSL_FMT_STREAM);// Sound for game
        music2 = oslLoadSoundFile("dawn.bg m", OSL_FMT_STREAM);// Sound for menu
    
        player = oslLoadImageFile("Pics/player.png", OSL_IN_RAM, OSL_PF_8888);
        menu = oslLoadImageFile("Pics/menu.png" , OSL_IN_RAM, OSL_PF_8888);
    
        while (!osl_quit)
        {
            Keys();
    
            oslPlaySound(music2,0);
            oslDrawImage (menu);
    
            oslReadKeys();
    
            if (osl_keys->held.start)
    
            {
                oslClearScreen (RGB(0,0,0));
                oslStopSound(music2);
            }
            oslPlaySound(music, 0);
            player->x = 135;
            player->y = 240;
            oslDrawImage(player);
    // draw player
            oslDeinitAudio();
            oslQuit();
    
            return 0;
        }
    }
    No offense but you really should stop doing this and at least learn the basic logic flow statements. This code STILL only runs once.

    Read: http://parabellumgames.wordpress.com...c-programming/

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

    I've never used OSL, but looking at that straight away makes me think its wrong, with that while(!osl_quit) and the oslQuit(); function in the while loop, surely it makes it act like linear code? You should have some if statement before the oslQuit, to make sure it only runs when you want it to, thus actually keeping the while loop.

    A quick question to do with loops, if I do something like this:
    Code:
    int loop1 = 1; loop2 = 1;
    while(loop1)
    {
         //random code
         while(loop2)
         {
              //more random code
              if(something == something else) loop1 = 0;
         }
    }
    Would that effectively break the first loop thus removing you from both loops, or would it keep you running in loop2 until you broke from that, then break you from loop1 once you've "escaped" loop2?

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

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

  15. #8265
    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

    Zitat Zitat von Auraomega
    I've never used OSL, but looking at that straight away makes me think its wrong, with that while(!osl_quit) and the oslQuit(); function in the while loop, surely it makes it act like linear code? You should have some if statement before the oslQuit, to make sure it only runs when you want it to, thus actually keeping the while loop.

    A quick question to do with loops, if I do something like this:
    Code:
    int loop1 = 1; loop2 = 1;
    while(loop1)
    {
         //random code
         while(loop2)
         {
              //more random code
              if(something == something else) loop1 = 0;
         }
    }
    Would that effectively break the first loop thus removing you from both loops, or would it keep you running in loop2 until you broke from that, then break you from loop1 once you've "escaped" loop2?

    -Aura
    You should try experimenting yourself...

    But if you need to know without experimenting, if 'something' IS true to 'something else' it will still run the nested loop, only should that nested loop break would it compare loop1 to true/1 again and not execute the outer loop.

    P.S. what's loop2's data type ;)

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


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

    Thanks for that, and it was just a quick question before I hit the hay, I couldn't be bothered to search for the answer or type some test code, makefile, and output,
    int loop1 = 1; loop2 = 1;
    hell, I couldn't even make sure my code was correct

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

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

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

    Dev-C++ has made testing things a 5 second job... just throwing that out there ^^

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

    Projects

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


  18. #8268
    QJ Gamer Green
    Points: 5.106, Level: 45
    Level completed: 78%, Points required for next Level: 44
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    66
    Points
    5.106
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Dev-C++ has made testing things a 5 second job... just throwing that out there ^^
    How so?

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

    You type out normal command line code (no GUI) and hit F9, it compiles, thats only Win32 mind, no PSP stuff.

    I used to use Dev-C++, but it got annoying, its big, laggy, buggy and formats stuff horribly (I'm not talking the colouring, but the tabs, spaces etc), I instead use Notepad++ and MinGW32 command line stuff when I compile for the PC, its similar to the PSP too because you have to use makefiles, which I have also found preferable to showing an IDE what to link to.

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

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

  20. #8270
    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 Auraomega
    its similar to the PSP too because you have to use makefiles
    You don't have to. I still use an IDE to cross compile. (In my case Code::Blocks).

  21. #8271
    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 noticed that graphics.c doesn't function properly when using intrafont. For example, when I try to display an image when printing with intrafont the image becomes distorted. Can anyone tell me how to get them both functioning?

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

    I have no such problems, have you made sure that you have cached the fonts correctly? Try the biggest caching (I forget which one) and see if that helps. If that doesn't work maybe you could post some code, as it may be the order you are doing things.

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

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

  23. #8273
    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

    You need to reset a couple of the GU states that intraFont changes after using it.

    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

  24. #8274
    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 Insert_Witty_Name
    You need to reset a couple of the GU states that intraFont changes after using it.
    Ah, and that...

    I edited my intraFontPrint function to contain everything needed so I wouldn't have to continuously add the code when I used intraFont:

    Code:
    float intraFontPrint(intraFont *font, float x, float y, const char *text) {
        guStart(); /*~~~~~~~~~~~~~~~~Added Function~~~~~~~~~~~~~~~~~~~~*/
        if (!text || strlen(text) == 0 || !font) return x;
    	
    	int i = 0, length = 0;
    	if (font->options & INTRAFONT_STRING_SJIS) {
    		while (text[i]) {
    			length++;
    			i += ( text[i] <= 0x7FU || (text[i] >= 0xA0U && text[i] <= 0xDFU) || text[i] >= 0xFDU) ? 1 : 2; //single or double byte
    		}
    	} else {
    		length = strlen(text);
    	}
    	
        unsigned short* ucs2_text = (unsigned short*)malloc((length+1)*sizeof(unsigned short));
        if (!ucs2_text) return x;
    	
    	unsigned char* utext = (unsigned char*)text;
    	for (i = 0; i < length; i++) {
    		if (font->options & INTRAFONT_STRING_SJIS) {
    			ucs2_text[i] = intraFontSJIS2UCS2((unsigned char**)&utext);
    		} else {
    			ucs2_text[i] = utext[i];
    		}
    	}
        ucs2_text[i] = 0;
    	
        x = intraFontPrintUCS2(font, x, y, ucs2_text);
    	
        free(ucs2_text);
    	sceGuTexMode(GU_PSM_8888, 0, 0, 0); /*~~~~~~~~~~~~~~~~Added Function~~~~~~~~~~~~~~~~~~~~*/
        sceGuFinish();                      /*~~~~~~~~~~~~~~~~Added Function~~~~~~~~~~~~~~~~~~~~*/
        sceGuSync(0,0);                     /*~~~~~~~~~~~~~~~~Added Function~~~~~~~~~~~~~~~~~~~~*/
        return x;
    }
    Might be helpful to you.
    -Aura
    Last.fm | Deviant Art | First working OS picture

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

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

    Zitat Zitat von Auraomega
    You type out normal command line code (no GUI) and hit F9, it compiles, thats only Win32 mind, no PSP stuff.

    I used to use Dev-C++, but it got annoying, its big, laggy, buggy and formats stuff horribly (I'm not talking the colouring, but the tabs, spaces etc), I instead use Notepad++ and MinGW32 command line stuff when I compile for the PC, its similar to the PSP too because you have to use makefiles, which I have also found preferable to showing an IDE what to link to.

    -Aura
    Everything can be turned off or on in Dev-c++, my line/tab space is 2 and I ignore smart tabs. Works great.

    By the way, the code you posted wasn't PSP specific so why does it matter if it was compiled for PC?

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


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

    Hmm, well either way it was the makefile thing that was bugging me the most (I tried compiling the NeHe tutorials for OpenGL and it wouldn't link some libraries correctly).

    The person after ask why Dev-C++ was faster, I was simply stating it wouldn't be suitable for testing for the PSP (which yaustar corrected me on), I just wanted to clear up any possible confusion seeing as this is a PSP thread. Either way its obsolete now as yaustar added, you can use an IDE to compile PSP stuff on the fly.

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

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

  27. #8277
    QJ Gamer Green
    Points: 3.415, Level: 36
    Level completed: 44%, Points required for next Level: 85
    Overall activity: 6,0%

    Registriert seit
    Jan 2008
    Beiträge
    64
    Points
    3.415
    Level
    36
    My Mood
    Aggressive
    Downloads
    0
    Uploads
    0

    Standard netdialog problem

    Hello everyone,
    I have a problem with tne netdialog.c: I can't compile it...
    Here the netdialog.c:
    Code:
    /*
     * PSP Software Development Kit - http://www.pspdev.org
     * -----------------------------------------------------------------------
     * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
     *
     * main.c - Net dialog sample for connecting to an access point
     *
     * For OE firmwares, this sample must be run under the 3.xx kernel.
     *
     * Copyright (c) 2007 David Perry (Insert_Witty_Name)
     *
     */
    
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <string.h>
    #include <math.h>
    #include <psputility.h>
    #include <pspgu.h>
    #include <pspgum.h>
    #include <pspsdk.h>
    #include <pspnet.h>
    #include <pspnet_inet.h>
    #include <pspnet_apctl.h>
    
    /*
    #if _PSP_FW_VERSION >= 200
    PSP_MODULE_INFO("Net Dialog Sample", 0, 1, 1);
    #else
    PSP_MODULE_INFO("Net Dialog Sample", 0x1000, 1, 1);
    PSP_MAIN_THREAD_ATTR(0);
    #endif
    */
    
    static int running = 1;
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common)
    {
    	quit();
    	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, PSP_THREAD_ATTR_USER, 0);
    
    	if (thid >= 0)
    		sceKernelStartThread(thid, 0, 0);
    
    	return thid;
    }
    
    /* Graphics stuff, based on cube sample */
    static unsigned int __attribute__((aligned(16))) list[262144];
    
    /*
    struct Vertex
    {
    	unsigned int color;
    	float x,y,z;
    };
    
    struct Vertex __attribute__((aligned(16))) vertices[12*3] =
    {
        	{0xff7f0000,-1,-1, 1}, // 0
        	{0xff7f0000,-1, 1, 1}, // 4
        	{0xff7f0000, 1, 1, 1}, // 5
    
        	{0xff7f0000,-1,-1, 1}, // 0
        	{0xff7f0000, 1, 1, 1}, // 5
        	{0xff7f0000, 1,-1, 1}, // 1
    
        	{0xff7f0000,-1,-1,-1}, // 3
        	{0xff7f0000, 1,-1,-1}, // 2
        	{0xff7f0000, 1, 1,-1}, // 6
    
        	{0xff7f0000,-1,-1,-1}, // 3
        	{0xff7f0000, 1, 1,-1}, // 6
        	{0xff7f0000,-1, 1,-1}, // 7
    
        	{0xff007f00, 1,-1,-1}, // 0
        	{0xff007f00, 1,-1, 1}, // 3
        	{0xff007f00, 1, 1, 1}, // 7
    
        	{0xff007f00, 1,-1,-1}, // 0
        	{0xff007f00, 1, 1, 1}, // 7
        	{0xff007f00, 1, 1,-1}, // 4
    
        	{0xff007f00,-1,-1,-1}, // 0
        	{0xff007f00,-1, 1,-1}, // 3
        	{0xff007f00,-1, 1, 1}, // 7
    
        	{0xff007f00,-1,-1,-1}, // 0
        	{0xff007f00,-1, 1, 1}, // 7
        	{0xff007f00,-1,-1, 1}, // 4
    
        	{0xff00007f,-1, 1,-1}, // 0
        	{0xff00007f, 1, 1,-1}, // 1
        	{0xff00007f, 1, 1, 1}, // 2
    
        	{0xff00007f,-1, 1,-1}, // 0
        	{0xff00007f, 1, 1, 1}, // 2
        	{0xff00007f,-1, 1, 1}, // 3
    
        	{0xff00007f,-1,-1,-1}, // 4
        	{0xff00007f,-1,-1, 1}, // 7
        	{0xff00007f, 1,-1, 1}, // 6
    
        	{0xff00007f,-1,-1,-1}, // 4
        	{0xff00007f, 1,-1, 1}, // 6
        	{0xff00007f, 1,-1,-1}, // 5
    };
    */
    
    #define BUF_WIDTH (512)
    #define SCR_WIDTH (480)
    #define SCR_HEIGHT (272)
    #define PIXEL_SIZE (4)
    #define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
    #define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2)
    
    static void setupGu()
    {
        	sceGuInit();
    
        	sceGuStart(GU_DIRECT,list);
        	sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH);
        	sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH);
        	sceGuDepthBuffer((void*)0x110000,BUF_WIDTH);
        	sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
        	sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
        	sceGuDepthRange(0xc350,0x2710);
        	sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
        	sceGuEnable(GU_SCISSOR_TEST);
        	sceGuDepthFunc(GU_GEQUAL);
        	sceGuEnable(GU_DEPTH_TEST);
        	sceGuFrontFace(GU_CW);
        	sceGuShadeModel(GU_SMOOTH);
        	sceGuEnable(GU_CULL_FACE);
        	sceGuEnable(GU_CLIP_PLANES);
        	sceGuFinish();
        	sceGuSync(0,0);
    
        	sceDisplayWaitVblankStart();
        	sceGuDisplay(GU_TRUE);
    }
    
    static void drawStuff(void)
    {
    	static int val = 0;
    
    	sceGuStart(GU_DIRECT, list);
    
    	sceGuClearColor(0xff554433);
    	sceGuClearDepth(0);
    	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
    
    	sceGumMatrixMode(GU_PROJECTION);
    	sceGumLoadIdentity();
    	sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);
    	   
    	sceGumMatrixMode(GU_VIEW);
    	sceGumLoadIdentity();
    	
    	sceGumMatrixMode(GU_MODEL);
    	sceGumLoadIdentity();
    	    
    	ScePspFVector3 pos = { 0, 0, -5.0f };
    	ScePspFVector3 rot = { val * 0.79f * (M_PI/180.0f), val * 0.98f * (M_PI/180.0f), val * 1.32f * (M_PI/180.0f) };
    	sceGumTranslate(&pos);
    	sceGumRotateXYZ(&rot);
    
    	//sceGumDrawArray(GU_TRIANGLES, GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D, 12*3, 0, vertices);
    
    	sceGuFinish();
    	sceGuSync(0,0);
    	
    	val++;
    }
    
    int netDialog()
    {
    	int done = 0;
    
       	pspUtilityNetconfData data;
    
    	memset(&data, 0, sizeof(data));
    	data.base.size = sizeof(data);
    	data.base.language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
    	data.base.buttonSwap = PSP_UTILITY_ACCEPT_CROSS;
    	data.base.graphicsThread = 17;
    	data.base.accessThread = 19;
    	data.base.fontThread = 18;
    	data.base.soundThread = 16;
    	data.action = PSP_NETCONF_ACTION_CONNECTAP;
    	
    	struct pspUtilityNetconfAdhoc adhocparam;
    	memset(&adhocparam, 0, sizeof(adhocparam));
    	data.adhocparam = &adhocparam;
    
    	sceUtilityNetconfInitStart(&data);
    	
    	while(running)
    	{
    		drawStuff();
    
    		switch(sceUtilityNetconfGetStatus())
    		{
    			case PSP_UTILITY_DIALOG_NONE:
    				break;
    
    			case PSP_UTILITY_DIALOG_VISIBLE:
    				sceUtilityNetconfUpdate(1);
    				break;
    
    			case PSP_UTILITY_DIALOG_QUIT:
    				sceUtilityNetconfShutdownStart();
    				break;
    				
    			case PSP_UTILITY_DIALOG_FINISHED:
    				done = 1;
    				break;
    
    			default:
    				break;
    		}
    
    		sceDisplayWaitVblankStart();
    		sceGuSwapBuffers();
    		
    		if(done)
    			break;
    	}
    	
    	return 1;
    }
    
    void netInit(void)
    {
    	sceNetInit(128*1024, 42, 4*1024, 42, 4*1024);
    	
    	sceNetInetInit();
    	
    	sceNetApctlInit(0x8000, 48);
    }
    
    void netTerm(void)
    {
    	sceNetApctlTerm();
    	
    	sceNetInetTerm();
    	
    	sceNetTerm();
    }
    
    int user_thread(SceSize args, void *argp)
    {
    	netInit();
    	
    	SetupCallbacks();
    	
    	setupGu();
    
    	netDialog();
    	
    	netTerm();
    	
    	return 0;
    }
    
    
    int main(int argc, char *argv[])
    {
    	#if _PSP_FW_VERSION >= 200
    	sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);
    
    	sceUtilityLoadNetModule(PSP_NET_MODULE_INET);
    	
    	netInit();
    	
    	SetupCallbacks();
    	
    	setupGu();
    
    	netDialog();
    	
    	netTerm();
    
    	#else
    
    	pspSdkLoadInetModules();
    
    	SceUID thid = sceKernelCreateThread("user_thread", user_thread, 0x18, 0x10000, PSP_THREAD_ATTR_USER, NULL);
    
    	sceKernelStartThread(thid, 0, NULL);
    	
    	sceKernelWaitThreadEnd(thid, 0);
    	#endif
    	
    	sceKernelExitGame();
    
    	return 0;
    }
    And here the makefile:
    Code:
    TARGET = net
    OBJS = netdialog.o
    
    PSP_FW_VERSION = 371
    
    INCDIR = 
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    PSPSDK=$(shell psp-config --pspsdk-path)
    PSPBIN = $(PSPSDK)/../bin
    
    
    LIBDIR =
    
    EXTRA_TARGETS = EBOOT.PBP
    PSP_EBOOT_TITLE = net
    
    LIBDIR =
    LDFLAGS =
    STDLIBS= -lc -lSDL_image -lSDL_gfx -lSDL_ttf -lpng -ljpeg -lSDL -lcurl -lfreetype
    LIBS=$(STDLIBS)-lpspwlan -lpsputility -lpspgum -lpspgu -lm -lpspnet -lpspkernel -lpspnet_inet -lpspnet_apctl
    
    include $(PSPSDK)/lib/build.mak
    Here a screenshot of the problem:


    Thank you ^^

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

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

    Standard

    I answered this in another forum where you just posted the exact same question...

    I'll answer it again though in case it turns up in a search for someone.

    You're pre-compiled toolchain pre-dates the changes I made that are required for the sample to compile.

    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

  29. #8279
    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

    Weights = Thickness?

  30. #8280
    QJ Gamer Blue
    Points: 4.296, Level: 41
    Level completed: 73%, Points required for next Level: 54
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    132
    Points
    4.296
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard







    How can i make it so that the cliffs have collision detection too? I know how to do it for the sides of the map but i was wondering how it can be done for various parts of the maps? I just want to know, now its in my head and i keep thinking about it lol. By the way i am using oslib and have just started to learn to code for the psp =\. would someone be kind enough to answer my question?


 

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

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