Merge branch 'master' into Glew_Version_For_Real

This commit is contained in:
Christoph Oelckers 2014-06-29 08:53:43 +02:00
commit 08054ddc34
37 changed files with 272 additions and 183 deletions

View file

@ -78,10 +78,23 @@ else( MSVC )
set( ZDOOM_OUTPUT_OLDSTYLE OFF ) set( ZDOOM_OUTPUT_OLDSTYLE OFF )
endif( MSVC ) endif( MSVC )
# Replacement variables for a possible long list of C/C++ compilers compatible with GCC
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE TRUE )
else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE FALSE )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE TRUE )
else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE FALSE )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
find_package( BZip2 ) find_package( BZip2 )

View file

@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 )
make_release_only() make_release_only()
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
add_definitions( -DBZ_NO_STDIO ) add_definitions( -DBZ_NO_STDIO )
add_library( bz2 add_library( bz2

View file

@ -13,9 +13,9 @@ endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" )
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS )
if( NOT ITOA_EXISTS ) if( NOT ITOA_EXISTS )
@ -103,6 +103,6 @@ add_library( dumb
src/it/xmeffect.c ) src/it/xmeffect.c )
target_link_libraries( dumb ) target_link_libraries( dumb )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse ) set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )

View file

@ -18,7 +18,7 @@ if( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) set( CMAKE_BUILD_TYPE "RelWithDebInfo" )
endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" )
if( NOT PROFILE ) if( NOT PROFILE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" )
@ -27,7 +27,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
if( HAVE_NO_ARRAY_BOUNDS ) if( HAVE_NO_ARRAY_BOUNDS )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" )
endif( HAVE_NO_ARRAY_BOUNDS ) endif( HAVE_NO_ARRAY_BOUNDS )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )

View file

@ -8,9 +8,9 @@ if( MSVC )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" )
endif( MSVC ) endif( MSVC )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )

View file

@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 )
make_release_only() make_release_only()
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
add_library( jpeg add_library( jpeg
jcomapi.c jcomapi.c

View file

@ -1,15 +1,24 @@
/* 7zCrc.c -- CRC32 calculation /* 7zCrc.c -- CRC32 init
2009-11-23 : Igor Pavlov : Public domain */ 2010-12-01 : Igor Pavlov : Public domain */
#include "7zCrc.h" #include "7zCrc.h"
#include "CpuArch.h" #include "CpuArch.h"
#define kCrcPoly 0xEDB88320 #define kCrcPoly 0xEDB88320
#ifdef MY_CPU_LE #ifdef MY_CPU_X86_OR_AMD64
#define CRC_NUM_TABLES 8 #define CRC_NUM_TABLES 8
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#elif defined(MY_CPU_LE)
#define CRC_NUM_TABLES 4
#else #else
#define CRC_NUM_TABLES 1 #define CRC_NUM_TABLES 5
#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
#ifndef MY_CPU_BE
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif #endif
typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
@ -17,25 +26,6 @@ typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size,
static CRC_FUNC g_CrcUpdate; static CRC_FUNC g_CrcUpdate;
UInt32 g_CrcTable[256 * CRC_NUM_TABLES]; UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
#if CRC_NUM_TABLES == 1
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
static UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
#else
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size) UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
{ {
return g_CrcUpdate(v, data, size, g_CrcTable); return g_CrcUpdate(v, data, size, g_CrcTable);
@ -57,18 +47,37 @@ void MY_FAST_CALL CrcGenerateTable()
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
g_CrcTable[i] = r; g_CrcTable[i] = r;
} }
#if CRC_NUM_TABLES == 1
g_CrcUpdate = CrcUpdateT1;
#else
for (; i < 256 * CRC_NUM_TABLES; i++) for (; i < 256 * CRC_NUM_TABLES; i++)
{ {
UInt32 r = g_CrcTable[i - 256]; UInt32 r = g_CrcTable[i - 256];
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
} }
#ifdef MY_CPU_LE
g_CrcUpdate = CrcUpdateT4; g_CrcUpdate = CrcUpdateT4;
#ifdef MY_CPU_X86_OR_AMD64
#if CRC_NUM_TABLES == 8
if (!CPU_Is_InOrder()) if (!CPU_Is_InOrder())
g_CrcUpdate = CrcUpdateT8; g_CrcUpdate = CrcUpdateT8;
#endif #endif
#else
{
#ifndef MY_CPU_BE
UInt32 k = 1;
if (*(const Byte *)&k == 1)
g_CrcUpdate = CrcUpdateT4;
else
#endif
{
for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
{
UInt32 x = g_CrcTable[i - 256];
g_CrcTable[i] = CRC_UINT32_SWAP(x);
}
g_CrcUpdate = CrcUpdateT1_BeT4;
}
}
#endif #endif
} }

View file

