Seite 314 von 340 ErsteErste ... 214 264 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 ... LetzteLetzte
Zeige Ergebnis 9.391 bis 9.420 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; @slicer4ever Thanks I shall take a look at it...

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

    @slicer4ever

    Thanks I shall take a look at it


    [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]

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

    Post

    I haven't done anything for psp in a long time, and thus, i forgot basically anything.
    So, as i'm learning from the basics i've got some problems.

    so, i have Test.txt which looks like this -
    Code:
    7
    3
    2
    2
    And then, in code -
    Code:
    int w=0,h=0,x=0,y=0;
           SceUID file = sceIoOpen("Test.txt", IOASSIGN_RDONLY, 0777);
    	sceIoRead(file, &w,sizeof(int));
    	sceIoRead(file, &h,sizeof(int));
    	sceIoRead(file, &x,sizeof(int));
    	sceIoRead(file, &y,sizeof(int));
    	oslPrintf("\n %d \n %d \n %d \n %d \n",w,h,x,y);
    And what i see?
    Code:
    856296754
    221383281
    168635938
    589505315
    Change from sizeof to 1 gives another set of strange numbers.
    So, how do i fix it?

  3. #9393
    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

    Yo guys i'm back with a new question:P I want to use a ICON0.png for my eboot so I put the icon0 in the folder of the main.c and makefile and added this line to the makefile:
    #PSP_EBOOT_ICON = ICON0.PNG

    But when I compile and i put the eboot on my psp i see the standard ICON0.png. What am I doing wrong?
    [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. #9394
    QJ Gamer Silver
    Points: 8.475, Level: 62
    Level completed: 9%, Points required for next Level: 275
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Perth, Scotland
    Beiträge
    1.094
    Points
    8.475
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Remove the '#'.

  5. #9395
    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 Davee Beitrag anzeigen
    Remove the '#'.
    # in makefiles is commenting the code, very much like // in C++.

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

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

  6. #9396
    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

    Oke
    [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]

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

    [SPOILER]
    Code:
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <psppower.h>
    #include <pspkerneltypes.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <pspthreadman.h>
    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include <string.h>
    #include <pspsdk.h>
    #include <pspgu.h>
    #include <png.h>
    #include <pspidstorage.h>
    #include <string.h>
    
    
    extern int ReadKey(int key, char *buffer);
    extern int WriteKey(int key, char *buffer);
    extern int CreateKey(int key);
    extern int DeleteKey(int key);
    extern void dump();
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
    int cbid;
    
    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCallback(cbid);
    
    sceKernelSleepThreadCB();
    
    return 0;
    }
    
    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
    int thid = 0;
    
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0) {
    sceKernelStartThread(thid, 0, 0);
    }
    
    return thid;
    }
    
    int check_mobo(void)
    {
        int mobo;
        char buffer[512];
    
        ReadKey(0x0100, buffer);
        mobo = buffer[0x03f];
    
        ReadKey(0x0050, buffer);
        mobo = (mobo << 8) | buffer[0x021];
    
        return mobo;
    }
    void refresh()
    {
    
    pspDebugScreenClear();
    
    
    get_info();
    }
    void get_info()
    {
    
    printf("*******************Motherboard/IdStorage Info***********************\n");
            switch (check_mobo())
            {
                case 0x0101:
                printf("test identifies the motherboard as a TA-079/81\n");
                break;
                case 0x0202:
                printf("test identifies the motherboard as a TA-082/86\n");
                break;
                case 0x0303:
                printf("test PSP identifies the motherboard as a TA-085\n");
                break;
                default:
                printf("IdStorage seems to be corrupt, please use DC8 to make a new one!\n");
                break;
            }
            
    
    
    printf("\n********************************************************************\n");
    }
    
    int main() { 
    pspDebugScreenInit();
    SetupCallbacks();
    SceCtrlData pad;
     
    sceCtrlReadBufferPositive(&pad, 1);
    
    SceUID idmod = pspSdkLoadStartModule("ms0:/seplugins/idstorage.prx", PSP_MEMORY_PARTITION_KERNEL);
    
    
    
    	if ((idmod < 0))	{
    	pspDebugScreenClear();
          printf(" Error 0x%08X loading/starting idstorage.prx\nPlease make sure it is located at <ms0:/seplugins>/!!\n", idmod);
          sceKernelDelayThread(3*1000*1000);
          sceKernelExitGame();
       	} else { 
          refresh();
    	}
    
    
    while(1) {
              sceCtrlReadBufferPositive(&pad, 1);
              if(pad.Buttons & PSP_CTRL_CROSS) {
                        refresh();
              }
              if(pad.Buttons & PSP_CTRL_SQUARE) {
    			pspDebugScreenClear();
                      printf("Exiting to xmb in 2 seconds....\n\nPlease wait for the XMB to load.");
    			sceKernelDelayThread(2000000);
                      sceKernelExitGame();
    
                                            }
              if(pad.Buttons & PSP_CTRL_TRIANGLE) {
                       
    
                                                  }
              if(pad.Buttons & PSP_CTRL_CIRCLE) {
                     
                                                }
    }
    
    sceKernelSleepThread(); 
    return 0; 
    }
    [/SPOILER]


    plz help, using check_mobo always returns error, but im sure my idstorage is fine!...

    !~SlasheR~!

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

    why don't you just print out the check_mobo() function on several psp's, and see what it's returning as
    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

  9. #9399
    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

    Is it possible to disable the gameboot screen with a piece of code?
    If yes; where can I find this?
    [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]

  10. #9400
    QJ Gamer Green
    Points: 4.092, Level: 40
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    508
    Points
    4.092
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von malliet Beitrag anzeigen
    Is it possible to disable the gameboot screen with a piece of code?
    If yes; where can I find this?
    I'd decrypt the game loader, use "prxtool --elfout FILE.prx > FILE.elf", stick it in a disassembler, find where it loads gameboot.pmf or whatever, then branch over it(beq $zero, $zero, 0xADDYTOGOTO or j 0xADDYTOGOTO), requires some asm knowledge. Then find the exact address, then do something like

    *((unsigned int*)((unsigned int)ADDRESS)) = 0xASMVALUEOFBRANCHORJ;
    I gone and made that one power spoofer and that gay cheat device.

  11. #9401
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    I'd hook the function that loads the gameboot and replace it with a function that loads a dummy gameboot (0 bytes)

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

    Don't want to be insistent mcuh, but can somebody help me with my problem on the previous page?

    http://forums.qj.net/showthread.php?...=1#post2141464
    Link to the post.

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

    Zitat Zitat von slicer4ever Beitrag anzeigen
    why don't you just print out the check_mobo() function on several psp's, and see what it's returning as
    Yea i would but i only have a slim, looking to buy a phat. :Jump:

    ill see if i can borrow my friends.

    !~SlasheR~!

    --EDIT--

    i tried uploading it but it keeps saying something about my "Quota Limit" the zip is only 132kb?
    Geändert von slasher101 (12-26-2008 um 04:48 PM Uhr)

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

    sendspace.com, just print out the results i'll give u the results from my 2 phats
    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

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

    Cool

    Zitat Zitat von slicer4ever Beitrag anzeigen
    sendspace.com, just print out the results i'll give u the results from my 2 phats
    Fix It PSP = http://www.sendspace.com/file/9gu8vg
    Still in early stages :-)


    !~SlasheR~!

  16. #9406
    QJ Gamer Green
    Points: 4.092, Level: 40
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    508
    Points
    4.092
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Netaro Beitrag anzeigen
    Don't want to be insistent mcuh, but can somebody help me with my problem on the previous page?

    http://forums.qj.net/showthread.php?...=1#post2141464
    Link to the post.
    I had that happen to me when I loaded more than desired. You're probably best off loading it to a buffer and going from there, or do something like 8(assuming you're going for just the 32 bits) instead of sizeof(int).
    I gone and made that one power spoofer and that gay cheat device.

  17. #9407
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von NoEffex Beitrag anzeigen
    I'd decrypt the game loader, use "prxtool --elfout FILE.prx > FILE.elf", stick it in a disassembler, find where it loads gameboot.pmf or whatever, then branch over it(beq $zero, $zero, 0xADDYTOGOTO or j 0xADDYTOGOTO), requires some asm knowledge. Then find the exact address, then do something like

    *((unsigned int*)((unsigned int)ADDRESS)) = 0xASMVALUEOFBRANCHORJ;
    Or patch the fileIoOpen function and check if it loads gameboot.pmf, like this:
    Code:
    patchedFileIoOpen(char[500] fileName) {
    char[500] file;
      if(fileName == "flash0:/resources/bla/bla/gameboot.pmf") {
         file = "ms0:/gameboot.pmf";
         originalFileIoOpen(file);
      } else {
         originalFileIoOpen(fileName);
      }
    }
    Look at hellcats wallpaper changer source for patching functions.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

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

    Currently playing around with .mp3 loading/playing using pspmp3.h. Most of my .mp3's play fine however sceMp3Decode returns 0x80671103 when playing some. Anyone know of the cause of this?

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

    Question

    i dont know, try to look in the sdk docs to see if its listed there :)
    -=Double Post Merge =-
    is there a function to get the tachyon, pommel and the rest of the things??

    the guys at ps2dev.org = :Argh:


    !~SlasheR~!
    Geändert von slasher101 (12-27-2008 um 07:52 PM Uhr) Grund: Automerged Doublepost

  20. #9410
    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 Netaro Beitrag anzeigen
    Don't want to be insistent mcuh, but can somebody help me with my problem on the previous page?

    http://forums.qj.net/showthread.php?...=1#post2141464
    Link to the post.
    You should be reading chars, not ints from the text file.

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

    slasher, i keep getting an error saying that it can't find the idstorage.prx, u seem to want it on the ms so i pulled it out of flash and placed it where your program said to place it, but it still wouldn't load
    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

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

    srry need to fix that

    place fixitpsp.prx in ms0:/seplugins/

    then it will work,

    thx for testing it =)

    !~SlasheR~!

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

    i did do that, and it wasn't asking for fixitpsp.prx, but for idstorage.prx to be in ms0:/seplugins/, even after placing idstorage.prx in their it still failed
    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. #9414
    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 begining to get a tad annoyed at some code I've written, I'm trying to compile a prx but it fails with an error which doesn't make sense:

    Code:
    int module_start(SceSize args, void *argp)
    {
    	...
    	return 0;
    }
    
    int module_stop(void)
    {
    	return 0;
    }
    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(flashPatch, 0, 0x0)
    PSP_EXPORT_END
    
    PSP_END_EXPORTS
    Code:
    TARGET = patch
    OBJS = main.o 
    
    INCDIR = 
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    BUILD_PRX = 1
    PRX_EXPORTS = exports.exp
    
    USE_KERNEL_LIBC=0
    USE_KERNEL_LIBS=0
    
    LIBDIR =
    LDFLAGS = -mno-crt0 -nostartfiles
    
    
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    The error is:
    /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/bin/ld: warning: cannot find
    entry symbol module_start; defaulting to 0000000000000000
    exports.o:(.rodata.sceRes ident+0x8): undefined reference to `module_start'
    collect2: ld returned 1 exit status
    I've had this before, but whats really strange is I copied the exports, makefile and removed the functions from a compiling prx to test, I got the same error, yet I can compile prxs fine without that error in other cases. Is there something simple I'm missing?

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

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

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

    Talking

    @slicer i know it asks for idstorage.prx but you have to place fixitpsp.prx ~NOT~ idstorage, if it still doesnt work it cant load it for some reason

    !~SlasheR~!
    Geändert von slasher101 (12-28-2008 um 02:23 PM Uhr)

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

    i know, i've done both in that folder, but it won't load, sorry, your probably going to need to borrow your friend's phat and see if this well even work for phats(don't see why not, but you never know)
    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

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

    yep ok =),

    ive been playing around a bit and found this peice of code compiles but...
    nothing gets shown on screen at runtime

    Code:
    // Hello World - My First App for the PSP
    
    /*
    This program was created by (Your Name Here) on (Date Here)
    It is a simple "Hello World" Application.
    */
    
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>
    #define printf pspDebugScreenPrintf
    #define settextcolor pspDebugScreenSetTextColor
    #define setbackcolor pspDebugScreenSetBackColor
    #define clearscreen pspDebugScreenClear
    
    
    
    PSP_MODULE_INFO("Scroller", 0, 1, 5); 
    
    
    
    
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
    int cbid;
    
    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCallback(cbid);
    
    sceKernelSleepThreadCB();
    
    return 0;
    }
    
    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
    int thid = 0;
    
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0) {
    sceKernelStartThread(thid, 0, 0);
    }
    
    return thid;
    }
    
    
    void fixtext(int at)
    {
    pspDebugScreenClear();
    if(at==1)
    {
    	settextcolor(0x00FF0000);
    	printf("1\n");
    	settextcolor(0x000000FF);
    	printf("2\n3");
    	
    } else if(at==2)
    {
    settextcolor(0x000000FF);
    printf("1\n");
    settextcolor(0x00FF0000);
    printf("2\n");
    settextcolor(0x000000FF);
    printf("3");
    } else if (at==3)
    {
    	settextcolor(0x000000FF);
    	printf("1\n2\n");
    	settextcolor(0x00FF0000);
    	printf("3");
    }
    }
    
    
    
    
    int main() { 
    pspDebugScreenInit();
    SetupCallbacks();
    SceCtrlData pad;
     int at = 1;
    sceCtrlReadBufferPositive(&pad, 1);
    pspDebugScreenSetTextColor(0x00FF0000);
    while(1)
    {
    	if(pad.Buttons & PSP_CTRL_UP) {
    		at += 1;
    		fixtext(at);
    	}
    	if(pad.Buttons & PSP_CTRL_DOWN) {
    		at -= 1;
            fixtext(at);
    	}
    }
    
          
    
    
    
    sceKernelSleepThread(); 
    return 0; 
    }
    plz help

    !~SlasheR~!

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

    No delays, you're running through that loop probably 200 times before you remove your finger, thus thats + or - 200. You have no delay/checks to allow you to stop pressing the button, nor do you have any limits (I.E. at = 4 which isn't supported).

    -Aura

    EDIT:

    Also, your method is going to get you seriously bogged down with code if you add lots of possibilities, something like this would be preferable:
    Code:
    void fixtext(int at)
    {
    	for(int loop = AT_MIN; loop < AT_MAX; loop++)
    	{
    		if(loop == at)
    		{
    			settextcolor(0x00FF0000);
    		}
    		else
    		{
    			settextcolor(0x000000FF);
    		}
    		printf("%i"\n, loop);
    		/*
    		or if you are using non-integer values as options
    		use if statements or switches (although I dislike switches as
    		people commonly forget the break and mess up their code)
    		
    		if(loop == 1)
    		{
    			printf("option 1\n");
    		}
    		if(loop == 2)
    		{
    			printf("option 2\n");
    		}
    		*/
    	}
    }
    notice how the code would be significantly smaller? It makes stuff like this easier to search through, because believe me, when you have files with over 5000 lines of code seeing a function like yours becomes annoying

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

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

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

    Wink

    thanks and how would i fix it?

    and as for your prob

    Code:
    PSP_EXPORT_START(flashPatch, 0, 0x0)
    PSP_EXPORT_FUNC(something_HERE)
    PSP_EXPORT_END

  30. #9420
    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 for some shortening code bits...

    Search on here for lastpad methods, or you could use sceKernelDelayThread(int delay); although that method still leaves chance for an exceptionally slooooooow person to still hit the button.

    My question was about a function defined already, its asking for module_start which is define in both the source and the exports already. Re-read the post to see my problem.

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

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


 

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 .