Seite 280 von 340 ErsteErste ... 180 230 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 330 ... LetzteLetzte
Zeige Ergebnis 8.371 bis 8.400 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; Hey, can anyone suggest an alternative to blitAlphaImageToScreen()? That makes my images go all weird, they dont blit properly, and ...

  
  1. #8371
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    Hey,
    can anyone suggest an alternative to blitAlphaImageToScreen()? That makes my images go all weird, they dont blit properly, and libGe supposedly supports alpha but i just get white instead or transparency.



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

    It's probably your images fault ;) And ya theres plenty of alternatives. Oslib, JG++ (i believe thats the name of it i forgot lol), GU, PSPGL, LTE, triEngine, etc. etc.

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


  3. #8373
    QJ Gamer Platinum
    Points: 66.627, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    National Front Disco
    Beiträge
    13.057
    Points
    66.627
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    As SG57 said, OSLib. It has a good transparency function, but it only supports PNG files I believe.

  4. #8374
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    Yeah, iv used OSLib before but its more of an engine like those others mentioned

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

    Moose_Island - What are you talking about... You can either specify a transparency key in code and load a 24 bit image (JPG i believe) and have those parts be transparent or just load a 32 bit image with transparency in it already. As for file format support - PNG, JPG and GIF support.

    Xsjado - yes it's an engine, but if your current graphics library is lacking in what you need, you should be smart enough to get a better one or else why even bother? Don't bend over backwards trying to get something done when there are much easier, more efficient methods available.

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


  6. #8376
    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 SilverSpring
    You don't need to choose your own address, just need to make sure your buffer is 64 Byte aligned.
    I'm using malloc, as I'm reading the data.PSP into memory, do I use __attribute__((aligned(64 ))) on the pointer? Like this:

    Code:
    unsigned char* datapsp __attribute__((aligned(64)));
    Zitat Zitat von SilverSpring
    Yea you need to post the stub, specifically your imports attributes flag. Is your lib for umode or kmode exports, or both? Post your exports attributes flag from your exports file as well then.
    Its all usermode, I wasn't aware there was any difference between exports in kernel and user:

    (Its all basically graphics.c and intraFont.c functions)
    Spoiler for Stub:
    Code:
    	.set noreorder
    
    #include "pspstub.s"
    
    	STUB_START "GraphicsModule",0x00090000,0x00280005
    	STUB_FUNC  0x53B64845,loadImage
    	STUB_FUNC  0x11B85F76,loadPngImage
    	STUB_FUNC  0xAEFDA2B8,loadJpegImage
    	STUB_FUNC  0x5B54A8F2,loadImageFromMemory
    	STUB_FUNC  0xA25C9A03,blitImageToImage
    	STUB_FUNC  0xA5EEE86F,blitImageToScreen
    	STUB_FUNC  0x04EBBB47,blitAlphaImageToImage
    	STUB_FUNC  0x15FC8575,blitAlphaImageToScreen
    	STUB_FUNC  0xE3C65B49,createImage
    	STUB_FUNC  0x5D376A46,freeImage
    	STUB_FUNC  0x2051CEBB,clearImage
    	STUB_FUNC  0x17E489B2,clearScreen
    	STUB_FUNC  0x04C6A497,fillImageRect
    	STUB_FUNC  0x03CA35C7,fillScreenRect
    	STUB_FUNC  0xEFFF7611,putPixelScreen
    	STUB_FUNC  0x42E79358,putPixelImage
    	STUB_FUNC  0x86CB522E,getPixelScreen
    	STUB_FUNC  0xC31E37EC,getPixelImage
    	STUB_FUNC  0xD49FC83B,saveImage
    	STUB_FUNC  0x89A37178,savePngImage
    	STUB_FUNC  0xED85D2AB,saveJpegImage
    	STUB_FUNC  0x5DCDA3F3,flipScreen
    	STUB_FUNC  0x361DC427,initGraphics
    	STUB_FUNC  0x970ED5DF,disableGraphics
    	STUB_FUNC  0x15C0CF5C,drawLineScreen
    	STUB_FUNC  0x72FA72F0,drawLineImage
    	STUB_FUNC  0x3F7CA9B0,getVramDrawBuffer
    	STUB_FUNC  0xD4C6015D,getVramDisplayBuffer
    	STUB_FUNC  0x72FC960B,guStart
    	STUB_FUNC  0x43222295,intraFontInit
    	STUB_FUNC  0x5490AF57,intraFontShutdown
    	STUB_FUNC  0xC1DDA431,intraFontLoad
    	STUB_FUNC  0xAAC3056A,intraFontUnload
    	STUB_FUNC  0xE70425F0,intraFontActivate
    	STUB_FUNC  0x5E7343C2,intraFontSetStyle
    	STUB_FUNC  0x208C3DFF,intraFontPrintUCS2
    	STUB_FUNC  0x73A00FD5,intraFontPrint
    	STUB_FUNC  0x2487F1B9,intraFontPrintf
    	STUB_FUNC  0xB67F0E98,intraFontMeasureText
    	STUB_FUNC  0x3933584A,intraFontMeasureTextUCS2
    	STUB_END


    Spoiler for Exports:
    Code:
    # Define the exports for the prx
    PSP_BEGIN_EXPORTS
    
    # These four lines are mandatory (although you can add other functions like module_stop)
    # syslib is a psynonym for the single mandatory export.
    PSP_EXPORT_START(syslib, 0, 0x8000)
    PSP_EXPORT_FUNC_HASH(module_start)
    PSP_EXPORT_VAR_HASH(module_info)
    PSP_EXPORT_END
    
    PSP_EXPORT_START(GraphicsModule, 0, 0x0001)
    PSP_EXPORT_FUNC(loadImage)
    PSP_EXPORT_FUNC(loadPngImage)
    PSP_EXPORT_FUNC(loadJpegImage)
    PSP_EXPORT_FUNC(loadImageFromMemory)
    PSP_EXPORT_FUNC(blitImageToImage)
    PSP_EXPORT_FUNC(blitImageToScreen)
    PSP_EXPORT_FUNC(blitAlphaImageToImage)
    PSP_EXPORT_FUNC(blitAlphaImageToScreen)
    PSP_EXPORT_FUNC(createImage)
    PSP_EXPORT_FUNC(freeImage)
    PSP_EXPORT_FUNC(clearImage)
    PSP_EXPORT_FUNC(clearScreen)
    PSP_EXPORT_FUNC(fillImageRect)
    PSP_EXPORT_FUNC(fillScreenRect)
    PSP_EXPORT_FUNC(putPixelScreen)
    PSP_EXPORT_FUNC(putPixelImage)
    PSP_EXPORT_FUNC(getPixelScreen)
    PSP_EXPORT_FUNC(getPixelImage)
    PSP_EXPORT_FUNC(saveImage)
    PSP_EXPORT_FUNC(savePngImage)
    PSP_EXPORT_FUNC(saveJpegImage)
    PSP_EXPORT_FUNC(flipScreen)
    PSP_EXPORT_FUNC(initGraphics)
    PSP_EXPORT_FUNC(disableGraphics)
    PSP_EXPORT_FUNC(drawLineScreen)
    PSP_EXPORT_FUNC(drawLineImage)
    PSP_EXPORT_FUNC(getVramDrawBuffer)
    PSP_EXPORT_FUNC(getVramDisplayBuffer)
    PSP_EXPORT_FUNC(guStart)
    PSP_EXPORT_FUNC(intraFontInit)
    PSP_EXPORT_FUNC(intraFontShutdown)
    PSP_EXPORT_FUNC(intraFontLoad)
    PSP_EXPORT_FUNC(intraFontUnload)
    PSP_EXPORT_FUNC(intraFontActivate)
    PSP_EXPORT_FUNC(intraFontSetStyle)
    PSP_EXPORT_FUNC(intraFontPrintUCS2)
    PSP_EXPORT_FUNC(intraFontPrint)
    PSP_EXPORT_FUNC(intraFontPrintf)
    PSP_EXPORT_FUNC(intraFontMeasureText)
    PSP_EXPORT_FUNC(intraFontMeasureTextUCS2)
    PSP_EXPORT_END
    
    PSP_END_EXPORTS


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

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

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

    im trying to do collision but i have a prob. I cant seem to move my main sprite so i can check if the 2 other objects have collision. Can someone please help?


    Code:
    //Oslib header file
    #include <oslib/oslib.h>
    
    //This is needed for eboot
    PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
    
    //this creates pointers for our images.
    OSL_IMAGE *sprite, *sprite2, *sprite3;
    
    //definations
    #define DOWN 0
    #define UP 35
    #define RIGHT 70
    #define LEFT 105
    
    //variables
    int sprite_position;
    int sprite_march;
    
    //declare the function like buttons and spriteAnimation
    void Buttons();
    void SpriteAnimate();
    int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY,OSL_IMAGE *img3, float img3posX, float img3posY );
    
    int main()
    {
    
    //start the Oslib library
        oslInit(0);
    //start the graphixs mode
        oslInitGfx(OSL_PF_8888, 1);
    
    //sets the transparency color
        oslSetTransparentColor(RGB(255,0,255));
    
    //loads the images into memory
        sprite = oslLoadImageFile("sprite.png", OSL_IN_RAM, OSL_PF_5551);
        sprite2 = oslLoadImageFile("sprite2.png", OSL_IN_RAM, OSL_PF_5551);
        sprite3 = oslLoadImageFile("sprite3.png", OSL_IN_RAM, OSL_PF_5551);
    
    //Disables the transparent color so it cannot be used again
        oslDisableTransparentColor();
    
    //sees if all files are avaiable
        if (!sprite || !sprite2||!sprite3)
            oslDebug("! one or more of the files were missing, the program cannot run");
            
            
    //Sets the sprites original position, lets see if i can get 2 sprites on da bloody screen
        sprite->x = 155;
        sprite->y = 95;
        sprite_position = DOWN;
    
    //sets second sprite position
        sprite2->x = 230;
        sprite2->y = 130;
        
    //sets thrid sprite pos
        sprite3->x = 270;
        sprite3->y = 130;
    
    
    //main while loop
        while (!osl_quit)
        {
            //to be able ot draw on the screen
                oslStartDrawing();
                
            //Buttons 
                Buttons();
                
            //draws a green background
                oslDrawGradientRect(0,0,480,272,RGB(0,128,0),RGB(0,128,0), RGB(128,255,128), RGB(128,255,128)); 
                
            //this draws the images to the screen
                oslDrawImage(sprite);
                oslDrawImage(sprite2);
                oslDrawImage(sprite3);
                
            //stops the drawing mode
                oslEndDrawing();
                
            //sync the screen 
                oslSyncFrame();
            }
            
            //terminate the program
            oslEndGfx();
            oslQuit();
            return 0;
        }
        
            void Buttons()
            {
            //starts up the psp buttons
                oslReadKeys();
                
            if (osl_keys->held.down)
            {
                if(!collision(sprite, sprite->x, sprite->y + 2, sprite2, sprite2->x, sprite2->y, sprite3, sprite3->x, sprite3->y  ))
                {
                //sprite movement
                sprite->y +=2;
                
                //sets sprite position on sprite sheet
                    sprite_position = DOWN;
                
                //calls sprie animate
                    SpriteAnimate();
            }
            }
                    
                if (osl_keys->held.up)
            {
                if(!collision(sprite, sprite->x, sprite->y - 2, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y ))
                {
                    sprite->y-= 2;
                    sprite_position = UP;
                    SpriteAnimate();
                
            }
            }
            
           if (osl_keys->held.right)
        {
                if(!collision(sprite, sprite->x + 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y  ))
                {
            sprite->x += 2;
            sprite_position = RIGHT;
            SpriteAnimate();
        }
        }
                
                    if (osl_keys->held.left)
        {
            if(!collision(sprite, sprite->x - 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y  ))
            {
            sprite->x -= 2;
            sprite_position = LEFT;
            SpriteAnimate();
        }
        }
                
                   //If a button is not pressed
        if (!osl_keys->held.value) 
        {
        //Start the variable over for when a button is pressed again
            sprite_march = 0; 
    
            //Sets the sprite's direction
            oslSetImageTileSize(sprite,0,sprite_position,22,35);
        }
    }
    
    
    void SpriteAnimate()
       {    
            //Moves the sprite in the row that it is in
            sprite_march++;
    
            //Moves the sprite constantly
            oslSetImageTileSize(sprite,(sprite_march * 22),sprite_position,22,35);
    
            //resets the sprite movement in that row
            if (sprite_march == 6) sprite_march = 0;
        
    }
                
            
            int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY, OSL_IMAGE *img3, float img3posX, float img3posY ) 
    {
       int collision;
       collision = 0;
       float img1width  = img1->stretchX;
       float img1height = img1->stretchY;
       float img2width  = img2->stretchX;
       float img2height = img2->stretchY;
       float img3width = img3->stretchX;
       float img3height = img3->stretchY;
      
       
       if ((img1posX + img1width > img2posX) &&
           (img1posX < img2posX + img2width) &&
           (img1posX + img1width > img3posX)&&
           (img1posX <img3posX + img3width)&&
           (img1posY + img1height > img3posY)&&
           (img1posY < img3posY + img3height)&&
           (img1posY + img1height > img2posY) &&
           (img1posY < img2posY + img2height) ) 
    {
    {
             collision = 1;               
       }     
       return collision;
    }
    }

  8. #8378
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Xsjado - yes it's an engine, but if your current graphics library is lacking in what you need, you should be smart enough to get a better one or else why even bother? Don't bend over backwards trying to get something done when there are much easier, more efficient methods available.
    Yeah, very true. Im gonna get to work on porting my code to OSL. Thanks

  9. #8379
    QJ Gamer Silver
    Points: 12.501, Level: 73
    Level completed: 13%, Points required for next Level: 349
    Overall activity: 62,0%

    Registriert seit
    Sep 2007
    Ort
    AUS
    Beiträge
    284
    Points
    12.501
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    can some one help me with this error.
    luasystem.cpp.text+0x26bc): undefined reference to `sctrlHENIsSE()'
    luasystem.cpp.text+0x26cc): undefined reference to `sctrlHENIsDevhook()'
    luasystem.cpp.text+0x26fc): undefined reference to `sctrlSEGetConfig(SEConfi g*)'
    luasystem.cpp.text+0x2718): undefined reference to `sctrlSEMountUmdFromFile( char*, int, int)'
    luasystem.cpp.text+0x2734): undefined reference to `sctrlSEMountUmdFromFile( char*, int, int)'
    luasystem.cpp.text+0x279c): undefined reference to `sctrlKernelLoadExecVSHDi sc(char const*, SceKernelLoadExecVSHParam *)'
    luasystem.cpp.text+0x281c): undefined reference to `sctrlKernelLoadExecVSHDi sc(char const*, SceKernelLoadExecVSHParam *)'
    luasystem.cpp.text+0x2874): undefined reference to `sctrlKernelLoadExecVSHMs 2(char const*, SceKernelLoadExecVSHParam *)'
    collect2: ld returned 1 exit status
    make: *** [luaplayer.elf] Error 1

    I get it when compiling. I have referenced the headers needed and added the lib in the make file



    &(^&&*T^&*^& DONT WORRY FIXED )&*&^*(&^
    Geändert von homemister91 (04-06-2008 um 12:57 AM Uhr)
    Wyvern. That is all

  10. #8380
    Points: 2.572, Level: 30
    Level completed: 82%, Points required for next Level: 28
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    1
    Points
    2.572
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    Awesome

  11. #8381
    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 Auraomega
    I'm using malloc, as I'm reading the data.PSP into memory
    As I stated when you first asked, use memalign.

    Code:
    memalign(64, size);

    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. #8382
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know where to find the .tga image for this tutorial?

    http://www.psp-programming.com/code/doku.php?id=cspgu-neheport-lesson5

    I got a nehe.tga image of the net but i dont think its the right one because it cant be opened
    -= Double Post =-
    All good, just got the picture from the NeHe OpenGL texture mapping tut and saved it as a tga with Photoshop
    Geändert von Xsjado7 (04-06-2008 um 01:44 PM Uhr) Grund: Automerged Doublepost

  13. #8383
    QJ Gamer Bronze
    Points: 4.795, Level: 44
    Level completed: 23%, Points required for next Level: 155
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Netherlands
    Beiträge
    359
    Points
    4.795
    Level
    44
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard How do you tell the PSP to shutdown in C

    Hi,

    I have Googled for it and checked several sites, but could not find it. I know that sceKernelExitGame() returns to the VSH. But how do I tell a PSP that it needs to shutdown?

    In Pandora the function sceKernelExitGame() reboots the PSP.

  14. #8384
    Points: 9.019, Level: 63
    Level completed: 90%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    Narnia
    Beiträge
    110
    Points
    9.019
    Level
    63
    Downloads
    0
    Uploads
    0

    Standard

    This exits the game to the XMB.
    Code:
    sceKernelExitGame();
    I forgot how to shut down. Let me make a quick search.

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

    scePowerRequestStandby() "shuts down" the PSP completely (clearing memory)

    scePowerRequestSuspend() shuts down PSP keeping memory intact (resume application later)

    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)

  16. #8386
    Points: 9.019, Level: 63
    Level completed: 90%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    Narnia
    Beiträge
    110
    Points
    9.019
    Level
    63
    Downloads
    0
    Uploads
    0

    Standard

    Dangit....
    I have all my code on my other computer so I had to look it up and I was just about to post it!

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

    :P beat you to the chase lol

    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)

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

    It's times like this that I turn to the PSPLink source code. It's very educational. scePowerRequestStandby is how PSPLink does it.

    crait: I recognize your avatar. Which movie is it from? I can't remember. Is it Butterfly and Sword?
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  19. #8389
    Points: 9.019, Level: 63
    Level completed: 90%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    Narnia
    Beiträge
    110
    Points
    9.019
    Level
    63
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Archaemic
    It's times like this that I turn to the PSPLink source code. It's very educational. scePowerRequestStandby is how PSPLink does it.

    crait: I recognize your avatar. Which movie is it from? I can't remember. Is it Butterfly and Sword?
    Yes, I too look at source code for how to do stuff if someone has used it before.

    And nope. Kung Pow! Enter The Fist
    But it's originally from Savage Killers AKA Tiger and Crane Fist

  20. #8390
    QJ Gamer Platinum
    Points: 66.627, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    National Front Disco
    Beiträge
    13.057
    Points
    66.627
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Thread merged with C/C++ Programming Help Thread, it exists for a reason.

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

    I know what ntohs,htons,ntohl,htonl do...

    But where's the source for these?

    It changes byteordering; I would like to peek @ the source.

  22. #8392
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Hey,
    I am using this huge line for a file check, and if it fails, display an error:
    Code:
    if (!menu || !credit1 || !spaceship || !enemy || !bg1 || !bg2 || !blueweapon || !redweapon || !specialweapon || !explosion || !bpickup || !fpickup) { oslDebug("Error: Could not load one or more images"); }
    Is there an easier way to do a file check for every png image i load?

    Thanks.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

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

    TMNT - If you're going to ask for help, specify the graphics library your using that handles PNG loading.

    In anycase, don't do it that way. If you're using oslib 2.10, call this after initialization, it will automatically assert anything you load.
    Code:
    oslSetQuitOnLoadFailure((int) 1 /* 1 - on, 0 - off */);
    Should you be using any other version of oslib or just choose not to use it as you like to manage what you load, not rely on some integrated stuff (like me), use oslAssert(pointer_to_OSL_ resource) Why you do this is to prevent the manual oslDebug stuff, oslAssert automatically triggers a fatal error message box informing you what file couldn't be loaded and gives you the line and source file where it was called (be it not found or not enough memory).

    I don't know if you know this or not, but a few things you should know when working with loaded resources. When ever you're loading a resource, always and check if it's already loaded, if it is delete it then load. When working with sounds and music it is automatically stopped then deleted, When unloading resources, always check if it's already loaded and if it is then delete and assign to NULL to prevent false-positives when checking for if it's already loaded.
    example:
    Code:
    // load main menu resources
    if (menu_background) // if the menu_background is loaded
      oslDeleteImage(menu_background); // delete it
    
    menu_background = oslLoadImageFile("menu.png", ......); // load our menu background image
    oslAssert(menu_background); // check and make sure it loaded
    
    if (menu_music) // if the menu music is already loaded
      oslDeleteSound(menu_music); // delete it, stops automatically if playing
    
    menu_music = oslLoadSoundFile("music.bgm"...); // load menu music
    oslAssert(menu_music);
    
    .............
    
    // delete menu resources
    if (menu_background)
      oslDeleteImage(menu_background);
    
    menu_background = NULL;
    
    if (menu_music)
      oslDeleteSound(menu_music);
    
    menu_music = NULL;
    Why assign to NULL?
    Code:
    void Menu();
    void Game();
    
    OSL_IMAGE *menuBackground = NULL;
    
    void LoadMenuResources()
    {
      if (menuBackground) // this is what im talking about
        oslDeleteImage(menuBackground); // this will crash it second time through
    
      menuBackground = oslLoadImageFilePNG("menu.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_5551);
      oslAssert(menuBackground); 
    }
    
    void UnloadMenuResources()
    {
      if (menuBackground)
        oslDeleteImage(menuBackground);
    
      //menuBackground = NULL;
    }
    
    void Menu()
    {
      LoadMenuResources();
    
      while(1)
      {
        if x is pressed {
          break;
        }
      }
    
      UnloadMenuResources();
    
      Game(); 
    }
    
    void Game()
    {
      LoadGameResources();
    
      while(1)
      {
        if x is pressed {
          break;
        }
      }
    
      UnloadGameResources();
    
      Menu();
    }
    
    int main()
    {
      Menu();
    
      return 0;
    }
    Obviously that won't compile but you can adapt it to compile and see for yourself.

    It will run fine, your menu will work, you can go to the game as well, it's just when you try to leave the game and go back to the menu that you try to load the menu resources that it will crash. This is because when you unloaded the menu resources, you didn't nullify the pointer to the OSL_IMAGE struct that is the menuBackground, so menuBackground doesn't return NULL since it is pointing to an address in memory, so the line in LoadMenuResources() i commented on will crash it upon re-entering the menu (specifically the oslDeleteImage). It will run that first if statement since menuBackground isn't returning null despite it being deleted in the unloading since it is pointing to an address. so it will try to delete the stuff at the address menuBackground is pointing to. Undefined behavior will occur but in 99% of the cases, expect a crash with an address fetch exception.

    If you do happen to try it out, uncomment the line where it assigns it to NULL and see the difference.

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


  24. #8394
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Thanks dude. I will try that tommorow, and give you the results. I only needed the first code though, but thanks for the thorough explaination. I am using OSlib 2.10.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

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

    Still I don't think it nullifies the pointer after deleting, (tried it myself) so if you do any deleting and running through it again, you'll have a problem.

    ...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. #8396
    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'm having a few problems with plugins in Project4, only one method has to work and I'm not truely fussed which, but every one I've attempted has failed, just wondering if anyone can help me with the 2 that I still have structured?

    I want to load an EBOOT.PBP (or prx for that matter) with arguments:
    Spoiler for loadExec:
    Code:
    void loadPlugin(char bpath[])
    {
    	struct SceKernelLoadExecVSHParam param;
        memset(&param, 0, sizeof(param));
        param.size = sizeof(param)+strlen(bpath)+1;
        param.argp = bpath;
        param.args = strlen(bpath)+1;
        param.key  = "game";
    	
    	sctrlKernelLoadExecVSHMs2("ms0:/EBOOK/EBOOT.PBP", &param);
    }
    This method simply loadExecs EBOOT.PBP, but doesn't send arguments to it.


    Spoiler for loadModuleBuffer:
    Code:
    void loadPlugin(char bpath[])
    {
    	char pluginLocation[256];
    	unsigned char* datapsp;
    	int bufferSize;
    	long int pointerStart, pointerEnd;
    	SceUID EBOOT;
    	SceUID plugin;
    	int status = 0;
    	
    	EBOOT = sceIoOpen("ms0:/EBOOK/EBOOT.PBP", PSP_O_RDONLY, 0777);
    	
    	getOffsets(EBOOT, 32, &pointerStart, &pointerEnd);	
    	bufferSize = pointerEnd - pointerStart;
    	//datapsp = (unsigned char*) malloc (bufferSize+1);
    	datapsp = (unsigned char*) memalign (64, bufferSize);
    	if(datapsp > 0)
    	{
    		sceIoLseek(EBOOT, pointerStart, SEEK_SET);
    		sceIoRead(EBOOT, datapsp, bufferSize);
    		
    		sceIoClose(EBOOT);
    		plugin = loadModBuffer(datapsp, bufferSize, 0, NULL);
    		if(plugin < 0)
    		{
    			fatalerror(plugin, "loadPlugin", "loadfile.c", "loadModBuffer", "Error loading plugin file");
    		}
    		
    		else
    		{
    			status = startMod(plugin, strlen(bpath), bpath, 0, 0);
    			if(status < 0)
    			{
    				fatalerror(status, "loadPlugin", "loadfile.c", "startMod", "Error starting plugin file");
    			}
    		}
    		//free(datapsp);
    	}
    	else
    	{
    		sceIoClose(EBOOT);
    	}
    }
    This method crashes, getOffsets is perfect as I've used it with many other things, and the loadModBuffer is just a kernel wrapper for sceKernelLoadModuleBuffer , as is startMod just a wrapper for sceKernelStartModule (had to export this to another module as main code wouldn't compile with said function).


    I think I'd prefer to be able to do the latter way, but the former is ok too, as long as I have some way of passing arguments I'll be happy.

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

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

  27. #8397
    Ænima
    Points: 6.447, Level: 52
    Level completed: 49%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Sep 2007
    Beiträge
    587
    Points
    6.447
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega
    I'm having a few problems with plugins in Project4, only one method has to work and I'm not truely fussed which, but every one I've attempted has failed, just wondering if anyone can help me with the 2 that I still have structured?

    I want to load an EBOOT.PBP (or prx for that matter) with arguments:
    Spoiler for loadExec:
    Code:
    void loadPlugin(char bpath[])
    {
    	struct SceKernelLoadExecVSHParam param;
        memset(&param, 0, sizeof(param));
        param.size = sizeof(param)+strlen(bpath)+1;
        param.argp = bpath;
        param.args = strlen(bpath)+1;
        param.key  = "game";
    	
    	sctrlKernelLoadExecVSHMs2("ms0:/EBOOK/EBOOT.PBP", &param);
    }
    This method simply loadExecs EBOOT.PBP, but doesn't send arguments to it.


    Spoiler for loadModuleBuffer:
    Code:
    void loadPlugin(char bpath[])
    {
    	char pluginLocation[256];
    	unsigned char* datapsp;
    	int bufferSize;
    	long int pointerStart, pointerEnd;
    	SceUID EBOOT;
    	SceUID plugin;
    	int status = 0;
    	
    	EBOOT = sceIoOpen("ms0:/EBOOK/EBOOT.PBP", PSP_O_RDONLY, 0777);
    	
    	getOffsets(EBOOT, 32, &pointerStart, &pointerEnd);	
    	bufferSize = pointerEnd - pointerStart;
    	//datapsp = (unsigned char*) malloc (bufferSize+1);
    	datapsp = (unsigned char*) memalign (64, bufferSize);
    	if(datapsp > 0)
    	{
    		sceIoLseek(EBOOT, pointerStart, SEEK_SET);
    		sceIoRead(EBOOT, datapsp, bufferSize);
    		
    		sceIoClose(EBOOT);
    		plugin = loadModBuffer(datapsp, bufferSize, 0, NULL);
    		if(plugin < 0)
    		{
    			fatalerror(plugin, "loadPlugin", "loadfile.c", "loadModBuffer", "Error loading plugin file");
    		}
    		
    		else
    		{
    			status = startMod(plugin, strlen(bpath), bpath, 0, 0);
    			if(status < 0)
    			{
    				fatalerror(status, "loadPlugin", "loadfile.c", "startMod", "Error starting plugin file");
    			}
    		}
    		//free(datapsp);
    	}
    	else
    	{
    		sceIoClose(EBOOT);
    	}
    }
    This method crashes, getOffsets is perfect as I've used it with many other things, and the loadModBuffer is just a kernel wrapper for sceKernelLoadModuleBuffer , as is startMod just a wrapper for sceKernelStartModule (had to export this to another module as main code wouldn't compile with said function).


    I think I'd prefer to be able to do the latter way, but the former is ok too, as long as I have some way of passing arguments I'll be happy.

    Thanks.
    -Aura
    I don't know if this will help, or if it's right, but whenever I pass a text argument, I use a pointer.

    void load_plugin(char * path) {}
    [IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]

    Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.

  28. #8398
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Lol, you didn't really have to quote that if you replied right after his post (no offense, your awesome).
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  29. #8399
    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 Judas
    I don't know if this will help, or if it's right, but whenever I pass a text argument, I use a pointer.

    void load_plugin(char * path) {}
    Nope, it shouldn't make a difference as far as I'm aware, although any suggestions are worth noting so I'll have a quick fiddle around with the code to see if that fixes it :)

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

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

  30. #8400
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Hey,
    here is my shooting code:
    Code:
    /*******************
        Shooting
    ********************/
    //Fresh Shot Ready
    if (WeaponTimer < 1)
    {
    WeaponPosX = SpaceshipPosX + SpaceshipWidth;
    WeaponPosY = SpaceshipPosY + 15;
    weapondamage = 0;
    }
    
    //Fresh Shot Ready
    if (FireTimer < 1)
    {
    WeaponPosX = SpaceshipPosX + SpaceshipWidth;
    WeaponPosY = SpaceshipPosY + 15;
    weapondamage = 0;
    }
    
    //Active Shoot
    if (FireTimer > 1) {    
       if ( (FireTimer < 4) && (weaponstatus < 4) ) { WAV_Play(fire1); }
       else if ( (FireTimer < 4) && (weaponstatus > 3) ) { WAV_Play(flame); }
       if (WeaponTimer > 0) {
           if ( (weaponstatus > 0) && (weaponstatus < 4) ) {
           blitimage(WeaponOffsetX, WeaponOffsetY, WeaponWidth, WeaponHeight, Weapon, WeaponPosX, WeaponPosY);
           }
           else if ( (weaponstatus > 3) && (weaponstatus < 7) ) {
           blitimage(WeaponOffsetX, WeaponOffsetY, WeaponWidth, WeaponHeight, Weapon2, WeaponPosX, WeaponPosY);
           }
       weapondamage = weaponpower1;
       }
       FireTimer++;
       WeaponPosX += wspeed1;
    }
    
    //Refresh Shooting
    if (FireTimer > WeaponDistance)
    {
    WeaponPosX = SpaceshipPosX + SpaceshipWidth;
    WeaponPosY = SpaceshipPosY + 15;
    weapondamage = 0;
    FireTimer = 0;
    WeaponTimer = 1;
    }
    It works great, but the problem is that i can't have more than one bullet. How am i supposed to allow "rapidfire" or "more than one bullet on the screen" at a time by using only one image?

    Thanks. :o
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)


 

Tags for this Thread

Forumregeln

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





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

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