@ -1,12 +1,12 @@
/* 7zCrcOpt.c -- CRC32 calculation : optimized version /* 7zCrcOpt.c -- CRC32 calculation
2009-11-23 : Igor Pavlov : Public domain */ 2010-12-01 : Igor Pavlov : Public domain */
#include "CpuArch.h" #include "CpuArch.h"
#ifdef MY_CPU_LE
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
#ifndef MY_CPU_BE
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
{ {
const Byte *p = (const Byte *)data; const Byte *p = (const Byte *)data;
@ -32,3 +32,33 @@ UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const U
} }
#endif #endif
#ifndef MY_CPU_LE
#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
v = CRC_UINT32_SWAP(v);
table += 0x100;
for (; size >= 4; size -= 4, p += 4)
{
v ^= *(const UInt32 *)p;
v =
table[0x000 + (v & 0xFF)] ^
table[0x100 + ((v >> 8) & 0xFF)] ^
table[0x200 + ((v >> 16) & 0xFF)] ^
table[0x300 + ((v >> 24))];
}
table -= 0x100;
v = CRC_UINT32_SWAP(v);
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
#endif

View file

@ -1,7 +1,8 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 20 #define MY_VER_MINOR 22
#define MY_VER_BUILD 0 #define MY_VER_BUILD 00
#define MY_VERSION "9.20" #define MY_VERSION "9.22 beta"
#define MY_DATE "2010-11-18" #define MY_7ZIP_VERSION "9.22 beta"
#define MY_DATE "2011-04-18"
#define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_COPYRIGHT ": Igor Pavlov : Public domain"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE

View file

@ -3,10 +3,6 @@
#include "CpuArch.h" #include "CpuArch.h"
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef MY_CPU_X86_OR_AMD64 #ifdef MY_CPU_X86_OR_AMD64
#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__) #if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)

View file

@ -1,5 +1,5 @@
/* CpuArch.h -- CPU specific code /* CpuArch.h -- CPU specific code
2010-10-26: Igor Pavlov : Public domain */ 2010-12-01: Igor Pavlov : Public domain */
#ifndef __CPU_ARCH_H #ifndef __CPU_ARCH_H
#define __CPU_ARCH_H #define __CPU_ARCH_H
@ -52,7 +52,7 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla
#define MY_CPU_LE #define MY_CPU_LE
#endif #endif
#if defined(__BIG_ENDIAN__) #if defined(__BIG_ENDIAN__) || defined(__m68k__) || defined(__ARMEB__) || defined(__MIPSEB__)
#define MY_CPU_BE #define MY_CPU_BE
#endif #endif

View file

@ -1,5 +1,5 @@
/* Lzma2Dec.c -- LZMA2 Decoder /* Lzma2Dec.c -- LZMA2 Decoder
2009-05-03 : Igor Pavlov : Public domain */ 2010-12-15 : Igor Pavlov : Public domain */
/* #define SHOW_DEBUG_INFO */ /* #define SHOW_DEBUG_INFO */
@ -330,27 +330,21 @@ SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc)
{ {
CLzma2Dec decoder; CLzma2Dec p;
SRes res; SRes res;
SizeT outSize = *destLen, inSize = *srcLen; SizeT outSize = *destLen, inSize = *srcLen;
Byte props[LZMA_PROPS_SIZE];
Lzma2Dec_Construct(&decoder);
*destLen = *srcLen = 0; *destLen = *srcLen = 0;
*status = LZMA_STATUS_NOT_SPECIFIED; *status = LZMA_STATUS_NOT_SPECIFIED;
decoder.decoder.dic = dest; Lzma2Dec_Construct(&p);
decoder.decoder.dicBufSize = outSize; RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc));
p.decoder.dic = dest;
RINOK(Lzma2Dec_GetOldProps(prop, props)); p.decoder.dicBufSize = outSize;
RINOK(LzmaDec_AllocateProbs(&decoder.decoder, props, LZMA_PROPS_SIZE, alloc)); Lzma2Dec_Init(&p);
*srcLen = inSize; *srcLen = inSize;
res = Lzma2Dec_DecodeToDic(&decoder, outSize, src, srcLen, finishMode, status); res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
*destLen = decoder.decoder.dicPos; *destLen = p.decoder.dicPos;
if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
res = SZ_ERROR_INPUT_EOF; res = SZ_ERROR_INPUT_EOF;
Lzma2Dec_FreeProbs(&p, alloc);
LzmaDec_FreeProbs(&decoder.decoder, alloc);
return res; return res;
} }

View file

