Seite 318 von 340 ErsteErste ... 218 268 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 ... LetzteLetzte
Zeige Ergebnis 9.511 bis 9.540 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; Check my post, specifically the 2 code boxes. Notice whats different about them. Yeah, it helps to get the function ...

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

    Check my post, specifically the 2 code boxes. Notice whats different about them. Yeah, it helps to get the function name correct

    -Aura


    Last.fm | Deviant Art | First working OS picture

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

  2. #9512
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    been messin around with the vlf library

    but it wont load the lateral menu even
    though i tell it too any help.
    Code:
    //============================================
    //      Basic includes/start of program
    //============================================
    #include <pspkernel.h>
    #include <stdlib.h>
    #include "vlf.h"
    #include "graphics.h"
    #include <pspsdk.h>  
    #include <pspdebug.h>
    #include <pspctrl.h>
    #include <psppower.h>
    //--------------------------------------------
    PSP_MODULE_INFO("VLFTest", 0x800, 1, 0);
    PSP_MAIN_THREAD_ATTR(0);
    //--------------------------------------------
    //============================================
    //            Global variables
    //============================================
    void *ReadFileAllocEx(char *file, int seek, int size, int *retSize);
    
    int done = 0;
    
    //============================================
    //                  Main
    //============================================
    int app_main()  
    {
       int mini();
       char *items[] = { "Start", "Exit" };
    	
       vlfGuiSystemSetup(1, 1, 1);		
       vlfGuiLateralMenu(2, items, 0, mini, 100);
       
       vlfGuiSetModelSystem();
       void *battery_icon;   
       vlfGuiSetBackgroundPlane(0x00CC99);
       vlfGuiSetModelSystem();  
       vlfGuiAddClock(); // Añade el reloj en la esquina superior derecha  
    //   vlfGuiAddBatteryIconSystem(&battery_icon, 10*1000*1000);  
         
       int title_text = vlfGuiAddText(240, 50, "BlackBurd"); 
    //   vlfGuiSetTextAlignment(title_text, VLF_ALIGNMENT_CENTER);
    
       while(1) {  
           vlfGuiDrawFrame();  
       }  
         
       sceKernelSleepThread();  
       return 0;  
    }
    //============================================
    //               Main program
    //============================================
    int mini(int sel)
    {
    	switch (sel)
    	{
    		case 0:			
    			jesus();		
    		return VLF_EV_RET_REMOVE_HANDLERS | VLF_EV_RET_REMOVE_OBJECTS;
    		
    		case 1:
    			sceKernelExitGame();
    		break;
    	}
    	
    	return VLF_EV_RET_NOTHING;
    }
    
    int jesus (int sel)
    {
    	vlfGuiAddText(240, 50, "Demo test 2.");
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  3. #9513
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    BlackBurd, your's doesn't work too. Compiles but screen stays black:

    Code:
    #include <pspsdk.h>
    #include <pspkernel.h>
    #include <psppower.h>
    #include <pspctrl.h>
    #include <pspdisplay.h>
    #include <pspdebug.h>
    
    #define printf pspDebugScreenPrintf
    
    PSP_MODULE_INFO("menu", 0, 1, 0);
    PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
    
    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);
    sceKernelRegisterExitCallback(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;
    }
    
    #define N_Entries 3
    char *MenuItems[] =
    {
    "ITEM",
    "ITEM2",
    "ITEM3"
    };
    
    int main()
    {
    SceCtrlData menupad, lastpad;
    sceCtrlReadBufferPositive (&lastpad, 1);
    
    int i, selection = 0;
    
    while(1)
    {
    pspDebugScreenSetXY(0, 0);
    printf("Welcome to PROGRAM-NAME\n");
    
    for(i = 0; i < N_Entries; i++)
    {
    if (i != selection)
    printf(" %s\n", MenuItems[i]);
    
    else
    printf(" -> %s\n", MenuItems[i]);
    }
    
    sceCtrlReadBufferPositive (&menupad, 1);
    if (lastpad.Buttons != menupad.Buttons)
    {
    lastpad.Buttons = menupad.Buttons;
    
    if (menupad.Buttons & PSP_CTRL_DOWN)
    {
    selection++;
    if (selection >= N_Entries)
    selection = 0;
    }
    
    else if(menupad.Buttons & PSP_CTRL_UP)
    {
    selection--;
    if (selection < 0)
    selection = N_Entries - 1;
    }
    
    else if(menupad.Buttons & PSP_CTRL_CROSS)
    {
    break;
    }
    }
    }
    
    return selection;
    }
    [spoiler=My Releases So Far]
    PSP_Operator v2.0 Final (and earlier; stopped with this one)
    Mario's Road v2.0 (working on 2.5:D)
    UMD_Operator v0.0.2 (and earlier; stopped with this one)
    PSP-Quiz v0.1 (working on v0.2 already:D)
    [/spoiler]

  4. #9514
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von malliet Beitrag anzeigen
    BlackBurd, your's doesn't work too. Compiles but screen stays black:
    It does work.
    You need the vlf library prx's for it to display.


    The only problem is that it wont display the lateral menu just the date time and wave
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  5. #9515
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Hahahahaha, I meant my problem with my menu:P You posted one for me on the previous page
    but I meant that one didn't work XD
    [spoiler=My Releases So Far]
    PSP_Operator v2.0 Final (and earlier; stopped with this one)
    Mario's Road v2.0 (working on 2.5:D)
    UMD_Operator v0.0.2 (and earlier; stopped with this one)
    PSP-Quiz v0.1 (working on v0.2 already:D)
    [/spoiler]

  6. #9516
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von malliet Beitrag anzeigen
    Hahahahaha, I meant my problem with my menu:P You posted one for me on the previous page
    but I meant that one didn't work XD
    Oooh i just changed what aura said was wrong with it.

    It actually worked on my psp.
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  7. #9517
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    The menu works now, Davee helped me out

    I have another question again. I have a PRX Plugin now that needs to play MP3 sounds.
    It compiles perfect but when I enable it in Recovery Menu and start my PSP the
    screen stays black and my PSP turns off.

    main.c:

    Code:
    /* PRX psp file */
    #include <pspsdk.h>
    #include <pspkernel.h>
    #include <string.h>
    #include <pspsysmem.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <pspaudio.h>
    #include <pspaudiolib.h>
    #include <psppower.h>
    
    #include "mp3player.h"
    
    PSP_MODULE_INFO("XMB Music", 0x1000, 1, 1);
    PSP_HEAP_SIZE_KB(20480);
    
    #define printf pspDebugScreenPrintf
    
    int main()
    {
     scePowerSetClockFrequency(333, 333, 166);
     pspDebugScreenInit();
     pspAudioInit();
     SceCtrlData pad;
     int i;
     MP3_Init(1);
     MP3_Load("ms0:/music/music.mp3");
     while(1)
     {
      sceCtrlReadBufferPositive(&pad, 1);
      if(pad.Buttons & PSP_CTRL_CROSS)
      {
       MP3_Play();
      }
      else if(pad.Buttons & PSP_CTRL_CIRCLE)
      {
       MP3_Pause();
       for(i=0; i<10; i++)
       {
        sceDisplayWaitVblankStart();
       }
      }
      if (MP3_EndOfStream() == 1)
      {
       MP3_Stop();
      }
     }
      MP3_Stop();
      MP3_FreeTune();
      sceKernelSleepThread();
      return 0;
    }
    
    /* Exported function returns the address of module_info */
    void* getModuleInfo(void)
    {
    	return (void *) &module_info;
    }
    exports.exp:

    Code:
    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
    
    # Export our function
    PSP_EXPORT_START(MyLib, 0, 0x0001)
    PSP_EXPORT_FUNC_HASH(getModuleInfo)
    PSP_EXPORT_END
    
    PSP_END_EXPORTS
    Makefile:

    Code:
    TARGET = musicplugin
    OBJS = main.o mp3player.o
    
    # Define to build this as a prx (instead of a static elf)
    BUILD_PRX=1
    # Define the name of our custom exports (minus the .exp extension)
    PRX_EXPORTS=exports.exp
    
    USE_PSPSDK_LIBC = 1
    
    INCDIR = 
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    LIBDIR =
    LIBS = -lmad -lpspaudiolib -lpspaudio -lpsppower
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    Geändert von malliet (01-14-2009 um 12:40 PM Uhr) Grund: Automerged Doublepost
    [spoiler=My Releases So Far]
    PSP_Operator v2.0 Final (and earlier; stopped with this one)
    Mario's Road v2.0 (working on 2.5:D)
    UMD_Operator v0.0.2 (and earlier; stopped with this one)
    PSP-Quiz v0.1 (working on v0.2 already:D)
    [/spoiler]

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

    Just taking one look at your code and I can tell you the problem:

    PSP_HEAP_SIZE_KB(20480); allocates all free user memory. I know for a fact that the XMB actually allocates directly to the user memory so if you've allocated it elsewhere then the XMB won't load.

    There may be other issues but I've not looked at the code enough to see, I'll update if I find anything else blindly obvious.

    -Aura

    EDIT:

    Another thing, you've selected kernel mode (0x1000) and allocated from user memory, I'm not certain but I don't think thats either possible nor a good idea.
    Geändert von Auraomega (01-14-2009 um 01:12 PM Uhr)
    Last.fm | Deviant Art | First working OS picture

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

  9. #9519
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    any body know anything about vlf library.

    i still need help with the lateral menu.
    mo one else seems to know how to do it and im very sure i didnt make a typo because it complies.
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  10. #9520
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    my ones always compile but it never shows anything on screen either :Argh:

    ~!SlasheR!~!

  11. #9521
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slasher2661996 Beitrag anzeigen
    my ones always compile but it never shows anything on screen either :Argh:

    ~!SlasheR!~!
    you actually have to build the prx.

    If you cant get trickbrick v5 and delete the eboot then put yours in and see if it runs.
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  12. #9522
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    tried dont work

    my computers acting up atm tho so... :Argh::Argh::Argh:

    ~!SlasheR!~

  13. #9523
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slasher2661996 Beitrag anzeigen
    tried dont work

    my computers acting up atm tho so... :Argh::Argh::Argh:

    ~!SlasheR!~
    ill pm you when i get back to my pc im doing this from psp
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  14. #9524
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Hi

    I'm having troubles using FontLoader. I tried to include it in my project but since it is a c++ project I had to rename fontloader.c to fontloader.cpp. Now when I try to compile he tells me

    fontloader.cpp (83) : multiple definition of `ft_library'
    main.cpp (30) : first defined here
    but line 83 is just

    Code:
    	u32* fbLine = framebuffer + xofs + yofs * lineSize;
    	for (y = 0; y < bitmap->rows; y++) {  // Line 83
    		u8* column = line;
    and there's no ft_library used in my main.cpp at all! In fact 'ft_library' is only used 3 times in the whole project, and only in fontloader.h:

    Code:
    FT_Library  ft_library;
    and fontloader.cpp:
    Code:
            initError = FT_Init_FreeType( &ft_library ); // line 26
            // [...]
    	int error = FT_New_Memory_Face(ft_library, fontData, filesize, 0, &font->face); // line 48
    and there's only 1 definition. All I did was change the filename to .cpp.


    PS: Are there any other libraries for displaying fonts than fontloader? I was told pgeFont is pretty good and fast and stuff, but it doesn't work with Psilocybeing's graphic library on which the rest of the project is heavily built on already.

  15. #9525
    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:
    FT_Library  ft_library;
    This is in a header file? If so, change it to:
    Code:
    extern FT_Library  ft_library;
    and add
    Code:
    FT_Library  ft_library;
    To the top after the includes in FontLibrary.cpp.

  16. #9526
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    It compiles and works! Thanks a lot yaustar! :)

  17. #9527
    QJ Gamer Bronze
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2008
    Ort
    thugz mansion
    Beiträge
    875
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Okay i got my men working but now im having problems with audio playback.

    Is there an audio library that is compatible with dax's vlf library.
    Zitat Zitat von SuperBatXS
    I use my psp all the time in the plane. I was masturbating once while watching some lesbian videos when a fat lady beside me was sleeping and her really hot daughter next to her was getting ready for my dong to shove up her ding. Then, her daughter and I were about to go to the bathroom together but, the air hostess came to tell me i should stop right now. I swear this happened. I am never taking my psp to the plane again. Always got my iPod though...hehe. ;)

  18. #9528
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Exclamation

    still no luck with the vlf library, could someone please answer my question on the next page?
    ~!SlasheR!~

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

    How do I allocate memory to the first dimension of an array?

    Something like
    Code:
    char *array[256];
    array = ?
    ?

  20. #9530
    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

    This only works in initialization, but you can do this:

    Code:
    char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
    If there are entries absent, they are set to zero.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  21. #9531
    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 Xsjado7 Beitrag anzeigen
    How do I allocate memory to the first dimension of an array?

    Something like
    Code:
    char *array[256];
    array = ?
    ?
    That's an array of pointers, the first entry being at array[0].

    Just do array[0] = malloc(...);

    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

  22. #9532
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    So well, another one of my endless troubles.

    So, i'm toying with samples in pspsdk samples.

    The clut sample in gu folder is quite interesting, but i have to get it working with Oslib library at once.
    So now, with no guessing what i'm doing i just copy&pasted the sample, removed what was unneded (guessing) and put in with oslib.
    When compiling to check whenever it works, i have that error -
    PHP-Code:
    main.cpp:(.text+0x1dc): relocation truncated to fitR_MIPS_GPREL16 against `osl_quit'
    main.cpp:(.text+0x1e8): relocation truncated to fit: R_MIPS_GPREL16 against 
    `osl_skip'
    main.cpp:(.text+0x22c): relocation truncated to fit: R_MIPS_GPREL16 against `osl_frameskip'
    main.cpp:(.text+0x230): relocation truncated to fitR_MIPS_GPREL16 against `osl_maxFrameskip'
    main.cpp:(.text+0x238): relocation truncated to fit: R_MIPS_GPREL16 against 
    `osl_vsyncEnabled'
    main.cpp:(.text+0x23c): relocation truncated to fit: R_MIPS_GPREL16 against `osl_quit' 
    And now, i have no idea, i'm literraly at dark now. So, any help appreciated.
    Source in the attachement.
    Also, if somebody was kind enough to help me make it use only Oslib functions then i would be very grateful.
    Angehängte Dateien Angehängte Dateien

  23. #9533
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    drop oslib, trying to use the oslib and direct GU clut is not going to work like you want, trust me, if your going to use the clut than simple drop oslib competly and begin learning the gu, also the CLUT is damn amazing, no worry of my rendering being an issue on my end=-), but like i said competly drop oslib if you plan to use CLUT=-)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  24. #9534
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever Beitrag anzeigen
    drop oslib, trying to use the oslib and direct GU clut is not going to work like you want, trust me, if your going to use the clut than simple drop oslib competly and begin learning the gu, also the CLUT is damn amazing, no worry of my rendering being an issue on my end=-), but like i said competly drop oslib if you plan to use CLUT=-)
    Too bad, but i have to use oslib. I'm just making a game, and clut will be a background on some maps, so i have to use them both at once, and my pspsdk knowledge isn't good enough to drop oslib, let alone do what i want
    So, the question is - direct GU drawing with oslib with no conflicts. How?

  25. #9535
    QJ Gamer Bronze
    Points: 6.359, Level: 52
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    france
    Beiträge
    170
    Points
    6.359
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Netaro Beitrag anzeigen
    Too bad, but i have to use oslib. I'm just making a game, and clut will be a background on some maps, so i have to use them both at once, and my pspsdk knowledge isn't good enough to drop oslib, let alone do what i want
    So, the question is - direct GU drawing with oslib with no conflicts. How?
    I got interested when I saw your message, so I tried to include the clut sample into my oslib application, and was successful, I can draw the clut sample and an OSL_IMAGE on top of it.

    clutoslib.cpp, where the function is:
    PHP-Code:
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <time.h>

    #include <pspgu.h>

    #include <oslib/oslib.h>

    //static unsigned int __attribute__((aligned(16))) clut_list[262144];

    struct Vertex
    {
        
    float u,v;
        
    float x,y,z;
    };

    #define NUM_SLICES 128
    #define NUM_ROWS 128
    #define RING_SIZE 2.0f
    #define RING_RADIUS 1.0f
    #define SPRITE_SIZE 0.025f

    unsigned int colors[8] = 
    {
        
    0xffff0000,
        
    0xffff00ff,
        
    0xff0000ff,
        
    0xff00ffff,
        
    0xff00ff00,
        
    0xffffff00,
        
    0xffffffff,
        
    0xff00ffff
    };

    unsigned int __attribute__((aligned(16))) clut256[256];
    unsigned char __attribute__((aligned(16))) tex256[256*256];

    int test_clut()
    {
        
    OSL_IMAGE *image=oslLoadImageFilePNG((char *)"test.png"OSL_IN_RAM|OSL_SWIZZLEDOSL_PF_8888);
        
        
    unsigned int i,j;

        for (
    0256; ++j)
        {
            for (
    0256; ++i)
            {
                
    tex256[256] = i;
            }
        }
        
        
    sceKernelDcacheWritebackAll();

        
    int offset 0;

        while(!
    osl_quit)
        {        
            
    // animate palette

            
    unsigned intclut = (unsigned int*)(((unsigned int)clut256)|0x40000000);
            for (
    0256; ++i)
            {
                
    unsigned int j = (offset)&0xff;
                *(
    clut++) = (<< 24)|(<< 16)|(<< 8)|(j);
            }

            
    oslStartDrawing();

            
    // clear screen

            
    sceGuClearColor(0xff00ff);
            
    sceGuClear(GU_COLOR_BUFFER_BIT);

            
    // setup CLUT texture

            
    sceGuClutMode(GU_PSM_8888,0,0xff,0); // 32-bit palette
            
    sceGuClutLoad((256/8),clut256); // upload 32*8 entries (256)
            
    sceGuTexMode(GU_PSM_T8,0,0,0); // 8-bit image
            
    sceGuTexImage(0,256,256,256,tex256);
            
    sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
            
    sceGuTexFilter(GU_LINEAR,GU_LINEAR);
            
    sceGuTexScale(1.0f,1.0f);
            
    sceGuTexOffset(0.0f,0.0f);
            
    sceGuAmbientColor(0xffffffff);

            
    // render sprite

            
    sceGuColor(0xffffffff);
            
    struct Vertexvertices = (struct Vertex*)sceGuGetMemory(sizeof(struct Vertex));
            
    vertices[0].0vertices[0].0;
            
    vertices[0].0vertices[0].0vertices[0].0;
            
    vertices[1].256vertices[1].256;
            
    vertices[1].480vertices[1].272vertices[1].0;
            
    sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);

            
    // oslib drawings
            
    oslDrawImageXY(image215111);

            
    // wait for next frame

            
    oslEndDrawing();
            
    oslEndFrame();
            
    oslSyncFrame();
            
            
    offset++;
        }
        
        
    oslDeleteImage(image);
        return 
    0;

    my makefile (cleaned, only relevant parts):
    PHP-Code:
    TARGET clutoslib
    OBJS 
    =     code/main.o

    BUILD_PRX 
    1
    PSP_FW_VERSION 
    371

    INCDIR 

    CFLAGS = -G0 -Wall -O3 -fsingle-precision-constant -falign-functions=64
    CXXFLAGS 
    = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS 
    = $(CFLAGS)

    LIBDIR =
    LDFLAGS =
    STDLIBS= -losl -lpng -lz -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lstdc++ -lpspmpeg -lpspaudiocodec

    LIBS
    =$(STDLIBS)$(YOURLIBS)

    EXTRA_TARGETS EBOOT.PBP
    PSP_EBOOT_TITLE 
    clut oslib
    PSP_EBOOT_ICON 
    ICON0.png
    PSPSDK
    =$(shell psp-config --pspsdk-path)
    include $(
    PSPSDK)/lib/build.mak 
    try to call the test_clut() function into your main(), don't forget to put an image named "test.png" next to the eboot.

    if you want to know, I'm using oslibmod by sakya, and I'm initializing it like this:
    PHP-Code:
        oslInitAudioME(OSL_FMT_MP3);
        
    scePowerSetClockFrequency(333333166);
        
    oslInit(OSL_IF_USEOWNCALLBACKS);
        
    oslInitGfx(OSL_PF_8888true);        
        
    oslSetDithering(false);
        
    oslSetFrameskip(1);
        
    oslSetMaxFrameskip(3);
        
    oslSetTextColor(RGBA(255,255,255,255));
        
    oslSetBkColor(RGBA(0,0,0,0)); 
    I provide my own callbacks.

    Note that I first tried to write the benchmarks from oslib, but the text & bg were white, I don't know why...
    Angehängte Grafiken Angehängte Grafiken  
    Try my latest game (iOS):


  26. #9536
    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 an annoying compiler issue with some code of mine...

    makefile:
    Code:
    ...
    OBJS =\
    PBPDepack.o\
    ...
    main.cpp:
    Code:
    #include "depack.h"
    ...
    FILE *fp;
    fp = fopen("ms0:/test.pbp", "r");
    long int one = 0;
    long int two = 0;
    getOffsets(fp, 0, &one, &two);
    fclose(fp);
    depack.h:
    Code:
    #include <stdio.h>
    
    void getOffsets(FILE *pbp, int position, long int *pointerStart, long int *pointerEnd);
    PBPDepack.s:
    Code:
    	.set noreorder
    
    #include "pspstub.s"
    
    	STUB_START "PBPDepack",0x40090000,0x00010005
    	STUB_FUNC  0x5FF3D8D7,getOffsets
    	STUB_END
    Error:
    main.o: In function `loadOption(int)':
    ...:381: undefined reference to `getOffsets(
    __sFILE*, int, long*, long*)'
    No idea what is going on, its not exclusive to PBPDepack either, I've tried a couple of modules and exports, all giving the same problem that its undefined. Anyone know whats going on here?

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

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

  27. #9537
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von daaa57150 Beitrag anzeigen
    I got interested when I saw your message, so I tried to include the clut sample into my oslib application, and was successful, I can draw the clut sample and an OSL_IMAGE on top of it.

    clutoslib.cpp, where the function is:
    PHP-Code:
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <time.h>

    #include <pspgu.h>

    #include <oslib/oslib.h>

    //static unsigned int __attribute__((aligned(16))) clut_list[262144];

    struct Vertex
    {
        
    float u,v;
        
    float x,y,z;
    };

    #define NUM_SLICES 128
    #define NUM_ROWS 128
    #define RING_SIZE 2.0f
    #define RING_RADIUS 1.0f
    #define SPRITE_SIZE 0.025f

    unsigned int colors[8] = 
    {
        
    0xffff0000,
        
    0xffff00ff,
        
    0xff0000ff,
        
    0xff00ffff,
        
    0xff00ff00,
        
    0xffffff00,
        
    0xffffffff,
        
    0xff00ffff
    };

    unsigned int __attribute__((aligned(16))) clut256[256];
    unsigned char __attribute__((aligned(16))) tex256[256*256];

    int test_clut()
    {
        
    OSL_IMAGE *image=oslLoadImageFilePNG((char *)"test.png"OSL_IN_RAM|OSL_SWIZZLEDOSL_PF_8888);
        
        
    unsigned int i,j;

        for (
    0256; ++j)
        {
            for (
    0256; ++i)
            {
                
    tex256[256] = i;
            }
        }
        
        
    sceKernelDcacheWritebackAll();

        
    int offset 0;

        while(!
    osl_quit)
        {        
            
    // animate palette

            
    unsigned intclut = (unsigned int*)(((unsigned int)clut256)|0x40000000);
            for (
    0256; ++i)
            {
                
    unsigned int j = (offset)&0xff;
                *(
    clut++) = (<< 24)|(<< 16)|(<< 8)|(j);
            }

            
    oslStartDrawing();

            
    // clear screen

            
    sceGuClearColor(0xff00ff);
            
    sceGuClear(GU_COLOR_BUFFER_BIT);

            
    // setup CLUT texture

            
    sceGuClutMode(GU_PSM_8888,0,0xff,0); // 32-bit palette
            
    sceGuClutLoad((256/8),clut256); // upload 32*8 entries (256)
            
    sceGuTexMode(GU_PSM_T8,0,0,0); // 8-bit image
            
    sceGuTexImage(0,256,256,256,tex256);
            
    sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
            
    sceGuTexFilter(GU_LINEAR,GU_LINEAR);
            
    sceGuTexScale(1.0f,1.0f);
            
    sceGuTexOffset(0.0f,0.0f);
            
    sceGuAmbientColor(0xffffffff);

            
    // render sprite

            
    sceGuColor(0xffffffff);
            
    struct Vertexvertices = (struct Vertex*)sceGuGetMemory(sizeof(struct Vertex));
            
    vertices[0].0vertices[0].0;
            
    vertices[0].0vertices[0].0vertices[0].0;
            
    vertices[1].256vertices[1].256;
            
    vertices[1].480vertices[1].272vertices[1].0;
            
    sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);

            
    // oslib drawings
            
    oslDrawImageXY(image215111);

            
    // wait for next frame

            
    oslEndDrawing();
            
    oslEndFrame();
            
    oslSyncFrame();
            
            
    offset++;
        }
        
        
    oslDeleteImage(image);
        return 
    0;

    my makefile (cleaned, only relevant parts):
    PHP-Code:
    TARGET clutoslib
    OBJS 
    =     code/main.o

    BUILD_PRX 
    1
    PSP_FW_VERSION 
    371

    INCDIR 

    CFLAGS = -G0 -Wall -O3 -fsingle-precision-constant -falign-functions=64
    CXXFLAGS 
    = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS 
    = $(CFLAGS)

    LIBDIR =
    LDFLAGS =
    STDLIBS= -losl -lpng -lz -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lstdc++ -lpspmpeg -lpspaudiocodec

    LIBS
    =$(STDLIBS)$(YOURLIBS)

    EXTRA_TARGETS EBOOT.PBP
    PSP_EBOOT_TITLE 
    clut oslib
    PSP_EBOOT_ICON 
    ICON0.png
    PSPSDK
    =$(shell psp-config --pspsdk-path)
    include $(
    PSPSDK)/lib/build.mak 
    try to call the test_clut() function into your main(), don't forget to put an image named "test.png" next to the eboot.

    if you want to know, I'm using oslibmod by sakya, and I'm initializing it like this:
    PHP-Code:
        oslInitAudioME(OSL_FMT_MP3);
        
    scePowerSetClockFrequency(333333166);
        
    oslInit(OSL_IF_USEOWNCALLBACKS);
        
    oslInitGfx(OSL_PF_8888true);        
        
    oslSetDithering(false);
        
    oslSetFrameskip(1);
        
    oslSetMaxFrameskip(3);
        
    oslSetTextColor(RGBA(255,255,255,255));
        
    oslSetBkColor(RGBA(0,0,0,0)); 
    I provide my own callbacks.

    Note that I first tried to write the benchmarks from oslib, but the text & bg were white, I don't know why...
    u do realize that gives you no aid in oslib drawing, but is drawing with the gu and oslib which is rly stupid
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    Quoting THAT much of a post, it would have been nice if you said something constructive rather than "is rly stupid"... Why is it stupid? What can he do to achieve the same thing (ease of coding with clut)? Your post is just as pointless as this one.

    Actually, my post isn't pointless because I'm gonna ask a question. Isn't OSLib just a bunch of functions working with the GU? So how is using the GU with the GU dumb?

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

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

  29. #9539
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    no, it's not that, which i meant, while yes oslib uses the GU, it's the way he used it their, they wish to take advantage of the CLUT with oslib, and AFAIK oslib doesn't take advantage of a CLUT, and their's no way to change that, oslib's internal functions take care of handling an image, and displaying it, which makes it not possible(to my knowledge) to be able to use a CLUT with oslib, the only other option is to get oslib's source, and include CLUT handling into oslib, than re-compile oslib with CLUT capabilitie's internally, otherwise it's just one huge big PITA to try and use oslib, with native gu commands, which at that point, your better off using the GU than cluttering up your code with a bunch of oslib calls as well, which is why, it's rly stupid PERIOD.

    secondly, i also question if they understand what the CLUT is, copy and pasting code isn't going to help like their doing

    edit: and lastly, my post wasn't pointless, do you only take the most negative thing in a post, and immediately think a post is meaningless, when that's said, perhaps you forgot the first part:

    Zitat Zitat von slicer4ever
    u do realize that gives you no aid in oslib drawing
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  30. #9540
    QJ Gamer Bronze
    Points: 6.359, Level: 52
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    france
    Beiträge
    170
    Points
    6.359
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever Beitrag anzeigen
    u do realize that gives you no aid in oslib drawing, but is drawing with the gu and oslib which is rly stupid
    Netaro wants to include the clut code into his project, which uses oslib. my post just shows him how to integrate it, how is that stupid?

    Zitat Zitat von Auraomega Beitrag anzeigen
    Isn't OSLib just a bunch of functions working with the GU?
    Yep, the graphical part is using the GU, I basically just had to remove all the initialization instructions because it's already done by oslib + subsituing some functions...

    Edit: beaten by Slicer :)
    You have a point Slicer, but I think what Netaro wants is the pretty effect, nothing more.
    -=Double Post Merge =-
    Zitat Zitat von slicer4ever Beitrag anzeigen
    secondly, i also question if they understand what the CLUT is, copy and pasting code isn't going to help like their doing
    I took a look on wikipedia before trying the code... it's helping having a nice background effect, and knowing how to use the GU with oslib, to sometimes do things oslib doesn't allow by itself.
    Geändert von daaa57150 (01-19-2009 um 11:55 AM Uhr) Grund: Automerged Doublepost
    Try my latest game (iOS):



 

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

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