VBA-M Forums

Full Version: [FIXED]PNG screenshotting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
- 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.
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.
Quote: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);
"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 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.ph...id=1023154
mudlord Wrote:"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.
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 o.O


EDIT2:
I just found someone having the exact same problem: http://www.mail-archive.com/gnuwin32-use...00657.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/Visual...nce368.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.
Heh.

In that case, make libpng static. Removes the issue of dependancy hell.
yup, I will
Reference URL's