@ -1,5 +1,5 @@
/* LzmaDec.c -- LZMA Decoder /* LzmaDec.c -- LZMA Decoder
2009-09-20 : Igor Pavlov : Public domain */ 2010-12-15 : Igor Pavlov : Public domain */
#include "LzmaDec.h" #include "LzmaDec.h"
@ -442,8 +442,9 @@ static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
p->processedPos += len; p->processedPos += len;
p->remainLen -= len; p->remainLen -= len;
while (len-- != 0) while (len != 0)
{ {
len--;
dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
dicPos++; dicPos++;
} }
@ -972,28 +973,21 @@ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
{ {
CLzmaDec p; CLzmaDec p;
SRes res; SRes res;
SizeT inSize = *srcLen; SizeT outSize = *destLen, inSize = *srcLen;
SizeT outSize = *destLen; *destLen = *srcLen = 0;
*srcLen = *destLen = 0; *status = LZMA_STATUS_NOT_SPECIFIED;
if (inSize < RC_INIT_SIZE) if (inSize < RC_INIT_SIZE)
return SZ_ERROR_INPUT_EOF; return SZ_ERROR_INPUT_EOF;
LzmaDec_Construct(&p); LzmaDec_Construct(&p);
res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc));
if (res != 0)
return res;
p.dic = dest; p.dic = dest;
p.dicBufSize = outSize; p.dicBufSize = outSize;
LzmaDec_Init(&p); LzmaDec_Init(&p);
*srcLen = inSize; *srcLen = inSize;
res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
*destLen = p.dicPos;
if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
res = SZ_ERROR_INPUT_EOF; res = SZ_ERROR_INPUT_EOF;
(*destLen) = p.dicPos;
LzmaDec_FreeProbs(&p, alloc); LzmaDec_FreeProbs(&p, alloc);
return res; return res;
} }

View file

@ -1,5 +1,5 @@
/* LzmaEnc.c -- LZMA Encoder /* LzmaEnc.c -- LZMA Encoder
2010-04-16 : Igor Pavlov : Public domain */ 2011-01-27 : Igor Pavlov : Public domain */
#include <string.h> #include <string.h>
@ -46,6 +46,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
{ {
p->level = 5; p->level = 5;
p->dictSize = p->mc = 0; p->dictSize = p->mc = 0;
p->reduceSize = (UInt32)(Int32)-1;
p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
p->writeEndMark = 0; p->writeEndMark = 0;
} }
@ -56,6 +57,15 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
if (level < 0) level = 5; if (level < 0) level = 5;
p->level = level; p->level = level;
if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
if (p->dictSize > p->reduceSize)
{
unsigned i;
for (i = 15; i <= 30; i++)
{
if (p->reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; }
if (p->reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; }
}
}
if (p->lc < 0) p->lc = 3; if (p->lc < 0) p->lc = 3;
if (p->lp < 0) p->lp = 0; if (p->lp < 0) p->lp = 0;
if (p->pb < 0) p->pb = 2; if (p->pb < 0) p->pb = 2;
@ -329,7 +339,6 @@ typedef struct
SRes result; SRes result;
UInt32 dictSize; UInt32 dictSize;
UInt32 matchFinderCycles;
int needInit; int needInit;
@ -398,7 +407,6 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30)) props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30))
return SZ_ERROR_PARAM; return SZ_ERROR_PARAM;
p->dictSize = props.dictSize; p->dictSize = props.dictSize;
p->matchFinderCycles = props.mc;
{ {
unsigned fb = props.fb; unsigned fb = props.fb;
if (fb < 5) if (fb < 5)

View file

@ -1,14 +1,12 @@
/* LzmaEnc.h -- LZMA Encoder /* LzmaEnc.h -- LZMA Encoder
2009-02-07 : Igor Pavlov : Public domain */ 2011-01-27 : Igor Pavlov : Public domain */
#ifndef __LZMA_ENC_H #ifndef __LZMA_ENC_H
#define __LZMA_ENC_H #define __LZMA_ENC_H
#include "Types.h" #include "Types.h"
#ifdef __cplusplus EXTERN_C_BEGIN
extern "C" {
#endif
#define LZMA_PROPS_SIZE 5 #define LZMA_PROPS_SIZE 5
@ -18,6 +16,8 @@ typedef struct _CLzmaEncProps
UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
default = (1 << 24) */ default = (1 << 24) */
UInt32 reduceSize; /* estimated size of data that will be compressed. default = 0xFFFFFFFF.
Encoder uses this value to reduce dictionary size */
int lc; /* 0 <= lc <= 8, default = 3 */ int lc; /* 0 <= lc <= 8, default = 3 */
int lp; /* 0 <= lp <= 4, default = 0 */ int lp; /* 0 <= lp <= 4, default = 0 */
int pb; /* 0 <= pb <= 4, default = 2 */ int pb; /* 0 <= pb <= 4, default = 2 */
@ -73,8 +73,6 @@ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
#ifdef __cplusplus EXTERN_C_END
}
#endif
#endif #endif

View file

@ -6,13 +6,6 @@
#include "Types.h" #include "Types.h"
#ifdef _WIN32
#include <windows.h>
typedef DWORD WRes;
#else
typedef int WRes;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -6,6 +6,10 @@
#include <stddef.h> #include <stddef.h>
#ifdef _WIN32
#include <windows.h>
#endif
#ifndef EXTERN_C_BEGIN #ifndef EXTERN_C_BEGIN
#ifdef __cplusplus #ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" { #define EXTERN_C_BEGIN extern "C" {
@ -38,12 +42,14 @@ EXTERN_C_BEGIN
typedef int SRes; typedef int SRes;
#ifndef RINOK #ifdef _WIN32
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } typedef DWORD WRes;
#else
typedef int WRes;
#endif #endif
#if defined(__APPLE__) && !__LP64__ #ifndef RINOK
#define _LZMA_UINT32_IS_ULONG #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
#endif #endif
typedef unsigned char Byte; typedef unsigned char Byte;

View file

@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 )
make_release_only() make_release_only()
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( LZMA_FILES set( LZMA_FILES
C/7zBuf.c C/7zBuf.c

8
lzma/history.txt Executable file → Normal file
View file

@ -1,6 +1,14 @@
HISTORY of the LZMA SDK HISTORY of the LZMA SDK
----------------------- -----------------------
9.21 beta 2011-04-11
-------------------------
- New class FString for file names at file systems.
- Speed optimization in CRC code for big-endian CPUs.
- The BUG in Lzma2Dec.c was fixed:
Lzma2Decode function didn't work.
9.18 beta 2010-11-02 9.18 beta 2010-11-02
------------------------- -------------------------
- New small SFX module for installers (SfxSetup). - New small SFX module for installers (SfxSetup).

8
lzma/lzma.txt Executable file → Normal file
View file

@ -1,4 +1,4 @@
LZMA SDK 9.20 LZMA SDK 9.22
------------- -------------
LZMA SDK provides the documentation, samples, header files, libraries, LZMA SDK provides the documentation, samples, header files, libraries,
@ -24,6 +24,12 @@ Some code in LZMA SDK is based on public domain code from another developers:
1) PPMd var.H (2001): Dmitry Shkarin 1) PPMd var.H (2001): Dmitry Shkarin
2) SHA-256: Wei Dai (Crypto++ library) 2) SHA-256: Wei Dai (Crypto++ library)
You can copy, modify, distribute and perform LZMA SDK code, even for commercial purposes,
all without asking permission.
LZMA SDK code is compatible with open source licenses, for example, you can
include it to GNU GPL or GNU LGPL code.
LZMA SDK Contents LZMA SDK Contents
----------------- -----------------

