forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems with screenshot code.
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Panajev2001a



Joined: 20 Aug 2005
Posts: 100

PostPosted: Sat Sep 03, 2005 1:11 am    Post subject: Reply with quote

My frame-buffer set-up is this:

Code:
   sceGuDrawBuffer(GU_PSM_8888,(void*)FRAME_BUFFER_1,BUF_WIDTH);
   sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)FRAME_BUFFER_2,BUF_WIDTH);


The "initial" Draw Buffer when the application is initialized is at the beginning of VRAM and after that we have the Display Buffer and then the Z-buffer.

If in Vram32 (the pointer to the beginning of the frame-buffer) that address is returned (beginning of VRAM) then Vram32 should be pointing, since this function is called after the SwapBuffers() function, to the current Display Buffer (which is what was the Draw Buffer before we swapped the buffers, etc...).

We should still have the Vblank + 1 frame_time to save the image.
Back to top
View user's profile Send private message
Panajev2001a



Joined: 20 Aug 2005
Posts: 100

PostPosted: Sat Sep 03, 2005 1:23 am    Post subject: Reply with quote

deleted...

Last edited by Panajev2001a on Sat Sep 03, 2005 1:53 am; edited 1 time in total
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Sep 03, 2005 1:35 am    Post subject: Reply with quote

I'm sure you know that your malloc is still wrong :-)
Back to top
View user's profile Send private message
Panajev2001a



Joined: 20 Aug 2005
Posts: 100

PostPosted: Sat Sep 03, 2005 1:48 am    Post subject: Reply with quote

publicity message: drink PanaCola.

Last edited by Panajev2001a on Sat Sep 03, 2005 1:54 am; edited 1 time in total
Back to top
View user's profile Send private message
Panajev2001a



Joined: 20 Aug 2005
Posts: 100

PostPosted: Sat Sep 03, 2005 1:53 am    Post subject: Reply with quote

yeah, malloc ... what a shitty hack I did... allocating chars for "%05d" that way... grumble.

Here:

EDIT: feck FREE and MALLOC (well in this spot)

Code:
void screenshot(const char* filename)
{
      static int m_SS_Number = 0;
        u32* vram32;
        u16* vram16;
        int bufferwidth;
        int pixelformat;
        int unknown;
        int i, x, y;
        png_structp png_ptr;
        png_infop info_ptr;
        FILE* fp;
        u8* line;

      //char *  name =  NULL;
      
      //name = (char *) malloc ( strlen(filename) + 1 + 5 + 4 + 1);

                char name [strlen (filename) + 11] addr_align(16);

      sprintf(name, "%s_%05d.png", filename, m_SS_Number);
       
      fp = fopen((const char *)name, "wb");

        if (!fp) return;
        png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
        if (!png_ptr) return;
        info_ptr = png_create_info_struct(png_ptr);
        if (!info_ptr) {
                png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
                fclose(fp);
                return;
        }
        png_init_io(png_ptr, fp);
        png_set_IHDR(png_ptr, info_ptr, SCREEN_WIDTH, SCREEN_HEIGHT,
                8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
                PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
        png_write_info(png_ptr, info_ptr);
        line = (u8*) malloc(SCREEN_WIDTH * 3);
        sceDisplayWaitVblankStart();  // if framebuf was set with PSP_DISPLAY_SETBUF_NEXTFRAME, wait until it is changed
        sceDisplayGetFrameBuf((void**)&vram32, &bufferwidth, &pixelformat, &unknown);
        vram16 = (u16*) vram32;
        for (y = 0; y < SCREEN_HEIGHT; y++) {
                for (i = 0, x = 0; x < SCREEN_WIDTH; x++) {
                        u32 color = 0;
                        u8 r = 0, g = 0, b = 0;
                        switch (pixelformat) {
                                case PSP_DISPLAY_PIXEL_FORMAT_565:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0x1f) << 3;
                                        g = ((color >> 5) & 0x3f) << 2 ;
                                        b = ((color >> 11) & 0x1f) << 3 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_5551:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0x1f) << 3;
                                        g = ((color >> 5) & 0x1f) << 3 ;
                                        b = ((color >> 10) & 0x1f) << 3 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_4444:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0xf) << 4;
                                        g = ((color >> 4) & 0xf) << 4 ;
                                        b = ((color >> 8) & 0xf) << 4 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_8888:
                                        color = vram32[x + y * bufferwidth];
                                        r = color & 0xff;
                                        g = (color >> 8) & 0xff;
                                        b = (color >> 16) & 0xff;
                                        break;
                        }
                        line[i++] = r;
                        line[i++] = g;
                        line[i++] = b;
                }
                png_write_row(png_ptr, line);
        }
        free(line);
        png_write_end(png_ptr, info_ptr);
        png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
        fclose(fp);

      //if (name != NULL) {
         
         //free (name);

      //}

      m_SS_Number++;
}


