Seite 273 von 340 ErsteErste ... 173 223 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 323 ... LetzteLetzte
Zeige Ergebnis 8.161 bis 8.190 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 think he is refering to an int. You can either cast it straight to an int which will truncate ...

  
  1. #8161
    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

    I think he is refering to an int. You can either cast it straight to an int which will truncate the float value (e.g 5.9 will become 5) or round it and then cast it to an int.



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

    Anti-QJ - a decimal is technically a float/double with infinite precision (pi, e, etc). Floats, doubles, long doubles, etc. have limited precision for obvious reasons. since some machines have no real use for incredibly high precision, there isnt hardware dedicated directly to it (the PSP for example, it can't handle doubles in hardware so they are handled in software, so you loose a little performance using doubles. The PSP isnt a graphing calculator after all :o

    ...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. #8163
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

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

    Standard

    ok, thanx for teh help.

  4. #8164
    Points: 2.680, Level: 31
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    12
    Points
    2.680
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard problem images

    Hi, I just began programming on the psp, but I have a little problem. I have a script that loads a .png and plays a .mp3, but if I want to write text it goes under the png. I just want it above , so some1 knows how to do this??

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

    Since you said script im guessing your using LUA. Theres a LUA help thread a thread-or-so below this one for any help you may have. Anyway, in your main loop/where the text and images are printed have your text preint first and then the image.

    Quick question about AI. Iv never worked with it and i really dont want to but i have to for my game otherwise it'll never see the light of day. All im gonna be doing is generating a random number between 0 and 1000 with the mersenne twister or whatever its called. From there i simply do a check to see what the random number is and also how far away the player is for example 200 pixels. Then, if the random number is > 500, stand still else move forward. Is that what simple AI is based around? Iv read Vaza's first tutorial on planning and stuff but i cant really be bothered reading the others seeing as though they're about a tic-tac-toe game and im making a 2d fighter. I just wanna know if im going the right way
    Geändert von Xsjado7 (03-15-2008 um 05:53 AM Uhr)

  6. #8166
    Æ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 devos50
    Hi, I just began programming on the psp, but I have a little problem. I have a script that loads a .png and plays a .mp3, but if I want to write text it goes under the png. I just want it above , so some1 knows how to do this??
    This tutorial shows you how to make use of the printTextScreen function.

    http://psp-coding.com/index.php?topic=7.0
    [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.

  7. #8167
    Points: 2.680, Level: 31
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    12
    Points
    2.680
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    thank you! It works great now:):Jump:
    -= Double Post =-
    Hi, another small problem. When I want to compile it it gives an error at the last line: expected declaration or statement at the end of input. This is my code:

    Spoiler for click to uncover:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <pspaudio.h>
    #include <pspaudiolib.h>
    #include <psppower.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>

    #include "graphics.h"
    #include "mp3player.h"

    PSP_MODULE_INFO("Mp3 Player", 0, 1, 1);
    #define printf pspDebugScreenPrintf
    #define prints printTextScreen
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))

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

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

    cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
    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() {
    scePowerSetClockFrequency (333, 333, 166);

    pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();

    pspAudioInit();
    SceCtrlData pad;
    Color white = RGB(255,255,255);
    Color red = RGB(255,0,0);
    int i;
    int selComponent = 0;
    MP3_Init(1);
    MP3_Load("test.mp3");
    Image* background;
    Image* gw;
    background = loadImage("background.png ");
    gw = loadImage("gw.png");
    blitAlphaImageToScreen(0 ,0 ,480 , 272, background, 0, 0);
    blitAlphaImageToScreen(0 ,0 ,136 , 170, gw, 300, 50);
    prints(0,0,"Now playing: -The Tarnished Coast (GW soundtrack)-",white);
    prints(0,10,"Made by: Devos50",white);
    while(1) {
    sceCtrlReadBufferPositive (&pad, 1);
    if(pad.Buttons & PSP_CTRL_UP) {
    if(selComponent > 0) {
    selComponent--;
    }
    for(i=0; i<10; i++) {
    sceDisplayWaitVblankStart ();
    }
    } else if(pad.Buttons & PSP_CTRL_DOWN) {
    if(selComponent < 2) {
    selComponent++;
    }
    for(i=0; i<10; i++) {
    sceDisplayWaitVblankStart ();
    }
    }
    if(pad.Buttons & PSP_CTRL_CROSS) {
    switch(selComponent) {
    case 0:
    MP3_Play();
    break;
    case 1:
    MP3_Pause();
    break;
    case 2:
    MP3_Stop();
    break;
    default:
    break;
    }
    } else if(pad.Buttons & PSP_CTRL_LEFT) {
    switch(selComponent) {
    case 0:
    break;
    case 1:
    break;
    case 2:
    break;
    default:
    break;
    }
    if(selComponent == 0) {
    prints(0, 20,"Play",white);
    } else {
    prints(0,20,"Play",red);
    }
    if(selComponent == 1) {
    prints(0, 30,"Pause",white);
    } else {
    prints(0,30,"Pause",red);
    }
    if(selComponent == 2) {
    prints(0, 40,"Stop",white);
    } else {
    prints(0,40,"Stop",red);
    }
    flipScreen();
    sceKernelSleepThread();
    return 0;
    }


    its a program with a background (2 png's) and a selection menu with some text. Someone knows what i'm doing wrong??
    Geändert von devos50 (03-15-2008 um 08:57 AM Uhr) Grund: Automerged Doublepost

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

    What is the EXACT error and line number?

  9. #8169
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    I'm pretty sure you forgetting 1 or 2 closing braces somewhere. If you indented your code, you would know that.

  10. #8170
    Points: 2.680, Level: 31
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    12
    Points
    2.680
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    it's in the last line, with the
    }

    Here is the error in cygwin:
    main.c: in function 'main';
    main.c:142: error: expected declaration or statement at the end of input;
    make: *** [main.o] Error 1

    someone knows how to solve it?

  11. #8171
    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 michaelp
    I'm pretty sure you forgetting 1 or 2 closing braces somewhere. If you indented your code, you would know that.
    Yep:
    Code:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <pspaudio.h>
    #include <pspaudiolib.h>
    #include <psppower.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    
    #include "graphics.h"
    #include "mp3player.h"
    
    PSP_MODULE_INFO("Mp3 Player", 0, 1, 1);
    #define printf pspDebugScreenPrintf
    #define prints printTextScreen
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common)
    {
        sceKernelExitGame();
        return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp)
    {
        int cbid;
    
        cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
        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()
    {
        scePowerSetClockFrequency (333, 333, 166);
    
        pspDebugScreenInit();
        SetupCallbacks();
        initGraphics();
    
        pspAudioInit();
        SceCtrlData pad;
        Color white = RGB(255,255,255);
        Color red = RGB(255,0,0);
        int i;
        int selComponent = 0;
        MP3_Init(1);
        MP3_Load("test.mp3");
        Image* background;
        Image* gw;
        background = loadImage("background.png ");
        gw = loadImage("gw.png");
        blitAlphaImageToScreen(0 ,0 ,480 , 272, background, 0, 0);
        blitAlphaImageToScreen(0 ,0 ,136 , 170, gw, 300, 50);
        prints(0,0,"Now playing: -The Tarnished Coast (GW soundtrack)-",white);
        prints(0,10,"Made by: Devos50",white);
        while (1)
        {
            sceCtrlReadBufferPositive (&pad, 1);
            if (pad.Buttons & PSP_CTRL_UP)
            {
                if (selComponent > 0)
                {
                    selComponent--;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            else if (pad.Buttons & PSP_CTRL_DOWN)
            {
                if (selComponent < 2)
                {
                    selComponent++;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            if (pad.Buttons & PSP_CTRL_CROSS)
            {
                switch (selComponent)
                {
                case 0:
                    MP3_Play();
                    break;
                case 1:
                    MP3_Pause();
                    break;
                case 2:
                    MP3_Stop();
                    break;
                default:
                    break;
                }
            }
            else if (pad.Buttons & PSP_CTRL_LEFT)
            {
                switch (selComponent)
                {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                default:
                    break;
                }
                if (selComponent == 0)
                {
                    prints(0, 20,"Play",white);
                }
                else
                {
                    prints(0,20,"Play",red);
                }
                if (selComponent == 1)
                {
                    prints(0, 30,"Pause",white);
                }
                else
                {
                    prints(0,30,"Pause",red);
                }
                if (selComponent == 2)
                {
                    prints(0, 40,"Stop",white);
                }
                else
                {
                    prints(0,40,"Stop",red);
                }
                flipScreen();
                sceKernelSleepThread();
                return 0;
            }

  12. #8172
    Points: 2.680, Level: 31
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    12
    Points
    2.680
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    still get the same error. I've looked up the script but can't find what I forgot. Some1 can find it???

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

    I think you forgot one right at the end:

    Code:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <pspaudio.h>
    #include <pspaudiolib.h>
    #include <psppower.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    
    #include "graphics.h"
    #include "mp3player.h"
    
    PSP_MODULE_INFO("Mp3 Player", 0, 1, 1);
    #define printf pspDebugScreenPrintf
    #define prints printTextScreen
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common)
    {
        sceKernelExitGame();
        return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp)
    {
        int cbid;
    
        cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
        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()
    {
        scePowerSetClockFrequency (333, 333, 166);
    
        pspDebugScreenInit();
        SetupCallbacks();
        initGraphics();
    
        pspAudioInit();
        SceCtrlData pad;
        Color white = RGB(255,255,255);
        Color red = RGB(255,0,0);
        int i;
        int selComponent = 0;
        MP3_Init(1);
        MP3_Load("test.mp3");
        Image* background;
        Image* gw;
        background = loadImage("background.png ");
        gw = loadImage("gw.png");
        blitAlphaImageToScreen(0 ,0 ,480 , 272, background, 0, 0);
        blitAlphaImageToScreen(0 ,0 ,136 , 170, gw, 300, 50);
        prints(0,0,"Now playing: -The Tarnished Coast (GW soundtrack)-",white);
        prints(0,10,"Made by: Devos50",white);
    
    while (1)
    {
            sceCtrlReadBufferPositive (&pad, 1);
            if (pad.Buttons & PSP_CTRL_UP)
            {
                if (selComponent > 0)
                {
                    selComponent--;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            else if (pad.Buttons & PSP_CTRL_DOWN)
            {
                if (selComponent < 2)
                {
                    selComponent++;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            if (pad.Buttons & PSP_CTRL_CROSS)
            {
                switch (selComponent)
                {
                case 0:
                    MP3_Play();
                    break;
                case 1:
                    MP3_Pause();
                    break;
                case 2:
                    MP3_Stop();
                    break;
                default:
                    break;
                }
            }
            else if (pad.Buttons & PSP_CTRL_LEFT)
            {
                switch (selComponent)
                {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                default:
                    break;
                }
                if (selComponent == 0)
                {
                    prints(0, 20,"Play",white);
                }
                else
                {
                    prints(0,20,"Play",red);
                }
                if (selComponent == 1)
                {
                    prints(0, 30,"Pause",white);
                }
                else
                {
                    prints(0,30,"Pause",red);
                }
                if (selComponent == 2)
                {
                    prints(0, 40,"Stop",white);
                }
                else
                {
                    prints(0,40,"Stop",red);
                }
                flipScreen();
                sceKernelSleepThread();
                return 0;
            }
    }

  14. #8174
    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 devos50
    still get the same error. I've looked up the script but can't find what I forgot. Some1 can find it???
    Of course you do. It is exactly the same code but properly indented. It should be obvious where you left the missing brace.

    Code:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <pspaudio.h>
    #include <pspaudiolib.h>
    #include <psppower.h>
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    
    #include "graphics.h"
    #include "mp3player.h"
    
    PSP_MODULE_INFO("Mp3 Player", 0, 1, 1);
    #define printf pspDebugScreenPrintf
    #define prints printTextScreen
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common)
    {
        sceKernelExitGame();
        return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp)
    {
        int cbid;
    
        cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
        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()
    {
        scePowerSetClockFrequency (333, 333, 166);
    
        pspDebugScreenInit();
        SetupCallbacks();
        initGraphics();
    
        pspAudioInit();
        SceCtrlData pad;
        Color white = RGB(255,255,255);
        Color red = RGB(255,0,0);
        int i;
        int selComponent = 0;
        MP3_Init(1);
        MP3_Load("test.mp3");
        Image* background;
        Image* gw;
        background = loadImage("background.png ");
        gw = loadImage("gw.png");
        blitAlphaImageToScreen(0 ,0 ,480 , 272, background, 0, 0);
        blitAlphaImageToScreen(0 ,0 ,136 , 170, gw, 300, 50);
        prints(0,0,"Now playing: -The Tarnished Coast (GW soundtrack)-",white);
        prints(0,10,"Made by: Devos50",white);
        while (1)
        {
            sceCtrlReadBufferPositive (&pad, 1);
            if (pad.Buttons & PSP_CTRL_UP)
            {
                if (selComponent > 0)
                {
                    selComponent--;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            else if (pad.Buttons & PSP_CTRL_DOWN)
            {
                if (selComponent < 2)
                {
                    selComponent++;
                }
                for (i=0; i<10; i++)
                {
                    sceDisplayWaitVblankStart ();
                }
            }
            if (pad.Buttons & PSP_CTRL_CROSS)
            {
                switch (selComponent)
                {
                case 0:
                    MP3_Play();
                    break;
                case 1:
                    MP3_Pause();
                    break;
                case 2:
                    MP3_Stop();
                    break;
                default:
                    break;
                }
            }
            else if (pad.Buttons & PSP_CTRL_LEFT)
            {
                switch (selComponent)
                {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                default:
                    break;
                }
                if (selComponent == 0)
                {
                    prints(0, 20,"Play",white);
                }
                else
                {
                    prints(0,20,"Play",red);
                }
                if (selComponent == 1)
                {
                    prints(0, 30,"Pause",white);
                }
                else
                {
                    prints(0,30,"Pause",red);
                }
                if (selComponent == 2)
                {
                    prints(0, 40,"Stop",white);
                }
                else
                {
                    prints(0,40,"Stop",red);
                }
            } // This one
    
            flipScreen();
            sceKernelSleepThread();
    
        } // and this one
    
        return 0;
    }

  15. #8175
    Points: 2.680, Level: 31
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    12
    Points
    2.680
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    ok, I can compile it now, but when I want to start it on my psp, it won't run. My psp freezes and shut down. Where is the error?? I've looked again at the script but can't find it:o

    ps: I found an error in the callback thread. There was a space, but I saw that while I was compiling and fixed it, so that isn't the error, and I'm sure I've copied the test.mp3 and gw.png and background.png in the EBOOT folders, and have all the necessary headers.

  16. #8176
    QJ Gamer Blue
    Points: 3.734, Level: 38
    Level completed: 56%, Points required for next Level: 66
    Overall activity: 14,0%

    Registriert seit
    Oct 2007
    Ort
    Illinois
    Beiträge
    158
    Points
    3.734
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    I was looking at the 1.50 POC source code, and was wondering how I would go on about changing this:

    Code:
    	if (strcmp(dirname, "ms0:/PSP/GAME") == 0)
    	{
    		theuid = res;
    	}
    so it would read from ms0:/PSP/GAME150 instead of /GAME. I've tried changing the string to /GAME150 but it still reads everything from /GAME.

    Anybody?

  17. #8177
    QJ Gamer Bronze
    Points: 5.354, Level: 47
    Level completed: 2%, Points required for next Level: 196
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    Right here
    Beiträge
    179
    Points
    5.354
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mirzab14
    I was looking at the 1.50 POC source code, and was wondering how I would go on about changing this:

    Code:
        if (strcmp(dirname, "ms0:/PSP/GAME") == 0)
        {
            theuid = res;
        }
    so it would read from ms0:/PSP/GAME150 instead of /GAME. I've tried changing the string to /GAME150 but it still reads everything from /GAME.

    Anybody?
    you also have to change both paths in the dread and dopen functions

    Code:
    int dopen_patch(const char *dirname)
    {
        int res = sceIoDopen(dirname);
    
        if (strcmp(dirname, "ms0:/PSP/GAME150") == 0)
        {
            theuid = res;
        }
    
        return res;
    }
    
    int dread_patch(SceUID dfd, SceIoDirent *dir)
    {
        char path[512];
    
        if (dfd != theuid)
            return sceIoDread(dfd, dir);
    
        while (1)
        {        
            int res = sceIoDread(dfd, dir);
                
            if (res <= 0)
                return res;
    
            snprintf(path, 512, "ms0:/PSP/GAME150/%s/EBOOT.PBP", dir->d_name);
    
            SceUID fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
    
            if (fd > 0)
            {
                u32 signature;
    
                sceIoRead(fd, &signature, 4);
                sceIoClose(fd);
    
                if (signature == PBP_SIGNATURE)
                    return res;
            }        
        }
    
        return 0;
    }
    sudo rm -rf /

    PSN ID: FigMan13

  18. #8178
    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 devos50
    ok, I can compile it now, but when I want to start it on my psp, it won't run. My psp freezes and shut down. Where is the error?? I've looked again at the script but can't find it:o

    ps: I found an error in the callback thread. There was a space, but I saw that while I was compiling and fixed it, so that isn't the error, and I'm sure I've copied the test.mp3 and gw.png and background.png in the EBOOT folders, and have all the necessary headers.
    Hint: What does sceKernelSleepThread do? Where is it being called?

  19. #8179
    QJ Gamer Blue
    Points: 3.734, Level: 38
    Level completed: 56%, Points required for next Level: 66
    Overall activity: 14,0%

    Registriert seit
    Oct 2007
    Ort
    Illinois
    Beiträge
    158
    Points
    3.734
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FigMan
    you also have to change both paths in the dread and dopen functions

    Code:
    int dopen_patch(const char *dirname)
    {
        int res = sceIoDopen(dirname);
    
        if (strcmp(dirname, "ms0:/PSP/GAME150") == 0)
        {
            theuid = res;
        }
    
        return res;
    }
    
    int dread_patch(SceUID dfd, SceIoDirent *dir)
    {
        char path[512];
    
        if (dfd != theuid)
            return sceIoDread(dfd, dir);
    
        while (1)
        {        
            int res = sceIoDread(dfd, dir);
                
            if (res <= 0)
                return res;
    
            snprintf(path, 512, "ms0:/PSP/GAME150/%s/EBOOT.PBP", dir->d_name);
    
            SceUID fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
    
            if (fd > 0)
            {
                u32 signature;
    
                sceIoRead(fd, &signature, 4);
                sceIoClose(fd);
    
                if (signature == PBP_SIGNATURE)
                    return res;
            }        
        }
    
        return 0;
    }
    Thanks, but still doesn't work. Maybe its something that can't be edited?

  20. #8180
    QJ Gamer Silver
    Points: 6.763, Level: 54
    Level completed: 7%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    413
    Points
    6.763
    Level
    54
    Downloads
    0
    Uploads
    0

    Standard

    I was wondering if anyone knows how to get the title of a PSP Game while using a PRX?

    I'm wanting to make my own simple universal cheat device and I need the title for each game.
    Atheist, because I just won't believe in what doesn't show itself to me.

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

    Either find the address of it in memory or maybe read the param.sfo of the currently playing game

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

    Yeah, read the PARAM.SFO. disc0:/PSP_GAME/PARAM.SFO is where it is for every PSP game.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  23. #8183
    QJ Gamer Silver
    Points: 6.763, Level: 54
    Level completed: 7%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    413
    Points
    6.763
    Level
    54
    Downloads
    0
    Uploads
    0

    Standard

    Thanks.
    Do you know exactly where in the file it is located?
    Atheist, because I just won't believe in what doesn't show itself to me.

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

    If I'm not mistaken, it varies. You'll have to parse some of the file to get exactly where in the file it's located.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

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

    Check out the source for mksfo in the SDK.

    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

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

    Code:
    #include <oslib/oslib.h>
    #imclude <pspkernel.h>
    
    PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
    
    OSL_IMAGE *background;
    
    int main()
    {
       	oslInit(0);							
    	oslInitGfx(OSL_PF_8888, 1);
    	
    	Color pink = RGB(255,0,255);
        Color white = RGB(255,255,255);
        
        background = oslLoadImageFile("menuback.png", OSL_IN_RAM, OSL_PF_5551);
        
        background->x = 0;
    	background->y = 0;
       	
        if (!background)
    	{
    		oslDebug("Image file: 'menuback.png' has not been found.");
    	}
        
        int menustatus;
        menustatus = 1
        
        oslReadKeys();
        
        oslStartDrawing();
        oslDrawImage(background);
        
        oslPrintf_xy(0,0,"Play Game", white);
        oslPrintf_xy(0,20,"Options", white);
        oslPrintf_xy(0,40,"Exit", white);
        
        if(menustatus = 1)
        {
            oslPrintf_xy(0,0,"Play Game", pink);
    		
    			{ 
    		if (osl_keys->pressed.cross)
    			game();
    			}
        }
        
        if(menu status = 2)
        {
            oslPrintf_xy(0,20,"Options", pink);
    		
    		if (osl_keys->pressed.cross)
    			{ 
    			options();
    			}
        }
        
    
    	if (menustatus = 3)
    	{	
    		oslPrintf_xy(0,60,"Credits", pink);
    		
    		if (osl_keys->pressed.cross)
    			{ 
    			credits();
    			}
    	}
    
    	if(menustatus = 4)
        {
            oslPrintf_xy(0,40,"Exit", pink);
    			
    		if (osl_keys->pressed.cross)
    			{ 
    			sceKernelExitGame();
    			}
        }
    	
    
        if (osl_pad.pressed.down)
        {  
    		menustatus ++;
        }
    	
    	if (osl_pad.pressed.up)
    	{
    		menustatus --;
    	}
    }
    
    
    void options()
    {	
    	Color pink = RGB(255,0,255);
        Color white = RGB(255,255,255);
        
        background = oslLoadImageFile("menuback.png", OSL_IN_RAM, OSL_PF_5551);
        
        background->x = 0;
    	background->y = 0;
       	
       	oslInit(0);							
    	oslInitGfx(OSL_PF_8888, 1);
       	
        if (!background)
    	{
    		oslDebug("Image file: 'menuback.png' has not been found.");
    	}
        
        int menustatus;
        menustatus = 1
        
        oslReadKeys();
        
        oslStartDrawing();
        oslDrawImage(background);
    	
    	oslPrintf_xy(50,50,"Kirby: All Pink - Options", white);
    	oslPrintf_xy(50,70,"Version 0.1", white);
    	
    	if (menustatus = 1)
    	{
    		oslPrintf_xy(50,100,"omg not done yet", pink);
    	
    	if (osl_pad.pressed.down)
        {  
    		menustatus ++;
        }
    	
    	if (osl_pad.pressed.up)
        {  
    		menustatus --;
        }
    }
    I'm having some trouble compiling this code. I didn't want to have to post it here but I have asked a few people and none know what the problem is. I get these errors/warnings:

    Code:
    [email protected] ~/menu
    $ make
    psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G4 -Wall -O2  -D_PSP_FW_VERSION
    =150   -c -o main.o main.c
    main.c: In function 'main':
    main.c:4: error: 'Color' undeclared (first use in this function)
    main.c:4: error: (Each undeclared identifier is reported only once
    main.c:4: error: for each function it appears in.)
    main.c:4: error: expected ';' before 'pink'
    main.c:5: error: expected ';' before 'white'
    main.c:7: error: 'background' undeclared (first use in this function)
    main.c:7: warning: implicit declaration of function 'oslLoadImageFile'
    main.c:7: error: 'OSL_IN_RAM' undeclared (first use in this function)
    main.c:7: error: 'OSL_PF_5551' undeclared (first use in this function)
    main.c:12: warning: implicit declaration of function 'oslInit'
    main.c:13: warning: implicit declaration of function 'oslInitGfx'
    main.c:13: error: 'OSL_PF_8888' undeclared (first use in this function)
    main.c:17: warning: implicit declaration of function 'oslDebug'
    main.c:23: error: expected ';' before 'oslReadKeys'
    main.c:25: warning: implicit declaration of function 'oslStartDrawing'
    main.c:26: warning: implicit declaration of function 'oslDrawImage'
    main.c:28: warning: implicit declaration of function 'oslPrintf_xy'
    main.c:28: error: 'white' undeclared (first use in this function)
    main.c:32: warning: suggest parentheses around assignment used as truth value
    main.c:34: error: 'pink' undeclared (first use in this function)
    main.c:36: error: 'osl_keys' undeclared (first use in this function)
    main.c:38: warning: implicit declaration of function 'game'
    main.c:42: error: 'menu' undeclared (first use in this function)
    main.c:42: error: expected ')' before 'status'
    main.c:48: warning: implicit declaration of function 'options'
    main.c:53: warning: suggest parentheses around assignment used as truth value
    main.c:59: warning: implicit declaration of function 'credits'
    main.c:63: warning: suggest parentheses around assignment used as truth value
    main.c:69: warning: implicit declaration of function 'sceKernelExitGame'
    main.c:74: error: 'osl_pad' undeclared (first use in this function)
    main.c: At top level:
    main.c:87: warning: conflicting types for 'options'
    main.c:48: warning: previous implicit declaration of 'options' was here
    main.c: In function 'options':
    main.c:88: error: 'Color' undeclared (first use in this function)
    main.c:88: error: expected ';' before 'pink'
    main.c:89: error: expected ';' before 'white'
    main.c:91: error: 'background' undeclared (first use in this function)
    main.c:91: error: 'OSL_IN_RAM' undeclared (first use in this function)
    main.c:91: error: 'OSL_PF_5551' undeclared (first use in this function)
    main.c:97: error: 'OSL_PF_8888' undeclared (first use in this function)
    main.c:107: error: expected ';' before 'oslReadKeys'
    main.c:112: error: 'white' undeclared (first use in this function)
    main.c:115: warning: suggest parentheses around assignment used as truth value
    main.c:117: error: 'pink' undeclared (first use in this function)
    main.c:119: error: 'osl_pad' undeclared (first use in this function)
    main.c:128:2: warning: no newline at end of file
    main.c:128: error: expected declaration or statement at end of input
    main.c: In function 'main':
    main.c:83: warning: control reaches end of non-void function
    make: *** [main.o] Error 1

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

    The compiler says there is no datatype of Color. Are you sure it is defined in the headers you have included? Normally it is a u32 IIRC. That will solve most of the errors.

  28. #8188
    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

    I'm sorry but what is a u32 IIRC?

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

    u32 = Unsigned 32 bit integer. If you look in the PSP SDK, you will see a typedef in one of the headers like this:
    Code:
    typedef u32 unsigned int;
    Or similar.

    IIRC = If I Recall Correctly.

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

    with OSL you declare it like:
    Code:
    OSL_COLOR*


 

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 .