View file

@ -16,14 +16,14 @@ else( NOT APPLE )
# At the moment asm code doesn't work with OS X, so disable by default # At the moment asm code doesn't work with OS X, so disable by default
option( NO_ASM "Disable assembly code" ON ) option( NO_ASM "Disable assembly code" ON )
endif( NOT APPLE ) endif( NOT APPLE )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
option( NO_STRIP "Do not strip Release or MinSizeRel builds" ) option( NO_STRIP "Do not strip Release or MinSizeRel builds" )
# At least some versions of Xcode fail if you strip with the linker # At least some versions of Xcode fail if you strip with the linker
# instead of the separate strip utility. # instead of the separate strip utility.
if( APPLE ) if( APPLE )
set( NO_STRIP ON ) set( NO_STRIP ON )
endif( APPLE ) endif( APPLE )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON ) option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
@ -463,7 +463,7 @@ endif( SSE_MATTERS )
# Set up flags for GCC # Set up flags for GCC
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
if( PROFILE ) if( PROFILE )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" )
@ -492,7 +492,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" ) set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" )
set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s" ) set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s" )
endif( NOT NO_STRIP ) endif( NOT NO_STRIP )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# Check for functions that may or may not exist. # Check for functions that may or may not exist.
@ -622,15 +622,15 @@ if( WIN32 )
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ) set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ${PLAT_MAC_SOURCES} ) set( OTHER_SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ${PLAT_MAC_SOURCES} )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# CMake is not set up to compile and link rc files with GCC. :( # CMake is not set up to compile and link rc files with GCC. :(
add_custom_command( OUTPUT zdoom-rc.o add_custom_command( OUTPUT zdoom-rc.o
COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc
DEPENDS win32/zdoom.rc ) DEPENDS win32/zdoom.rc )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o )
else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) else( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
else( WIN32 ) else( WIN32 )
set( SYSTEM_SOURCES_DIR sdl ) set( SYSTEM_SOURCES_DIR sdl )
@ -1266,16 +1266,16 @@ if( NOT WIN32 )
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make ) COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
endif( NOT WIN32 ) endif( NOT WIN32 )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) if( CMAKE_COMPILER_IS_GNUCXX )
# GCC misoptimizes this file # GCC misoptimizes this file
set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" ) set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) endif( CMAKE_COMPILER_IS_GNUCXX )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# Need to enable intrinsics for this file. # Need to enable intrinsics for this file.
if( SSE_MATTERS ) if( SSE_MATTERS )
set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" ) set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
endif( SSE_MATTERS ) endif( SSE_MATTERS )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+") source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+")
source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+") source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+")

View file

