mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 12:25:00 +08:00
Compare commits
1 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
989958e185 |
2
.github/workflows/c-cpp.yml
vendored
2
.github/workflows/c-cpp.yml
vendored
@@ -66,7 +66,7 @@ jobs:
|
|||||||
targetos: apple
|
targetos: apple
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
env:
|
env:
|
||||||
SDL_VERSION: 2.32.0
|
SDL_VERSION: 2.30.12
|
||||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
GH_CROSSCOMPILING: ${{ matrix.cross }}
|
GH_CROSSCOMPILING: ${{ matrix.cross }}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
2
3rdparty/extras/xash-extras
vendored
2
3rdparty/extras/xash-extras
vendored
Submodule 3rdparty/extras/xash-extras updated: 0c83a63d00...4982e5edb0
2
3rdparty/gl4es/gl4es
vendored
2
3rdparty/gl4es/gl4es
vendored
Submodule 3rdparty/gl4es/gl4es updated: a744af14d4...e39434a2b1
3
3rdparty/libbacktrace/wscript
vendored
3
3rdparty/libbacktrace/wscript
vendored
@@ -148,7 +148,8 @@ def configure(conf):
|
|||||||
conf.write_config_header('backtrace-supported.h')
|
conf.write_config_header('backtrace-supported.h')
|
||||||
|
|
||||||
@TaskGen.feature('frandomseed')
|
@TaskGen.feature('frandomseed')
|
||||||
@TaskGen.after_method('propagate_uselib_vars')
|
@TaskGen.after_method('process_source')
|
||||||
|
@TaskGen.before_method('apply_link')
|
||||||
def process_frandom_seed(ctx):
|
def process_frandom_seed(ctx):
|
||||||
tasks = getattr(ctx, 'compiled_tasks', [])
|
tasks = getattr(ctx, 'compiled_tasks', [])
|
||||||
|
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: 1b6929d663...695ea1be2e
@@ -38,9 +38,6 @@ Uploaded to github by Oleg Cherkasky - https://github.com/gunrunners-paradise/Ct
|
|||||||
## Deathmatch Classic
|
## Deathmatch Classic
|
||||||
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||||
|
|
||||||
## Delta Particles
|
|
||||||
Available on ModDB - https://www.moddb.com/mods/half-life-delta/downloads/delta-particles-full-sources-maps-and-c-code
|
|
||||||
|
|
||||||
## Earth Special Forces
|
## Earth Special Forces
|
||||||
Alpha 2.0 - https://www.gamers-desire.de/details/2830
|
Alpha 2.0 - https://www.gamers-desire.de/details/2830
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
|||||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) \
|
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](http://fwgsdiscord.mentality.rip/) [](https://t.me/flyingwithgauss) \
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
|
||||||
|
|
||||||
Xash3D ([pronounced](https://ipa-reader.com/?text=ks%C9%91%CA%82) `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
Xash3D ([pronounced](https://ipa-reader.com/?text=ks%C9%91%CA%82) `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ cmake_minimum_required(VERSION 3.6)
|
|||||||
project(XASH_ANDROID)
|
project(XASH_ANDROID)
|
||||||
|
|
||||||
# armeabi-v7a requires cpufeatures library
|
# armeabi-v7a requires cpufeatures library
|
||||||
if(ANDROID)
|
include(AndroidNdkModules)
|
||||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
android_ndk_import_module_cpufeatures()
|
||||||
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
|
||||||
target_link_libraries(cpufeatures dl)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPython)
|
find_package(PythonInterp 2.7 REQUIRED)
|
||||||
|
|
||||||
|
get_filename_component(C_COMPILER_ID ${CMAKE_C_COMPILER} NAME_WE)
|
||||||
|
get_filename_component(CXX_COMPILER_ID ${CMAKE_CXX_COMPILER} NAME_WE)
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
set(BUILD_TYPE "debug")
|
set(BUILD_TYPE "debug")
|
||||||
@@ -20,20 +20,30 @@ else()
|
|||||||
list(APPEND WAF_EXTRA_ARGS --enable-poly-opt --enable-lto)
|
list(APPEND WAF_EXTRA_ARGS --enable-poly-opt --enable-lto)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID_ABI STREQUAL "x86")
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
# HACKHACK: I don't know why but engine gets built as 64-bit binary here
|
set(64BIT ON CACHE BOOL "" FORCE)
|
||||||
list(APPEND WAF_EXTRA_ARGS -4)
|
list(APPEND WAF_EXTRA_ARGS -8) # only required for x86 when testing this cmakelist under linux
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
|
||||||
|
set(WAF_CC "${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
|
||||||
|
set(WAF_CXX "${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||||
|
|
||||||
# not cleanest way to get upper directory
|
# not cleanest way to get upper directory
|
||||||
set(ENGINE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
set(ENGINE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
||||||
|
|
||||||
set(WAF_CC "${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
|
execute_process(
|
||||||
set(WAF_CXX "${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET}")
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
set(WAF ${Python_EXECUTABLE} ${ENGINE_SOURCE_DIR}waf -t ${ENGINE_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/xash3d-fwgs)
|
CC=${WAF_CC} CXX=${WAF_CXX}
|
||||||
|
AR=${CMAKE_AR} STRIP=${CMAKE_STRIP}
|
||||||
|
${PYTHON_EXECUTABLE} waf configure -T ${BUILD_TYPE} -o "${CMAKE_CURRENT_BINARY_DIR}/xash3d-fwgs" ${WAF_EXTRA_ARGS} cmake
|
||||||
|
--check-c-compiler=${C_COMPILER_ID} --check-cxx-compiler=${CXX_COMPILER_ID}
|
||||||
|
-s "${ENGINE_SOURCE_DIR}/SDL" --skip-sdl2-sanity-check --enable-bundled-deps
|
||||||
|
WORKING_DIRECTORY "${ENGINE_SOURCE_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/hlsdk-portable" hlsdk-portable)
|
||||||
|
|
||||||
# try to build minimal SDL. Enable features as we're gonna use them
|
# try to build minimal SDL. Enable features as we're gonna use them
|
||||||
set(SDL_RENDER OFF)
|
set(SDL_RENDER OFF)
|
||||||
@@ -46,50 +56,5 @@ set(SDL_VULKAN OFF)
|
|||||||
set(SDL_OFFSCREEN OFF)
|
set(SDL_OFFSCREEN OFF)
|
||||||
set(SDL_STATIC OFF)
|
set(SDL_STATIC OFF)
|
||||||
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/SDL" SDL)
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/SDL" SDL)
|
||||||
|
add_subdirectory("${ENGINE_SOURCE_DIR}/" xash3d-fwgs)
|
||||||
include(ExternalProject)
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/mainui" mainui)
|
||||||
|
|
||||||
# gradle passes backslashes to cmake, how does this even work for everybody else?
|
|
||||||
string(REPLACE "\\" "/" CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
||||||
|
|
||||||
ExternalProject_Add(
|
|
||||||
Xash3DFWGS
|
|
||||||
SOURCE_DIR ${ENGINE_SOURCE_DIR}
|
|
||||||
INSTALL_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
BUILD_IN_SOURCE TRUE
|
|
||||||
DEPENDS SDL2
|
|
||||||
BUILD_ALWAYS TRUE
|
|
||||||
LOG_CONFIGURE TRUE
|
|
||||||
LOG_BUILD TRUE
|
|
||||||
LOG_INSTALL TRUE
|
|
||||||
LOG_OUTPUT_ON_FAILURE TRUE
|
|
||||||
LOG_MERGED_STDOUTERR TRUE
|
|
||||||
|
|
||||||
# USES_TERMINAL_CONFIGURE TRUE
|
|
||||||
# USES_TERMINAL_BUILD TRUE
|
|
||||||
# USES_TERMINAL_INSTALL TRUE
|
|
||||||
|
|
||||||
# NOTE: setting up WAFLOCK is important to avoid possible race conditions
|
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
ANDROID_NDK=${ANDROID_NDK}
|
|
||||||
BUILD_CMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} configure -T ${BUILD_TYPE} --android=${ANDROID_ABI},,${CMAKE_SYSTEM_VERSION}
|
|
||||||
-s "${ENGINE_SOURCE_DIR}/3rdparty/SDL" --enable-bundled-deps
|
|
||||||
|
|
||||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} build -v
|
|
||||||
|
|
||||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} install --destdir=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/hlsdk-portable" hlsdk-portable)
|
|
||||||
|
|
||||||
# a1ba: without this, xash3d target will be ignored as nothing depends on it
|
|
||||||
add_dependencies(client Xash3DFWGS)
|
|
||||||
add_dependencies(server Xash3DFWGS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "su.xash.engine"
|
namespace = "su.xash.engine"
|
||||||
ndkVersion = "28.0.13004108"
|
ndkVersion = "27.2.12479018"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "su.xash"
|
applicationId = "su.xash"
|
||||||
|
|||||||
@@ -21,6 +21,3 @@ kotlin.code.style=official
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
|
||||||
# Enable verbose output for CMake
|
|
||||||
android.native.buildOutput=verbose
|
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ typedef struct netadr_s
|
|||||||
static inline netadrtype_t NET_NetadrType( const netadr_t *a )
|
static inline netadrtype_t NET_NetadrType( const netadr_t *a )
|
||||||
{
|
{
|
||||||
if( a->type == NA_IP6 || a->type == NA_MULTICAST_IP6 )
|
if( a->type == NA_IP6 || a->type == NA_MULTICAST_IP6 )
|
||||||
return (netadrtype_t)a->type;
|
return a->type;
|
||||||
|
|
||||||
if( a->ip6_0[0] || a->ip6_0[1] )
|
if( a->ip6_0[0] || a->ip6_0[1] )
|
||||||
return NA_UNDEFINED;
|
return NA_UNDEFINED;
|
||||||
|
|
||||||
return (netadrtype_t)a->type;
|
return a->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void NET_NetadrSetType( netadr_t *a, netadrtype_t type )
|
static inline void NET_NetadrSetType( netadr_t *a, netadrtype_t type )
|
||||||
|
|||||||
@@ -13,19 +13,13 @@
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#include <sys/types.h> // off_t
|
#include <sys/types.h> // off_t
|
||||||
#ifdef STDINT_H
|
|
||||||
#include STDINT_H
|
#include STDINT_H
|
||||||
#else // !STDINT_H
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif // !STDINT_H
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
typedef uint8_t byte;
|
typedef uint8_t byte;
|
||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
typedef vec_t vec2_t[2];
|
typedef vec_t vec2_t[2];
|
||||||
#ifndef vec3_t // SDK renames it to Vector
|
|
||||||
typedef vec_t vec3_t[3];
|
typedef vec_t vec3_t[3];
|
||||||
#endif
|
|
||||||
typedef vec_t vec4_t[4];
|
typedef vec_t vec4_t[4];
|
||||||
typedef vec_t quat_t[4];
|
typedef vec_t quat_t[4];
|
||||||
typedef byte rgba_t[4]; // unsigned byte colorpack
|
typedef byte rgba_t[4]; // unsigned byte colorpack
|
||||||
@@ -50,7 +44,6 @@ typedef int qboolean;
|
|||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
#define BIT64( n ) ( 1ULL << ( n ))
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
|
|
||||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||||
@@ -67,8 +60,6 @@ typedef int qboolean;
|
|||||||
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
||||||
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
||||||
|
|
||||||
#undef EXPORT
|
|
||||||
|
|
||||||
#if defined( __GNUC__ )
|
#if defined( __GNUC__ )
|
||||||
#if defined( __i386__ )
|
#if defined( __i386__ )
|
||||||
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ static int CL_CalcTabStop( const cl_font_t *font, int x )
|
|||||||
return stop;
|
return stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_t *font, int flags )
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags )
|
||||||
{
|
{
|
||||||
wrect_t *rc;
|
wrect_t *rc;
|
||||||
float w, h;
|
float w, h;
|
||||||
@@ -231,7 +231,7 @@ int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_
|
|||||||
return font->charWidths[number];
|
return font->charWidths[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_t *font, int flags )
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags )
|
||||||
{
|
{
|
||||||
rgba_t current_color;
|
rgba_t current_color;
|
||||||
int draw_len = 0;
|
int draw_len = 0;
|
||||||
@@ -287,7 +287,7 @@ int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_
|
|||||||
return draw_len;
|
return draw_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawStringf( cl_font_t *font, float x, float y, const rgba_t color, int flags, const char *fmt, ... )
|
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
char buf[MAX_VA_STRING];
|
char buf[MAX_VA_STRING];
|
||||||
|
|||||||
@@ -1766,7 +1766,7 @@ static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, c
|
|||||||
|| !Q_stricmp( szName, "sensitivity" ))
|
|| !Q_stricmp( szName, "sensitivity" ))
|
||||||
flags |= FCVAR_PRIVILEGED;
|
flags |= FCVAR_PRIVILEGED;
|
||||||
|
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
static int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ pfnCvar_RegisterVariable
|
|||||||
*/
|
*/
|
||||||
static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
||||||
{
|
{
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_GAMEUIDLL ));
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
static int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||||
|
|||||||
@@ -92,11 +92,6 @@ static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned i
|
|||||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GAME_EXPORT pfnSetCustomClientID( const char *id )
|
|
||||||
{
|
|
||||||
// deprecated
|
|
||||||
}
|
|
||||||
|
|
||||||
static const mobile_engfuncs_t gMobileEngfuncs =
|
static const mobile_engfuncs_t gMobileEngfuncs =
|
||||||
{
|
{
|
||||||
MOBILITY_API_VERSION,
|
MOBILITY_API_VERSION,
|
||||||
@@ -111,7 +106,7 @@ static const mobile_engfuncs_t gMobileEngfuncs =
|
|||||||
pfnDrawScaledCharacter,
|
pfnDrawScaledCharacter,
|
||||||
Sys_Warn,
|
Sys_Warn,
|
||||||
Sys_GetNativeObject,
|
Sys_GetNativeObject,
|
||||||
pfnSetCustomClientID,
|
ID_SetCustomClientID,
|
||||||
pfnParseFileSafe
|
pfnParseFileSafe
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,7 @@ static void CL_ParseNewMovevars( sizebuf_t *msg )
|
|||||||
R_SetupSky( clgame.movevars.skyName );
|
R_SetupSky( clgame.movevars.skyName );
|
||||||
|
|
||||||
clgame.oldmovevars = clgame.movevars;
|
clgame.oldmovevars = clgame.movevars;
|
||||||
|
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||||
// FIXME: set world wave height when entities will be allocated
|
|
||||||
if( clgame.entities )
|
|
||||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
|
||||||
|
|
||||||
// keep features an actual!
|
// keep features an actual!
|
||||||
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
||||||
|
|||||||
@@ -807,11 +807,11 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
void CL_FreeFont( cl_font_t *font );
|
void CL_FreeFont( cl_font_t *font );
|
||||||
void CL_SetFontRendermode( cl_font_t *font );
|
void CL_SetFontRendermode( cl_font_t *font );
|
||||||
int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||||
int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
|
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
|
||||||
int CL_DrawStringf( cl_font_t *font, float x, float y, const rgba_t color, int flags, const char *fmt, ... ) FORMAT_CHECK( 6 );
|
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... ) FORMAT_CHECK( 6 );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -844,21 +844,19 @@ void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int he
|
|||||||
void CL_DisableScissor( scissor_state_t *scissor );
|
void CL_DisableScissor( scissor_state_t *scissor );
|
||||||
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
||||||
|
|
||||||
static inline cl_entity_t *CL_EDICT_NUM( int index )
|
static inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
if( !clgame.entities ) // not in game yet
|
if( !clgame.entities )
|
||||||
{
|
{
|
||||||
Host_Error( "%s: clgame.entities is NULL\n", __func__ );
|
Host_Error( "%s: clgame.entities is NULL\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( index < 0 || index >= clgame.maxEntities )
|
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
||||||
{
|
return clgame.entities + n;
|
||||||
Host_Error( "%s: bad number %i\n", __func__, index );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return clgame.entities + index;
|
Host_Error( "%s: bad number %i\n", __func__, n );
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||||
@@ -869,7 +867,10 @@ static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
|||||||
if( index < 0 || index >= clgame.maxEntities )
|
if( index < 0 || index >= clgame.maxEntities )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return clgame.entities + index;
|
if( index == 0 )
|
||||||
|
return clgame.entities;
|
||||||
|
|
||||||
|
return CL_EDICT_NUM( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline model_t *CL_ModelHandle( int modelindex )
|
static inline model_t *CL_ModelHandle( int modelindex )
|
||||||
@@ -879,7 +880,7 @@ static inline model_t *CL_ModelHandle( int modelindex )
|
|||||||
|
|
||||||
static inline qboolean CL_IsThirdPerson( void )
|
static inline qboolean CL_IsThirdPerson( void )
|
||||||
{
|
{
|
||||||
return clgame.dllFuncs.CL_IsThirdPerson();
|
return clgame.dllFuncs.CL_IsThirdPerson() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline cl_entity_t *CL_GetLocalPlayer( void )
|
static inline cl_entity_t *CL_GetLocalPlayer( void )
|
||||||
@@ -1107,7 +1108,7 @@ int Con_UtfMoveRight( char *str, int pos, int length );
|
|||||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
||||||
cl_font_t *Con_GetCurFont( void );
|
cl_font_t *Con_GetCurFont( void );
|
||||||
cl_font_t *Con_GetFont( int num );
|
cl_font_t *Con_GetFont( int num );
|
||||||
int Con_DrawString( int x, int y, const char *string, const rgba_t setColor ); // legacy, use cl_font.c
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
||||||
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||||
void Con_CharEvent( int key );
|
void Con_CharEvent( int key );
|
||||||
void Key_Console( int key );
|
void Key_Console( int key );
|
||||||
@@ -1214,6 +1215,7 @@ void OSK_Draw( void );
|
|||||||
//
|
//
|
||||||
void ID_Init( void );
|
void ID_Init( void );
|
||||||
const char *ID_GetMD5( void );
|
const char *ID_GetMD5( void );
|
||||||
|
void GAME_EXPORT ID_SetCustomClientID( const char *id );
|
||||||
|
|
||||||
extern rgba_t g_color_table[8];
|
extern rgba_t g_color_table[8];
|
||||||
extern triangleapi_t gTriApi;
|
extern triangleapi_t gTriApi;
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ Con_DrawString
|
|||||||
client version of routine
|
client version of routine
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
int Con_DrawString( int x, int y, const char *string, const rgba_t setColor )
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor )
|
||||||
{
|
{
|
||||||
return CL_DrawString( x, y, string, setColor, con.curFont, FONT_DRAW_UTF8 );
|
return CL_DrawString( x, y, string, setColor, con.curFont, FONT_DRAW_UTF8 );
|
||||||
}
|
}
|
||||||
@@ -843,14 +843,11 @@ If no console is visible, the notify window will pop up.
|
|||||||
*/
|
*/
|
||||||
void Con_Print( const char *txt )
|
void Con_Print( const char *txt )
|
||||||
{
|
{
|
||||||
static qboolean cr_pending = false;
|
static int cr_pending = 0;
|
||||||
static qboolean colorstring = false;
|
static char buf[MAX_PRINT_MSG];
|
||||||
static char buf[MAX_PRINT_MSG];
|
qboolean norefresh = false;
|
||||||
static int lastlength = 0;
|
static int lastlength = 0;
|
||||||
static int bufpos = 0;
|
static int bufpos = 0;
|
||||||
static int charpos = 0;
|
|
||||||
|
|
||||||
qboolean norefresh = false;
|
|
||||||
int c, mask = 0;
|
int c, mask = 0;
|
||||||
|
|
||||||
// client not running
|
// client not running
|
||||||
@@ -876,7 +873,7 @@ void Con_Print( const char *txt )
|
|||||||
if( cr_pending )
|
if( cr_pending )
|
||||||
{
|
{
|
||||||
Con_DeleteLastLine();
|
Con_DeleteLastLine();
|
||||||
cr_pending = false;
|
cr_pending = 0;
|
||||||
}
|
}
|
||||||
c = *txt;
|
c = *txt;
|
||||||
|
|
||||||
@@ -889,42 +886,23 @@ void Con_Print( const char *txt )
|
|||||||
{
|
{
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
cr_pending = true;
|
cr_pending = 1;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
buf[bufpos++] = c | mask;
|
buf[bufpos++] = c | mask;
|
||||||
|
if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 ))
|
||||||
if( IsColorString( txt ))
|
|
||||||
{
|
|
||||||
// first color string character
|
|
||||||
colorstring = true;
|
|
||||||
}
|
|
||||||
else if( colorstring )
|
|
||||||
{
|
|
||||||
// second color string character
|
|
||||||
colorstring = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// not a color string, move char counter
|
|
||||||
charpos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(( bufpos >= sizeof( buf ) - 1 ) || charpos >= ( con.linewidth - 1 ))
|
|
||||||
{
|
{
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -940,7 +918,6 @@ void Con_Print( const char *txt )
|
|||||||
Con_AddLine( buf, bufpos, lastlength != 0 );
|
Con_AddLine( buf, bufpos, lastlength != 0 );
|
||||||
lastlength = 0;
|
lastlength = 0;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pump messages to avoid window hanging
|
// pump messages to avoid window hanging
|
||||||
@@ -1490,16 +1467,6 @@ Handles history and console scrollback
|
|||||||
*/
|
*/
|
||||||
void Key_Console( int key )
|
void Key_Console( int key )
|
||||||
{
|
{
|
||||||
// exit the console by pressing MINUS on NSwitch
|
|
||||||
// or both Back(Select)/Start buttons for everyone else
|
|
||||||
if( key == K_BACK_BUTTON || key == K_START_BUTTON || key == K_ESCAPE )
|
|
||||||
{
|
|
||||||
if( cls.state == ca_active && !cl.background )
|
|
||||||
Key_SetKeyDest( key_game );
|
|
||||||
else UI_SetActiveMenu( true );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ctrl-L clears screen
|
// ctrl-L clears screen
|
||||||
if( key == 'l' && Key_IsDown( K_CTRL ))
|
if( key == 'l' && Key_IsDown( K_CTRL ))
|
||||||
{
|
{
|
||||||
@@ -1608,6 +1575,16 @@ void Key_Console( int key )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exit the console by pressing MINUS on NSwitch
|
||||||
|
// or both Back(Select)/Start buttons for everyone else
|
||||||
|
if( key == K_BACK_BUTTON || key == K_START_BUTTON )
|
||||||
|
{
|
||||||
|
if( cls.state == ca_active && !cl.background )
|
||||||
|
Key_SetKeyDest( key_game );
|
||||||
|
else UI_SetActiveMenu( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// pass to the normal editline routine
|
// pass to the normal editline routine
|
||||||
Field_KeyDownEvent( &con.input, key );
|
Field_KeyDownEvent( &con.input, key );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ GNU General Public License for more details.
|
|||||||
#if !XASH_WIN32
|
#if !XASH_WIN32
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char id_md5[33];
|
static char id_md5[33];
|
||||||
|
static char id_customid[MAX_STRING];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================
|
==========================================================
|
||||||
@@ -590,9 +590,25 @@ static void ID_Check( void )
|
|||||||
|
|
||||||
const char *ID_GetMD5( void )
|
const char *ID_GetMD5( void )
|
||||||
{
|
{
|
||||||
|
if( id_customid[0] )
|
||||||
|
return id_customid;
|
||||||
return id_md5;
|
return id_md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
ID_SetCustomClientID
|
||||||
|
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT ID_SetCustomClientID( const char *id )
|
||||||
|
{
|
||||||
|
if( !id )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_strncpy( id_customid, id, sizeof( id_customid ) );
|
||||||
|
}
|
||||||
|
|
||||||
void ID_Init( void )
|
void ID_Init( void )
|
||||||
{
|
{
|
||||||
MD5Context_t hash = { 0 };
|
MD5Context_t hash = { 0 };
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -332,7 +332,7 @@ static void IN_MouseMove( void )
|
|||||||
if( !in_mouseinitialized )
|
if( !in_mouseinitialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Touch_WantVisibleCursor( ))
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
Touch_KeyEvent( 0, 0 );
|
Touch_KeyEvent( 0, 0 );
|
||||||
@@ -363,7 +363,7 @@ void IN_MouseEvent( int key, int down )
|
|||||||
else ClearBits( in_mstate, BIT( key ));
|
else ClearBits( in_mstate, BIT( key ));
|
||||||
|
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
if( Touch_WantVisibleCursor( ))
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
Touch_KeyEvent( K_MOUSE1 + key, down );
|
Touch_KeyEvent( K_MOUSE1 + key, down );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ void Touch_ResetDefaultButtons( void );
|
|||||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||||
void Touch_KeyEvent( int key, int down );
|
void Touch_KeyEvent( int key, int down );
|
||||||
qboolean Touch_WantVisibleCursor( void );
|
qboolean Touch_WantVisibleCursor( void );
|
||||||
|
qboolean Touch_Emulated( void );
|
||||||
void Touch_NotifyResize( void );
|
void Touch_NotifyResize( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -726,8 +726,18 @@ void GAME_EXPORT Key_Event( int key, int down )
|
|||||||
return; // handled in client.dll
|
return; // handled in client.dll
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case key_message:
|
||||||
break;
|
Key_Message( key );
|
||||||
|
return;
|
||||||
|
case key_console:
|
||||||
|
if( cls.state == ca_active && !cl.background )
|
||||||
|
Key_SetKeyDest( key_game );
|
||||||
|
else UI_SetActiveMenu( true );
|
||||||
|
return;
|
||||||
|
case key_menu:
|
||||||
|
UI_KeyEvent( key, true );
|
||||||
|
return;
|
||||||
|
default: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,16 +103,10 @@ Cvar_BuildAutoDescription
|
|||||||
build cvar auto description that based on the setup flags
|
build cvar auto description that based on the setup flags
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags )
|
static const char *Cvar_BuildAutoDescription( int flags )
|
||||||
{
|
{
|
||||||
static char desc[256];
|
static char desc[256];
|
||||||
|
|
||||||
if( FBitSet( flags, FCVAR_GLCONFIG ))
|
|
||||||
{
|
|
||||||
Q_snprintf( desc, sizeof( desc ), CVAR_GLCONFIG_DESCRIPTION, szName );
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
desc[0] = '\0';
|
desc[0] = '\0';
|
||||||
|
|
||||||
if( FBitSet( flags, FCVAR_EXTDLL ))
|
if( FBitSet( flags, FCVAR_EXTDLL ))
|
||||||
@@ -447,7 +441,7 @@ convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *
|
|||||||
Cvar_DirectSet( var, value );
|
Cvar_DirectSet( var, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_ALLOCATED ) && Q_strcmp( var_desc, var->desc ))
|
if( FBitSet( var->flags, FCVAR_ALLOCATED ) && var_desc != NULL && Q_strcmp( var_desc, var->desc ))
|
||||||
{
|
{
|
||||||
if( !FBitSet( flags, FCVAR_GLCONFIG ))
|
if( !FBitSet( flags, FCVAR_GLCONFIG ))
|
||||||
Con_Reportf( "%s change description from %s to %s\n", var->name, var->desc, var_desc );
|
Con_Reportf( "%s change description from %s to %s\n", var->name, var->desc, var_desc );
|
||||||
@@ -460,6 +454,10 @@ convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// allocate a new cvar
|
// allocate a new cvar
|
||||||
|
|
||||||
|
if( !var_desc )
|
||||||
|
var_desc = Cvar_BuildAutoDescription( flags );
|
||||||
|
|
||||||
var = Mem_Malloc( cvar_pool, sizeof( *var ));
|
var = Mem_Malloc( cvar_pool, sizeof( *var ));
|
||||||
var->name = copystringpool( cvar_pool, name );
|
var->name = copystringpool( cvar_pool, name );
|
||||||
var->string = copystringpool( cvar_pool, value );
|
var->string = copystringpool( cvar_pool, value );
|
||||||
@@ -1206,7 +1204,7 @@ static void Cvar_List_f( void )
|
|||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))
|
if( FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))
|
||||||
Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, var->desc );
|
Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, var->desc );
|
||||||
else Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, Cvar_BuildAutoDescription( var->name, var->flags ));
|
else Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, Cvar_BuildAutoDescription( var->flags ));
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ void Cvar_DirectSet( convar_t *var, const char *value );
|
|||||||
void Cvar_DirectSetValue( convar_t *var, float value );
|
void Cvar_DirectSetValue( convar_t *var, float value );
|
||||||
void Cvar_Set( const char *var_name, const char *value );
|
void Cvar_Set( const char *var_name, const char *value );
|
||||||
void Cvar_SetValue( const char *var_name, float value );
|
void Cvar_SetValue( const char *var_name, float value );
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags ) RETURNS_NONNULL;
|
|
||||||
float Cvar_VariableValue( const char *var_name );
|
float Cvar_VariableValue( const char *var_name );
|
||||||
int Cvar_VariableInteger( const char *var_name );
|
int Cvar_VariableInteger( const char *var_name );
|
||||||
const char *Cvar_VariableString( const char *var_name ) RETURNS_NONNULL;
|
const char *Cvar_VariableString( const char *var_name ) RETURNS_NONNULL;
|
||||||
|
|||||||
@@ -258,7 +258,8 @@ static qboolean FS_DetermineReadOnlyRootDirectory( char *out, size_t size )
|
|||||||
|
|
||||||
void FS_CheckConfig( void )
|
void FS_CheckConfig( void )
|
||||||
{
|
{
|
||||||
if( fs_mount_lv.value || fs_mount_hd.value || fs_mount_addon.value || fs_mount_l10n.value )
|
// only used to prevent rescan after reading config.cfg when user hasn't enabled any addon directories
|
||||||
|
if( fs_mount_lv.value || fs_mount_hd.value || fs_mount_addon.value || fs_mount_l10n.value || Q_stricmp( ui_language.string, "english" ))
|
||||||
FS_Rescan_f();
|
FS_Rescan_f();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,6 +319,7 @@ void FS_Init( const char *basedir )
|
|||||||
Cvar_RegisterVariable( &fs_mount_lv );
|
Cvar_RegisterVariable( &fs_mount_lv );
|
||||||
Cvar_RegisterVariable( &fs_mount_addon );
|
Cvar_RegisterVariable( &fs_mount_addon );
|
||||||
Cvar_RegisterVariable( &fs_mount_l10n );
|
Cvar_RegisterVariable( &fs_mount_l10n );
|
||||||
|
Cvar_RegisterVariable( &ui_language );
|
||||||
|
|
||||||
if( !Sys_GetParmFromCmdLine( "-dll", host.gamedll ))
|
if( !Sys_GetParmFromCmdLine( "-dll", host.gamedll ))
|
||||||
host.gamedll[0] = 0;
|
host.gamedll[0] = 0;
|
||||||
|
|||||||
@@ -140,8 +140,7 @@ static void Sys_PrintUsage( const char *exename )
|
|||||||
|
|
||||||
"\nCommon options:\n"
|
"\nCommon options:\n"
|
||||||
O("-dev [level] ", "set log verbosity 0-2")
|
O("-dev [level] ", "set log verbosity 0-2")
|
||||||
O("-log [file name] ", "write log to \"engine.log\" or [file name] if specified")
|
O("-log ", "write log to \"engine.log\"")
|
||||||
O("-logtime ", "enable writing timestamps to the log file")
|
|
||||||
O("-nowriteconfig ", "disable config save")
|
O("-nowriteconfig ", "disable config save")
|
||||||
O("-noch ", "disable crashhandler")
|
O("-noch ", "disable crashhandler")
|
||||||
#if XASH_WIN32 // !!!!
|
#if XASH_WIN32 // !!!!
|
||||||
@@ -698,17 +697,17 @@ static qboolean Host_Autosleep( double dt, double scale )
|
|||||||
static double timewindow; // allocate a time window for sleeps
|
static double timewindow; // allocate a time window for sleeps
|
||||||
static int counter; // for debug
|
static int counter; // for debug
|
||||||
static double realsleeptime;
|
static double realsleeptime;
|
||||||
const double sleeptime = sleep * 0.000001;
|
const double sleeptime = sleep * 0.001;
|
||||||
|
|
||||||
if( dt < targetframetime * scale )
|
if( dt < targetframetime * scale )
|
||||||
{
|
{
|
||||||
// if we have allocated time window, try to sleep
|
// if we have allocated time window, try to sleep
|
||||||
if( timewindow > realsleeptime )
|
if( timewindow > realsleeptime )
|
||||||
{
|
{
|
||||||
// Platform_Sleep isn't guaranteed to sleep an exact amount of microseconds
|
// Platform_Sleep isn't guaranteed to sleep an exact amount of milliseconds
|
||||||
// so we measure the real sleep time and use it to decrease the window
|
// so we measure the real sleep time and use it to decrease the window
|
||||||
double t1 = Sys_DoubleTime(), t2;
|
double t1 = Sys_DoubleTime(), t2;
|
||||||
Platform_NanoSleep( sleep * 1000 ); // in usec!
|
Platform_Sleep( sleep ); // in msec!
|
||||||
t2 = Sys_DoubleTime();
|
t2 = Sys_DoubleTime();
|
||||||
realsleeptime = t2 - t1;
|
realsleeptime = t2 - t1;
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,8 @@ static void Mod_StudioCalcRotations( int boneused[], int numbones, const byte *p
|
|||||||
for( j = numbones - 1; j >= 0; j-- )
|
for( j = numbones - 1; j >= 0; j-- )
|
||||||
{
|
{
|
||||||
i = boneused[j];
|
i = boneused[j];
|
||||||
R_StudioCalcBones( frame, s, &pbone[i], &panim[i], adj, pos[i], q[i] );
|
R_StudioCalcBoneQuaternion( frame, s, &pbone[i], &panim[i], adj, q[i] );
|
||||||
|
R_StudioCalcBonePosition( frame, s, &pbone[i], &panim[i], adj, pos[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
||||||
@@ -723,7 +724,7 @@ void Mod_StudioComputeBounds( void *buffer, vec3_t mins, vec3_t maxs, qboolean i
|
|||||||
{
|
{
|
||||||
for( k = 0; k < pseqdesc->numframes; k++ )
|
for( k = 0; k < pseqdesc->numframes; k++ )
|
||||||
{
|
{
|
||||||
R_StudioCalcBones( k, 0, &pbones[j], panim, NULL, pos, NULL );
|
R_StudioCalcBonePosition( k, 0, &pbones[j], panim, NULL, pos );
|
||||||
Mod_StudioBoundVertex( vert_mins, vert_maxs, &bone_count, pos );
|
Mod_StudioBoundVertex( vert_mins, vert_maxs, &bone_count, pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -721,6 +721,39 @@ qboolean NET_CompareBaseAdr( const netadr_t a, const netadr_t b )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
NET_CompareClassBAdr
|
||||||
|
|
||||||
|
Compare local masks
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
qboolean NET_CompareClassBAdr( const netadr_t a, const netadr_t b )
|
||||||
|
{
|
||||||
|
netadrtype_t type_a = NET_NetadrType( &a );
|
||||||
|
netadrtype_t type_b = NET_NetadrType( &b );
|
||||||
|
|
||||||
|
if( type_a != type_b )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( type_a == NA_LOOPBACK )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if( type_a == NA_IP )
|
||||||
|
{
|
||||||
|
if( a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: we don't check for IPv6 here
|
||||||
|
// this check is very dumb and only used for LAN restriction
|
||||||
|
// Actual check is in IsReservedAdr
|
||||||
|
|
||||||
|
// for real mask compare use NET_CompareAdrByMask
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
NET_CompareAdrByMask
|
NET_CompareAdrByMask
|
||||||
@@ -1512,7 +1545,7 @@ static int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t
|
|||||||
total_sent += size;
|
total_sent += size;
|
||||||
len -= size;
|
len -= size;
|
||||||
packet_number++;
|
packet_number++;
|
||||||
Platform_NanoSleep( 100 * 1000 );
|
Platform_Sleep( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return total_sent;
|
return total_sent;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ void NET_Config( qboolean net_enable, qboolean changeport );
|
|||||||
const char *NET_AdrToString( const netadr_t a ) RETURNS_NONNULL;
|
const char *NET_AdrToString( const netadr_t a ) RETURNS_NONNULL;
|
||||||
const char *NET_BaseAdrToString( const netadr_t a ) RETURNS_NONNULL;
|
const char *NET_BaseAdrToString( const netadr_t a ) RETURNS_NONNULL;
|
||||||
qboolean NET_IsReservedAdr( netadr_t a );
|
qboolean NET_IsReservedAdr( netadr_t a );
|
||||||
|
qboolean NET_CompareClassBAdr( const netadr_t a, const netadr_t b );
|
||||||
qboolean NET_StringToAdr( const char *string, netadr_t *adr );
|
qboolean NET_StringToAdr( const char *string, netadr_t *adr );
|
||||||
qboolean NET_StringToFilterAdr( const char *s, netadr_t *adr, uint *prefixlen );
|
qboolean NET_StringToFilterAdr( const char *s, netadr_t *adr, uint *prefixlen );
|
||||||
net_gai_state_t NET_StringToAdrNB( const char *string, netadr_t *adr, qboolean v6only );
|
net_gai_state_t NET_StringToAdrNB( const char *string, netadr_t *adr, qboolean v6only );
|
||||||
|
|||||||
@@ -31,14 +31,15 @@ GNU General Public License for more details.
|
|||||||
#define XASH_COLORIZE_CONSOLE 0
|
#define XASH_COLORIZE_CONSOLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct logdata_s {
|
typedef struct {
|
||||||
char title[64];
|
char title[64];
|
||||||
qboolean log_active;
|
qboolean log_active;
|
||||||
qboolean log_time;
|
char log_path[MAX_SYSPATH];
|
||||||
char log_path[MAX_SYSPATH];
|
FILE *logfile;
|
||||||
FILE *logfile;
|
int logfileno;
|
||||||
int logfileno;
|
} LogData;
|
||||||
} s_ld;
|
|
||||||
|
static LogData s_ld;
|
||||||
|
|
||||||
void Sys_DestroyConsole( void )
|
void Sys_DestroyConsole( void )
|
||||||
{
|
{
|
||||||
@@ -77,19 +78,14 @@ static void Sys_FlushLogfile( void )
|
|||||||
|
|
||||||
void Sys_InitLog( void )
|
void Sys_InitLog( void )
|
||||||
{
|
{
|
||||||
const char *mode;
|
const char *mode;
|
||||||
|
|
||||||
if( Sys_CheckParm( "-log" ))
|
if( Sys_CheckParm( "-log" ))
|
||||||
{
|
{
|
||||||
if( !Sys_GetParmFromCmdLine( "-log", s_ld.log_path ) || !isalnum( s_ld.log_path[0] ))
|
|
||||||
Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path ));
|
|
||||||
|
|
||||||
COM_DefaultExtension( s_ld.log_path, ".log", sizeof( s_ld.log_path ));
|
|
||||||
s_ld.log_active = true;
|
s_ld.log_active = true;
|
||||||
|
Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path ));
|
||||||
}
|
}
|
||||||
|
|
||||||
s_ld.log_time = Sys_CheckParm( "-logtime" );
|
|
||||||
|
|
||||||
if( host.change_game && host.type != HOST_DEDICATED )
|
if( host.change_game && host.type != HOST_DEDICATED )
|
||||||
mode = "a";
|
mode = "a";
|
||||||
else mode = "w";
|
else mode = "w";
|
||||||
@@ -105,7 +101,7 @@ void Sys_InitLog( void )
|
|||||||
|
|
||||||
if ( !s_ld.logfile )
|
if ( !s_ld.logfile )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "%s: can't create log file %s: %s\n", __func__, s_ld.log_path, strerror( errno ));
|
Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s: %s\n", s_ld.log_path, strerror( errno ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,23 +295,17 @@ void Sys_PrintLog( const char *pMsg )
|
|||||||
// save last char to detect when line was not ended
|
// save last char to detect when line was not ended
|
||||||
lastchar = len > 0 ? pMsg[len - 1] : 0;
|
lastchar = len > 0 ? pMsg[len - 1] : 0;
|
||||||
|
|
||||||
// spew to engine.log
|
if( !s_ld.logfile )
|
||||||
if( s_ld.logfile )
|
return;
|
||||||
{
|
|
||||||
if( s_ld.log_time && print_time )
|
|
||||||
{
|
|
||||||
logtime_len = strftime( logtime, sizeof( logtime ), "[%Y:%m:%d|%H:%M:%S] ", crt_tm ); //full time
|
|
||||||
logtime_len = Q_min( logtime_len, sizeof( logtime ) - 1 ); // just in case
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logtime[0] = '\0';
|
|
||||||
logtime_len = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sys_PrintLogfile( s_ld.logfileno, logtime, logtime_len, pMsg, false );
|
if( print_time )
|
||||||
Sys_FlushLogfile();
|
{
|
||||||
|
logtime_len = strftime( logtime, sizeof( logtime ), "[%Y:%m:%d|%H:%M:%S] ", crt_tm ); //full time
|
||||||
|
logtime_len = Q_min( logtime_len, sizeof( logtime ) - 1 ); // just in case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sys_PrintLogfile( s_ld.logfileno, logtime, logtime_len, pMsg, false );
|
||||||
|
Sys_FlushLogfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ typedef struct memheader_s
|
|||||||
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
|
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
|
||||||
} memheader_t;
|
} memheader_t;
|
||||||
|
|
||||||
STATIC_CHECK_SIZEOF( memheader_t, 24, 40 );
|
|
||||||
|
|
||||||
typedef struct mempool_s
|
typedef struct mempool_s
|
||||||
{
|
{
|
||||||
struct memheader_s *chain; // chain of individual memory allocations
|
struct memheader_s *chain; // chain of individual memory allocations
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ qboolean SNDDMA_Init( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dma.buffer = Mem_Calloc( sndpool, samples * 2 ); //allocate pcm frame buffer
|
dma.buffer = Mem_Malloc( sndpool, samples * 2 ); //allocate pcm frame buffer
|
||||||
dma.samplepos = 0;
|
dma.samplepos = 0;
|
||||||
dma.samples = samples;
|
dma.samples = samples;
|
||||||
dma.format.width = 2;
|
dma.format.width = 2;
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ void Android_Shutdown( void );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
void Win32_Init( qboolean con_showalways );
|
|
||||||
void Win32_Shutdown( void );
|
|
||||||
qboolean Win32_NanoSleep( int nsec );
|
|
||||||
void Wcon_CreateConsole( qboolean con_showalways );
|
void Wcon_CreateConsole( qboolean con_showalways );
|
||||||
void Wcon_DestroyConsole( void );
|
void Wcon_DestroyConsole( void );
|
||||||
void Wcon_InitConsoleCommands( void );
|
void Wcon_InitConsoleCommands( void );
|
||||||
@@ -127,7 +124,7 @@ static inline void Platform_Init( qboolean con_showalways, const char *basedir )
|
|||||||
#elif XASH_DOS
|
#elif XASH_DOS
|
||||||
DOS_Init( );
|
DOS_Init( );
|
||||||
#elif XASH_WIN32
|
#elif XASH_WIN32
|
||||||
Win32_Init( con_showalways );
|
Wcon_CreateConsole( con_showalways );
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
Linux_Init( );
|
Linux_Init( );
|
||||||
#endif
|
#endif
|
||||||
@@ -142,7 +139,7 @@ static inline void Platform_Shutdown( void )
|
|||||||
#elif XASH_DOS
|
#elif XASH_DOS
|
||||||
DOS_Shutdown( );
|
DOS_Shutdown( );
|
||||||
#elif XASH_WIN32
|
#elif XASH_WIN32
|
||||||
Win32_Shutdown( );
|
Wcon_DestroyConsole( );
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
Linux_Shutdown( );
|
Linux_Shutdown( );
|
||||||
#endif
|
#endif
|
||||||
@@ -181,23 +178,6 @@ static inline void Platform_Sleep( int msec )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline qboolean Platform_NanoSleep( int nsec )
|
|
||||||
{
|
|
||||||
// SDL2 doesn't have nanosleep, so use low-level functions here
|
|
||||||
// When this code will be ported to SDL3, use SDL_DelayNS
|
|
||||||
#if XASH_POSIX
|
|
||||||
struct timespec ts = {
|
|
||||||
.tv_sec = 0,
|
|
||||||
.tv_nsec = nsec, // just don't put large numbers here
|
|
||||||
};
|
|
||||||
return nanosleep( &ts, NULL ) == 0;
|
|
||||||
#elif XASH_WIN32
|
|
||||||
return Win32_NanoSleep( nsec );
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if XASH_WIN32 || XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX || XASH_APPLE
|
#if XASH_WIN32 || XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX || XASH_APPLE
|
||||||
void Sys_SetupCrashHandler( const char *argv0 );
|
void Sys_SetupCrashHandler( const char *argv0 );
|
||||||
void Sys_RestoreCrashHandler( void );
|
void Sys_RestoreCrashHandler( void );
|
||||||
|
|||||||
@@ -158,7 +158,8 @@ void Sys_CrashLibbacktrace( int signal, siginfo_t *si, void *context )
|
|||||||
pd.message_size = sizeof( message ) - len;
|
pd.message_size = sizeof( message ) - len;
|
||||||
pd.len = 0;
|
pd.len = 0;
|
||||||
|
|
||||||
backtrace_full( g_bt_state, 1, Sys_BacktracePrintFull, Sys_BacktracePrintError, &pd );
|
if( g_bt_state )
|
||||||
|
backtrace_full( g_bt_state, 0, Sys_BacktracePrintFull, Sys_BacktracePrintError, &pd );
|
||||||
|
|
||||||
// put MessageBox as Sys_Error
|
// put MessageBox as Sys_Error
|
||||||
Msg( "%s\n", message );
|
Msg( "%s\n", message );
|
||||||
|
|||||||
@@ -33,12 +33,6 @@ static struct
|
|||||||
} cursors;
|
} cursors;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
qboolean pushed;
|
|
||||||
} in_visible_cursor_pos;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
Platform_GetMousePos
|
Platform_GetMousePos
|
||||||
@@ -209,6 +203,11 @@ void Platform_SetCursorType( VGUI_DefaultCursor type )
|
|||||||
{
|
{
|
||||||
qboolean visible;
|
qboolean visible;
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
if( !cursors.initialized )
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case dc_user:
|
case dc_user:
|
||||||
@@ -221,7 +220,7 @@ void Platform_SetCursorType( VGUI_DefaultCursor type )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// never disable cursor in touch emulation mode
|
// never disable cursor in touch emulation mode
|
||||||
if( !visible && Touch_WantVisibleCursor( ))
|
if( !visible && Touch_Emulated( ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
host.mouse_visible = visible;
|
host.mouse_visible = visible;
|
||||||
@@ -230,28 +229,11 @@ void Platform_SetCursorType( VGUI_DefaultCursor type )
|
|||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( host.mouse_visible )
|
if( host.mouse_visible )
|
||||||
{
|
{
|
||||||
if( cursors.initialized )
|
SDL_SetCursor( cursors.cursors[type] );
|
||||||
SDL_SetCursor( cursors.cursors[type] );
|
|
||||||
|
|
||||||
SDL_ShowCursor( true );
|
SDL_ShowCursor( true );
|
||||||
|
|
||||||
// restore the last mouse position
|
|
||||||
if( in_visible_cursor_pos.pushed )
|
|
||||||
{
|
|
||||||
SDL_WarpMouseInWindow( host.hWnd, in_visible_cursor_pos.x, in_visible_cursor_pos.y );
|
|
||||||
in_visible_cursor_pos.pushed = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// save last mouse position and warp it to the center
|
|
||||||
if( !in_visible_cursor_pos.pushed )
|
|
||||||
{
|
|
||||||
SDL_GetMouseState( &in_visible_cursor_pos.x, &in_visible_cursor_pos.y );
|
|
||||||
SDL_WarpMouseInWindow( host.hWnd, host.window_center_x, host.window_center_y );
|
|
||||||
in_visible_cursor_pos.pushed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_ShowCursor( false );
|
SDL_ShowCursor( false );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -171,18 +171,6 @@ static void SDLash_GameControllerAdded( int device_index )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this "game controller" only exists on Android within emulator and tries to map
|
|
||||||
// keyboard events into game controller events, which as you can expect, doesn't
|
|
||||||
// work and I don't understand the intention here. When debugging Xash in Android
|
|
||||||
// Studio emulator, just enable hardware input passthrough.
|
|
||||||
#if XASH_ANDROID
|
|
||||||
if( !Q_strcmp( SDL_GameControllerName( gc ), "qwerty2" ))
|
|
||||||
{
|
|
||||||
SDL_GameControllerClose( gc );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif // XASH_ANDROID
|
|
||||||
|
|
||||||
list = Mem_Realloc( host.mempool, g_gamepads, sizeof( *list ) * ( g_num_gamepads + 1 ));
|
list = Mem_Realloc( host.mempool, g_gamepads, sizeof( *list ) * ( g_num_gamepads + 1 ));
|
||||||
list[g_num_gamepads++] = gc;
|
list[g_num_gamepads++] = gc;
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ qboolean SNDDMA_Init( void )
|
|||||||
if( !samplecount )
|
if( !samplecount )
|
||||||
samplecount = 0x8000;
|
samplecount = 0x8000;
|
||||||
dma.samples = samplecount * obtained.channels;
|
dma.samples = samplecount * obtained.channels;
|
||||||
dma.buffer = Mem_Calloc( sndpool, dma.samples * 2 );
|
dma.buffer = Mem_Malloc( sndpool, dma.samples * 2 );
|
||||||
dma.samplepos = 0;
|
dma.samplepos = 0;
|
||||||
|
|
||||||
sdl_format = obtained.format;
|
sdl_format = obtained.format;
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ typedef struct
|
|||||||
qboolean inputEnabled;
|
qboolean inputEnabled;
|
||||||
qboolean consoleVisible;
|
qboolean consoleVisible;
|
||||||
qboolean attached;
|
qboolean attached;
|
||||||
|
|
||||||
|
// log stuff
|
||||||
|
qboolean log_active;
|
||||||
|
char log_path[MAX_SYSPATH];
|
||||||
} WinConData;
|
} WinConData;
|
||||||
|
|
||||||
static WinConData s_wcd;
|
static WinConData s_wcd;
|
||||||
@@ -498,13 +502,19 @@ create win32 console
|
|||||||
*/
|
*/
|
||||||
void Wcon_CreateConsole( qboolean con_showalways )
|
void Wcon_CreateConsole( qboolean con_showalways )
|
||||||
{
|
{
|
||||||
|
if( Sys_CheckParm( "-log" ))
|
||||||
|
s_wcd.log_active = true;
|
||||||
|
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
{
|
{
|
||||||
Q_strncpy( s_wcd.title, XASH_ENGINE_NAME " " XASH_VERSION, sizeof( s_wcd.title ));
|
Q_strncpy( s_wcd.title, XASH_ENGINE_NAME " " XASH_VERSION, sizeof( s_wcd.title ));
|
||||||
|
Q_strncpy( s_wcd.log_path, "engine.log", sizeof( s_wcd.log_path ));
|
||||||
}
|
}
|
||||||
else // dedicated console
|
else // dedicated console
|
||||||
{
|
{
|
||||||
Q_strncpy( s_wcd.title, XASH_DEDICATED_SERVER_NAME " " XASH_VERSION, sizeof( s_wcd.title ));
|
Q_strncpy( s_wcd.title, XASH_DEDICATED_SERVER_NAME " " XASH_VERSION, sizeof( s_wcd.title ));
|
||||||
|
Q_strncpy( s_wcd.log_path, "dedicated.log", sizeof( s_wcd.log_path ));
|
||||||
|
s_wcd.log_active = true; // always make log
|
||||||
}
|
}
|
||||||
|
|
||||||
s_wcd.attached = ( AttachConsole( ATTACH_PARENT_PROCESS ) != 0 );
|
s_wcd.attached = ( AttachConsole( ATTACH_PARENT_PROCESS ) != 0 );
|
||||||
@@ -586,6 +596,8 @@ void Wcon_DestroyConsole( void )
|
|||||||
// last text message into console or log
|
// last text message into console or log
|
||||||
Con_Reportf( "%s: Unloading xash.dll\n", __func__ );
|
Con_Reportf( "%s: Unloading xash.dll\n", __func__ );
|
||||||
|
|
||||||
|
Sys_CloseLog( NULL );
|
||||||
|
|
||||||
if( !s_wcd.attached )
|
if( !s_wcd.attached )
|
||||||
{
|
{
|
||||||
if( s_wcd.hWnd )
|
if( s_wcd.hWnd )
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ GNU General Public License for more details.
|
|||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
HANDLE g_waitable_timer;
|
|
||||||
|
|
||||||
#if XASH_TIMER == TIMER_WIN32
|
#if XASH_TIMER == TIMER_WIN32
|
||||||
double Platform_DoubleTime( void )
|
double Platform_DoubleTime( void )
|
||||||
{
|
{
|
||||||
@@ -38,67 +36,6 @@ double Platform_DoubleTime( void )
|
|||||||
}
|
}
|
||||||
#endif // XASH_TIMER == TIMER_WIN32
|
#endif // XASH_TIMER == TIMER_WIN32
|
||||||
|
|
||||||
void Win32_Init( qboolean con_showalways )
|
|
||||||
{
|
|
||||||
HMODULE hModule = LoadLibrary( "kernel32.dll" );
|
|
||||||
if( hModule )
|
|
||||||
{
|
|
||||||
HANDLE ( __stdcall *pfnCreateWaitableTimerExW)( LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess );
|
|
||||||
|
|
||||||
if(( pfnCreateWaitableTimerExW = (void *)GetProcAddress( hModule, "CreateWaitableTimerExW" )))
|
|
||||||
{
|
|
||||||
g_waitable_timer = pfnCreateWaitableTimerExW(
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0x1 /* CREATE_WAITABLE_TIMER_MANUAL_RESET */ | 0x2 /* CREATE_WAITABLE_TIMER_HIGH_RESOLUTION */,
|
|
||||||
0x0002 /* TIMER_MODIFY_STATE */ | SYNCHRONIZE | DELETE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeLibrary( hModule );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0 // FIXME: creates object but doesn't wait for specific time for me on Windows 10, with the code above commented
|
|
||||||
if( !g_waitable_timer )
|
|
||||||
g_waitable_timer = CreateWaitableTimer( NULL, TRUE, NULL );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Wcon_CreateConsole( con_showalways );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Win32_Shutdown( void )
|
|
||||||
{
|
|
||||||
Wcon_DestroyConsole( );
|
|
||||||
|
|
||||||
if( g_waitable_timer )
|
|
||||||
{
|
|
||||||
CloseHandle( g_waitable_timer );
|
|
||||||
g_waitable_timer = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean Win32_NanoSleep( int nsec )
|
|
||||||
{
|
|
||||||
LARGE_INTEGER ts;
|
|
||||||
|
|
||||||
if( !g_waitable_timer )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ts.QuadPart = -nsec / 100;
|
|
||||||
|
|
||||||
if( !SetWaitableTimer( g_waitable_timer, &ts, 0, NULL, NULL, FALSE ))
|
|
||||||
{
|
|
||||||
CloseHandle( g_waitable_timer );
|
|
||||||
g_waitable_timer = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( WaitForSingleObject( g_waitable_timer, Q_max( 1, nsec / 1000000 )) != WAIT_OBJECT_0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean Platform_DebuggerPresent( void )
|
qboolean Platform_DebuggerPresent( void )
|
||||||
{
|
{
|
||||||
return IsDebuggerPresent();
|
return IsDebuggerPresent();
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ typedef struct ref_api_s
|
|||||||
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
||||||
void (*CL_CenterPrint)( const char *s, float y );
|
void (*CL_CenterPrint)( const char *s, float y );
|
||||||
void (*Con_DrawStringLen)( const char *pText, int *length, int *height );
|
void (*Con_DrawStringLen)( const char *pText, int *length, int *height );
|
||||||
int (*Con_DrawString)( int x, int y, const char *string, const rgba_t setColor );
|
int (*Con_DrawString)( int x, int y, const char *string, rgba_t setColor );
|
||||||
void (*CL_DrawCenterPrint)( void );
|
void (*CL_DrawCenterPrint)( void );
|
||||||
|
|
||||||
// entity management
|
// entity management
|
||||||
|
|||||||
@@ -279,6 +279,19 @@ typedef struct sv_client_s
|
|||||||
a program error, like an overflowed reliable buffer
|
a program error, like an overflowed reliable buffer
|
||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
|
// MAX_CHALLENGES is made large to prevent a denial
|
||||||
|
// of service attack that could cycle all of them
|
||||||
|
// out before legitimate users connected
|
||||||
|
#define MAX_CHALLENGES 1024
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
netadr_t adr;
|
||||||
|
double time;
|
||||||
|
int challenge;
|
||||||
|
qboolean connected;
|
||||||
|
} challenge_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char name[32]; // in GoldSrc max name length is 12
|
char name[32]; // in GoldSrc max name length is 12
|
||||||
@@ -372,7 +385,7 @@ typedef struct
|
|||||||
entity_state_t *baselines; // [GI->max_edicts]
|
entity_state_t *baselines; // [GI->max_edicts]
|
||||||
entity_state_t *static_entities; // [MAX_STATIC_ENTITIES];
|
entity_state_t *static_entities; // [MAX_STATIC_ENTITIES];
|
||||||
|
|
||||||
uint32_t challenge_salt[16]; // pregenerated random numbers for generating challenged based on IP's MD5 address
|
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
|
||||||
|
|
||||||
sizebuf_t testpacket; // pregenerataed testpacket, only needs CRC32 patching
|
sizebuf_t testpacket; // pregenerataed testpacket, only needs CRC32 patching
|
||||||
byte *testpacket_buf; // check for NULL if testpacket is available
|
byte *testpacket_buf; // check for NULL if testpacket is available
|
||||||
|
|||||||
@@ -86,54 +86,38 @@ flood the server with invalid connection IPs. With a
|
|||||||
challenge, they must give a valid IP address.
|
challenge, they must give a valid IP address.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static int SV_GetChallenge( netadr_t from, qboolean *error )
|
static void SV_GetChallenge( netadr_t from )
|
||||||
{
|
{
|
||||||
const netadrtype_t type = NET_NetadrType( &from );
|
int i, oldest = 0;
|
||||||
MD5Context_t ctx;
|
double oldestTime;
|
||||||
byte digest[16];
|
|
||||||
|
|
||||||
*error = false;
|
oldestTime = 0x7fffffff;
|
||||||
|
|
||||||
MD5Init( &ctx );
|
// see if we already have a challenge for this ip
|
||||||
|
for( i = 0; i < MAX_CHALLENGES; i++ )
|
||||||
switch( type )
|
|
||||||
{
|
{
|
||||||
case NA_IP:
|
if( !svs.challenges[i].connected && NET_CompareAdr( from, svs.challenges[i].adr ))
|
||||||
MD5Update( &ctx, from.ip, sizeof( from.ip ));
|
break;
|
||||||
break;
|
|
||||||
case NA_IPX:
|
if( svs.challenges[i].time < oldestTime )
|
||||||
MD5Update( &ctx, from.ipx, sizeof( from.ipx ));
|
{
|
||||||
break;
|
oldestTime = svs.challenges[i].time;
|
||||||
case NA_IP6:
|
oldest = i;
|
||||||
{
|
}
|
||||||
byte ip6[16];
|
|
||||||
NET_NetadrToIP6Bytes( ip6, &from );
|
|
||||||
MD5Update( &ctx, ip6, sizeof( ip6 ));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NA_LOOPBACK:
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
*error = true;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MD5Update( &ctx, (byte *)svs.challenge_salt, sizeof( svs.challenge_salt ));
|
if( i == MAX_CHALLENGES )
|
||||||
MD5Final( digest, &ctx );
|
{
|
||||||
|
// this is the first time this client has asked for a challenge
|
||||||
return digest[0] | digest[1] << 8 | digest[2] << 16 | digest[3] << 24;
|
svs.challenges[oldest].challenge = (COM_RandomLong( 0, 0x7FFF ) << 16) | COM_RandomLong( 0, 0xFFFF );
|
||||||
}
|
svs.challenges[oldest].adr = from;
|
||||||
|
svs.challenges[oldest].time = host.realtime;
|
||||||
static void SV_SendChallenge( netadr_t from )
|
svs.challenges[oldest].connected = false;
|
||||||
{
|
i = oldest;
|
||||||
qboolean error = false;
|
}
|
||||||
int challenge = SV_GetChallenge( from, &error );
|
|
||||||
|
|
||||||
if( error )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// send it back
|
// send it back
|
||||||
Netchan_OutOfBandPrint( NS_SERVER, from, S2C_CHALLENGE" %i", challenge );
|
Netchan_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, S2C_CHALLENGE" %i", svs.challenges[i].challenge );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SV_GetFragmentSize( void *pcl, fragsize_t mode )
|
static int SV_GetFragmentSize( void *pcl, fragsize_t mode )
|
||||||
@@ -227,16 +211,35 @@ Make sure connecting client is not spoofing
|
|||||||
*/
|
*/
|
||||||
static int SV_CheckChallenge( netadr_t from, int challenge )
|
static int SV_CheckChallenge( netadr_t from, int challenge )
|
||||||
{
|
{
|
||||||
qboolean error = false;
|
int i;
|
||||||
int challenge2 = SV_GetChallenge( from, &error );
|
|
||||||
|
|
||||||
if( error || challenge2 != challenge )
|
// see if the challenge is valid
|
||||||
|
// don't care if it is a local address.
|
||||||
|
if( NET_IsLocalAddress( from ))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for( i = 0; i < MAX_CHALLENGES; i++ )
|
||||||
{
|
{
|
||||||
SV_RejectConnection( from, "no challenge for your address\n" );
|
if( NET_CompareAdr( from, svs.challenges[i].adr ))
|
||||||
return false;
|
{
|
||||||
|
if( challenge == svs.challenges[i].challenge )
|
||||||
|
break; // valid challenge
|
||||||
|
#if 0
|
||||||
|
// g-cont. this breaks multiple connections from single machine
|
||||||
|
SV_RejectConnection( from, "bad challenge %i\n", challenge );
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if( i == MAX_CHALLENGES )
|
||||||
|
{
|
||||||
|
SV_RejectConnection( from, "no challenge for your address\n" );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
svs.challenges[i].connected = true;
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -250,7 +253,7 @@ static int SV_CheckIPRestrictions( netadr_t from )
|
|||||||
{
|
{
|
||||||
if( sv_lan.value )
|
if( sv_lan.value )
|
||||||
{
|
{
|
||||||
if( !NET_IsReservedAdr( from ))
|
if( !NET_CompareClassBAdr( from, net_local ) && !NET_IsReservedAdr( from ))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -264,17 +267,23 @@ Get slot # and set client_t pointer for player, if possible
|
|||||||
We don't do this search on a "reconnect, we just reuse the slot
|
We don't do this search on a "reconnect, we just reuse the slot
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static sv_client_t *SV_FindEmptySlot( void )
|
static int SV_FindEmptySlot( netadr_t from, int *pslot, sv_client_t **ppClient )
|
||||||
{
|
{
|
||||||
int i;
|
sv_client_t *cl;
|
||||||
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < svs.maxclients; i++ )
|
for( i = 0, cl = svs.clients; i < svs.maxclients; i++, cl++ )
|
||||||
{
|
{
|
||||||
if( svs.clients[i].state == cs_free )
|
if( cl->state == cs_free )
|
||||||
return &svs.clients[i];
|
{
|
||||||
|
*ppClient = cl;
|
||||||
|
*pslot = i;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
SV_RejectConnection( from, "server is full\n" );
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -286,13 +295,15 @@ A connection request that did not come from the master
|
|||||||
*/
|
*/
|
||||||
static void SV_ConnectClient( netadr_t from )
|
static void SV_ConnectClient( netadr_t from )
|
||||||
{
|
{
|
||||||
char userinfo[MAX_INFO_STRING];
|
char userinfo[MAX_INFO_STRING];
|
||||||
char protinfo[MAX_INFO_STRING];
|
char protinfo[MAX_INFO_STRING];
|
||||||
sv_client_t *newcl = NULL;
|
sv_client_t *cl, *newcl = NULL;
|
||||||
int qport, version;
|
qboolean reconnect = false;
|
||||||
int i, count = 0;
|
int nClientSlot = 0;
|
||||||
int challenge;
|
int qport, version;
|
||||||
const char *s;
|
int i, count = 0;
|
||||||
|
int challenge;
|
||||||
|
const char *s;
|
||||||
int extensions;
|
int extensions;
|
||||||
uint netchan_flags = 0;
|
uint netchan_flags = 0;
|
||||||
|
|
||||||
@@ -310,6 +321,39 @@ static void SV_ConnectClient( netadr_t from )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
challenge = Q_atoi( Cmd_Argv( 2 )); // get challenge
|
||||||
|
|
||||||
|
// see if the challenge is valid (local clients don't need to challenge)
|
||||||
|
if( !SV_CheckChallenge( from, challenge ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
s = Cmd_Argv( 3 ); // protocol info
|
||||||
|
|
||||||
|
if( !Info_IsValid( s ))
|
||||||
|
{
|
||||||
|
SV_RejectConnection( from, "invalid protinfo in connect command\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( protinfo, s, sizeof( protinfo ));
|
||||||
|
|
||||||
|
if( !SV_ProcessUserAgent( from, protinfo ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract qport from protocol info
|
||||||
|
qport = Q_atoi( Info_ValueForKey( protinfo, "qport" ));
|
||||||
|
|
||||||
|
s = Info_ValueForKey( protinfo, "uuid" );
|
||||||
|
if( Q_strlen( s ) != 32 )
|
||||||
|
{
|
||||||
|
SV_RejectConnection( from, "invalid authentication certificate length\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ) );
|
||||||
|
|
||||||
// LAN servers restrict to class b IP addresses
|
// LAN servers restrict to class b IP addresses
|
||||||
if( !SV_CheckIPRestrictions( from ))
|
if( !SV_CheckIPRestrictions( from ))
|
||||||
{
|
{
|
||||||
@@ -317,37 +361,9 @@ static void SV_ConnectClient( netadr_t from )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
challenge = Q_atoi( Cmd_Argv( 2 )); // get challenge
|
|
||||||
|
|
||||||
// see if the challenge is valid (local clients don't need to challenge)
|
|
||||||
if( !SV_CheckChallenge( from, challenge ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
s = Cmd_Argv( 3 );
|
|
||||||
if( Q_strlen( s ) > sizeof( protinfo ) || !Info_IsValid( s ))
|
|
||||||
{
|
|
||||||
SV_RejectConnection( from, "invalid protinfo in connect command\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strncpy( protinfo, s, sizeof( protinfo )); // protocol info
|
|
||||||
|
|
||||||
if( !SV_ProcessUserAgent( from, protinfo ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( Q_strlen( Info_ValueForKey( protinfo, "uuid" )) != 32 )
|
|
||||||
{
|
|
||||||
SV_RejectConnection( from, "invalid authentication certificate length\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract qport from protocol info
|
|
||||||
qport = Q_atoi( Info_ValueForKey( protinfo, "qport" ));
|
|
||||||
extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ));
|
|
||||||
|
|
||||||
s = Cmd_Argv( 4 ); // user info
|
s = Cmd_Argv( 4 ); // user info
|
||||||
|
|
||||||
if( Q_strlen( s ) > sizeof( userinfo ) || !Info_IsValid( s ))
|
if( Q_strlen( s ) > MAX_INFO_STRING || !Info_IsValid( s ))
|
||||||
{
|
{
|
||||||
SV_RejectConnection( from, "invalid userinfo in connect command\n" );
|
SV_RejectConnection( from, "invalid userinfo in connect command\n" );
|
||||||
return;
|
return;
|
||||||
@@ -366,43 +382,43 @@ static void SV_ConnectClient( netadr_t from )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if there is already a slot for this ip, reuse it
|
// if there is already a slot for this ip, reuse it
|
||||||
for( i = 0; i < svs.maxclients; i++ )
|
for( i = 0, cl = svs.clients; i < svs.maxclients; i++, cl++ )
|
||||||
{
|
{
|
||||||
sv_client_t *cl = &svs.clients[i];
|
|
||||||
|
|
||||||
if( cl->state == cs_free || cl->state == cs_zombie )
|
if( cl->state == cs_free || cl->state == cs_zombie )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NET_CompareBaseAdr( from, cl->netchan.remote_address ) && ( cl->netchan.qport == qport || from.port == cl->netchan.remote_address.port ))
|
if( NET_CompareBaseAdr( from, cl->netchan.remote_address ) && ( cl->netchan.qport == qport || from.port == cl->netchan.remote_address.port ))
|
||||||
{
|
{
|
||||||
|
reconnect = true;
|
||||||
newcl = cl;
|
newcl = cl;
|
||||||
Con_Reportf( S_NOTE "%s:reconnect\n", NET_AdrToString( from ));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A reconnecting client will re-use the slot found above when checking for reconnection.
|
// A reconnecting client will re-use the slot found above when checking for reconnection.
|
||||||
// the slot will be wiped clean.
|
// the slot will be wiped clean.
|
||||||
if( !newcl )
|
if( !reconnect )
|
||||||
{
|
{
|
||||||
// connect the client if there are empty slots.
|
// connect the client if there are empty slots.
|
||||||
newcl = SV_FindEmptySlot();
|
if( !SV_FindEmptySlot( from, &nClientSlot, &newcl ))
|
||||||
|
|
||||||
if( !newcl )
|
|
||||||
{
|
|
||||||
SV_RejectConnection( from, "server is full\n" );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_Reportf( S_NOTE "%s:reconnect\n", NET_AdrToString( from ));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find a client slot
|
||||||
|
ASSERT( newcl != NULL );
|
||||||
|
|
||||||
// build a new connection
|
// build a new connection
|
||||||
// accept the new client
|
// accept the new client
|
||||||
|
|
||||||
sv.current_client = newcl;
|
sv.current_client = newcl;
|
||||||
newcl->edict = EDICT_NUM(( newcl - svs.clients ) + 1 );
|
newcl->edict = EDICT_NUM( (newcl - svs.clients) + 1 );
|
||||||
newcl->challenge = challenge; // save challenge for checksumming
|
newcl->challenge = challenge; // save challenge for checksumming
|
||||||
newcl->frames = (client_frame_t *)Mem_Realloc( host.mempool, newcl->frames, sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
|
if( newcl->frames ) Mem_Free( newcl->frames );
|
||||||
memset( newcl->frames, 0, sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
|
newcl->frames = (client_frame_t *)Z_Calloc( sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
|
||||||
newcl->userid = g_userid++; // create unique userid
|
newcl->userid = g_userid++; // create unique userid
|
||||||
newcl->state = cs_connected;
|
newcl->state = cs_connected;
|
||||||
newcl->extensions = extensions & (NET_EXT_SPLITSIZE);
|
newcl->extensions = extensions & (NET_EXT_SPLITSIZE);
|
||||||
@@ -466,11 +482,8 @@ static void SV_ConnectClient( netadr_t from )
|
|||||||
|
|
||||||
// if this was the first client on the server, or the last client
|
// if this was the first client on the server, or the last client
|
||||||
// the server can hold, send a heartbeat to the master.
|
// the server can hold, send a heartbeat to the master.
|
||||||
for( i = 0; i < svs.maxclients; i++ )
|
for( i = 0, cl = svs.clients; i < svs.maxclients; i++, cl++ )
|
||||||
{
|
if( cl->state >= cs_connected ) count++;
|
||||||
if( svs.clients[i].state >= cs_connected )
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log_Printf( "\"%s<%i><%i><>\" connected, address \"%s\"\n", newcl->name, newcl->userid, i, NET_AdrToString( newcl->netchan.remote_address ));
|
Log_Printf( "\"%s<%i><%i><>\" connected, address \"%s\"\n", newcl->name, newcl->userid, i, NET_AdrToString( newcl->netchan.remote_address ));
|
||||||
|
|
||||||
@@ -841,7 +854,7 @@ static void SV_TestBandWidth( netadr_t from )
|
|||||||
( packetsize > FRAGMENT_MAX_SIZE ))
|
( packetsize > FRAGMENT_MAX_SIZE ))
|
||||||
{
|
{
|
||||||
// skip the test and just get challenge
|
// skip the test and just get challenge
|
||||||
SV_SendChallenge( from );
|
SV_GetChallenge( from );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,7 +862,7 @@ static void SV_TestBandWidth( netadr_t from )
|
|||||||
ofs = packetsize - svs.testpacket_filepos - 1;
|
ofs = packetsize - svs.testpacket_filepos - 1;
|
||||||
if(( ofs < 0 ) || ( ofs > svs.testpacket_filelen ))
|
if(( ofs < 0 ) || ( ofs > svs.testpacket_filelen ))
|
||||||
{
|
{
|
||||||
SV_SendChallenge( from );
|
SV_GetChallenge( from );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1772,7 +1785,7 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl )
|
|||||||
if( host.realtime < cl->userinfo_next_changetime + cl->userinfo_penalty * sv_userinfo_penalty_multiplier.value )
|
if( host.realtime < cl->userinfo_next_changetime + cl->userinfo_penalty * sv_userinfo_penalty_multiplier.value )
|
||||||
{
|
{
|
||||||
// player changes userinfo too quick! ignore!
|
// player changes userinfo too quick! ignore!
|
||||||
if( host.realtime < cl->userinfo_next_changetime && cl->userinfo_change_attempts > 0 )
|
if( host.realtime < cl->userinfo_next_changetime )
|
||||||
{
|
{
|
||||||
Con_Reportf( "%s: ignore userinfo update for %s: penalty %f, attempts %i\n",
|
Con_Reportf( "%s: ignore userinfo update for %s: penalty %f, attempts %i\n",
|
||||||
__func__, cl->name, cl->userinfo_penalty, cl->userinfo_change_attempts );
|
__func__, cl->name, cl->userinfo_penalty, cl->userinfo_change_attempts );
|
||||||
@@ -1783,15 +1796,15 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// they spammed too fast, increase penalty
|
// they spammed too fast, increase penalty
|
||||||
if( cl->userinfo_change_attempts >= (int)sv_userinfo_penalty_attempts.value )
|
if( cl->userinfo_change_attempts > sv_userinfo_penalty_attempts.value )
|
||||||
{
|
{
|
||||||
|
Con_Reportf( "%s: penalty set %f for %s\n", __func__,
|
||||||
|
cl->userinfo_penalty, cl->name );
|
||||||
cl->userinfo_penalty *= sv_userinfo_penalty_multiplier.value;
|
cl->userinfo_penalty *= sv_userinfo_penalty_multiplier.value;
|
||||||
cl->userinfo_change_attempts = 0;
|
cl->userinfo_change_attempts = 0;
|
||||||
|
|
||||||
Con_Reportf( "%s: penalty set %f for %s\n", __func__, cl->userinfo_penalty, cl->name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cl->userinfo_next_changetime = host.realtime + cl->userinfo_penalty * sv_userinfo_penalty_multiplier.value;
|
cl->userinfo_next_changetime = host.realtime + cl->userinfo_penalty;
|
||||||
|
|
||||||
return allow;
|
return allow;
|
||||||
}
|
}
|
||||||
@@ -1895,10 +1908,13 @@ static void SV_UserinfoChanged( sv_client_t *cl )
|
|||||||
|
|
||||||
val = Info_ValueForKey( cl->userinfo, "cl_updaterate" );
|
val = Info_ValueForKey( cl->userinfo, "cl_updaterate" );
|
||||||
|
|
||||||
if( COM_CheckString( val ))
|
if( COM_CheckString( val ) )
|
||||||
{
|
{
|
||||||
float rate = Q_atoi( val );
|
if( Q_atoi( val ) != 0 )
|
||||||
cl->cl_updaterate = 1.0 / bound( sv_minupdaterate.value, rate, sv_maxupdaterate.value );
|
{
|
||||||
|
cl->cl_updaterate = 1.0 / bound( sv_minupdaterate.value, Q_atoi( val ), sv_maxupdaterate.value );
|
||||||
|
}
|
||||||
|
else cl->cl_updaterate = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call prog code to allow overrides
|
// call prog code to allow overrides
|
||||||
@@ -3163,7 +3179,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
else if( !Q_strcmp( pcmd, C2S_GETCHALLENGE ))
|
else if( !Q_strcmp( pcmd, C2S_GETCHALLENGE ))
|
||||||
{
|
{
|
||||||
SV_SendChallenge( from );
|
SV_GetChallenge( from );
|
||||||
}
|
}
|
||||||
else if( !Q_strcmp( pcmd, C2S_CONNECT ))
|
else if( !Q_strcmp( pcmd, C2S_CONNECT ))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ static void SV_Kick_f( void )
|
|||||||
sv_client_t *cl;
|
sv_client_t *cl;
|
||||||
const char *param;
|
const char *param;
|
||||||
|
|
||||||
if( Cmd_Argc() < 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_USAGE "kick <#id|name> [reason]\n" );
|
Con_Printf( S_USAGE "kick <#id|name> [reason]\n" );
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2379,7 +2379,7 @@ void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... )
|
|||||||
if( sv.state != ss_active )
|
if( sv.state != ss_active )
|
||||||
return; // early out
|
return; // early out
|
||||||
|
|
||||||
if(( cl = SV_ClientFromEdict( pEdict, false )) == NULL )
|
if(( cl = SV_ClientFromEdict( pEdict, true )) == NULL )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "stuffcmd: client is not spawned!\n" );
|
Con_Printf( S_ERROR "stuffcmd: client is not spawned!\n" );
|
||||||
return;
|
return;
|
||||||
@@ -4600,7 +4600,7 @@ static void GAME_EXPORT pfnQueryClientCvarValue( const edict_t *player, const ch
|
|||||||
if( !COM_CheckString( cvarName ))
|
if( !COM_CheckString( cvarName ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(( cl = SV_ClientFromEdict( player, false )) != NULL )
|
if(( cl = SV_ClientFromEdict( player, true )) != NULL )
|
||||||
{
|
{
|
||||||
MSG_BeginServerCmd( &cl->netchan.message, svc_querycvarvalue );
|
MSG_BeginServerCmd( &cl->netchan.message, svc_querycvarvalue );
|
||||||
MSG_WriteString( &cl->netchan.message, cvarName );
|
MSG_WriteString( &cl->netchan.message, cvarName );
|
||||||
@@ -4627,7 +4627,7 @@ static void GAME_EXPORT pfnQueryClientCvarValue2( const edict_t *player, const c
|
|||||||
if( !COM_CheckString( cvarName ))
|
if( !COM_CheckString( cvarName ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(( cl = SV_ClientFromEdict( player, false )) != NULL )
|
if(( cl = SV_ClientFromEdict( player, true )) != NULL )
|
||||||
{
|
{
|
||||||
MSG_BeginServerCmd( &cl->netchan.message, svc_querycvarvalue2 );
|
MSG_BeginServerCmd( &cl->netchan.message, svc_querycvarvalue2 );
|
||||||
MSG_WriteLong( &cl->netchan.message, requestID );
|
MSG_WriteLong( &cl->netchan.message, requestID );
|
||||||
|
|||||||
@@ -1027,9 +1027,6 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
|||||||
svs.timestart = Sys_DoubleTime();
|
svs.timestart = Sys_DoubleTime();
|
||||||
svs.spawncount++; // any partially connected client will be restarted
|
svs.spawncount++; // any partially connected client will be restarted
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( svs.challenge_salt ); i++ )
|
|
||||||
svs.challenge_salt[i] = COM_RandomLong( 0, 0x7FFFFFFE );
|
|
||||||
|
|
||||||
cycle = Cvar_VariableString( "mapchangecfgfile" );
|
cycle = Cvar_VariableString( "mapchangecfgfile" );
|
||||||
|
|
||||||
if( COM_CheckString( cycle ))
|
if( COM_CheckString( cycle ))
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ CVAR_DEFINE_AUTO( sv_skyvec_y, "0", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "skylight dir
|
|||||||
CVAR_DEFINE_AUTO( sv_skyvec_z, "0", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "skylight direction by z-axis" );
|
CVAR_DEFINE_AUTO( sv_skyvec_z, "0", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "skylight direction by z-axis" );
|
||||||
CVAR_DEFINE_AUTO( sv_wateralpha, "1", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "world surfaces water transparency factor. 1.0 - solid, 0.0 - fully transparent" );
|
CVAR_DEFINE_AUTO( sv_wateralpha, "1", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "world surfaces water transparency factor. 1.0 - solid, 0.0 - fully transparent" );
|
||||||
CVAR_DEFINE_AUTO( sv_background_freeze, "1", FCVAR_ARCHIVE, "freeze player movement on background maps (e.g. to prevent falling)" );
|
CVAR_DEFINE_AUTO( sv_background_freeze, "1", FCVAR_ARCHIVE, "freeze player movement on background maps (e.g. to prevent falling)" );
|
||||||
static CVAR_DEFINE_AUTO( showtriggers, "0", FCVAR_LATCH|FCVAR_TEMPORARY, "debug cvar shows triggers" );
|
static CVAR_DEFINE_AUTO( showtriggers, "0", FCVAR_LATCH, "debug cvar shows triggers" );
|
||||||
static CVAR_DEFINE_AUTO( sv_airmove, "1", FCVAR_SERVER, "obsolete, compatibility issues" );
|
static CVAR_DEFINE_AUTO( sv_airmove, "1", FCVAR_SERVER, "obsolete, compatibility issues" );
|
||||||
static CVAR_DEFINE_AUTO( sv_version, "", FCVAR_READ_ONLY, "engine version string" );
|
static CVAR_DEFINE_AUTO( sv_version, "", FCVAR_READ_ONLY, "engine version string" );
|
||||||
CVAR_DEFINE_AUTO( hostname, "", FCVAR_PRINTABLEONLY, "name of current host" );
|
CVAR_DEFINE_AUTO( hostname, "", FCVAR_PRINTABLEONLY, "name of current host" );
|
||||||
|
|||||||
@@ -601,7 +601,7 @@ static void SV_FindTouchedLeafs( edict_t *ent, model_t *mod, mnode_t *node, int
|
|||||||
// add an efrag if the node is a leaf
|
// add an efrag if the node is a leaf
|
||||||
if( node->contents < 0 )
|
if( node->contents < 0 )
|
||||||
{
|
{
|
||||||
if( ent->num_leafs >= MAX_ENT_LEAFS( FBitSet( mod->flags, MODEL_QBSP2 )))
|
if( ent->num_leafs > MAX_ENT_LEAFS( FBitSet( mod->flags, MODEL_QBSP2 )))
|
||||||
{
|
{
|
||||||
// continue counting leafs,
|
// continue counting leafs,
|
||||||
// so we know how many it's overrun
|
// so we know how many it's overrun
|
||||||
|
|||||||
@@ -3119,10 +3119,6 @@ qboolean FS_Rename( const char *oldname, const char *newname )
|
|||||||
char oldname2[MAX_SYSPATH], newname2[MAX_SYSPATH], oldpath[MAX_SYSPATH], newpath[MAX_SYSPATH];
|
char oldname2[MAX_SYSPATH], newname2[MAX_SYSPATH], oldpath[MAX_SYSPATH], newpath[MAX_SYSPATH];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// a1ba: disallow path traversal
|
|
||||||
if( FS_CheckNastyPath( oldname ) || FS_CheckNastyPath( newname ))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( !fs_writepath )
|
if( !fs_writepath )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -3171,10 +3167,6 @@ qboolean GAME_EXPORT FS_Delete( const char *path )
|
|||||||
char path2[MAX_SYSPATH], real_path[MAX_SYSPATH];
|
char path2[MAX_SYSPATH], real_path[MAX_SYSPATH];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// a1ba: disallow path traversal
|
|
||||||
if( FS_CheckNastyPath( path ))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( !fs_writepath || !COM_CheckString( path ))
|
if( !fs_writepath || !COM_CheckString( path ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -453,83 +453,174 @@ int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p )
|
|||||||
return sides;
|
return sides;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_StudioCalcBones( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const float *adj, vec3_t pos, vec4_t q )
|
/*
|
||||||
|
====================
|
||||||
|
StudioCalcBoneQuaternion
|
||||||
|
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void R_StudioCalcBoneQuaternion( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const float *adj, vec4_t q )
|
||||||
{
|
{
|
||||||
float v1[6], v2[6];
|
vec3_t angles1;
|
||||||
int i, max;
|
vec3_t angles2;
|
||||||
|
int j, k;
|
||||||
|
|
||||||
max = q != NULL ? 6 : 3;
|
for( j = 0; j < 3; j++ )
|
||||||
|
|
||||||
for( i = 0; i < max; i++ )
|
|
||||||
{
|
{
|
||||||
mstudioanimvalue_t *panimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[i] );
|
if( !panim || panim->offset[j+3] == 0 )
|
||||||
int j = frame;
|
|
||||||
float fadj = 0.0f;
|
|
||||||
|
|
||||||
if( pbone->bonecontroller[i] >= 0 && adj != NULL )
|
|
||||||
fadj = adj[pbone->bonecontroller[i]];
|
|
||||||
|
|
||||||
if( panim->offset[i] == 0 )
|
|
||||||
{
|
{
|
||||||
v1[i] = v2[i] = pbone->value[i] + fadj;
|
angles2[j] = angles1[j] = pbone->value[j+3]; // default;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( panimvalue->num.total < panimvalue->num.valid )
|
|
||||||
j = 0;
|
|
||||||
|
|
||||||
while( panimvalue->num.total <= j )
|
|
||||||
{
|
|
||||||
j -= panimvalue->num.total;
|
|
||||||
panimvalue += panimvalue->num.valid + 1;
|
|
||||||
|
|
||||||
if( panimvalue->num.total < panimvalue->num.valid )
|
|
||||||
j = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( panimvalue->num.valid > j )
|
|
||||||
{
|
|
||||||
v1[i] = panimvalue[j + 1].value;
|
|
||||||
|
|
||||||
if( panimvalue->num.valid > j + 1 )
|
|
||||||
v2[i] = panimvalue[j + 2].value;
|
|
||||||
else if( panimvalue->num.total > j + 1 )
|
|
||||||
v2[i] = v1[i];
|
|
||||||
else
|
|
||||||
v2[i] = panimvalue[panimvalue->num.valid + 2].value;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v1[i] = panimvalue[panimvalue->num.valid].value;
|
mstudioanimvalue_t *panimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j+3]);
|
||||||
|
|
||||||
if( panimvalue->num.total > j + 1 )
|
k = frame;
|
||||||
v2[i] = v1[i];
|
|
||||||
|
// debug
|
||||||
|
if( panimvalue->num.total < panimvalue->num.valid )
|
||||||
|
k = 0;
|
||||||
|
|
||||||
|
// find span of values that includes the frame we want
|
||||||
|
while( panimvalue->num.total <= k )
|
||||||
|
{
|
||||||
|
k -= panimvalue->num.total;
|
||||||
|
panimvalue += panimvalue->num.valid + 1;
|
||||||
|
|
||||||
|
// debug
|
||||||
|
if( panimvalue->num.total < panimvalue->num.valid )
|
||||||
|
k = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bah, missing blend!
|
||||||
|
if( panimvalue->num.valid > k )
|
||||||
|
{
|
||||||
|
angles1[j] = panimvalue[k+1].value;
|
||||||
|
|
||||||
|
if( panimvalue->num.valid > k + 1 )
|
||||||
|
{
|
||||||
|
angles2[j] = panimvalue[k+2].value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( panimvalue->num.total > k + 1 )
|
||||||
|
angles2[j] = angles1[j];
|
||||||
|
else angles2[j] = panimvalue[panimvalue->num.valid+2].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
v2[i] = panimvalue[panimvalue->num.valid + 2].value;
|
{
|
||||||
|
angles1[j] = panimvalue[panimvalue->num.valid].value;
|
||||||
|
if( panimvalue->num.total > k + 1 )
|
||||||
|
angles2[j] = angles1[j];
|
||||||
|
else angles2[j] = panimvalue[panimvalue->num.valid+2].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
angles1[j] = pbone->value[j+3] + angles1[j] * pbone->scale[j+3];
|
||||||
|
angles2[j] = pbone->value[j+3] + angles2[j] * pbone->scale[j+3];
|
||||||
}
|
}
|
||||||
|
|
||||||
v1[i] = pbone->value[i] + v1[i] * pbone->scale[i] + fadj;
|
if( pbone->bonecontroller[j+3] != -1 && adj != NULL )
|
||||||
v2[i] = pbone->value[i] + v2[i] * pbone->scale[i] + fadj;
|
{
|
||||||
|
angles1[j] += adj[pbone->bonecontroller[j+3]];
|
||||||
|
angles2[j] += adj[pbone->bonecontroller[j+3]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !VectorCompare( v1, v2 ))
|
if( !VectorCompare( angles1, angles2 ))
|
||||||
VectorLerp( v1, s, v2, pos );
|
|
||||||
else
|
|
||||||
VectorCopy( v1, pos );
|
|
||||||
|
|
||||||
if( q != NULL )
|
|
||||||
{
|
{
|
||||||
if( !VectorCompare( &v1[3], &v2[3] ))
|
vec4_t q1, q2;
|
||||||
{
|
|
||||||
vec4_t q1, q2;
|
|
||||||
|
|
||||||
AngleQuaternion( &v1[3], q1, true );
|
AngleQuaternion( angles1, q1, true );
|
||||||
AngleQuaternion( &v2[3], q2, true );
|
AngleQuaternion( angles2, q2, true );
|
||||||
QuaternionSlerp( q1, q2, s, q );
|
QuaternionSlerp( q1, q2, s, q );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AngleQuaternion( &v1[3], q, true );
|
AngleQuaternion( angles1, q, true );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
StudioCalcBonePosition
|
||||||
|
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void R_StudioCalcBonePosition( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const float *adj, vec3_t pos )
|
||||||
|
{
|
||||||
|
vec3_t origin1;
|
||||||
|
vec3_t origin2;
|
||||||
|
int j, k;
|
||||||
|
|
||||||
|
for( j = 0; j < 3; j++ )
|
||||||
|
{
|
||||||
|
if( !panim || panim->offset[j] == 0 )
|
||||||
|
{
|
||||||
|
origin2[j] = origin1[j] = pbone->value[j]; // default;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mstudioanimvalue_t *panimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j]);
|
||||||
|
|
||||||
|
k = frame;
|
||||||
|
|
||||||
|
// debug
|
||||||
|
if( panimvalue->num.total < panimvalue->num.valid )
|
||||||
|
k = 0;
|
||||||
|
|
||||||
|
// find span of values that includes the frame we want
|
||||||
|
while( panimvalue->num.total <= k )
|
||||||
|
{
|
||||||
|
k -= panimvalue->num.total;
|
||||||
|
panimvalue += panimvalue->num.valid + 1;
|
||||||
|
|
||||||
|
// debug
|
||||||
|
if( panimvalue->num.total < panimvalue->num.valid )
|
||||||
|
k = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bah, missing blend!
|
||||||
|
if( panimvalue->num.valid > k )
|
||||||
|
{
|
||||||
|
origin1[j] = panimvalue[k+1].value;
|
||||||
|
|
||||||
|
if( panimvalue->num.valid > k + 1 )
|
||||||
|
{
|
||||||
|
origin2[j] = panimvalue[k+2].value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( panimvalue->num.total > k + 1 )
|
||||||
|
origin2[j] = origin1[j];
|
||||||
|
else origin2[j] = panimvalue[panimvalue->num.valid+2].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
origin1[j] = panimvalue[panimvalue->num.valid].value;
|
||||||
|
if( panimvalue->num.total > k + 1 )
|
||||||
|
origin2[j] = origin1[j];
|
||||||
|
else origin2[j] = panimvalue[panimvalue->num.valid+2].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
origin1[j] = pbone->value[j] + origin1[j] * pbone->scale[j];
|
||||||
|
origin2[j] = pbone->value[j] + origin2[j] * pbone->scale[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pbone->bonecontroller[j] != -1 && adj != NULL )
|
||||||
|
{
|
||||||
|
origin1[j] += adj[pbone->bonecontroller[j]];
|
||||||
|
origin2[j] += adj[pbone->bonecontroller[j]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !VectorCompare( origin1, origin2 ))
|
||||||
|
{
|
||||||
|
VectorLerp( origin1, s, origin2, pos );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorCopy( origin1, pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ void VectorsAngles( const vec3_t forward, const vec3_t right, const vec3_t up, v
|
|||||||
void PlaneIntersect( const mplane_t *plane, const vec3_t p0, const vec3_t p1, vec3_t out );
|
void PlaneIntersect( const mplane_t *plane, const vec3_t p0, const vec3_t p1, vec3_t out );
|
||||||
qboolean SphereIntersect( const vec3_t vSphereCenter, float fSphereRadiusSquared, const vec3_t vLinePt, const vec3_t vLineDir );
|
qboolean SphereIntersect( const vec3_t vSphereCenter, float fSphereRadiusSquared, const vec3_t vLinePt, const vec3_t vLineDir );
|
||||||
void QuaternionSlerp( const vec4_t p, const vec4_t q, float t, vec4_t qt );
|
void QuaternionSlerp( const vec4_t p, const vec4_t q, float t, vec4_t qt );
|
||||||
|
void R_StudioCalcBoneQuaternion( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const float *adj, vec4_t q );
|
||||||
void R_StudioCalcBones( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const float *adj, vec3_t pos, vec4_t q );
|
void R_StudioCalcBonePosition( int frame, float s, const mstudiobone_t *pbone, const mstudioanim_t *panim, const vec3_t adj, vec3_t pos );
|
||||||
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p );
|
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p );
|
||||||
#define BOX_ON_PLANE_SIDE( emins, emaxs, p ) \
|
#define BOX_ON_PLANE_SIDE( emins, emaxs, p ) \
|
||||||
((( p )->type < 3 ) ? \
|
((( p )->type < 3 ) ? \
|
||||||
|
|||||||
@@ -2476,14 +2476,10 @@ static void R_SetupVBOArrayDlight( vboarray_t *vbo, texture_t *texture )
|
|||||||
|
|
||||||
static void R_SetupVBOArrayDecalDlight( int decalcount )
|
static void R_SetupVBOArrayDecalDlight( int decalcount )
|
||||||
{
|
{
|
||||||
if( vbos.decal_dlight_vbo )
|
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, vbos.decal_dlight_vbo );
|
||||||
{
|
|
||||||
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, vbos.decal_dlight_vbo );
|
|
||||||
#if !SPARSE_DECALS_UPLOAD
|
#if !SPARSE_DECALS_UPLOAD
|
||||||
pglBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof( vbovertex_t ) * DECAL_VERTS_MAX * decalcount, vbos.decal_dlight, GL_STREAM_DRAW_ARB );
|
pglBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof( vbovertex_t ) * DECAL_VERTS_MAX * decalcount, vbos.decal_dlight , GL_STREAM_DRAW_ARB );
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
R_SetDecalMode( true );
|
R_SetDecalMode( true );
|
||||||
// hack: fix decal dlights on gl_vbo_details == 2 (wrong state??)
|
// hack: fix decal dlights on gl_vbo_details == 2 (wrong state??)
|
||||||
/*if( mtst.details_enabled && mtst.tmu_dt != -1 )
|
/*if( mtst.details_enabled && mtst.tmu_dt != -1 )
|
||||||
|
|||||||
@@ -816,7 +816,10 @@ static void R_StudioCalcRotations( cl_entity_t *e, float pos[][3], vec4_t *q, ms
|
|||||||
R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen );
|
R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen );
|
||||||
|
|
||||||
for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ )
|
for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ )
|
||||||
R_StudioCalcBones( frame, s, pbone, panim, adj, pos[i], q[i] );
|
{
|
||||||
|
R_StudioCalcBoneQuaternion( frame, s, pbone, panim, adj, q[i] );
|
||||||
|
R_StudioCalcBonePosition( frame, s, pbone, panim, adj, pos[i] );
|
||||||
|
}
|
||||||
|
|
||||||
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
||||||
if( pseqdesc->motiontype & STUDIO_Y ) pos[pseqdesc->motionbone][1] = 0.0f;
|
if( pseqdesc->motiontype & STUDIO_Y ) pos[pseqdesc->motionbone][1] = 0.0f;
|
||||||
|
|||||||
@@ -835,7 +835,10 @@ static void R_StudioCalcRotations( cl_entity_t *e, float pos[][3], vec4_t *q, ms
|
|||||||
R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen );
|
R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen );
|
||||||
|
|
||||||
for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ )
|
for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ )
|
||||||
R_StudioCalcBones( frame, s, pbone, panim, adj, pos[i], q[i] );
|
{
|
||||||
|
R_StudioCalcBoneQuaternion( frame, s, pbone, panim, adj, q[i] );
|
||||||
|
R_StudioCalcBonePosition( frame, s, pbone, panim, adj, pos[i] );
|
||||||
|
}
|
||||||
|
|
||||||
if( pseqdesc->motiontype & STUDIO_X )
|
if( pseqdesc->motiontype & STUDIO_X )
|
||||||
pos[pseqdesc->motionbone][0] = 0.0f;
|
pos[pseqdesc->motionbone][0] = 0.0f;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ build_engine()
|
|||||||
die
|
die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cat build/config.log
|
||||||
|
|
||||||
./waf build || die
|
./waf build || die
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ def sdl2_configure_path(conf, path, libname):
|
|||||||
conf.env[FRAMEWORKPATH] = [my_dirname(path)]
|
conf.env[FRAMEWORKPATH] = [my_dirname(path)]
|
||||||
conf.env[FRAMEWORK] = [libname]
|
conf.env[FRAMEWORK] = [libname]
|
||||||
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env[FRAMEWORK], conf.env[FRAMEWORKPATH], conf.env[INCLUDES]))
|
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env[FRAMEWORK], conf.env[FRAMEWORKPATH], conf.env[INCLUDES]))
|
||||||
elif conf.env.DEST_OS == 'android':
|
|
||||||
# Special setup for waf called from CMake, through ExternalProject_Add
|
|
||||||
conf.env[INCLUDES] = [os.path.abspath(os.path.join(path, 'include'))]
|
|
||||||
conf.env[LIBPATH] = [os.environ['BUILD_CMAKE_LIBRARY_OUTPUT_DIRECTORY']]
|
|
||||||
conf.env[LIB] = [libname]
|
|
||||||
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env[LIB], conf.env[LIBPATH], conf.env[INCLUDES]))
|
|
||||||
else:
|
else:
|
||||||
conf.env[INCLUDES] = [
|
conf.env[INCLUDES] = [
|
||||||
os.path.abspath(os.path.join(path, 'include')),
|
os.path.abspath(os.path.join(path, 'include')),
|
||||||
|
|||||||
@@ -20,20 +20,12 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK']
|
ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK']
|
||||||
ANDROID_NDK_SUPPORTED = [10, 19, 20, 23, 25, 27, 28]
|
ANDROID_NDK_SUPPORTED = [10, 19, 20, 23, 25]
|
||||||
ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp
|
ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp
|
||||||
ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC
|
ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC
|
||||||
ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15
|
ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15
|
||||||
ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag
|
ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag
|
||||||
ANDROID_NDK_API_MIN = {
|
ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16, 23: 16, 25: 19 } # minimal API level ndk revision supports
|
||||||
10: 3,
|
|
||||||
19: 16,
|
|
||||||
20: 16,
|
|
||||||
23: 16,
|
|
||||||
25: 19,
|
|
||||||
27: 19,
|
|
||||||
28: 19,
|
|
||||||
} # minimal API level ndk revision supports
|
|
||||||
|
|
||||||
ANDROID_STPCPY_API_MIN = 21 # stpcpy() introduced in SDK 21
|
ANDROID_STPCPY_API_MIN = 21 # stpcpy() introduced in SDK 21
|
||||||
ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets
|
ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets
|
||||||
@@ -58,7 +50,6 @@ class Android:
|
|||||||
self.api = api
|
self.api = api
|
||||||
self.toolchain = toolchain
|
self.toolchain = toolchain
|
||||||
self.arch = arch
|
self.arch = arch
|
||||||
self.exe = '.exe' if sys.platform.startswith('win32') or sys.platform.startswith('cygwin') else ''
|
|
||||||
|
|
||||||
for i in ANDROID_NDK_ENVVARS:
|
for i in ANDROID_NDK_ENVVARS:
|
||||||
self.ndk_home = os.getenv(i)
|
self.ndk_home = os.getenv(i)
|
||||||
@@ -205,10 +196,10 @@ class Android:
|
|||||||
|
|
||||||
def gen_toolchain_path(self):
|
def gen_toolchain_path(self):
|
||||||
if self.is_clang():
|
if self.is_clang():
|
||||||
base = ''
|
triplet = '%s%d-' % (self.ndk_triplet(llvm_toolchain = True), self.api)
|
||||||
else:
|
else:
|
||||||
base = self.ndk_triplet() + '-'
|
triplet = self.ndk_triplet() + '-'
|
||||||
return os.path.join(self.gen_gcc_toolchain_path(), 'bin', base)
|
return os.path.join(self.gen_gcc_toolchain_path(), 'bin', triplet)
|
||||||
|
|
||||||
def gen_binutils_path(self):
|
def gen_binutils_path(self):
|
||||||
if self.ndk_rev >= 23:
|
if self.ndk_rev >= 23:
|
||||||
@@ -224,11 +215,7 @@ class Android:
|
|||||||
s = environ['CC']
|
s = environ['CC']
|
||||||
|
|
||||||
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
|
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
|
||||||
|
return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc')
|
||||||
if self.is_clang():
|
|
||||||
return '%s --target=%s%d' % (self.gen_toolchain_path() + 'clang' + self.exe, self.ndk_triplet(), self.api)
|
|
||||||
|
|
||||||
return self.gen_toolchain_path() + 'gcc'
|
|
||||||
|
|
||||||
def cxx(self):
|
def cxx(self):
|
||||||
if self.is_host():
|
if self.is_host():
|
||||||
@@ -239,33 +226,19 @@ class Android:
|
|||||||
s = environ['CXX']
|
s = environ['CXX']
|
||||||
|
|
||||||
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
|
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
|
||||||
|
return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++')
|
||||||
if self.is_clang():
|
|
||||||
return '%s --target=%s%d' % (self.gen_toolchain_path() + 'clang++' + self.exe, self.ndk_triplet(), self.api)
|
|
||||||
|
|
||||||
return self.gen_toolchain_path() + 'g++'
|
|
||||||
|
|
||||||
def strip(self):
|
def strip(self):
|
||||||
if self.is_host():
|
if self.is_host():
|
||||||
environ = getattr(self.ctx, 'environ', os.environ)
|
environ = getattr(self.ctx, 'environ', os.environ)
|
||||||
|
|
||||||
if 'STRIP' in environ:
|
if 'STRIP' in environ:
|
||||||
return environ['STRIP']
|
return environ['STRIP']
|
||||||
return 'llvm-strip'
|
return 'llvm-strip'
|
||||||
|
|
||||||
if self.ndk_rev >= 23:
|
if self.ndk_rev >= 23:
|
||||||
return os.path.join(self.gen_binutils_path(), 'llvm-strip' + self.exe)
|
return os.path.join(self.gen_binutils_path(), 'llvm-strip')
|
||||||
return os.path.join(self.gen_binutils_path(), 'strip' + self.exe)
|
return os.path.join(self.gen_binutils_path(), 'strip')
|
||||||
|
|
||||||
def ar(self):
|
|
||||||
if self.is_host():
|
|
||||||
environ = getattr(self.ctx, 'environ', os.environ)
|
|
||||||
if 'AR' in environ:
|
|
||||||
return environ['AR']
|
|
||||||
return 'llvm-ar'
|
|
||||||
|
|
||||||
if self.ndk_rev >= 23:
|
|
||||||
return os.path.join(self.gen_binutils_path(), 'llvm-ar' + self.exe)
|
|
||||||
return os.path.join(self.gen_binutils_path(), 'ar' + self.exe)
|
|
||||||
|
|
||||||
def system_stl(self):
|
def system_stl(self):
|
||||||
# TODO: proper STL support
|
# TODO: proper STL support
|
||||||
@@ -363,7 +336,7 @@ class Android:
|
|||||||
ldflags += ['-lgcc']
|
ldflags += ['-lgcc']
|
||||||
|
|
||||||
if self.is_clang() or self.is_host():
|
if self.is_clang() or self.is_host():
|
||||||
ldflags += ['-stdlib=libstdc++', '-lc++abi']
|
ldflags += ['-stdlib=libstdc++']
|
||||||
else: ldflags += ['-no-canonical-prefixes']
|
else: ldflags += ['-no-canonical-prefixes']
|
||||||
|
|
||||||
if self.is_arm():
|
if self.is_arm():
|
||||||
@@ -548,33 +521,25 @@ def configure(conf):
|
|||||||
|
|
||||||
valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64']
|
valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64']
|
||||||
|
|
||||||
if values[0] == 'arm64-v8a':
|
|
||||||
values[0] = 'aarch64'
|
|
||||||
|
|
||||||
if values[0] not in valid_archs:
|
if values[0] not in valid_archs:
|
||||||
conf.fatal('Unknown arch: %s. Supported: %r' % (values[0], ', '.join(valid_archs)))
|
conf.fatal('Unknown arch: %s. Supported: %r' % (values[0], ', '.join(valid_archs)))
|
||||||
|
|
||||||
conf.android = android = Android(conf, values[0], values[1], int(values[2]))
|
conf.android = android = Android(conf, values[0], values[1], int(values[2]))
|
||||||
|
|
||||||
conf.environ['CC'] = android.cc()
|
conf.environ['CC'] = android.cc()
|
||||||
conf.environ['CXX'] = android.cxx()
|
conf.environ['CXX'] = android.cxx()
|
||||||
conf.environ['STRIP'] = android.strip()
|
conf.environ['STRIP'] = android.strip()
|
||||||
conf.environ['AR'] = android.ar()
|
|
||||||
conf.env.CFLAGS += android.cflags()
|
conf.env.CFLAGS += android.cflags()
|
||||||
conf.env.CXXFLAGS += android.cflags(True)
|
conf.env.CXXFLAGS += android.cflags(True)
|
||||||
conf.env.LINKFLAGS += android.linkflags()
|
conf.env.LINKFLAGS += android.linkflags()
|
||||||
conf.env.LDFLAGS += android.ldflags()
|
conf.env.LDFLAGS += android.ldflags()
|
||||||
|
|
||||||
from waflib.Tools.compiler_c import c_compiler
|
|
||||||
from waflib.Tools.compiler_cxx import cxx_compiler
|
|
||||||
c_compiler['win32'] = ['clang' if android.is_clang() or android.is_host() else 'gcc']
|
|
||||||
cxx_compiler['win32'] = ['clang++' if android.is_clang() or android.is_host() else 'gxx']
|
|
||||||
|
|
||||||
conf.env.HAVE_M = True
|
conf.env.HAVE_M = True
|
||||||
if android.is_hardfp():
|
if android.is_hardfp():
|
||||||
conf.env.LIB_M = ['m_hard']
|
conf.env.LIB_M = ['m_hard']
|
||||||
else: conf.env.LIB_M = ['m']
|
else: conf.env.LIB_M = ['m']
|
||||||
|
|
||||||
|
conf.env.PREFIX = '/lib/%s' % android.apk_arch()
|
||||||
|
|
||||||
conf.msg('Selected Android NDK', '%s, version: %d' % (android.ndk_home, android.ndk_rev))
|
conf.msg('Selected Android NDK', '%s, version: %d' % (android.ndk_home, android.ndk_rev))
|
||||||
# no need to print C/C++ compiler, as it would be printed by compiler_c/cxx
|
# no need to print C/C++ compiler, as it would be printed by compiler_c/cxx
|
||||||
conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK/'))
|
conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK/'))
|
||||||
|
|||||||
22
wscript
22
wscript
@@ -84,7 +84,7 @@ SUBDIRS = [
|
|||||||
Subproject('filesystem'),
|
Subproject('filesystem'),
|
||||||
Subproject('stub/server'),
|
Subproject('stub/server'),
|
||||||
Subproject('dllemu'),
|
Subproject('dllemu'),
|
||||||
Subproject('3rdparty/libbacktrace'),
|
Subproject('3rdparty/libbacktrace', lambda x: not x.env.HAVE_SYSTEM_LIBBACKTRACE),
|
||||||
|
|
||||||
# disable only by engine feature, makes no sense to even parse subprojects in dedicated mode
|
# disable only by engine feature, makes no sense to even parse subprojects in dedicated mode
|
||||||
Subproject('3rdparty/extras', lambda x: x.env.CLIENT and x.env.DEST_OS != 'android'),
|
Subproject('3rdparty/extras', lambda x: x.env.CLIENT and x.env.DEST_OS != 'android'),
|
||||||
@@ -468,16 +468,7 @@ def configure(conf):
|
|||||||
|
|
||||||
# set _FILE_OFFSET_BITS=64 for filesystems with 64-bit inodes
|
# set _FILE_OFFSET_BITS=64 for filesystems with 64-bit inodes
|
||||||
# must be set globally as it changes ABI
|
# must be set globally as it changes ABI
|
||||||
if conf.env.DEST_OS == 'android' and conf.env.DEST_SIZEOF_VOID_P == 4:
|
if conf.env.DEST_OS not in ['psvita']:
|
||||||
# Android in 32-bit mode don't have good enough large file support
|
|
||||||
# with our native API level
|
|
||||||
# https://android.googlesource.com/platform/bionic/+/HEAD/docs/32-bit-abi.md
|
|
||||||
pass
|
|
||||||
elif conf.env.DEST_OS == 'psvita':
|
|
||||||
# PSVita don't have large file support at all
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# try to guess how to support large files
|
|
||||||
conf.check_large_file(compiler = 'c', execute = False)
|
conf.check_large_file(compiler = 'c', execute = False)
|
||||||
|
|
||||||
# indicate if we are packaging for Linux/BSD
|
# indicate if we are packaging for Linux/BSD
|
||||||
@@ -494,8 +485,11 @@ def configure(conf):
|
|||||||
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
||||||
|
|
||||||
if not conf.options.BUILD_BUNDLED_DEPS:
|
if not conf.options.BUILD_BUNDLED_DEPS:
|
||||||
# there was a check for system libbacktrace but we can't be sure if it supports fileline or not
|
frag='''#include <backtrace.h>
|
||||||
# therefore, always build libbacktrace ourselves
|
#include <backtrace-supported.h>
|
||||||
|
int main(int argc, char **argv) { return backtrace_create_state( argv[0], BACKTRACE_SUPPORTS_THREADS, 0, 0 ) != 0; }'''
|
||||||
|
|
||||||
|
conf.env.HAVE_SYSTEM_LIBBACKTRACE = conf.check_cc(lib='backtrace', fragment=frag, uselib_store='backtrace', mandatory=False)
|
||||||
|
|
||||||
if conf.env.CLIENT:
|
if conf.env.CLIENT:
|
||||||
for i in ('ogg','opusfile','vorbis','vorbisfile'):
|
for i in ('ogg','opusfile','vorbis','vorbisfile'):
|
||||||
@@ -538,7 +532,7 @@ def build(bld):
|
|||||||
|
|
||||||
# don't clean QtCreator files and reconfigure saved options
|
# don't clean QtCreator files and reconfigure saved options
|
||||||
bld.clean_files = bld.bldnode.ant_glob('**',
|
bld.clean_files = bld.bldnode.ant_glob('**',
|
||||||
excl='*.user configuration.py .lock* *conf_check_*/** config.log 3rdparty/libbacktrace/*.h %s/*' % Build.CACHE_DIR,
|
excl='*.user configuration.py .lock* *conf_check_*/** config.log %s/*' % Build.CACHE_DIR,
|
||||||
quiet=True, generator=True)
|
quiet=True, generator=True)
|
||||||
|
|
||||||
bld.load('xshlib')
|
bld.load('xshlib')
|
||||||
|
|||||||
Reference in New Issue
Block a user