Seite 1 von 4 1 2 3 4 LetzteLetzte
Zeige Ergebnis 1 bis 30 von 99

Post some C samples

This is a discussion on Post some C samples within the Developer's Dungeon forums, part of the PSP Development Forum category; Here is an elipse drawing routine I flogged from a LUA thread in this area and converted it to C, ...

  
  1. #1
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard Post some C samples

    Here is an elipse drawing routine I flogged from a LUA thread in this
    area and converted it to C, and fixed that rouge pixel that hangs out
    the right hand side of smaller circles/elipses. I also modified so you define
    the center instead of top left corner.
    Code:
    void draw_elipse() {
    
    int exx = centerx - mma;
    int eyy = centery - mma;
    
    int x0 = exx+(mma);
    int y0 = eyy+(mma);
    int stretch = mma + mma;
    
    int theta;
    for(theta=0; theta<60; theta++) {
    xo = (cos(theta)*stretch)+x0;
    yo = (sin(theta)*mma)+y0;
    DRAW PIXEL HERE xo,yo
    }
    
    xo = tballx + stretch;
    yo = tbally;
    DRAW BLANK (coverup) PIXEL HERE xo,yo
    }
    Cheers,
    Art.


    Geändert von dbrums13 (04-12-2013 um 02:06 PM Uhr)

  2. #2
    Developer
    Points: 5.478, Level: 47
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    New Zealand
    Beiträge
    171
    Points
    5.478
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Here is a class to wrap it up in (for any O.O. nuts like me :P)

    Code:
    #ifndef CELLIPSE_H
    #define CELLIPSE_H
    
    class CEllipse
    {
    public:
       CEllipse();
       CEllipse(CEllipse* Ellipse);
       CEllipse(int X, int Y, int Radius);
    
       void Draw();
    
       void MoveTo(int X, int Y);
       void Resize(int Radius);
    
       float Circumference();
       float Area();
    
    private:
       int mRadius;
    
       int mX, mY;
    };
    
    CEllipse()
    {
       this->mRadius  = 0;
       this->mX       = 0;
       this->mY       = 0;
    }
    
    CEllipse(CEllipse* Ellipse)
    {
       this->mRadius   = Ellipse->mRadius;
       this->mX        = Ellipse->mX;
       this->mY        = Ellipse->mY;
    }
    
    CEllipse(int X, int Y, int Radius)
    {
       this->mRadius   = Radius;
       this->mX        = X;
       this->mY        = Y;
    }
    
    CEllipse::Draw()
    {
       // Drawing code...
    }
    
    CEllipse::MoveTo(int X, int Y)
    {
       this->mX = X;
       this->mY = Y;
    }
    
    CEllipse::Resize(int Radius)
    {
       this->mRadius = Radius;
    }
    
    float CEllipse::Circumference()
    {
       return this->mRadius * 6.28;
    }
    
    float CEllipse::Area()
    {
       return this->mRadius * this->mRadius * 3.14;
    }
    
    #endif
    Then you should be able to do this:

    Code:
    #include "CEllipse.h"
    
    int main()
    {
       CEllipse* firstEllipse  = new CEllipse(50, 65, 20);
       CEllipse* secondEllipse = new CEllipse(firstEllipse);
    
       firstEllipse->MoveTo(60,50);
       secondEllipse->Resize(25);
    
       firstEllipse->Draw();
       secondEllipse->Draw();
    
       delete firstEllipse;
       delete secondEllipse;
    
       return 0;
    }
    Sorry for any errors, it's early in the morning

  3. #3
    Party at Las Noches!
    Points: 14.973, Level: 79
    Level completed: 25%, Points required for next Level: 377
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Florida
    Beiträge
    1.648
    Points
    14.973
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>
    
    #define printf	pspDebugScreenPrintf
    
    PSP_MODULE_INFO("Hello World", 0, 1, 1);
    
    int exit_callback(int arg1, int arg2, void *common);
    
    int CallbackThread(SceSize args, void *argp); 
    
    int SetupCallbacks(void);
    
    int main() {
    	SetupCallbacks();
    	pspDebugScreenInit();
    
    	SceCtrlData pad;
    	int exit = 0;
    
    	printf("Hello World\n\n");
    	printf("Press X to continue...\n");
    	while(exit == 0){
    		sceCtrlReadBufferPositive(&pad, 1);
    		if (pad.Buttons & PSP_CTRL_CROSS) {
    			exit = 1;
    		}
    	}	
    	sceKernelExitGame();
    	return 0;
    }
    
    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("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    	if(thid >= 0)
    	{
    		sceKernelStartThread(thid, 0, 0);
    	}
    	return thid;
    }
    Come on a thread for C Samples and no one decided to put Hello World lol :ROFL:
    Geändert von IchigoKurosaki (08-23-2006 um 04:02 PM Uhr)
    .:Nobis Development Group:.
    .:Personal Portfolio:.

    Playstation Portable - PSP1001 - 3.90 M33-2

  4. #4
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Ichigo, you know that you have done some basic faults in your code?

    - You don't need stdlib.h and string.h for a program like this
    - You have forgot to declare what the pad is (use SceCtrlData pad; )
    - You have forgot pspDebugScreenInit(); so if you were to compile it you wouldn't see any text...

    I don't know why you have all your functions after the main one but I guess that is just your way of programming.
    And I think it would be easier if you would just use sceKernelExitGame(); directly after the if (pad.Buttons & PSP_CTRL_CROSS) so you don't need to use any integers. But that is just me. =P

    /SodR
    Geändert von SodR (08-23-2006 um 11:29 AM Uhr) Grund: Automerged Doublepost

  5. #5
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    i put the exit callbacks as the first functions
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  6. #6
    Developer
    Points: 8.360, Level: 61
    Level completed: 70%, Points required for next Level: 90
    Overall activity: 16,0%

    Registriert seit
    Jun 2005
    Ort
    At my house...
    Beiträge
    886
    Points
    8.360
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    One of the first thread made here: http://forums.qj.net/f-developers-du...ets-15462.html

    Had only 3 exaples tho :P
    F.A.L.O?

  7. #7
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    SG57's collision function:
    Code:
    // Based of Ravines
    extern int CollisionDetection(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) { 
    int Collide = 0; 
    if ((y2 >= y1 && y1 + h1 >= y2) || (y2 + h2 >= y1 && y1 + h1 >= y2 + h2) || (y1 >= y2 && y2 + h2 >= y1) || (y1 + h1 >= y2 && y2 + h2 >= y1 + h1))		 
    {	 
    	 if (x2 >= x1 && x1 + w1 >= x2) {	 
    		 Collide = 1;	 
    		 } 
    	 if (x2 + w2 >= x1 && x1 + w1 >= x2 + w2) {		
    		 Collide = 1;		
    		 } 
    	 if (x1 >= x2 && x2 + w2 >= x1) {		
    		 Collide = 1;		
    		 } 
    	 if (x1 + w1 >= x2 && x2 + w2 >= x1 + w1) {		
    		 Collide = 1;		
    		 }	 
    }
    return Collide; 
    }
    edit- Another collision by me (mainly)
    Code:
    //basis from code by canadarox
    int function hitTest(int ob1x,int ob1y,int ob1width,int ob1height,int ob2x,int ob2y,int ob2width,int ob2height) {
    
    
    	int hit = 0; 
    
    if ((ob1x >= ob2x && ob1x <= (ob2x+ob2width)) && (ob1y >= ob2y & ob1y <= (ob2y+ob2height))) {
    	hit = 1;
    }
    
    	if (((ob1x+ob1width) >= ob2x && (ob1x+ob1width) <= (ob2x+ob2width)) && (ob1y >= ob2y & ob1y <= (ob2y+ob2height))) { 
    		hit = 1;
    } 
    
    if ((ob1x >= ob2x && ob1x <= (ob2x+ob2width)) && ((ob1y+ob1height) >= ob2y && (ob1y+ob1height) <= (ob2y+ob2height))) { 
    	hit = 1; 
    }
    
    if (((ob1x+ob1width) >= ob2x && (ob1x+ob1width) <= (ob2x+ob2width)) & ((ob1y+ob1height) >= ob2y && (ob1y+ob1height) <= (ob2y+ob2height))) {
    	hit = 1;
    }
    
    return hit; 
    
    }
    Arguments:
    ob1x = first object's x position
    ob1y = first object's y position
    ob1width = first object's width
    ob1height = first object's height
    ob2x = second object's x position
    ob2y = second object's y position
    ob2width = second object's width
    ob2height = second objects height
    -= Double Post =-
    a simple bare bones menu. Sorry if there are any errors.
    Code:
    #define BGR(r,g,b) ((r) | ((g) << 8) | ((b) << 16));
    #define red BGR(255,0,0);
    #define black BGR(0,0,0);
    #define white BGR(255,255,255);
    #define blue BGR(0,0,255);
     
     
    int menustatus = 1; 
     
    pspDebugScreenClear(); 
    sceCtrlReadBufferPositive(&pad, 1);
     
     if(pad.Buttons & PSP_CTRL_UP) {
     menustatus = menustatus--; 
    	 sceDisplayWaitVblankStart();
     } 
     
     if{Pad.Buttons & PSP_CTRL_DOWN) { 
     menustatus = menustatus++; 
    	 sceDisplayWaitVblankStart();
     } 
     
     pspDebugScreenSetTextColor(white);
    printTextScreen(50, 50, "Play");
     
     pspDebugScreenSetTextColor(blue);
    printTextScreen(50,60,"Options");
     
     pspDebugScreenSetTextColor(red);
    printTextScreen(50,70,"Exit"); 
     
     if( menustatus == 1 ) { 
     if (pad.Buttons & PSP_CTRL_CROSS) { 
     //insert game code here 
    }
    } 
     
    if( menustatus == 2 ) { 
    	if (pad.Buttons & PSP_CTRL_CROSS) { 
    		//insert game code here 
    	}
    }
     
    if( menustatus == 1 ) { 
    	if (pad.Buttons & PSP_CTRL_CROSS) { 
    		break; 
    	}
    } 
     
     if (menustatus <= 0) { 
     menustatus = 3; 
     }
     
     if (menustatus => 4) { 
     menustatus = 1; 
     }
    Geändert von Bronx (08-26-2006 um 02:22 PM Uhr) Grund: Automerged Doublepost

  8. #8
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    This is a nice thread, I will have a look and see what code I can add to it.
    -= Double Post =-
    This is taken from the XArt Graphics library
    This code will draw a circle and with a few little tweeks can be made into a Ellipse drawing function

    you will need to create a xsGfxDrawPixel function to draw pixels on the screen

    Code:
    void xsGfxDrawCircle(int x, int y, int r, UInt32 color)
    {
       int i=0;
       int j=r;
       int p=3 - 2 * r;
       
       while(i <= j) {
          xsGfxDrawPixel(x+i,y+j,color);
          xsGfxDrawPixel(x-i,y+j,color);
          xsGfxDrawPixel(x+i,y-j,color);
          xsGfxDrawPixel(x-i,y-j,color);
          xsGfxDrawPixel(x+j,y+i,color);
          xsGfxDrawPixel(x-j,y+i,color);
          xsGfxDrawPixel(x+j,y-i,color);
          xsGfxDrawPixel(x-j,y-i,color);
          
          if(p < 0) {
             p += 4 * i++ + 6;
          } else {
             p += 4 * (i++ - j--) + 10;
          }
       }
    }
    handy tip, do not use sin & cos functions for graphics, only use sin & cos for creating fix point math integer lookup tables for dealing with sin & cos

    Next post will be a thread for having a mouse pointer with X used for mouse down,mouse up etc events in your own apps
    Geändert von Hardrive (04-11-2007 um 01:53 PM Uhr) Grund: Automerged Doublepost

  9. #9
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    Playstation Portable SDK for Xcode with SDL

    At the moment I have just about completed the graphics part.
    when completed this will allow you to develope user mode homebrew on your Mac and run it on a Mac and then run it on a actual PSP when ready.

    it will be open source

  10. #10
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    I am working on mirroring the sce file functions to work on the Mac, so sce function calls for file io stuff will work like it was on a PSP

    including the ms0:/
    when you have ms0:/ in your path names it will be handled as ./ on Mac OS X

  11. #11
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    the SDL has just some basic ObjectiveC code in it to make things like mouse events etc work, all other stuff is in C or C++ and I will be sorting it out soon on the server to be downloaded so others can help out if they like

    xsFile is what I am at, also be working on xsImage

    these librarys were written for the PSP in user mode.

    not yet desided what I will replace xs with as it will be open source so not all will be done by me at the end.

    maybe "os" for open source
    or "x" for cross platform
    or could just take away xs and rename functions like xsGfxInit to gfxInit etc...

    xsImgLoad to imgLoad.......

  12. #12
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    ok, great :)
    What server though?

  13. #13
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    http://www.xart.co.uk/downloads/PSP.zip

    feel free to have a look.

  14. #14
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    for anyone who has the standard graphics.c, and is looking to load images directly from memory, rather than from a file -
    Code:
    typedef struct
    {
    
        const unsigned char *buffer;
        png_uint_32 bufsize;
        png_uint_32 current_pos;
    
    } MEMORY_READER_STATE;
    
    static void read_data_memory(png_structp png_ptr, png_bytep data, png_uint_32 length)
    {
    	MEMORY_READER_STATE *f = (MEMORY_READER_STATE *)png_get_io_ptr(png_ptr);
    	if (length > (f->bufsize - f->current_pos)) png_error(png_ptr, "read error in read_data_memory (loadpng)");
    	memcpy(data, f->buffer + f->current_pos, length);
    	f->current_pos += length;
    }
    
    Image* loadImageMemory(const void *buffer, int bufsize)
    {
    	png_structp png_ptr;
    	png_infop info_ptr;
    	MEMORY_READER_STATE memory_reader_state;
    	unsigned int sig_read = 0;
    	png_uint_32 width, height;
    	int bit_depth, color_type, interlace_type, x, y;
    	u32* line;
    	
    	if (!buffer || (bufsize <= 0)) return NULL;
    
    	Image* image = (Image*) malloc(sizeof(Image));
    	if (!image) return NULL;
    
    	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    	if (png_ptr == NULL) {
    		free(image);
    		return NULL;;
    	}
    
    	png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn);
    
    	info_ptr = png_create_info_struct(png_ptr);
    	if (info_ptr == NULL) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    
    	memory_reader_state.buffer = (unsigned char *)buffer;
    	memory_reader_state.bufsize = bufsize;
    	memory_reader_state.current_pos = 0;
    
    	png_set_read_fn(png_ptr, &memory_reader_state, (png_rw_ptr)read_data_memory);
    	png_read_info(png_ptr, info_ptr);
    	png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
    
    	image->imageWidth = width;
    	image->imageHeight = height;
    	image->textureWidth = getNextPower2(width);
    	image->textureHeight = getNextPower2(height);
    
    	png_set_sig_bytes(png_ptr, sig_read);
    	png_set_strip_16(png_ptr);
    	png_set_packing(png_ptr);
    
    	if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
    	if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
    	if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
    	png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
    
    	image->data = (Color*) memalign(16, image->textureWidth * image->textureHeight * sizeof(Color));
    	if (!image->data) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	line = (u32*) malloc(width * 4);
    	if (!line) {
    		free(image->data);
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	for (y = 0; y < height; y++) {
    		png_read_row(png_ptr, (u8*) line, png_bytep_NULL);
    		for (x = 0; x < width; x++) {
    			u32 color = line[x];
    			image->data[x + y * image->textureWidth] =  color;
    		}
    	}
    
    	free(line);
    	png_read_end(png_ptr, info_ptr);
    	png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
    
    	return image;
    }
    Maybe someone can find this useful?

  15. #15
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    for anyone who has the standard graphics.c, and is looking to load images directly from memory, rather than from a file -
    Maybe someone can find this useful?
    Definately.
    If you've got something to do it for Mikmod pls share as well,
    because it would be nice to be able to alter the sound file in RAM.

  16. #16
    Developer
    Points: 19.136, Level: 87
    Level completed: 58%, Points required for next Level: 214
    Overall activity: 33,0%

    Registriert seit
    Dec 2005
    Beiträge
    1.899
    Points
    19.136
    Level
    87
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Bronx
    oh nice, it works soo far... Not exactly sure what is what though. This is kinda a psp emu for just sdl
    If you change #define PSP=0 to #define PSP=1 then type make at the terminal it will compile it for the PSP, at the moment have not added the xsImage for loading in a mouse cursor so PSP not quite ready, but graphics should work fine

    as you may see it is still very early in development

    the psp.cpp is were you code stuff for the PSP and there is three lines you need in any loop when you compile it for Mac to prevent it from giving you the beachball
    -= Double Post =-
    Zitat Zitat von Alexisonfire
    for anyone who has the standard graphics.c, and is looking to load images directly from memory, rather than from a file -
    Code:
    typedef struct
    {
    
        const unsigned char *buffer;
        png_uint_32 bufsize;
        png_uint_32 current_pos;
    
    } MEMORY_READER_STATE;
    
    static void read_data_memory(png_structp png_ptr, png_bytep data, png_uint_32 length)
    {
    	MEMORY_READER_STATE *f = (MEMORY_READER_STATE *)png_get_io_ptr(png_ptr);
    	if (length > (f->bufsize - f->current_pos)) png_error(png_ptr, "read error in read_data_memory (loadpng)");
    	memcpy(data, f->buffer + f->current_pos, length);
    	f->current_pos += length;
    }
    
    Image* loadImageMemory(const void *buffer, int bufsize)
    {
    	png_structp png_ptr;
    	png_infop info_ptr;
    	MEMORY_READER_STATE memory_reader_state;
    	unsigned int sig_read = 0;
    	png_uint_32 width, height;
    	int bit_depth, color_type, interlace_type, x, y;
    	u32* line;
    	
    	if (!buffer || (bufsize <= 0)) return NULL;
    
    	Image* image = (Image*) malloc(sizeof(Image));
    	if (!image) return NULL;
    
    	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    	if (png_ptr == NULL) {
    		free(image);
    		return NULL;;
    	}
    
    	png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn);
    
    	info_ptr = png_create_info_struct(png_ptr);
    	if (info_ptr == NULL) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    
    	memory_reader_state.buffer = (unsigned char *)buffer;
    	memory_reader_state.bufsize = bufsize;
    	memory_reader_state.current_pos = 0;
    
    	png_set_read_fn(png_ptr, &memory_reader_state, (png_rw_ptr)read_data_memory);
    	png_read_info(png_ptr, info_ptr);
    	png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
    
    	image->imageWidth = width;
    	image->imageHeight = height;
    	image->textureWidth = getNextPower2(width);
    	image->textureHeight = getNextPower2(height);
    
    	png_set_sig_bytes(png_ptr, sig_read);
    	png_set_strip_16(png_ptr);
    	png_set_packing(png_ptr);
    
    	if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
    	if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
    	if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
    	png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
    
    	image->data = (Color*) memalign(16, image->textureWidth * image->textureHeight * sizeof(Color));
    	if (!image->data) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	line = (u32*) malloc(width * 4);
    	if (!line) {
    		free(image->data);
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	for (y = 0; y < height; y++) {
    		png_read_row(png_ptr, (u8*) line, png_bytep_NULL);
    		for (x = 0; x < width; x++) {
    			u32 color = line[x];
    			image->data[x + y * image->textureWidth] =  color;
    		}
    	}
    
    	free(line);
    	png_read_end(png_ptr, info_ptr);
    	png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
    
    	return image;
    }
    Maybe someone can find this useful?
    I may use it to add png support to the xsGraphics libary
    Geändert von xart (09-07-2006 um 02:52 AM Uhr) Grund: Automerged Doublepost

  17. #17
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    for anyone who has the standard graphics.c, and is looking to load images directly from memory, rather than from a file -
    Then once your png is in RAM, how do you associate the buffer that has your
    png in it with this function?

  18. #18
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Art
    Then once your png is in RAM, how do you associate the buffer that has your
    png in it with this function?
    I've just been using this function to read in the section data of an eboot that contains the icon0.png, etc, then using this function to load them directly.

    I would imagine it's something similar to this,
    Code:
    int total_size;
    FILE *infile;
    Image* theImage;
    
    infile = fopen("ms0:/whatever.png", "rb");
    
    fseek(infile, 0, SEEK_END); total_size = ftell(infile); fseek(infile, 0, SEEK_SET);
    
    void *buffer; int size;
    
    size = total_size;
    buffer = malloc(size);
    
    fread(buffer, size, 1, infile);
    
    theImage = loadImageMemory(buffer, size);
    
    fclose(infile);
    Geändert von Alexisonfire (09-17-2006 um 04:03 AM Uhr)

  19. #19
    QJ Gamer Platinum
    Points: 25.089, Level: 95
    Level completed: 74%, Points required for next Level: 261
    Overall activity: 18,0%

    Registriert seit
    Sep 2005
    Ort
    Edinburgh, UK
    Beiträge
    2.388
    Points
    25.089
    Level
    95
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Art
    Then once your png is in RAM, how do you associate the buffer that has your
    png in it with this function?
    Just call loadImageMemory...

  20. #20
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Here's USB Mode.

    Headers:
    Code:
     
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspusb.h>
    #include <pspusbstor.h>
    #include <string.h>
    Functions:
    Code:
     
    // Defines
    #define     printf     pspDebugScreenPrintf
    
    // Functions
    int LoadStartModule(char *path)
    {
         u32 loadResult;
         u32 startResult;
         int status;
    
         loadResult = sceKernelLoadModule(path, 0, NULL);
         if (loadResult & 0x80000000) return -1;
         else
         startResult = sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
    
         if (loadResult != startResult) return -2;
    
         return 0;
    }
    
    void initUSB()
    {
         u32 retVal;
    
         LoadStartModule("flash0:/kd/semawm.prx");
         LoadStartModule("flash0:/kd/usbstor.prx");
         LoadStartModule("flash0:/kd/usbstormgr.prx");
         LoadStartModule("flash0:/kd/usbstorms.prx");
         LoadStartModule("flash0:/kd/usbstorboot.prx");
    
         retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
    
         if (retVal != 0) {
              printf("Error starting USB Bus driver (0x%08X)\n", retVal);
              sceKernelSleepThread();
         }
    
         retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
         if (retVal != 0) {
              printf("Error starting USB Mass Storage driver (0x%08X)\n", retVal);
              sceKernelSleepThread();
         }
    
         retVal = sceUsbstorBootSetCapacity(0x800000);
         if (retVal != 0) {
              printf("Error setting capacity with USB Mass Storage driver (0x%08X)\n", retVal);
              sceKernelSleepThread();
         }
    
         retVal = 0;
    }
    
    void usbMode(const char* what)
    {
         u32 retVal;
    
         if (stricmp(what, "on")==0) {
              retVal = sceUsbActivate(0x1c8);
         }
         else if (stricmp(what, "off")==0) {
              retVal = sceUsbDeactivate(0);
         }
    }
    Call this just inside of your int main:
    Code:
    initUSB();
    Example:
    Code:
    usbMode("on");
    
    or
    
    usbMode("off");
    Put this in your 'Makefile':
    Code:
    In LIBS=
    -lpspusb -lpspusbstor

  21. #21
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Slasher
    for anyone who has the standard graphics.c, and is looking to load images directly from memory, rather than from a file -
    Code:
    typedef struct
    {
    
        const unsigned char *buffer;
        png_uint_32 bufsize;
        png_uint_32 current_pos;
    
    } MEMORY_READER_STATE;
    
    static void read_data_memory(png_structp png_ptr, png_bytep data, png_uint_32 length)
    {
    	MEMORY_READER_STATE *f = (MEMORY_READER_STATE *)png_get_io_ptr(png_ptr);
    	if (length > (f->bufsize - f->current_pos)) png_error(png_ptr, "read error in read_data_memory (loadpng)");
    	memcpy(data, f->buffer + f->current_pos, length);
    	f->current_pos += length;
    }
    
    Image* loadImageMemory(const void *buffer, int bufsize)
    {
    	png_structp png_ptr;
    	png_infop info_ptr;
    	MEMORY_READER_STATE memory_reader_state;
    	unsigned int sig_read = 0;
    	png_uint_32 width, height;
    	int bit_depth, color_type, interlace_type, x, y;
    	u32* line;
    	
    	if (!buffer || (bufsize <= 0)) return NULL;
    
    	Image* image = (Image*) malloc(sizeof(Image));
    	if (!image) return NULL;
    
    	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    	if (png_ptr == NULL) {
    		free(image);
    		return NULL;;
    	}
    
    	png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn);
    
    	info_ptr = png_create_info_struct(png_ptr);
    	if (info_ptr == NULL) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    
    	memory_reader_state.buffer = (unsigned char *)buffer;
    	memory_reader_state.bufsize = bufsize;
    	memory_reader_state.current_pos = 0;
    
    	png_set_read_fn(png_ptr, &memory_reader_state, (png_rw_ptr)read_data_memory);
    	png_read_info(png_ptr, info_ptr);
    	png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
    
    	image->imageWidth = width;
    	image->imageHeight = height;
    	image->textureWidth = getNextPower2(width);
    	image->textureHeight = getNextPower2(height);
    
    	png_set_sig_bytes(png_ptr, sig_read);
    	png_set_strip_16(png_ptr);
    	png_set_packing(png_ptr);
    
    	if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
    	if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
    	if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
    	png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
    
    	image->data = (Color*) memalign(16, image->textureWidth * image->textureHeight * sizeof(Color));
    	if (!image->data) {
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	line = (u32*) malloc(width * 4);
    	if (!line) {
    		free(image->data);
    		free(image);
    		png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
    		return NULL;
    	}
    	for (y = 0; y < height; y++) {
    		png_read_row(png_ptr, (u8*) line, png_bytep_NULL);
    		for (x = 0; x < width; x++) {
    			u32 color = line[x];
    			image->data[x + y * image->textureWidth] =  color;
    		}
    	}
    
    	free(line);
    	png_read_end(png_ptr, info_ptr);
    	png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
    
    	return image;
    }
    Maybe someone can find this useful?
    I'd love to use it, but get errors for just having included it in my source

    the first of which is that user_warning_fn is being used uninitialised.
    Then If I define the variable, there are other errors.
    Geändert von Art (11-18-2006 um 10:37 PM Uhr)

  22. #22
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    whoops
    Code:
    void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
    {
    }

  23. #23
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    I use my own usb.c and usb.h made it myself .....
    usb.c
    Spoiler for usb.c:

    Code:
    #include <pspkernel.h>
    
    #include <pspiofilemgr.h>
    
    #include <pspmodulemgr.h>
    
    #include <pspdisplay.h>
    
    #include <pspdebug.h>
    
    #include <pspusb.h>
    
    #include <pspusbstor.h>
    
    #include <pspthreadman.h>
    
    #include <pspctrl.h>
    
    #include <pspsdk.h>
    
    #include "usb.h"
    
    #define printf  pspDebugScreenPrintf
    
    
    
    
    
    void loaderInit()
    
    {
    
        pspKernelSetKernelPC();
    
        pspSdkInstallNoDeviceCheckPatch();
    
        pspDebugInstallKprintfHandler(NULL);
    
    }
    
    
    
    int LoadStartModule(char *path)
    
    {
    
        u32 loadResult;
    
        u32 startResult;
    
        int status;
    
    
    
        loadResult = sceKernelLoadModule(path, 0, NULL);
    
        if (loadResult & 0x80000000)
    
    	return -1;
    
        else
    
    	startResult =
    
    	    sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
    
    
    
        if (loadResult != startResult)
    
    	return -2;
    
    
    
        return 0;
    
    
    
    }
    
    int ready()
    
    {
    
           if(sceUsbGetState() & PSP_USB_ACTIVATED){
    
                               AODusb();
    
                               return 0;
    
                               }
    
                               
    
            int retVal =0;
    
        LoadStartModule("flash0:/kd/semawm.prx");
    
        LoadStartModule("flash0:/kd/usbstor.prx");
    
        LoadStartModule("flash0:/kd/usbstormgr.prx");
    
        LoadStartModule("flash0:/kd/usbstorms.prx");
    
        LoadStartModule("flash0:/kd/usbstorboot.prx");
    
    
    
        retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
    
        if (retVal != 0) {
    
    	printf("Error starting USB Bus driver (0x%08X)\n", retVal);
    
    	sceKernelSleepThread();
    
        }
    
        retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
    
        if (retVal != 0) {
    
    	printf("Error starting USB Mass Storage driver (0x%08X)\n",
    
    	       retVal);
    
    	sceKernelSleepThread();
    
        }
    
        retVal = sceUsbstorBootSetCapacity(0x800000);
    
        if (retVal != 0) {
    
    	printf
    
    	    ("Error setting capacity with USB Mass Storage driver (0x%08X)\n",
    
    	     retVal);
    
        }
    
        retVal = 0;
    
    }
    
    // Activate or DeActivate USB
    
    int AODusb() 
    
    {
    
        if(sceUsbGetState() & PSP_USB_ACTIVATED){
    
    sceUsbDeactivate(0x1c8);
    
    } else {
    
           sceUsbActivate(0x1c8);
    
           }
    
    
    
    return 1;
    
    }
    
    sceUsbDeactivate(0x1c8);
    
    int Activate_usb()
    
    {
    
        if(sceUsbGetState() & PSP_USB_ACTIVATED){
    
    return 0;
    
    } else {
    
           sceUsbActivate(0x1c8);
    
           }
    
    
    
    return 1;
    
    }
    
    int Deactivate_usb()
    
    {
    
     if(sceUsbGetState() & PSP_USB_ACTIVATED){
    
    sceUsbDeactivate(0x1c8);
    
    return 1;
    
    } else {
    
    return 0;
    
    }
    
    }
    Code:
    
    
    Spoiler for USB.h:

    and here is usb.h
    Code:
    #ifndef _USB_H_
    
    #define _USB_H_
    
    
    
    #ifdef __cplusplus
    
    extern "C" {
    
    #endif
    
    
    
    int LoadStartModule(char *path);
    
    int ready();
    
    int AODusb(); 
    
    void loaderInit();
    
    int Activate_usb();
    
    int Deactivate_usb();
    
    #ifdef __cplusplus
    
    }
    
    #endif
    
    #endif


    -= Double Post =-
    Zitat Zitat von Twenty 2
    Does anyone have a bunch of code like getting time and getting the psp username just a bunch of functions like that?
    Code:
    #include <psputility.h>
        char nick[256];
    
    sceUtilityGetSystemParamString(1, nick, 256);
    //nick will be your nick name
    there is an SDK sample for this:
    Spoiler for SDK SAMPLE:

    Code:
    /*
     * PSP Software Development Kit - http://www.pspdev.org
     * -----------------------------------------------------------------------
     * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
     *
     * main.c - Sample to demonstrate proper use of the systemparam functions
     *
     * Copyright (c) 2005 John Kelley <[email protected]>
     *
     * $Id: main.c 1869 2006-04-09 14:21:59Z tyranid $
     */
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspdisplay.h>
    #include <stdio.h>
    #include <string.h>
    #include <pspmoduleinfo.h>
    #include <psputility.h>
    
    /* Define the module info section */
    PSP_MODULE_INFO("SystemParam Sample", 0, 1, 0);
    
    //Just to leave room for expansion
    #define NUM_SYSTEMPARAMS 15
    
    /* Define printf, just to make typing easier */
    #define printf  pspDebugScreenPrintf
    
    /* 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, THREAD_ATTR_USER, 0);
        if (thid >= 0)
    	sceKernelStartThread(thid, 0, 0);
        return thid;
    }
    
    void printSystemParam(int id, int iVal, char *sVal) {
    	switch(id) {
    		case(PSP_SYSTEMPARAM_ID_STRING_NICKNAME):
    			printf("%-17s: %s\n", "Nickname", sVal);
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL):
    			printf("%-17s: %d\n", "AdHoc Channel", iVal);
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE):
    			printf("%-17s: %s\n", "WLAN Powersave", iVal == 0 ? "enabled   " : "disabled");
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT):
    			switch(iVal) {
    				case(PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD):
    					printf("%-17s: YYYYMMDD\n", "Date Format");
    					break;
    				case(PSP_SYSTEMPARAM_DATE_FORMAT_MMDDYYYY):
    					printf("%-17s: MMDDYYYY\n", "Date Format");
    					break;
    				case(PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY):
    					printf("%-17s: DDMMYYYY\n", "Date Format");
    					break;
    				default:
    					printf("%-17s: INVALID\n", "Date Format");
    			}
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT):
    			switch(iVal) {
    				case(PSP_SYSTEMPARAM_TIME_FORMAT_24HR):
    					printf("%-17s: 24HR\n", "Time Format");
    					break;
    				case(PSP_SYSTEMPARAM_TIME_FORMAT_12HR):
    					printf("%-17s: 12HR\n", "Time Format");
    					break;
    				default:
    					printf("%-17s: INVALID\n", "Time Format");
    			}
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_TIMEZONE):
    			printf("%-17s: %d\n", "Timezone", iVal);
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS):
    			switch(iVal) {
    				case(PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD):
    					printf("%-17s: standard\n", "Daylight Savings");
    					break;
    				case(PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_SAVING):
    					printf("%-17s: saving\n", "Daylight Savings");
    					break;
    				default:
    					printf("%-17s: INVALID\n", "Daylight Savings");
    			}
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_LANGUAGE):
    			switch(iVal) {
    				case(PSP_SYSTEMPARAM_LANGUAGE_JAPANESE):
    					printf("%-17s: Japanese\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_ENGLISH):
    					printf("%-17s: English\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_FRENCH):
    					printf("%-17s: French\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_SPANISH):
    					printf("%-17s: Spanish\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_GERMAN):
    					printf("%-17s: German\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_ITALIAN):
    					printf("%-17s: Italian\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_DUTCH):
    					printf("%-17s: Dutch\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE):
    					printf("%-17s: Portuguese\n", "Language");
    					break;
    				case(PSP_SYSTEMPARAM_LANGUAGE_KOREAN):
    					printf("%-17s: Korean\n", "Language");
    					break;
    				default:
    					printf("%-17s: INVALID\n", "Language");
    			}
    			break;
    		case(PSP_SYSTEMPARAM_ID_INT_UNKNOWN):
    			printf("%-17s: %d (1 on NA PSPs and 0 on JAP PSPs, v1.5+ only)\n", "Unknown:", iVal);
    			break;
    		default:
    			printf("%-17s: int 0x%08X, string '%s'\n", "Unknown", iVal, sVal);
    	}
    }
    
    /* main routine */
    int main(int argc, char *argv[])
    {
        char sVal[256];
        int iVal;
        int i;
        
        //init screen and callbacks
        pspDebugScreenInit();
        pspDebugScreenClear();
        
        SetupCallbacks();
    
        //fetch and print out power and battery information
        pspDebugScreenSetXY(0, 0);
        printf("SystemParam Sample v1.0 by John_K\n\n"); 
        	
        for (i = 0; i <= NUM_SYSTEMPARAMS; i++) {
        	iVal = 0xDEADBEEF;
        	memset(sVal, 0, 256);
        	if(sceUtilityGetSystemParamInt(i, &iVal) != PSP_SYSTEMPARAM_RETVAL_FAIL)
        		printSystemParam(i, iVal, sVal);
        	if(sceUtilityGetSystemParamString(i, sVal, 256) != PSP_SYSTEMPARAM_RETVAL_FAIL)
        		printSystemParam(i, iVal, sVal);
        }
    
        sceKernelSleepThread();
        sceKernelExitGame();
    
        return 0;
    }
    MakeFiel:
    Code:
    PSPSDK = $(shell psp-config --pspsdk-path)
    PSPLIBSDIR = $(PSPSDK)/..
    TARGET = sysparamsample
    OBJS = main.o
    
    LIBS = -lpsputility
    
    
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    include $(PSPSDK)/lib/build.mak
    Geändert von the unique warrior (11-19-2006 um 09:04 PM Uhr) Grund: Automerged Doublepost
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

  24. #24
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Slasher
    whoops
    Code:
    void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
    {
    }
    Still no luck The first of a few errors I get when I include it now is
    implicit declaration of the function getNextPower2 (there isn't one),
    and something about "memalign"... is there anything else left out?

    Have you used this yourself, nad know it to work?

  25. #25
    QJ Gamer Platinum
    Points: 25.089, Level: 95
    Level completed: 74%, Points required for next Level: 261
    Overall activity: 18,0%

    Registriert seit
    Sep 2005
    Ort
    Edinburgh, UK
    Beiträge
    2.388
    Points
    25.089
    Level
    95
    Downloads
    0
    Uploads
    0

    Standard

    For these USB samples, you ought to graciously ignore errors starting USB, if you want full compatibility with firmwares 2.0+.

    On 2.8, for instance, we currently can't do USB, so with your code, you would just hang the program on 2.8. Better to just return an error code to the calling function, and let it decide what to do about the lack of USB, rather than sleeping the thread.

  26. #26
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Art
    Still no luck The first of a few errors I get when I include it now is
    implicit declaration of the function getNextPower2 (there isn't one),
    and something about "memalign"... is there anything else left out?

    Have you used this yourself, nad know it to work?
    Whoops, there's a few other things I left out. My fault.
    Hah, here's a working gfx.c/h.
    http://slasher.team-duck.com/development/gfx.c
    http://slasher.team-duck.com/development/gfx.h

    Sorry for the trouble

  27. #27
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Are you sopposed to replace graphics.c and graphics.h with those files,
    and then use as normal?

  28. #28
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Damn.. he's banned!
    Still stuck with this
    Replacing Graphics.c & Graphics.h with the above files breaks a working
    program straight away. This might be the only way I can get a graphic font
    into any program since I'm having trouble with fontlib as well...

    Pls post if you have a game source with the pngs biult into the source files.

  29. #29
    Developer
    Points: 12.154, Level: 72
    Level completed: 26%, Points required for next Level: 296
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Dubuque
    Beiträge
    423
    Points
    12.154
    Level
    72
    My Mood
    Lurking
    Downloads
    1
    Uploads
    0

    Standard

    If you want to use OSlib, you can do it with a minor modification to the OSlib source, recompile the library, and off you go. ;)
    PSP Demo Videos (updated 11/29/08)
    MinerPSP Coder

  30. #30
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Here's a sample given to me by will1234.
    It's easy in hind sight
    Angehängte Dateien Angehängte Dateien


 
Seite 1 von 4 1 2 3 4 LetzteLetzte

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

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