@ -33,11 +33,17 @@
** **
*/ */
#ifdef _WIN32
#define USE_WINDOWS_DWORD
#endif
#include "LzmaDec.h"
#include "files.h" #include "files.h"
#include "i_system.h" #include "i_system.h"
#include "templates.h" #include "templates.h"
#include "m_misc.h" #include "m_misc.h"
//========================================================================== //==========================================================================
// //
// FileReader // FileReader
@ -370,6 +376,15 @@ extern "C" void bz_internal_error (int errcode)
// //
//========================================================================== //==========================================================================
// This is retarded but necessary to work around the inclusion of windows.h in recent
// LZMA versions, meaning it's no longer possible to include the LZMA headers in files.h.
// As a result we cannot declare the CLzmaDec member in the header so we work around
// it my wrapping it into another struct that can be declared anonymously in the header.
struct FileReaderLZMA::StreamPointer
{
CLzmaDec Stream;
};
static void *SzAlloc(void *, size_t size) { return malloc(size); } static void *SzAlloc(void *, size_t size) { return malloc(size); }
static void SzFree(void *, void *address) { free(address); } static void SzFree(void *, void *address) { free(address); }
ISzAlloc g_Alloc = { SzAlloc, SzFree }; ISzAlloc g_Alloc = { SzAlloc, SzFree };
@ -398,20 +413,22 @@ FileReaderLZMA::FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool
FillBuffer(); FillBuffer();
LzmaDec_Construct(&Stream); Streamp = new StreamPointer;
err = LzmaDec_Allocate(&Stream, header + 4, LZMA_PROPS_SIZE, &g_Alloc); LzmaDec_Construct(&Streamp->Stream);
err = LzmaDec_Allocate(&Streamp->Stream, header + 4, LZMA_PROPS_SIZE, &g_Alloc);
if (err != SZ_OK) if (err != SZ_OK)
{ {
I_Error("FileReaderLZMA: LzmaDec_Allocate failed: %d\n", err); I_Error("FileReaderLZMA: LzmaDec_Allocate failed: %d\n", err);
} }
LzmaDec_Init(&Stream); LzmaDec_Init(&Streamp->Stream);
} }
FileReaderLZMA::~FileReaderLZMA () FileReaderLZMA::~FileReaderLZMA ()
{ {
LzmaDec_Free(&Stream, &g_Alloc); LzmaDec_Free(&Streamp->Stream, &g_Alloc);
delete Streamp;
} }
long FileReaderLZMA::Read (void *buffer, long len) long FileReaderLZMA::Read (void *buffer, long len)
@ -426,7 +443,7 @@ long FileReaderLZMA::Read (void *buffer, long len)
size_t out_processed = len; size_t out_processed = len;
size_t in_processed = InSize; size_t in_processed = InSize;
err = LzmaDec_DecodeToBuf(&Stream, next_out, &out_processed, InBuff + InPos, &in_processed, finish_mode, &status); err = LzmaDec_DecodeToBuf(&Streamp->Stream, next_out, &out_processed, InBuff + InPos, &in_processed, finish_mode, &status);
InPos += in_processed; InPos += in_processed;
InSize -= in_processed; InSize -= in_processed;
next_out += out_processed; next_out += out_processed;

View file

@ -4,7 +4,6 @@
#include <stdio.h> #include <stdio.h>
#include <zlib.h> #include <zlib.h>
#include "bzlib.h" #include "bzlib.h"
#include "LzmaDec.h"
#include "doomtype.h" #include "doomtype.h"
#include "m_swap.h" #include "m_swap.h"
@ -257,6 +256,8 @@ private:
// Wraps around a FileReader to decompress a lzma stream // Wraps around a FileReader to decompress a lzma stream
class FileReaderLZMA : public FileReaderBase class FileReaderLZMA : public FileReaderBase
{ {
struct StreamPointer;
public: public:
FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip); FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip);
~FileReaderLZMA (); ~FileReaderLZMA ();
@ -308,7 +309,7 @@ private:
FileReader &File; FileReader &File;
bool SawEOF; bool SawEOF;
CLzmaDec Stream; StreamPointer *Streamp; // anonymous pointer to LKZA decoder struct - to avoid including the LZMA headers globally
size_t Size; size_t Size;
size_t InPos, InSize; size_t InPos, InSize;
size_t OutProcessed; size_t OutProcessed;

View file