of course 1 + 5 + 4 + 1 = 11 ;).

1 for the '_' char.

5 for the 5 digits of the integer value.

4 for the ".png" portion of the string.

1 for the null character '\0'.

Shine, what do you think about:

char name [strlen (filename) + 11];

On GCC it should work and seems better than using the heap with malloc and free.
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Sat Sep 03, 2005 3:01 am    Post subject: Reply with quote

I'll get back to this tomorrow, hope it doesn't move along too much that the whole topic changes.

I was having problems with making it load a game from the UMD, had to copy the boot file out and run it from the memorystick to start up the UMD. Which seems stupid, but the UMD doesn't like me when I try to directly run the boot file.
Back to top
View user's profile Send private message
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Sat Sep 10, 2005 7:05 am    Post subject: Reply with quote

Shine wrote:
I don't know which pspsdk installation you are using, I'm using the source from svn. You can checkout it like this:

svn co svn://svn.ps2dev.org/psp/trunk/zlib
svn co svn://svn.ps2dev.org/psp/trunk/libpng

having trouble making this work could some one please explain how to do that
Back to top
View user's profile Send private message
jason867



Joined: 24 Jul 2005
Posts: 78

PostPosted: Sun Sep 11, 2005 4:06 am    Post subject: Reply with quote

Shine wrote:
Panajev2001a wrote:
For others who might have trouble using Jason's code, I thought it might be useful to see as many working implementations of it as possible.


I think one working implementation, which works with all pixel formats and all vram start adresses, is better:

main.c
Makefile


I finally got around to implementing your improved screenshot code (the version you put links to subversion of), and of course, being the n00b I am, I have a few errors giving me trouble.

I've isolated the problem to your showimage function, when I comment it out, the screenshot functions works great, but when I leave your showimage function in there, it outputs this to the shell;

Code:

Owner@Pavilion1200 /usr/local/pspdev/psp/sdk/My_Homebrew/test
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o mai
n.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/
pspdev/psp/sdk/lib   main.o -lpng -lz -lpspdebug -lpspdisplay -lpspge -lpspctrl
-lpspsdk -lc -lpspuser -lpspkernel -o test.elf
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libpng.a(pngrtran.o): In
 function `png_build_gamma_table':
pngrtran.c:(.text+0x1264): undefined reference to `pow'
pngrtran.c:(.text+0x147c): undefined reference to `pow'
pngrtran.c:(.text+0x1524): undefined reference to `pow'
pngrtran.c:(.text+0x163c): undefined reference to `pow'
pngrtran.c:(.text+0x1718): undefined reference to `pow'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libpng.a(pngrtran.o):png
rtran.c:(.text+0x1804): more undefined references to `pow' follow
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1

Owner@Pavilion1200 /usr/local/pspdev/psp/sdk/My_Homebrew/test
$


And here is my screenshot.h file;
Code:

//////////////////////////////////////////////////////////////////////////////////////////
// Screenshot.h Version 1.0
// By Jason J. Owens
// September 10, 2005 6:27 AM
//////////////////////////////////////////////////////////////////////////////////////////

#ifndef __SCREENSHOT__
#define __SCREENSHOT__
//////////////////////////////////////////////////////////////////////////////////////////
// #includes
#include <png.h>
//////////////////////////////////////////////////////////////////////////////////////////

// Function Prototypes
void Screenshot(const char* filename);
void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg);
void ShowImage(const char* filename);
//////////////////////////////////////////////////////////////////////////////////////////

// Function Definitions
// Saves the current contents of the screen to the filepath passed to 'filename'
void Screenshot(const char* filename)
{
        u32* vram32;
        u16* vram16;
        int bufferwidth;
        int pixelformat;
        int unknown;
        int i, x, y;
        png_structp png_ptr;
        png_infop info_ptr;
        FILE* fp;
        u8* line;
       
        fp = fopen(filename, "wb");
        if (!fp) return;
        png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
        if (!png_ptr) return;
        info_ptr = png_create_info_struct(png_ptr);
        if (!info_ptr) {
                png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
                fclose(fp);
                return;
        }
        png_init_io(png_ptr, fp);
        png_set_IHDR(png_ptr, info_ptr, SCR_WIDTH, SCR_HEIGHT,
                8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
                PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
        png_write_info(png_ptr, info_ptr);
        line = (u8*) malloc(SCR_WIDTH * 3);
        sceDisplayWaitVblankStart();  // if framebuf was set with PSP_DISPLAY_SETBUF_NEXTFRAME, wait until it is changed
        sceDisplayGetFrameBuf((void*)&vram32, &bufferwidth, &pixelformat, &unknown);
        vram16 = (u16*) vram32;
        for (y = 0; y < SCR_HEIGHT; y++) {
                for (i = 0, x = 0; x < SCR_WIDTH; x++) {
                        u32 color = 0;
                        u8 r = 0, g = 0, b = 0;
                        switch (pixelformat) {
                                case PSP_DISPLAY_PIXEL_FORMAT_565:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0x1f) << 3;
                                        g = ((color >> 5) & 0x3f) << 2 ;
                                        b = ((color >> 11) & 0x1f) << 3 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_5551:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0x1f) << 3;
                                        g = ((color >> 5) & 0x1f) << 3 ;
                                        b = ((color >> 10) & 0x1f) << 3 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_4444:
                                        color = vram16[x + y * bufferwidth];
                                        r = (color & 0xf) << 4;
                                        g = ((color >> 4) & 0xf) << 4 ;
                                        b = ((color >> 8) & 0xf) << 4 ;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_8888:
                                        color = vram32[x + y * bufferwidth];
                                        r = color & 0xff;
                                        g = (color >> 8) & 0xff;
                                        b = (color >> 16) & 0xff;
                                        break;
                        }
                        line[i++] = r;
                        line[i++] = g;
                        line[i++] = b;
                }
                png_write_row(png_ptr, line);
        }
        free(line);
        png_write_end(png_ptr, info_ptr);
        png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
        fclose(fp);
}
//////////////////////////////////////////////////////////////////////////////////////////

// Function to pass warnings to, and it ignores them.
void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
{
        // ignore PNG warnings
}
//////////////////////////////////////////////////////////////////////////////////////////

// Display screenshot saved at the filepath passed to 'filename'.
void ShowImage(const char* filename)
{
        u32* vram32;
        u16* vram16;
        int bufferwidth;
        int pixelformat;
        int unknown;
        png_structp png_ptr;
        png_infop info_ptr;
        unsigned int sig_read = 0;
        png_uint_32 width, height;
        int bit_depth, color_type, interlace_type, x, y;
        u32* line;
        FILE *fp;

        if ((fp = fopen(filename, "rb")) == NULL) return;
        png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
        if (png_ptr == NULL) {
                fclose(fp);
                return;
        }
        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) {
                fclose(fp);
                png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
                return;
        }
        png_init_io(png_ptr, fp);
        png_set_sig_bytes(png_ptr, sig_read);
        png_read_info(png_ptr, info_ptr);
        png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL);
        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);
        line = (u32*) malloc(width * 4);
        if (!line) {
                fclose(fp);
                png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
                return;
        }
        sceDisplayWaitVblankStart();  // if framebuf was set with PSP_DISPLAY_SETBUF_NEXTFRAME, wait until it is changed
        sceDisplayGetFrameBuf((void*)&vram32, &bufferwidth, &pixelformat, &unknown);
        vram16 = (u16*) vram32;
        for (y = 0; y < height; y++) {
                png_read_row(png_ptr, (u8*) line, png_bytep_NULL);
                for (x = 0; x < width; x++) {
                        u32 color32 = line[x];
                        u16 color16;
                        int r = color32 & 0xff;
                        int g = (color32 >> 8) & 0xff;
                        int b = (color32 >> 16) & 0xff;
                        switch (pixelformat) {
                                case PSP_DISPLAY_PIXEL_FORMAT_565:
                                        color16 = (r >> 3) | ((g >> 2) << 5) | ((b >> 3) << 11);
                                        vram16[x + y * bufferwidth] = color16;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_5551:
                                        color16 = (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10);
                                        vram16[x + y * bufferwidth] = color16;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_4444:
                                        color16 = (r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8);
                                        vram16[x + y * bufferwidth] = color16;
                                        break;
                                case PSP_DISPLAY_PIXEL_FORMAT_8888:
                                        color32 = r | (g << 8) | (b << 16);
                                        vram32[x + y * bufferwidth] = color32;
                                        break;
                        }
                }
        }
        free(line);
        png_read_end(png_ptr, info_ptr);
        png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
        fclose(fp);
}
//////////////////////////////////////////////////////////////////////////////////////////

#endif

//////////////////////////////////////////////////////////////////////////////////////////


Any ideas?
_________________
Ask not for whom the bell tolls, it tolls for thee, besides, I'm playing my PSP, tee hee!
------------------------------------------------------
Visit my website for my PSP Homebrew!
Back to top
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Sep 11, 2005 4:17 am    Post subject: Reply with quote

Add "-lm" in your Makefile
Back to top
View user's profile Send private message
jason867



Joined: 24 Jul 2005
Posts: 78

PostPosted: Sun Sep 11, 2005 10:15 am    Post subject: Reply with quote

I completely missed that! I just glanced at your makefile and thought it was the same as before. Yeah, that fixed it, thanks!

By the way, how do you make comments in makefiles, it's the character '@' right?

I had a couple more questions, but I can't think of them at the moment.

Thanks again for all the help.
_________________
Ask not for whom the bell tolls, it tolls for thee, besides, I'm playing my PSP, tee hee!
------------------------------------------------------
Visit my website for my PSP Homebrew!
Back to top
View user's profile Send private message Visit poster's website
loko



Joined: 23 Jul 2005
Posts: 6

PostPosted: Thu Sep 15, 2005 1:35 am    Post subject: Reply with quote

That's a piece of code dude !

I'm now working on it to enable taking screenshots from an umd game. I've never managed to get umd launching in is own parallel thread.

I'm making a tool that configure action buttons before launching an umd game.

I'm dreaming of taking official game screenshots, it would definetly make me buying more umd games

Someone help ?

thanks in advance.
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Sat Sep 17, 2005 5:19 pm    Post subject: Reply with quote

back here again.

loko I've been able to do what you're trying to produce, but using the code provided does not seem to perform very well for producing screenshots while there is an animation happening.

Also my program sometimes doesn't like to load the UMD. Probably because it isn't activated, not sure how to handle that.

Shine wrote:
In the libpng folder is a sample, how to save one image at once, which uses 522240 bytes instead of only one line with 1920 bytes. If this is ok for your application, you should try it, but I don't think that it helps much.

Where is this sample? I can't seem to find it.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Sep 17, 2005 5:24 pm    Post subject: Reply with quote

Shiki wrote:
Shine wrote:
In the libpng folder is a sample, how to save one image at once, which uses 522240 bytes instead of only one line with 1920 bytes. If this is ok for your application, you should try it, but I don't think that it helps much.

Where is this sample? I can't seem to find it.


http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2Flibpng%2Fscreenshot%2F&rev=0&sc=0
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Sat Sep 17, 2005 6:16 pm    Post subject: Reply with quote

Shine wrote:
Shiki wrote:
Shine wrote:
In the libpng folder is a sample, how to save one image at once, which uses 522240 bytes instead of only one line with 1920 bytes. If this is ok for your application, you should try it, but I don't think that it helps much.

Where is this sample? I can't seem to find it.


http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2Flibpng%2Fscreenshot%2F&rev=0&sc=0


Well Shine, that's the example I used last time. :( No other examples?
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Sep 17, 2005 8:01 pm    Post subject: Reply with quote

Shiki wrote:
Well Shine, that's the example I used last time. :( No other examples?


Sorry, was too early this morning :-)

http://svn.ps2dev.org/filedetails.php?repname=psp&path=%2Ftrunk%2Flibpng%2Fexample.c&rev=0&sc=0
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Sat Sep 17, 2005 9:02 pm    Post subject: Reply with quote

Thanks, I'll look into that.
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Fri Sep 23, 2005 7:06 pm    Post subject: Reply with quote

Code:
//png_write_row(png_ptr, line);
row_pointers[y] = &line;

So I changed the code to put the line pointer address into the row_pointers but the image now doesn't seem to save correctly.

Code:
png_write_image(png_ptr, row_pointers);

I need a debugger.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Sep 23, 2005 7:32 pm    Post subject: Reply with quote

Shiki wrote:
Code:
//png_write_row(png_ptr, line);
row_pointers[y] = &line;

So I changed the code to put the line pointer address into the row_pointers but the image now doesn't seem to save correctly.


It doesn't make much sense, if you put the same line pointer to every row_pointers array entries. If you want to save it at once, you have to reserve as many rows as the image height. You'll need to use the sample from libpng as a base and customize it to your needs, not my sample. But I don't think that it will be faster.
Back to top
View user's profile Send private message
Shiki



Joined: 02 Sep 2005
Posts: 10

PostPosted: Fri Sep 23, 2005 9:27 pm    Post subject: Reply with quote

Yeah, it's because you said it might not be faster I don't want to completely write another version that ends up being the same result.

What would be the fastest way of taking a screen dump?
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Sep 23, 2005 9:50 pm    Post subject: Reply with quote

I think the fastest way would be not to access the memory stick, but using the WiFi interface. And then perhaps using the ME for compressing it, but you have to profile it, if compressing takes more time than the WiFi transfer.
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Fri Sep 23, 2005 11:15 pm    Post subject: Reply with quote

One good possibility to optimize it is to take the swtich/case instrutions out of the "for-loop", and do for each case an own for-loop, so it does't have to check for every pixel in which format to store it.
That should give quite a speedup, although i think the main bottleneck is the MS access, like you already said shine.
_________________
infj
Back to top
View user's profile Send private message
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Sat Sep 24, 2005 12:24 am    Post subject: Reply with quote

maybe you get some significant speedup if you read the entire PNG to memory and then start the decoder instead of letting the decoder call read/seek for every chunk.
Back to top
View user's profile Send private message
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Wed Sep 28, 2005 9:01 am    Post subject: Reply with quote

undefined reference to "deflate..."
undefined reference to "inflate..."
undefined reference to "crc32"
a bunch of stuff that looks like that
what am i doing wrong?
make file :
Code:

TARGET = crazypaint2

OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LIBS = -lm -lz -lpng
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = crazypaint2


PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

using jasons screenshot code[/code]
Back to top
View user's profile Send private message
jason867



Joined: 24 Jul 2005
Posts: 78

PostPosted: Wed Sep 28, 2005 10:08 am    Post subject: Reply with quote

Did you install libpng and zlib via svn?
_________________
Ask not for whom the bell tolls, it tolls for thee, besides, I'm playing my PSP, tee hee!
------------------------------------------------------
Visit my website for my PSP Homebrew!
Back to top
View user's profile Send private message Visit poster's website
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Wed Sep 28, 2005 10:42 am    Post subject: Reply with quote

i installed both zlib and libpng
in that order

i did make, make install for zlib
and make, make install for libpng

i had the zlib and libpng folders in the psptoolchain folder im using cygwin
Back to top
View user's profile Send private message
jason867



Joined: 24 Jul 2005
Posts: 78

PostPosted: Wed Sep 28, 2005 11:27 pm    Post subject: Reply with quote

did you include <png.h>
and <zlib.h> (im not sure if you actually need this one or not...)

i typed all of this in with my psp browser! lol
_________________
Ask not for whom the bell tolls, it tolls for thee, besides, I'm playing my PSP, tee hee!
------------------------------------------------------
Visit my website for my PSP Homebrew!
Back to top
View user's profile Send private message Visit poster's website
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Thu Sep 29, 2005 6:53 am    Post subject: Reply with quote

haha good job btw i think that may fix it i had "png.h" instead of <png.h>
not sure why...
lol ive only been doing this for 2 weeks or so
Back to top
View user's profile Send private message
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Thu Sep 29, 2005 6:59 am    Post subject: Reply with quote

nope didnt work it seems the undefines are in png.c and etc
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Thu Sep 29, 2005 7:03 am    Post subject: Reply with quote

You could try the screenshot sample in the libpng folder to see if something is wrong with your program or with your psptoolchain setup.
Back to top
View user's profile Send private message
elevationsnow



Joined: 10 Sep 2005
Posts: 22

PostPosted: Thu Sep 29, 2005 9:36 am    Post subject: Reply with quote

yeah the compiler is a bitch and wants different order of libs for different programs
jasons optical chaos
-lz -lpng
my program
-lm -lpng -lz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group