diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a9ef5ba8..a6fab34ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -377,6 +377,12 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB}) set(SRB2_HAVE_PNG ON) add_definitions(-DHAVE_PNG) add_definitions(-D_LARGEFILE64_SOURCE) + set(SRB2_PNG_SOURCES apng.c) + set(SRB2_PNG_HEADERS apng.h) + prepend_sources(SRB2_PNG_SOURCES) + prepend_sources(SRB2_PNG_HEADERS) + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS}) else() message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.") endif() diff --git a/src/Makefile b/src/Makefile index c894203a4..6363ab7dc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -338,6 +338,8 @@ endif LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) + +OBJS+=$(OBJDIR)/apng.o endif ifdef HAVE_LIBGME diff --git a/src/apng.c b/src/apng.c new file mode 100644 index 000000000..2109c0a07 --- /dev/null +++ b/src/apng.c @@ -0,0 +1,266 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include "apng.h" + +#define APNG_WROTE_acTL 0x10000U + +struct apng_info_def +{ + png_uint_32 mode; + png_uint_32 valid; + + png_uint_32 num_frames; + png_uint_32 num_plays; + + long start_acTL;/* acTL is written here */ + + png_flush_ptr output_flush_fn; + apng_seek_ptr output_seek_fn; + apng_tell_ptr output_tell_fn; + + apng_set_acTL_ptr set_acTL_fn; +}; + +/* PROTOS (FUCK COMPILER) */ +void apng_seek (png_structp, apng_const_infop, size_t); +size_t apng_tell (png_structp, apng_const_infop); +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void apng_flush (png_structp, apng_infop); +#ifdef PNG_STDIO_SUPPORTED +void apng_default_flush (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED +void apng_default_seek (png_structp, size_t); +size_t apng_default_tell (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +void apng_write_IEND (png_structp); +void apng_write_acTL (png_structp, png_uint_32, png_uint_32); + +apng_infop +apng_create_info_struct (png_structp pngp) +{ + apng_infop ainfop; + (void)pngp; + if (( ainfop = calloc(sizeof (apng_info),1) )) + { + apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0); + apng_set_set_acTL_fn(pngp, ainfop, 0); + } + return ainfop; +} + +void +apng_destroy_info_struct (png_structp pngp, apng_infopp ainfopp) +{ + (void)pngp; + if (!( pngp && ainfopp )) + return; + + free((*ainfopp)); +} + +void +apng_seek (png_structp pngp, apng_const_infop ainfop, size_t l) +{ + (*(ainfop->output_seek_fn))(pngp, l); +} + +size_t +apng_tell (png_structp pngp, apng_const_infop ainfop) +{ + return (*(ainfop->output_tell_fn))(pngp); +} + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void +apng_flush (png_structp pngp, apng_infop ainfop) +{ + if (ainfop->output_flush_fn) + (*(ainfop->output_flush_fn))(pngp); +} + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_flush (png_structp pngp) +{ + if (!( pngp )) + return; + + fflush((png_FILE_p)png_get_io_ptr); +} +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_seek (png_structp pngp, size_t l) +{ + if (!( pngp )) + return; + + if (fseek((png_FILE_p)png_get_io_ptr(pngp), (long)l, SEEK_SET) == -1) + png_error(pngp, "Seek Error"); +} + +size_t +apng_default_tell (png_structp pngp) +{ + long l; + + if (!( pngp )) + { + png_error(pngp, "Call to apng_default_tell with NULL pngp failed"); + } + + if (( l = ftell((png_FILE_p)png_get_io_ptr(pngp)) ) == -1) + png_error(pngp, "Tell Error"); + + return (size_t)l; +} +#endif/* PNG_STDIO_SUPPORTED */ + +void +apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, + png_rw_ptr write_f, png_flush_ptr flush_f, + apng_seek_ptr seek_f, apng_tell_ptr tell_f) +{ + if (!( pngp && ainfop )) + return; + + png_set_write_fn(pngp, iop, write_f, flush_f); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED + if (!flush_f) + ainfop->output_flush_fn = &apng_default_flush; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_flush_fn = flush_f; +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_seek_fn = &apng_default_seek; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_seek_fn = seek_f; +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_tell_fn = apng_default_tell; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_tell_fn = tell_f; +} + +void +apng_write_IEND (png_structp pngp) +{ + png_byte chunkc[] = "IEND"; + png_write_chunk(pngp, chunkc, 0, 0); +} + +void +apng_write_acTL (png_structp pngp, png_uint_32 frames, png_uint_32 plays) +{ + png_byte chunkc[] = "acTL"; + png_byte buf[8]; + png_save_uint_32(buf, frames); + png_save_uint_32(buf + 4, plays); + png_write_chunk(pngp, chunkc, buf, 8); +} + +png_uint_32 +apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + if (!( pngp && infop && ainfop )) + return 0; + + ainfop->num_frames = frames; + ainfop->num_plays = plays; + + ainfop->valid |= PNG_INFO_acTL; + + return 1; +} + +void +apng_write_info_before_PLTE (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + if (!( pngp && infop && ainfop )) + return; + + png_write_info_before_PLTE(pngp, infop); + + if (( ainfop->valid & PNG_INFO_acTL ) &&!( ainfop->mode & APNG_WROTE_acTL )) + { + ainfop->start_acTL = apng_tell(pngp, ainfop); + + apng_write_acTL(pngp, 0, 0); + /* modified for runtime dynamic linking */ + (*(ainfop->set_acTL_fn))(pngp, infop, PNG_UINT_31_MAX, 0); + + ainfop->mode |= APNG_WROTE_acTL; + } +} + +void +apng_write_info (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + apng_write_info_before_PLTE(pngp, infop, ainfop); + png_write_info(pngp, infop); +} + +void +apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) +{ + (void)infop; + apng_write_IEND(pngp); + apng_seek(pngp, ainfop, ainfop->start_acTL); + apng_write_acTL(pngp, ainfop->num_frames, ainfop->num_plays); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED + apng_flush(pngp, infop); +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ +} + +/* Dynamic runtime linking capable! (Hopefully.) */ +void +apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, + apng_set_acTL_ptr set_acTL_f) +{ + (void)pngp; + if (!ainfop->set_acTL_fn) + ainfop->set_acTL_fn = &png_set_acTL; + else + ainfop->set_acTL_fn = set_acTL_f; +} diff --git a/src/apng.h b/src/apng.h new file mode 100644 index 000000000..eefd6aaa3 --- /dev/null +++ b/src/apng.h @@ -0,0 +1,66 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef APNG_H +#define APNG_H + +#include + +typedef struct apng_info_def apng_info; +typedef apng_info * apng_infop; +typedef const apng_info * apng_const_infop; +typedef apng_info * * apng_infopp; + +typedef void (*apng_seek_ptr)(png_structp, size_t); +typedef size_t (*apng_tell_ptr)(png_structp); + +typedef png_uint_32 (*apng_set_acTL_ptr)(png_structp, png_infop, + png_uint_32, png_uint_32); + +apng_infop apng_create_info_struct (png_structp png_ptr); + +void apng_destroy_info_struct (png_structp png_ptr, + apng_infopp info_ptr_ptr); + +/* Call the following functions in place of the libpng counterparts. */ + +png_uint_32 apng_set_acTL (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr, + png_uint_32 num_frames, png_uint_32 num_plays); + +void apng_write_info_before_PLTE (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); +void apng_write_info (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_write_end (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_set_write_fn (png_structp png_ptr, apng_infop ainfo_ptr, + png_voidp io_ptr, + png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn, + apng_seek_ptr output_seek_fn, apng_tell_ptr output_tell_fn); + +void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr, + apng_set_acTL_ptr set_acTL_fn); + +#endif/* APNG_H */ diff --git a/src/m_misc.c b/src/m_misc.c index c99fa1736..fe5215922 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -93,9 +93,8 @@ typedef off_t off64_t; #ifdef PNG_WRITE_SUPPORTED #define USE_PNG // Only actually use PNG if write is supported. #if defined (PNG_WRITE_APNG_SUPPORTED) //|| !defined(PNG_STATIC) - #if (PNG_LIBPNG_VER_MAJOR) == 1 && (PNG_LIBPNG_VER_MINOR <= 4) // Supposedly, the current APNG code can't work on newer versions as is + #include "apng.h" #define USE_APNG - #endif #endif // See hardware/hw_draw.c for a similar check to this one. #endif @@ -794,13 +793,13 @@ static inline void M_PNGImage(png_structp png_ptr, png_infop png_info_ptr, PNG_C #ifdef USE_APNG static png_structp apng_ptr = NULL; static png_infop apng_info_ptr = NULL; +static apng_infop apng_ainfo_ptr = NULL; static png_FILE_p apng_FILE = NULL; static png_uint_32 apng_frames = 0; -static png_byte acTL_cn[5] = { 97, 99, 84, 76, '\0'}; #ifdef PNG_STATIC // Win32 build have static libpng -#define apng_set_acTL png_set_acTL -#define apng_write_frame_head png_write_frame_head -#define apng_write_frame_tail png_write_frame_tail +#define aPNG_set_acTL png_set_acTL +#define aPNG_write_frame_head png_write_frame_head +#define aPNG_write_frame_tail png_write_frame_tail #else // outside libpng may not have apng support #ifndef PNG_WRITE_APNG_SUPPORTED // libpng header may not have apng patch @@ -837,20 +836,20 @@ static png_byte acTL_cn[5] = { 97, 99, 84, 76, '\0'}; #endif #endif -typedef PNG_EXPORT(png_uint_32, (*P_png_set_acTL)) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays)); -typedef PNG_EXPORT (void, (*P_png_write_frame_head)) PNGARG((png_structp png_ptr, +typedef png_uint_32 (*P_png_set_acTL) (png_structp png_ptr, + png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays); +typedef void (*P_png_write_frame_head) (png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers, png_uint_32 width, png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset, png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, - png_byte blend_op)); + png_byte blend_op); -typedef PNG_EXPORT (void, (*P_png_write_frame_tail)) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -static P_png_set_acTL apng_set_acTL = NULL; -static P_png_write_frame_head apng_write_frame_head = NULL; -static P_png_write_frame_tail apng_write_frame_tail = NULL; +typedef void (*P_png_write_frame_tail) (png_structp png_ptr, + png_infop info_ptr); +static P_png_set_acTL aPNG_set_acTL = NULL; +static P_png_write_frame_head aPNG_write_frame_head = NULL; +static P_png_write_frame_tail aPNG_write_frame_tail = NULL; #endif static inline boolean M_PNGLib(void) @@ -859,7 +858,7 @@ static inline boolean M_PNGLib(void) return true; #else static void *pnglib = NULL; - if (apng_set_acTL && apng_write_frame_head && apng_write_frame_tail) + if (aPNG_set_acTL && aPNG_write_frame_head && aPNG_write_frame_tail) return true; if (pnglib) return false; @@ -879,16 +878,16 @@ static inline boolean M_PNGLib(void) if (!pnglib) return false; #ifdef HAVE_SDL - apng_set_acTL = hwSym("png_set_acTL", pnglib); - apng_write_frame_head = hwSym("png_write_frame_head", pnglib); - apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib); + aPNG_set_acTL = hwSym("png_set_acTL", pnglib); + aPNG_write_frame_head = hwSym("png_write_frame_head", pnglib); + aPNG_write_frame_tail = hwSym("png_write_frame_tail", pnglib); #endif #ifdef _WIN32 - apng_set_acTL = GetProcAddress("png_set_acTL", pnglib); - apng_write_frame_head = GetProcAddress("png_write_frame_head", pnglib); - apng_write_frame_tail = GetProcAddress("png_write_frame_tail", pnglib); + aPNG_set_acTL = GetProcAddress("png_set_acTL", pnglib); + aPNG_write_frame_head = GetProcAddress("png_write_frame_head", pnglib); + aPNG_write_frame_tail = GetProcAddress("png_write_frame_tail", pnglib); #endif - return (apng_set_acTL && apng_write_frame_head && apng_write_frame_tail); + return (aPNG_set_acTL && aPNG_write_frame_head && aPNG_write_frame_tail); #endif } @@ -902,11 +901,6 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn apng_frames++; -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(apng_ptr, apng_info_ptr, apng_frames, 0); - for (y = 0; y < height; y++) { row_pointers[y] = png_buf; @@ -914,9 +908,9 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn } #ifndef PNG_STATIC - if (apng_write_frame_head) + if (aPNG_write_frame_head) #endif - apng_write_frame_head(apng_ptr, apng_info_ptr, row_pointers, + aPNG_write_frame_head(apng_ptr, apng_info_ptr, row_pointers, vid.width, /* width */ height, /* height */ 0, /* x offset */ @@ -929,57 +923,21 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn png_write_image(png_ptr, row_pointers); #ifndef PNG_STATIC - if (apng_write_frame_tail) + if (aPNG_write_frame_tail) #endif - apng_write_frame_tail(apng_ptr, apng_info_ptr); + aPNG_write_frame_tail(apng_ptr, apng_info_ptr); png_free(png_ptr, (png_voidp)row_pointers); } -static inline boolean M_PNGfind_acTL(void) +static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr, + apng_infop png_ainfo_ptr) { - png_byte cn[8]; // 4 bytes for len then 4 byes for name - long endpos = ftell(apng_FILE); // not the real end of file, just what of libpng wrote - for (fseek(apng_FILE, 0, SEEK_SET); // let go to the start of the file - ftell(apng_FILE)+12 < endpos; // let not go over the file bound - fseek(apng_FILE, 1, SEEK_CUR) // we went 8 steps back and now we go 1 step forward - ) - { - if (fread(cn, sizeof(cn), 1, apng_FILE) != 1) // read 8 bytes - return false; // failed to read data - if (fseek(apng_FILE, -8, SEEK_CUR) != 0) //rewind 8 bytes - return false; // failed to rewird - if (!png_memcmp(cn+4, acTL_cn, 4)) //cmp for chuck header - return true; // found it - } - return false; // acTL chuck not found -} - -static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr) -{ - png_byte data[16]; - long oldpos; - -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(png_ptr, png_info_ptr, apng_frames, 0); + apng_set_acTL(png_ptr, png_info_ptr, png_ainfo_ptr, apng_frames, 0); #ifndef NO_PNG_DEBUG png_debug(1, "in png_write_acTL\n"); #endif - - png_ptr->num_frames_to_write = apng_frames; - - png_save_uint_32(data, apng_frames); - png_save_uint_32(data + 4, 0); - - oldpos = ftell(apng_FILE); - - if (M_PNGfind_acTL()) - png_write_chunk(png_ptr, (png_bytep)acTL_cn, data, (png_size_t)8); - - fseek(apng_FILE, oldpos, SEEK_SET); } static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) @@ -1011,6 +969,16 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) return false; } + apng_ainfo_ptr = apng_create_info_struct(apng_ptr); + if (!apng_ainfo_ptr) + { + CONS_Debug(DBG_RENDER, "M_StartMovie: Error on allocate for apng\n"); + png_destroy_write_struct(&apng_ptr, &apng_info_ptr); + fclose(apng_FILE); + remove(filename); + return false; + } + png_init_io(apng_ptr, apng_FILE); #ifdef PNG_SET_USER_LIMITS_SUPPORTED @@ -1028,12 +996,11 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) M_PNGText(apng_ptr, apng_info_ptr, true); -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(apng_ptr, apng_info_ptr, PNG_UINT_31_MAX, 0); + apng_set_set_acTL_fn(apng_ptr, apng_ainfo_ptr, aPNG_set_acTL); - png_write_info(apng_ptr, apng_info_ptr); + apng_set_acTL(apng_ptr, apng_info_ptr, apng_ainfo_ptr, PNG_UINT_31_MAX, 0); + + apng_write_info(apng_ptr, apng_info_ptr, apng_ainfo_ptr); apng_frames = 0; @@ -1236,8 +1203,8 @@ void M_StopMovie(void) if (apng_frames) { - M_PNGfix_acTL(apng_ptr, apng_info_ptr); - png_write_end(apng_ptr, apng_info_ptr); + M_PNGfix_acTL(apng_ptr, apng_info_ptr, apng_ainfo_ptr); + apng_write_end(apng_ptr, apng_info_ptr, apng_ainfo_ptr); } png_destroy_write_struct(&apng_ptr, &apng_info_ptr); diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index f7b7c7ba4..7f8f052ba 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -70,6 +70,8 @@ if(${SDL2_FOUND}) set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} + ${SRB2_PNG_HEADERS} ${SRB2_CORE_RENDER_SOURCES} ${SRB2_CORE_GAME_SOURCES} ${SRB2_LUA_SOURCES} @@ -80,7 +82,8 @@ if(${SDL2_FOUND}) ${SRB2_SDL2_HEADERS} ) - source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}) + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS}) source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES}) source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES}) source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES}) diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 04af6a8e1..e43772179 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -164,6 +164,7 @@ + @@ -316,6 +317,7 @@ + diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index ac0b03177..d67ac6308 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -294,6 +294,9 @@ LUA + + M_Misc + M_Misc diff --git a/src/sdl/Srb2SDL-vc9.vcproj b/src/sdl/Srb2SDL-vc9.vcproj index d2a268f8d..3898aeba4 100644 --- a/src/sdl/Srb2SDL-vc9.vcproj +++ b/src/sdl/Srb2SDL-vc9.vcproj @@ -2834,6 +2834,50 @@ RelativePath="..\m_argv.h" > + + + + + + + + + + + + + + + + diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 94a3fbb63..a8ecbf7f8 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; }; 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; }; 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; }; + 1E44AF110B67CDE900BAD059 /* apng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* apng.c */; }; 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; }; 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; }; 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; }; @@ -253,7 +254,9 @@ 1E44AF000B67CDE900BAD059 /* m_menu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_menu.c; path = ../../m_menu.c; sourceTree = SOURCE_ROOT; }; 1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; }; 1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.h; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; }; 1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; }; 1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; }; @@ -679,6 +682,8 @@ 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */, 1E44AF020B67CDE900BAD059 /* m_misc.c */, 1E44AF030B67CDE900BAD059 /* m_misc.h */, + 1E44AF020B67CDE900BAD059 /* apng.c */, + 1E44AF030B67CDE900BAD059 /* apng.h */, 676BB51C0E0DE06100C95963 /* m_queue.c */, 676BB51D0E0DE06100C95963 /* m_queue.h */, 1E44AF040B67CDE900BAD059 /* m_random.c */, diff --git a/src/sdl12/Srb2SDL-vc10.vcxproj b/src/sdl12/Srb2SDL-vc10.vcxproj index 958cd7d02..99916f58d 100644 --- a/src/sdl12/Srb2SDL-vc10.vcxproj +++ b/src/sdl12/Srb2SDL-vc10.vcxproj @@ -835,6 +835,16 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -1293,6 +1303,7 @@ + diff --git a/src/sdl12/Srb2SDL-vc9.vcproj b/src/sdl12/Srb2SDL-vc9.vcproj index d2a268f8d..fa386e381 100644 --- a/src/sdl12/Srb2SDL-vc9.vcproj +++ b/src/sdl12/Srb2SDL-vc9.vcproj @@ -2790,6 +2790,50 @@ + + + + + + + + + + + + + + + + diff --git a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj index de12201f5..1f8e3276a 100644 --- a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj @@ -1365,6 +1365,20 @@ path = ../../m_misc.h; refType = 2; }; + 84177764085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = apng.c; + path = ../../apng.c; + refType = 2; + }; + 84177765085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_misc.h; + path = ../../apng.h; + refType = 2; + }; 84177766085A10EB000C01D8 = { fileEncoding = 30; isa = PBXFileReference; diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 0ab40c45e..69c544c56 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; }; 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; }; 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; }; + 1E44AF110B67CDE900BAD059 /* apng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* apng.c */; }; 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; }; 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; }; 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; }; @@ -254,6 +255,8 @@ 1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; }; 1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; + 1E44AF030B67CDE900BAD059 /* apng.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = apng.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; 1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; }; 1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; }; 1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; }; @@ -679,6 +682,8 @@ 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */, 1E44AF020B67CDE900BAD059 /* m_misc.c */, 1E44AF030B67CDE900BAD059 /* m_misc.h */, + 1E44AF020B67CDE900BAD059 /* apng.c */, + 1E44AF030B67CDE900BAD059 /* apng.h */, 676BB51C0E0DE06100C95963 /* m_queue.c */, 676BB51D0E0DE06100C95963 /* m_queue.h */, 1E44AF040B67CDE900BAD059 /* m_random.c */, diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj index ca73b1293..774ce5cbe 100644 --- a/src/win32/Srb2win-vc10.vcxproj +++ b/src/win32/Srb2win-vc10.vcxproj @@ -182,6 +182,7 @@ + @@ -330,6 +331,7 @@ + diff --git a/src/win32/Srb2win-vc9.vcproj b/src/win32/Srb2win-vc9.vcproj index 24235bc7b..a64b8638c 100644 --- a/src/win32/Srb2win-vc9.vcproj +++ b/src/win32/Srb2win-vc9.vcproj @@ -2851,6 +2851,50 @@ RelativePath="..\m_misc.h" > + + + + + + + + + + + + + + + +