[FIXED]PNG screenshotting

Locked
Hard Core Rikki
Member
Posts: 78
Joined: Tue Apr 08, 2008 12:26 pm

[FIXED]PNG screenshotting

Post by Hard Core Rikki »

  • svn 478 (probably not exclusive to this revision)
  • fresh ini
  • additional files in the root folder:

d3dx9_36.dll

d3dx9_37.dll

libpng13.dll

zlib1.dll

 

 

If the screenshot format is png, screenshotting crashes the emulator every time, whether triggered by the screenshot command in the menu or the keyboard shortcut. screenies not written (black 0 byte files) and not readable.

 

When BMP is selected instead, screenshotting works fine.

Last edited by Hard Core Rikki on Mon Aug 10, 2009 1:38 am, edited 1 time in total.
spacy51
Senior Member
Posts: 371
Joined: Tue Mar 18, 2008 4:59 pm

[FIXED]PNG screenshotting

Post by spacy51 »

The debug version crashes as well. The code causing libpng13.dll to fail is located in Util.cpp at line 109 ("png_write_info(png_ptr,info_ptr);")

 

There were no changes recently, but the png-lib has been updated several times, so there were possibly some slight API changes.

I haven't worked with libpng until now, so help is appreciated.

Last edited by spacy51 on Wed Apr 16, 2008 8:09 am, edited 1 time in total.
Hard Core Rikki
Member
Posts: 78
Joined: Tue Apr 08, 2008 12:26 pm

[FIXED]PNG screenshotting

Post by Hard Core Rikki »

png_write_info(png_ptr,info_ptr);

 

I believe one of these would be correct.

png_write_info(png_ptr, ptr_info);

png_write_info(png_ptr, png_info);

Last edited by Hard Core Rikki on Wed Apr 16, 2008 8:31 pm, edited 1 time in total.
mudlord
Senior Member
Posts: 306
Joined: Sun Feb 08, 2009 7:16 am

[FIXED]PNG screenshotting

Post by mudlord »

"There were no changes recently, but the png-lib has been updated several times, so there were possibly some slight API changes."

 

Main question I have to ask is are you using the latest libpng version?

Squall Leonhart
Posting Freak
Posts: 1223
Joined: Tue Mar 18, 2008 9:21 am

[FIXED]PNG screenshotting

Post by Squall Leonhart »

I already reported this on sourceforge, it only occured when hitting the screenshot key, at first, and could be worked around by hitting pause first.

 

but now it is doing it via the menu as well. it seems to be something to do with it continuing play after having taken the screenshot, as the sound returns again for about a second.

 

https://sourceforge.net/tracker/index.php?func=detail&aid=1928413&group_id=212795&atid=1023154

Last edited by Squall Leonhart on Fri Apr 18, 2008 1:15 am, edited 1 time in total.
spacy51
Senior Member
Posts: 371
Joined: Tue Mar 18, 2008 4:59 pm

[FIXED]PNG screenshotting

Post by spacy51 »

"There were no changes recently, but the png-lib has been updated several times, so there were possibly some slight API changes."

 

Main question I have to ask is are you using the latest libpng version?

 

 

I am currently using libpng 1.2.25 (x86), built from the official project files with the official source package.

 

There is already a newer version 1.2.26, but I don't think this bug is libpng-related.

Last edited by spacy51 on Fri Apr 18, 2008 9:20 am, edited 1 time in total.
spacy51
Senior Member
Posts: 371
Joined: Tue Mar 18, 2008 4:59 pm

[FIXED]PNG screenshotting

Post by spacy51 »

This one is really a hard nut to crack. I already made the png initialization look like in the official tutorial and still get that error. I will continue to work on it, though. Just built me some debug libpng & zlib.

 

EDIT:

I'm now using libpng 1.2.28, debug build.

 

This bug gets stranger and stranger.

Libpng crashes when trying to write the 8-bit signature ("...PNG...") at the beginning of the file:

 

pngwio.c:

Line 54: check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));

 

[values:

data = 0x0012ec88 "‰PNGÌÌÌÌH\Έí"

lenght = 8

png_ptr->io_ptr = 0x00adeb70

]

 

 

fwrite() crashes here:

fwrite.c (MS C-Runtime):

Line 79: _lock_str(stream); /* lock stream */

 

Finally, lock_file crashes at "EnterCriticalSection( &(((FILEX *)pf)->lock) );"

 

 

Someone help me [img]<fileStore.core_Emoticons>/emoticons/huh.png[/img]/emoticons/huh@2x.png 2x" width="20" height="20" />

 

 

EDIT2:

I just found someone having the exact same problem: http://www.mail-archive.com/gnuwin32-users@lists.sourceforge.net/msg00657.html

 

His solution:

"The solution is relatively simple: just be sure that the project in which you

are using LibPng is compiled with the same "Runtime Library" settings. I think

that by default the lib is compiled in "/MD" (multi-threaded DLL) and a lot

of projects are single threaded by default. This setting can be found in the

project's property under C++/Code Generation (in VC7.1)."

 

Now, this would be an easy fix, but I already have the same runtime (Multi-Threaded Release/Debug) for zlib/libpng & VBA-M.

 

Maybe only a static link to libpng as it was default for the MSVC2005 builds will help???

 

 

EDIT3:

Of course this bug occurs on all builds from the http://vba-m.com/vbam/vbacompiles/msvc2008/ dir (SVN451 and up). http://vba-m.com/vbam/vbacompiles/VisualBoyAdvance368.rar was the last version working, since it was compiled with MSVC2005 which still has the static link to libpng & zlib. Welcome to DLL hell.

Last edited by spacy51 on Sun May 04, 2008 1:20 pm, edited 1 time in total.
mudlord
Senior Member
Posts: 306
Joined: Sun Feb 08, 2009 7:16 am

[FIXED]PNG screenshotting

Post by mudlord »

Heh.

 

In that case, make libpng static. Removes the issue of dependancy hell.

spacy51
Senior Member
Posts: 371
Joined: Tue Mar 18, 2008 4:59 pm

[FIXED]PNG screenshotting

Post by spacy51 »

yup, I will

Locked