Browse Source

Merge master into mobile_hacks

mobile_hacks
Alibek Omarov 3 years ago
parent
commit
5c328b7098
  1. 9
      cl_dll/view.cpp
  2. 8
      cl_dll/view.h
  3. 43
      scripts/waifulib/xcompile.py
  4. 10
      wscript

9
cl_dll/view.cpp

@ -25,6 +25,7 @@
#include "screenfade.h" #include "screenfade.h"
#include "shake.h" #include "shake.h"
#include "hltv.h" #include "hltv.h"
#include "view.h"
// Spectator Mode // Spectator Mode
extern "C" extern "C"
@ -36,14 +37,6 @@ extern "C"
int iIsSpectator; int iIsSpectator;
} }
#if !defined(M_PI)
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#if !defined(M_PI_F)
#define M_PI_F (float)M_PI
#endif
extern "C" extern "C"
{ {
int CL_IsThirdPerson( void ); int CL_IsThirdPerson( void );

8
cl_dll/view.h

@ -9,6 +9,14 @@
#define VIEWH #define VIEWH
#pragma once #pragma once
#if !defined(M_PI)
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#if !defined(M_PI_F)
#define M_PI_F (float)M_PI
#endif
void V_StartPitchDrift( void ); void V_StartPitchDrift( void );
void V_StopPitchDrift( void ); void V_StopPitchDrift( void );
#endif // !VIEWH #endif // !VIEWH

43
scripts/waifulib/xcompile.py

@ -152,6 +152,8 @@ class Android:
def gen_host_toolchain(self): def gen_host_toolchain(self):
# With host toolchain we don't care about OS # With host toolchain we don't care about OS
# so just download NDK for Linux x86_64 # so just download NDK for Linux x86_64
if 'HOST_TOOLCHAIN' in self.ctx.environ:
return self.ctx.environ['HOST_TOOLCHAIN']
if self.is_host(): if self.is_host():
return 'linux-x86_64' return 'linux-x86_64'
@ -198,16 +200,32 @@ class Android:
def cc(self): def cc(self):
if self.is_host(): if self.is_host():
return 'clang --target=%s%d' % (self.ndk_triplet(), self.api) s = 'clang'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CC' in environ:
s = environ['CC']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc') return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc')
def cxx(self): def cxx(self):
if self.is_host(): if self.is_host():
return 'clang++ --target=%s%d' % (self.ndk_triplet(), self.api) s = 'clang++'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CXX' in environ:
s = environ['CXX']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++') return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++')
def strip(self): def strip(self):
if self.is_host(): if self.is_host():
environ = getattr(self.ctx, 'environ', os.environ)
if 'STRIP' in environ:
return environ['STRIP']
return 'llvm-strip' return 'llvm-strip'
return os.path.join(self.gen_binutils_path(), 'strip') return os.path.join(self.gen_binutils_path(), 'strip')
@ -281,7 +299,7 @@ class Android:
cflags += fixup_host_clang_with_old_ndk() cflags += fixup_host_clang_with_old_ndk()
# ARMv5 support # ARMv5 support
cflags += ['-march=armv5te', '-mtune=xscale', '-msoft-float'] cflags += ['-march=armv5te', '-msoft-float']
elif self.is_x86(): elif self.is_x86():
cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS'] cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS']
return cflags return cflags
@ -300,7 +318,7 @@ class Android:
if self.is_clang() or self.is_host(): if self.is_clang() or self.is_host():
linkflags += ['-fuse-ld=lld'] linkflags += ['-fuse-ld=lld']
linkflags += ['-Wl,--hash-style=both','-Wl,--no-undefined'] linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined', '-no-canonical-prefixes']
return linkflags return linkflags
def ldflags(self): def ldflags(self):
@ -325,6 +343,10 @@ def options(opt):
android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None, android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None,
help='enable building for android, format: --android=<arch>,<toolchain>,<api>, example: --android=armeabi-v7a-hard,4.9,9') help='enable building for android, format: --android=<arch>,<toolchain>,<api>, example: --android=armeabi-v7a-hard,4.9,9')
magx = opt.add_option_group('MotoMAGX options')
magx.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False,
help = 'enable targetting for MotoMAGX phones [default: %default]')
def configure(conf): def configure(conf):
if conf.options.ANDROID_OPTS: if conf.options.ANDROID_OPTS:
values = conf.options.ANDROID_OPTS.split(',') values = conf.options.ANDROID_OPTS.split(',')
@ -360,7 +382,14 @@ def configure(conf):
# conf.env.ANDROID_OPTS = android # conf.env.ANDROID_OPTS = android
conf.env.DEST_OS2 = 'android' conf.env.DEST_OS2 = 'android'
elif conf.options.MAGX:
# useless to change toolchain path, as toolchain meant to be placed in this path
toolchain_path = '/opt/toolchains/motomagx/arm-eabi2/lib/'
conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']]
conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']]
conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX]
conf.env.MAGX = conf.options.MAGX
MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' }) MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' })
for k in c_config.MACRO_TO_DESTOS: for k in c_config.MACRO_TO_DESTOS:
MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important
@ -375,6 +404,10 @@ def post_compiler_cxx_configure(conf):
if conf.android.ndk_rev == 19: if conf.android.ndk_rev == 19:
conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++'] conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++']
conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++'] conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++']
elif conf.options.MAGX:
for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']:
conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX')
return return
def post_compiler_c_configure(conf): def post_compiler_c_configure(conf):

10
wscript

@ -40,11 +40,8 @@ def options(opt):
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False, grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]') help = 'enable polyhedral optimization if possible [default: %default]')
grp.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False, grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False,
help = 'enable targetting for MotoMAGX phones [default: %default]') help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]')
grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'SIMPLE_MOD_HACKS', default = False,
help = 'enable hacks for simple mods that don\'t touch HL game logic so much but still require small patches. Enforced for Android. [default: %default]')
opt.load('subproject') opt.load('subproject')
@ -111,8 +108,7 @@ def configure(conf):
conf.options.GOLDSRC = False conf.options.GOLDSRC = False
conf.env.SERVER_NAME = 'server' # can't be any other name, until specified conf.env.SERVER_NAME = 'server' # can't be any other name, until specified
conf.env.MAGX = conf.options.MAGX if conf.env.MAGX:
if conf.options.MAGX:
enforce_pic = False enforce_pic = False
conf.check_pic(enforce_pic) conf.check_pic(enforce_pic)

Loading…
Cancel
Save