Merge branch 'master' into next

This commit is contained in:
Monster Iestyn 2019-03-25 18:08:36 +00:00
commit 7441dd7d9b
4 changed files with 62 additions and 8 deletions

View File

@ -54,13 +54,19 @@ macro(copy_files_to_build_dir target dlllist_var)
endif()
endmacro()
# 64-bit check
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
# bitness check
set(SRB2_SYSTEM_BITS 0)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Target is 64-bit")
set(SRB2_SYSTEM_BITS 64)
else()
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
message(STATUS "Target is 32-bit")
set(SRB2_SYSTEM_BITS 32)
endif()
if(${SRB2_SYSTEM_BITS} EQUAL 0)
message(STATUS "Target bitness is unknown")
endif()
# OS macros
if (UNIX)

View File

@ -612,7 +612,7 @@ static boolean SOCK_Get(void)
if (c != ERRSOCKET)
{
// find remote node number
for (j = 0; j <= MAXNETNODES; j++) //include LAN
for (j = 1; j <= MAXNETNODES; j++) //include LAN
{
if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
{
@ -1340,8 +1340,12 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
while (runp != NULL)
{
// find ip of the server
memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen);
runp = NULL;
if (sendto(mysockets[0], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0)
{
memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen);
break;
}
runp = runp->ai_next;
}
I_freeaddrinfo(ai);
return newnode;

View File

@ -1402,7 +1402,13 @@ static int joy_open2(const char *fname)
void I_InitJoystick(void)
{
I_ShutdownJoystick();
SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
if (M_CheckParm("-noxinput"))
SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
if (M_CheckParm("-nohidapi"))
SDL_SetHintWithPriority("SDL_JOYSTICK_HIDAPI", "0", SDL_HINT_OVERRIDE);
if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy"))
return;
if (joy_open(cv_usejoystick.string) != -1)
@ -1418,7 +1424,13 @@ void I_InitJoystick(void)
void I_InitJoystick2(void)
{
I_ShutdownJoystick2();
SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
if (M_CheckParm("-noxinput"))
SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
if (M_CheckParm("-nohidapi"))
SDL_SetHintWithPriority("SDL_JOYSTICK_HIDAPI", "0", SDL_HINT_OVERRIDE);
if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy"))
return;
if (joy_open2(cv_usejoystick2.string) != -1)

View File

@ -1179,6 +1179,23 @@ void zerr(int ret)
}
#endif
#define NO_PNG_LUMPS
#ifdef NO_PNG_LUMPS
static void ErrorIfPNG(UINT8 *d, size_t s, char *f, char *l)
{
if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/
return;
// Check for PNG file signature using memcmp
// As it may be faster on CPUs with slow unaligned memory access
// Ref: http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature
if (memcmp(&d[0], "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0)
{
I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f);
}
}
#endif
/** Reads bytes from the head of a lump.
* Note: If the lump is compressed, the whole thing has to be read anyway.
*
@ -1218,7 +1235,15 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
switch(wadfiles[wad]->lumpinfo[lump].compression)
{
case CM_NOCOMPRESSION: // If it's uncompressed, we directly write the data into our destination, and return the bytes read.
#ifdef NO_PNG_LUMPS
{
size_t bytesread = fread(dest, 1, size, handle);
ErrorIfPNG(dest, bytesread, wadfiles[wad]->filename, l->name2);
return bytesread;
}
#else
return fread(dest, 1, size, handle);
#endif
case CM_LZF: // Is it LZF compressed? Used by ZWADs.
{
#ifdef ZWAD
@ -1253,11 +1278,15 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
M_Memcpy(dest, decData + offset, size);
Z_Free(rawData);
Z_Free(decData);
#ifdef NO_PNG_LUMPS
ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
#endif
return size;
#else
//I_Error("ZWAD files not supported on this platform.");
return 0;
#endif
}
#ifdef HAVE_ZLIB
case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support.
@ -1311,6 +1340,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
Z_Free(rawData);
Z_Free(decData);
#ifdef NO_PNG_LUMPS
ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
#endif
return size;
}
#endif