screenshot.c
branch0.4.5
changeset 9956 341e963c63c4
parent 2791 f8ffac7515d4
equal deleted inserted replaced
9955:d24647f8227b 9956:341e963c63c4
    10 #include "viewport.h"
    10 #include "viewport.h"
    11 #include "player.h"
    11 #include "player.h"
    12 #include "screenshot.h"
    12 #include "screenshot.h"
    13 #include "variables.h"
    13 #include "variables.h"
    14 
    14 
       
    15 #if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
       
    16 extern const char *convert_to_fs_charset(const char *filename);
       
    17 #else
       
    18 #define convert_to_fs_charset(str) (str)
       
    19 #endif
       
    20 
    15 char _screenshot_format_name[8];
    21 char _screenshot_format_name[8];
    16 uint _num_screenshot_formats;
    22 uint _num_screenshot_formats;
    17 uint _cur_screenshot_format;
    23 uint _cur_screenshot_format;
    18 
    24 
    19 // called by the ScreenShot proc to generate screenshot lines.
    25 // called by the ScreenShot proc to generate screenshot lines.
    71 
    77 
    72 	// only implemented for 8bit images so far.
    78 	// only implemented for 8bit images so far.
    73 	if (pixelformat != 8)
    79 	if (pixelformat != 8)
    74 		return false;
    80 		return false;
    75 
    81 
    76 	f = fopen(name, "wb");
    82 	f = fopen(convert_to_fs_charset(name), "wb");
    77 	if (f == NULL) return false;
    83 	if (f == NULL) return false;
    78 
    84 
    79 	// each scanline must be aligned on a 32bit boundary
    85 	// each scanline must be aligned on a 32bit boundary
    80 	padw = ALIGN(w, 4);
    86 	padw = ALIGN(w, 4);
    81 
    87 
   175 
   181 
   176 	// only implemented for 8bit images so far.
   182 	// only implemented for 8bit images so far.
   177 	if (pixelformat != 8)
   183 	if (pixelformat != 8)
   178 		return false;
   184 		return false;
   179 
   185 
   180 	f = fopen(name, "wb");
   186 	f = fopen(convert_to_fs_charset(name), "wb");
   181 	if (f == NULL) return false;
   187 	if (f == NULL) return false;
   182 
   188 
   183 	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (char *)name, png_my_error, png_my_warning);
   189 	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (char *)name, png_my_error, png_my_warning);
   184 
   190 
   185 	if (png_ptr == NULL) {
   191 	if (png_ptr == NULL) {
   286 	PcxHeader pcx;
   292 	PcxHeader pcx;
   287 
   293 
   288 	if (pixelformat != 8 || w == 0)
   294 	if (pixelformat != 8 || w == 0)
   289 		return false;
   295 		return false;
   290 
   296 
   291 	f = fopen(name, "wb");
   297 	f = fopen(convert_to_fs_charset(name), "wb");
   292 	if (f == NULL) return false;
   298 	if (f == NULL) return false;
   293 
   299 
   294 	memset(&pcx, 0, sizeof(pcx));
   300 	memset(&pcx, 0, sizeof(pcx));
   295 
   301 
   296 	// setup pcx header
   302 	// setup pcx header