@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact) DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
{ {
int i; unsigned int i;
AActor *tiny; AActor *tiny;
angle_t angle; angle_t angle;

View file

@ -797,7 +797,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers) DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
{ {
int i; unsigned int i;
angle_t angle; angle_t angle;
AActor *ripper; AActor *ripper;

View file

@ -171,7 +171,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact) DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
{ {
int i; unsigned int i;
angle_t angle; angle_t angle;
AActor *shard; AActor *shard;

View file

@ -125,7 +125,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode) DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
{ {
AActor *mo; AActor *mo;
int i; unsigned int i;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {

View file

@ -29,51 +29,51 @@
// WAD files are stored little endian. // WAD files are stored little endian.
#ifdef __APPLE__ #ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h> #include <libkern/OSByteOrder.h>
inline short LittleShort(short x) inline short LittleShort(short x)
{ {
return (short)CFSwapInt16LittleToHost((uint16_t)x); return (short)OSSwapLittleToHostInt16((uint16_t)x);
} }
inline unsigned short LittleShort(unsigned short x) inline unsigned short LittleShort(unsigned short x)
{ {
return CFSwapInt16LittleToHost(x); return OSSwapLittleToHostInt16(x);
} }
inline short LittleShort(int x) inline short LittleShort(int x)
{ {
return CFSwapInt16LittleToHost((uint16_t)x); return OSSwapLittleToHostInt16((uint16_t)x);
} }
inline int LittleLong(int x) inline int LittleLong(int x)
{ {
return CFSwapInt32LittleToHost((uint32_t)x); return OSSwapLittleToHostInt32((uint32_t)x);
} }
inline unsigned int LittleLong(unsigned int x) inline unsigned int LittleLong(unsigned int x)
{ {
return CFSwapInt32LittleToHost(x); return OSSwapLittleToHostInt32(x);
} }
inline short BigShort(short x) inline short BigShort(short x)
{ {
return (short)CFSwapInt16BigToHost((uint16_t)x); return (short)OSSwapBigToHostInt16((uint16_t)x);
} }
inline unsigned short BigShort(unsigned short x) inline unsigned short BigShort(unsigned short x)
{ {
return CFSwapInt16BigToHost(x); return OSSwapBigToHostInt16(x);
} }
inline int BigLong(int x) inline int BigLong(int x)
{ {
return CFSwapInt32BigToHost((uint32_t)x); return OSSwapBigToHostInt32((uint32_t)x);
} }
inline unsigned int BigLong(unsigned int x) inline unsigned int BigLong(unsigned int x)
{ {
return CFSwapInt32BigToHost(x); return OSSwapBigToHostInt32(x);
} }
#else #else

View file

@ -32,6 +32,12 @@
** **
** **
*/ */
#ifdef _WIN32
#define USE_WINDOWS_DWORD
#endif
#include "7z.h"
#include "7zCrc.h"
#include "resourcefile.h" #include "resourcefile.h"
#include "cmdlib.h" #include "cmdlib.h"
@ -41,8 +47,6 @@
#include "i_system.h" #include "i_system.h"
#include "w_wad.h" #include "w_wad.h"
#include "7z.h"
#include "7zCrc.h"
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View file

@ -303,8 +303,8 @@ int main (int argc, char **argv)
vid_defwidth = videoInfo->current_w; vid_defwidth = videoInfo->current_w;
vid_defheight = videoInfo->current_h; vid_defheight = videoInfo->current_h;
vid_defbits = videoInfo->vfmt->BitsPerPixel; vid_defbits = videoInfo->vfmt->BitsPerPixel;
vid_vsync = True; vid_vsync = true;
fullscreen = True; fullscreen = true;
} }
#endif // __APPLE__ #endif // __APPLE__

View file

@ -97,22 +97,14 @@ SDL_Cursor *X11Cursor;
SDL_Cursor *FirstCursor; SDL_Cursor *FirstCursor;
#endif #endif
DWORD LanguageIDs[4] = DWORD LanguageIDs[4];
{
MAKE_ID ('e','n','u',0),
MAKE_ID ('e','n','u',0),
MAKE_ID ('e','n','u',0),
MAKE_ID ('e','n','u',0)
};
int (*I_GetTime) (bool saveMS); int (*I_GetTime) (bool saveMS);
int (*I_WaitForTic) (int); int (*I_WaitForTic) (int);
void (*I_FreezeTime) (bool frozen); void (*I_FreezeTime) (bool frozen);
void I_Tactile (int on, int off, int total) void I_Tactile (int /*on*/, int /*off*/, int /*total*/)
{ {
// UNUSED.
on = off = total = 0;
} }
ticcmd_t emptycmd; ticcmd_t emptycmd;
@ -326,6 +318,13 @@ void I_WaitVBL (int count)
// //
void SetLanguageIDs () void SetLanguageIDs ()
{ {
size_t langlen = strlen(language);
DWORD lang = (langlen < 2 || langlen > 3) ?
MAKE_ID('e','n','u','\0') :
MAKE_ID(language[0],language[1],language[2],'\0');
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
} }
// //

View file

@ -1297,6 +1297,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
// A_FireProjectile // A_FireProjectile
// //
//========================================================================== //==========================================================================
enum FP_Flags
{
FPF_AIMATANGLE = 1,
FPF_TRANSFERTRANSLATION = 2,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
{ {
ACTION_PARAM_START(7); ACTION_PARAM_START(7);
@ -1305,11 +1310,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
ACTION_PARAM_BOOL(UseAmmo, 2); ACTION_PARAM_BOOL(UseAmmo, 2);
ACTION_PARAM_INT(SpawnOfs_XY, 3); ACTION_PARAM_INT(SpawnOfs_XY, 3);
ACTION_PARAM_FIXED(SpawnHeight, 4); ACTION_PARAM_FIXED(SpawnHeight, 4);
ACTION_PARAM_BOOL(AimAtAngle, 5); ACTION_PARAM_INT(Flags, 5);
ACTION_PARAM_ANGLE(pitch, 6); ACTION_PARAM_ANGLE(pitch, 6);
if (!self->player) return; if (!self->player) return;
player_t *player=self->player; player_t *player=self->player;
AWeapon * weapon=player->ReadyWeapon; AWeapon * weapon=player->ReadyWeapon;
AActor *linetarget; AActor *linetarget;
@ -1327,18 +1333,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
fixed_t z = SpawnHeight; fixed_t z = SpawnHeight;
fixed_t shootangle = self->angle; fixed_t shootangle = self->angle;
if (AimAtAngle) shootangle+=Angle; if (Flags & FPF_AIMATANGLE) shootangle += Angle;
// Temporarily adjusts the pitch // Temporarily adjusts the pitch
fixed_t SavedPlayerPitch = self->pitch; fixed_t SavedPlayerPitch = self->pitch;
self->pitch -= pitch; self->pitch -= pitch;
AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget); AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget);
self->pitch = SavedPlayerPitch; self->pitch = SavedPlayerPitch;
// automatic handling of seeker missiles // automatic handling of seeker missiles
if (misl) if (misl)
{ {
if (Flags & FPF_TRANSFERTRANSLATION) misl->Translation = self->Translation;
if (linetarget && misl->flags2&MF2_SEEKERMISSILE) misl->tracer=linetarget; if (linetarget && misl->flags2&MF2_SEEKERMISSILE) misl->tracer=linetarget;
if (!AimAtAngle) if (!(Flags & FPF_AIMATANGLE))
{ {
// This original implementation is to aim straight ahead and then offset // This original implementation is to aim straight ahead and then offset
// the angle from the resulting direction. // the angle from the resulting direction.

View file

@ -167,7 +167,7 @@ INTBOOL CheckActorFlag(const AActor *owner, FFlagDef *fd)
{ {
return fd->flagbit & *(DWORD *)(((char*)owner) + fd->structoffset); return fd->flagbit & *(DWORD *)(((char*)owner) + fd->structoffset);
} }
#ifdef __BID_ENDIAN__ #ifdef __BIG_ENDIAN__
else if (fd->fieldsize == 2) else if (fd->fieldsize == 2)
{ {
return fd->flagbit & *(WORD *)(((char*)owner) + fd->structoffset); return fd->flagbit & *(WORD *)(((char*)owner) + fd->structoffset);

View file

@ -2,7 +2,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency> <dependency>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>
</assembly> </assembly>

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.4 ) cmake_minimum_required( VERSION 2.4 )
if( WIN32 ) if( WIN32 )
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o
COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc
DEPENDS trustinfo.rc ) DEPENDS trustinfo.rc )
set( TRUSTINFO trustinfo.o ) set( TRUSTINFO trustinfo.o )
else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) else( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
if( MSVC_VERSION GREATER 1399 ) if( MSVC_VERSION GREATER 1399 )
# VC 8+ adds a manifest automatically to the executable. We need to # VC 8+ adds a manifest automatically to the executable. We need to
# merge ours with it. # merge ours with it.
@ -14,7 +14,7 @@ if( WIN32 )
else( MSVC_VERSION GREATER 1399 ) else( MSVC_VERSION GREATER 1399 )
set( TRUSTINFO trustinfo.rc ) set( TRUSTINFO trustinfo.rc )
endif( MSVC_VERSION GREATER 1399 ) endif( MSVC_VERSION GREATER 1399 )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
else( WIN32 ) else( WIN32 )
set( TRUSTINFO "" ) set( TRUSTINFO "" )
endif( WIN32 ) endif( WIN32 )

View file

@ -129,7 +129,7 @@ typedef struct compressor_s
int method; int method;
} compressor_t; } compressor_t;
typedef unsigned int DWORD; typedef unsigned int UINT32;
typedef unsigned short WORD; typedef unsigned short WORD;
typedef unsigned char BYTE; typedef unsigned char BYTE;
@ -139,49 +139,49 @@ typedef unsigned char BYTE;
//#pragma pack(push,1) //#pragma pack(push,1)
typedef struct typedef struct
{ {
DWORD Magic; // 0 UINT32 Magic; // 0
BYTE VersionToExtract[2]; // 4 BYTE VersionToExtract[2]; // 4
WORD Flags; // 6 WORD Flags; // 6
WORD Method; // 8 WORD Method; // 8
WORD ModTime; // 10 WORD ModTime; // 10
WORD ModDate; // 12 WORD ModDate; // 12
DWORD CRC32; // 14 UINT32 CRC32; // 14
DWORD CompressedSize; // 18 UINT32 CompressedSize; // 18
DWORD UncompressedSize; // 22 UINT32 UncompressedSize; // 22
WORD NameLength; // 26 WORD NameLength; // 26
WORD ExtraLength; // 28 WORD ExtraLength; // 28
} LocalFileHeader; } LocalFileHeader;
typedef struct typedef struct
{ {
DWORD Magic; UINT32 Magic;
BYTE VersionMadeBy[2]; BYTE VersionMadeBy[2];
BYTE VersionToExtract[2]; BYTE VersionToExtract[2];
WORD Flags; WORD Flags;
WORD Method; WORD Method;
WORD ModTime; WORD ModTime;
WORD ModDate; WORD ModDate;
DWORD CRC32; UINT32 CRC32;
DWORD CompressedSize; UINT32 CompressedSize;
DWORD UncompressedSize; UINT32 UncompressedSize;
WORD NameLength; WORD NameLength;
WORD ExtraLength; WORD ExtraLength;
WORD CommentLength; WORD CommentLength;
WORD StartingDiskNumber; WORD StartingDiskNumber;
WORD InternalAttributes; WORD InternalAttributes;
DWORD ExternalAttributes; UINT32 ExternalAttributes;
DWORD LocalHeaderOffset; UINT32 LocalHeaderOffset;
} CentralDirectoryEntry; } CentralDirectoryEntry;
typedef struct typedef struct
{ {
DWORD Magic; UINT32 Magic;
WORD DiskNumber; WORD DiskNumber;
WORD FirstDisk; WORD FirstDisk;
WORD NumEntries; WORD NumEntries;
WORD NumEntriesOnAllDisks; WORD NumEntriesOnAllDisks;
DWORD DirectorySize; UINT32 DirectorySize;
DWORD DirectoryOffset; UINT32 DirectoryOffset;
WORD ZipCommentLength; WORD ZipCommentLength;
} EndOfCentralDirectory; } EndOfCentralDirectory;
//#pragma pack(pop) //#pragma pack(pop)
@ -1373,7 +1373,7 @@ BYTE *find_central_dir(FILE *fin)
back_read = 4; back_read = 4;
while (back_read < max_back) while (back_read < max_back)
{ {
DWORD read_size, read_pos; UINT32 read_size, read_pos;
int i; int i;
if (back_read + BUFREADCOMMENT > max_back) if (back_read + BUFREADCOMMENT > max_back)
back_read = max_back; back_read = max_back;
@ -1420,12 +1420,12 @@ BYTE *find_central_dir(FILE *fin)
free(dir); free(dir);
return NULL; return NULL;
} }
if (*(DWORD *)dir != ZIP_CENTRALFILE) if (*(UINT32 *)dir != ZIP_CENTRALFILE)
{ {
free(dir); free(dir);
return NULL; return NULL;
} }
*(DWORD *)(dir + LittleLong(eod.DirectorySize)) = ZIP_ENDOFDIR; *(UINT32 *)(dir + LittleLong(eod.DirectorySize)) = ZIP_ENDOFDIR;
return dir; return dir;
} }
@ -1444,7 +1444,7 @@ CentralDirectoryEntry *find_file_in_zip(BYTE *dir, const char *path, unsigned in
CentralDirectoryEntry *ent; CentralDirectoryEntry *ent;
int flags; int flags;
while (*(DWORD *)dir == ZIP_CENTRALFILE) while (*(UINT32 *)dir == ZIP_CENTRALFILE)
{ {
ent = (CentralDirectoryEntry *)dir; ent = (CentralDirectoryEntry *)dir;
if (pathlen == LittleShort(ent->NameLength) && if (pathlen == LittleShort(ent->NameLength) &&
@ -1455,7 +1455,7 @@ CentralDirectoryEntry *find_file_in_zip(BYTE *dir, const char *path, unsigned in
} }
dir += sizeof(*ent) + LittleShort(ent->NameLength) + LittleShort(ent->ExtraLength) + LittleShort(ent->CommentLength); dir += sizeof(*ent) + LittleShort(ent->NameLength) + LittleShort(ent->ExtraLength) + LittleShort(ent->CommentLength);
} }
if (*(DWORD *)dir != ZIP_CENTRALFILE) if (*(UINT32 *)dir != ZIP_CENTRALFILE)
{ {
return NULL; return NULL;
} }
@ -1495,7 +1495,7 @@ int copy_zip_file(FILE *zip, file_entry_t *file, FILE *ozip, CentralDirectoryEnt
{ {
LocalFileHeader lfh; LocalFileHeader lfh;
BYTE *buf; BYTE *buf;
DWORD buf_size; UINT32 buf_size;
if (fseek(ozip, LittleLong(ent->LocalHeaderOffset), SEEK_SET) != 0) if (fseek(ozip, LittleLong(ent->LocalHeaderOffset), SEEK_SET) != 0)
{ {

View file

@ -164,6 +164,10 @@ const int CPF_DAGGER = 2;
const int CPF_PULLIN = 4; const int CPF_PULLIN = 4;
const int CPF_NORANDOMPUFFZ = 8; const int CPF_NORANDOMPUFFZ = 8;
// Flags for A_CustomMissile
const int FPF_AIMATANGLE = 1;
const int FPF_TRANSFERTRANSLATION = 2;
// Flags for A_Teleport // Flags for A_Teleport
const int TF_TELEFRAG = 1;const int TF_RANDOMDECIDE = 2; const int TF_TELEFRAG = 1;const int TF_RANDOMDECIDE = 2;