Merge branch 'master' into master

This commit is contained in:
Mr0maks
2019-05-30 21:25:56 +05:00
committed by GitHub
19 changed files with 232 additions and 131 deletions
+2
View File
@@ -51,6 +51,7 @@ const char *demo_cmd[dem_lastcmd+1] =
"dem_stop",
};
#pragma pack( push, 1 )
typedef struct
{
int id; // should be IDEM
@@ -62,6 +63,7 @@ typedef struct
char gamedir[64]; // name of game directory (FS_Gamedir())
int directory_offset; // offset of Entry Directory.
} demoheader_t;
#pragma pack( pop )
typedef struct
{
+7 -4
View File
@@ -109,7 +109,7 @@ void CRC32_ProcessByte( dword *pulCRC, byte ch )
void CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer )
{
dword ulCrc = *pulCRC;
dword ulCrc = *pulCRC, tmp;
byte *pb = (byte *)pBuffer;
uint nFront;
int nMain;
@@ -120,7 +120,8 @@ JustAfew:
case 6: ulCrc = crc32table[*pb++ ^ (byte)ulCrc] ^ (ulCrc >> 8);
case 5: ulCrc = crc32table[*pb++ ^ (byte)ulCrc] ^ (ulCrc >> 8);
case 4:
ulCrc ^= *(dword *)pb; // warning, this only works on little-endian.
memcpy( &tmp, pb, sizeof(dword));
ulCrc ^= tmp; // warning, this only works on little-endian.
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
@@ -151,12 +152,14 @@ JustAfew:
nMain = nBuffer >> 3;
while( nMain-- )
{
ulCrc ^= *(dword *)pb; // warning, this only works on little-endian.
memcpy( &tmp, pb, sizeof(dword));
ulCrc ^= tmp; // warning, this only works on little-endian.
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc ^= *(dword *)(pb + 4);// warning, this only works on little-endian.
memcpy( &tmp, pb + 4, sizeof(dword));
ulCrc ^= tmp; // warning, this only works on little-endian.
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
+5 -5
View File
@@ -71,7 +71,7 @@ typedef struct stringlist_s
typedef struct wadtype_s
{
char *ext;
char type;
signed char type;
} wadtype_t;
typedef struct file_s
@@ -150,7 +150,7 @@ qboolean fs_caseinsensitive = true; // try to search missing files
static void FS_InitMemory( void );
static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly );
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char matchtype );
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const signed char matchtype );
static dpackfile_t *FS_AddFileToPack( const char* name, pack_t *pack, fs_offset_t offset, fs_offset_t size );
void Zip_Close( zip_t *zip );
static byte *W_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
@@ -2367,7 +2367,7 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir
else if( search->wad )
{
dlumpinfo_t *lump;
char type = W_TypeFromExt( name );
signed char type = W_TypeFromExt( name );
qboolean anywadname = true;
string wadname, wadfolder;
string shortname;
@@ -3381,7 +3381,7 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
else if( searchpath->wad )
{
string wadpattern, wadname, temp2;
char type = W_TypeFromExt( pattern );
signed char type = W_TypeFromExt( pattern );
qboolean anywadname = true;
string wadfolder;
@@ -3594,7 +3594,7 @@ W_FindLump
Serach for already existed lump
===========
*/
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char matchtype )
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const signed char matchtype )
{
int left, right;
+2 -2
View File
@@ -78,8 +78,8 @@ typedef struct
int size; // uncompressed
signed char type; // TYP_*
signed char attribs; // file attribs
char pad0;
char pad1;
signed char pad0;
signed char pad1;
char name[WAD3_NAMELEN]; // must be null terminated
} dlumpinfo_t;
+3 -17
View File
@@ -43,25 +43,11 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
qboolean load_qfont = false;
bmp_t bhdr;
if( filesize < sizeof( bhdr )) return false;
if( filesize < sizeof( bhdr )) return false;
buf_p = (byte *)buffer;
bhdr.id[0] = *buf_p++;
bhdr.id[1] = *buf_p++; // move pointer
bhdr.fileSize = *(int *)buf_p; buf_p += 4;
bhdr.reserved0 = *(int *)buf_p; buf_p += 4;
bhdr.bitmapDataOffset = *(int *)buf_p; buf_p += 4;
bhdr.bitmapHeaderSize = *(int *)buf_p; buf_p += 4;
bhdr.width = *(int *)buf_p; buf_p += 4;
bhdr.height = *(int *)buf_p; buf_p += 4;
bhdr.planes = *(short *)buf_p; buf_p += 2;
bhdr.bitsPerPixel = *(short *)buf_p; buf_p += 2;
bhdr.compression = *(int *)buf_p; buf_p += 4;
bhdr.bitmapDataSize = *(int *)buf_p; buf_p += 4;
bhdr.hRes = *(int *)buf_p; buf_p += 4;
bhdr.vRes = *(int *)buf_p; buf_p += 4;
bhdr.colors = *(int *)buf_p; buf_p += 4;
bhdr.importantColors = *(int *)buf_p; buf_p += 4;
memcpy( &bhdr, buf_p, sizeof( bmp_t ));
buf_p += sizeof( bmp_t );
// bogus file header check
if( bhdr.reserved0 != 0 ) return false;
+2 -2
View File
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
#ifdef __ANDROID__
#if defined __ANDROID__ && !defined XASH_64BIT
#include <android/log.h>
#include "linker.h"
@@ -77,7 +77,7 @@ static unsigned elfhash(const char* _name) {
Binary Interface) where in Chapter 5 it discuss resolving "Shared
Object Dependencies" in breadth first search order.
*/
Elf_Sym* dlsym_handle_lookup(soinfo* si, const char* name) {
static Elf_Sym* dlsym_handle_lookup(soinfo* si, const char* name) {
return soinfo_elf_lookup(si, elfhash(name), name);
}
+20 -21
View File
@@ -32,10 +32,27 @@
#include <unistd.h>
#include <sys/types.h>
#include <elf.h>
#include <sys/exec_elf.h>
// #include <elf.h>
#include <linux/elf.h>
// #include <sys/exec_elf.h>
// #include <link.h>
#include <link.h>
// a1ba: we don't really need custom linker on Android 64, because
// it's only intended to workaround bug which persist on Android < 4.4
#define Elf_Ehdr Elf32_Ehdr
#define Elf_Phdr Elf32_Phdr
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Rel Elf32_Rel
#define Elf_RelA Elf32_Rela
#define Elf_Dyn Elf32_Dyn
#define Elf_Half Elf32_Half
#define Elf_Word Elf32_Word
#define Elf_Sword Elf32_Sword
#define Elf_Addr Elf32_Addr
#define Elf_Off Elf32_Off
#define Elf_Nhdr Elf32_Nhdr
#define Elf_Note Elf32_Note
// Returns the address of the page containing address 'x'.
#define PAGE_START(x) ((x) & PAGE_MASK)
@@ -180,23 +197,5 @@ struct soinfo {
void CallFunction(const char* function_name, linker_function_t function);
};
extern soinfo libdl_info;
void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
soinfo* do_dlopen(const char* name, int flags);
int do_dlclose(soinfo* si);
Elf_Sym* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start);
soinfo* find_containing_library(const void* addr);
Elf_Sym* dladdr_find_symbol(soinfo* si, const void* addr);
Elf_Sym* dlsym_handle_lookup(soinfo* si, const char* name);
void debuggerd_init();
extern "C" void notify_gdb_of_libraries();
char* linker_get_error_buffer();
size_t linker_get_error_buffer_size();
#endif
#endif
+2
View File
@@ -5,6 +5,8 @@
#include "filesystem.h"
#include "platform/android/android_priv.h"
#include "vid_common.h"
#include <android/native_window.h>
#include <android/native_window_jni.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
+2
View File
@@ -718,8 +718,10 @@ int GL_SetAttribute( int attr, int val )
switch( attr )
{
case REF_GL_CONTEXT_PROFILE_MASK:
#ifdef SDL_HINT_OPENGL_ES_DRIVER
if( val == REF_GL_CONTEXT_PROFILE_ES )
SDL_SetHint( SDL_HINT_OPENGL_ES_DRIVER, "1" );
#endif // SDL_HINT_OPENGL_ES_DRIVER
break;
default:
break;
+6 -3
View File
@@ -34,6 +34,9 @@ def configure(conf):
if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
conf.env.append_unique('DEFINES', 'XASH_SDL')
conf.check_cc(header_name='zlib.h', uselib_store='ZLIB')
conf.check_cc(lib='z', uselib_store='ZLIB')
if conf.env.SINGLE_BINARY:
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
@@ -49,9 +52,9 @@ def configure(conf):
if conf.env.DEST_OS == 'win32':
conf.env.append_unique('DEFINES', 'DBGHELP')
conf.env.append_unique('DEFINES', 'PSAPI_VERSION=1')
conf.check_cc(header_name='zlib.h', uselib_store='ZLIB')
conf.check_cc(lib='z', uselib_store='ZLIB')
if conf.env.DEST_SIZEOF_VOID_P != 4:
conf.env.append_unique('DEFINES', 'XASH_64BIT')
def build(bld):
libs = [ 'public' ]