├── .gitignore ├── src ├── gfxshared.h ├── fsdword.h ├── win_gqos.h ├── ui │ ├── ui_menus.h │ └── menudefinition.h ├── bg_shared.h ├── crashrpt │ └── crashrpt_lang.ini ├── fsdword.asm ├── bg_items.h ├── crc.h ├── xassets │ ├── menulist.h │ ├── fx.h │ ├── simple.h │ ├── font.h │ └── gfximage.h ├── msvc_proto.h ├── callbacks.h ├── cg_scoreboard.h ├── null.c ├── dobj.h ├── cg_weapons.h ├── cg_local_mp.h ├── dobj.c ├── server.c ├── bg_shared.c ├── stringed_public.h ├── sys_patch.h ├── keys.h ├── pmove.c ├── bg_items.c ├── snd_system.h ├── steam_interface.h ├── g_team.c ├── cg_font.c ├── com_stringtable.c ├── client_callbacks.asm ├── other.c ├── com_findxassets.c ├── cl_rank.c ├── sv_main.c ├── httpftp.h └── net_reliabletransport.h ├── external ├── mbedtls │ ├── .gitignore │ ├── src │ │ └── version.c │ ├── include │ │ └── mbedtls │ │ │ └── havege.h │ └── CMakeLists.txt ├── steam_api │ ├── include │ │ └── steam_api │ │ │ ├── isteammasterserverupdater.h │ │ │ ├── steam_shared.h │ │ │ ├── steamtypes.h │ │ │ ├── steamhttpenums.h │ │ │ ├── isteamgamecoordinator.h │ │ │ ├── isteamgameserverstats.h │ │ │ ├── steamcontrollerpublic.h │ │ │ ├── isteamps3overlayrenderer.h │ │ │ ├── steamencryptedappticket.h │ │ │ ├── steam_apix.h │ │ │ ├── targetver.h │ │ │ ├── opensteamworks │ │ │ ├── IImportStruct.h │ │ │ ├── ContentServerCommon.h │ │ │ └── ECurrencyCode.h │ │ │ ├── steamuniverse.h │ │ │ ├── isteamappticket.h │ │ │ └── isteammusic.h │ ├── external │ │ └── libudis86 │ │ │ ├── CMakeLists.txt │ │ │ └── include │ │ │ └── udis86 │ │ │ └── syn.h │ └── CMakeLists.txt ├── discord-rpc │ ├── src │ │ ├── dllmain.cpp │ │ ├── connection.h │ │ ├── backoff.h │ │ ├── msg_queue.h │ │ ├── rapidjson │ │ │ └── internal │ │ │ │ └── swap.h │ │ └── rpc_connection.h │ ├── include │ │ └── discord-rpc │ │ │ └── discord_register.h │ ├── CMakeLists.txt │ └── LICENSE ├── client-auth │ └── CMakeLists.txt ├── tomcrypt │ ├── src │ │ ├── misc │ │ │ ├── crypt │ │ │ │ ├── crypt_ltc_mp_descriptor.c │ │ │ │ ├── crypt_prng_descriptor.c │ │ │ │ ├── crypt_hash_descriptor.c │ │ │ │ ├── crypt_argchk.c │ │ │ │ ├── crypt_hash_is_valid.c │ │ │ │ ├── crypt_prng_is_valid.c │ │ │ │ ├── crypt_find_hash.c │ │ │ │ ├── crypt_unregister_hash.c │ │ │ │ └── crypt_register_hash.c │ │ │ └── zeromem.c │ │ ├── math │ │ │ ├── bn_mp_mod_d.c │ │ │ ├── bn_mp_radix_smap.c │ │ │ ├── bn_mp_signed_bin_size.c │ │ │ ├── bn_mp_set.c │ │ │ ├── bn_mp_unsigned_bin_size.c │ │ │ ├── bn_mp_init_copy.c │ │ │ ├── bn_mp_exch.c │ │ │ ├── bn_mp_zero.c │ │ │ ├── bn_mp_clear_multi.c │ │ │ ├── bn_mp_to_signed_bin.c │ │ │ ├── bn_reverse.c │ │ │ ├── bn_mp_to_signed_bin_n.c │ │ │ ├── bn_mp_dr_setup.c │ │ │ ├── bn_mp_to_unsigned_bin_n.c │ │ │ ├── bn_mp_reduce_setup.c │ │ │ ├── bn_mp_neg.c │ │ │ ├── bn_mp_sqrmod.c │ │ │ ├── bn_mp_mulmod.c │ │ │ ├── bn_mp_abs.c │ │ │ ├── bn_mp_cmp_d.c │ │ │ ├── bn_mp_cmp.c │ │ │ ├── bn_mp_clear.c │ │ │ ├── bn_mp_reduce_2k_setup_l.c │ │ │ ├── bn_mp_count_bits.c │ │ │ ├── bn_mp_dr_is_modulus.c │ │ │ ├── bn_mp_mod.c │ │ │ ├── bn_mp_invmod.c │ │ │ ├── bn_mp_read_signed_bin.c │ │ │ ├── bn_mp_clamp.c │ │ │ ├── bn_mp_init.c │ │ │ ├── bn_mp_reduce_2k_setup.c │ │ │ ├── bn_mp_reduce_is_2k_l.c │ │ │ ├── bn_mp_init_size.c │ │ │ ├── bn_mp_get_int.c │ │ │ ├── bn_mp_set_int.c │ │ │ ├── bn_mp_2expt.c │ │ │ ├── bn_mp_to_unsigned_bin.c │ │ │ ├── bncore.c │ │ │ ├── bn_mp_prime_is_divisible.c │ │ │ ├── bn_mp_cmp_mag.c │ │ │ ├── bn_mp_cnt_lsb.c │ │ │ ├── bn_mp_reduce_is_2k.c │ │ │ ├── multi.c │ │ │ ├── bn_mp_read_unsigned_bin.c │ │ │ ├── bn_mp_sqr.c │ │ │ ├── bn_mp_reduce_2k.c │ │ │ ├── bn_mp_add.c │ │ │ ├── bn_mp_reduce_2k_l.c │ │ │ ├── bn_mp_mod_2d.c │ │ │ ├── bn_mp_copy.c │ │ │ ├── bn_mp_grow.c │ │ │ ├── bn_mp_lcm.c │ │ │ ├── bn_mp_montgomery_calc_normalization.c │ │ │ ├── bn_mp_div_2.c │ │ │ ├── bn_mp_montgomery_setup.c │ │ │ ├── bn_mp_lshd.c │ │ │ ├── bn_mp_sub.c │ │ │ ├── bn_mp_rshd.c │ │ │ ├── bn_mp_init_multi.c │ │ │ ├── bn_mp_toradix.c │ │ │ ├── bn_mp_mul.c │ │ │ ├── bn_mp_div_3.c │ │ │ ├── bn_mp_mul_d.c │ │ │ ├── bn_mp_prime_is_prime.c │ │ │ ├── bn_mp_mul_2.c │ │ │ └── rand_prime.c │ │ ├── pk │ │ │ ├── rsa │ │ │ │ └── rsa_free.c │ │ │ ├── asn1 │ │ │ │ └── der │ │ │ │ │ ├── boolean │ │ │ │ │ ├── der_length_boolean.c │ │ │ │ │ ├── der_decode_boolean.c │ │ │ │ │ └── der_encode_boolean.c │ │ │ │ │ ├── utctime │ │ │ │ │ └── der_length_utctime.c │ │ │ │ │ ├── bit │ │ │ │ │ └── der_length_bit_string.c │ │ │ │ │ ├── octet │ │ │ │ │ └── der_length_octet_string.c │ │ │ │ │ ├── short_integer │ │ │ │ │ ├── der_decode_short_integer.c │ │ │ │ │ └── der_length_short_integer.c │ │ │ │ │ └── sequence │ │ │ │ │ └── der_sequence_free.c │ │ │ └── pkcs1 │ │ │ │ ├── pkcs_1_os2ip.c │ │ │ │ └── pkcs_1_i2osp.c │ │ ├── mac │ │ │ └── hmac │ │ │ │ └── hmac_process.c │ │ └── hashes │ │ │ └── hash_memory.c │ └── include │ │ └── tomcrypt │ │ ├── tomcrypt_misc.h │ │ └── tomcrypt_argchk.h └── unzip │ ├── include │ └── unzip │ │ └── inffast.h │ └── CMakeLists.txt ├── .gitattributes ├── assets ├── cod4x │ ├── mss │ ├── core │ ├── main │ │ └── jcod4x_00.iwd │ └── zone │ │ ├── cod4x_ambfix.ff │ │ ├── cod4x_patch.ff │ │ └── cod4x_patchv2.ff └── github │ └── banner.png ├── release.sh ├── .editorconfig ├── LICENSE.md ├── .github └── workflows │ └── build.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /src/gfxshared.h: -------------------------------------------------------------------------------- 1 | 2 | char __cdecl ColorIndex(char c); -------------------------------------------------------------------------------- /src/fsdword.h: -------------------------------------------------------------------------------- 1 | 2 | //void* __readfsdword(int index); 3 | -------------------------------------------------------------------------------- /external/mbedtls/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | libmbed* 3 | *.sln 4 | *.vcxproj 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.dll -diff 2 | *.a -diff 3 | *.o -diff 4 | *.exe -diff 5 | *.so -diff -------------------------------------------------------------------------------- /src/win_gqos.h: -------------------------------------------------------------------------------- 1 | void QoS2_Init(int socket, netadr_t* remote); 2 | void QoS2_Shutdown(); -------------------------------------------------------------------------------- /assets/cod4x/mss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/mss -------------------------------------------------------------------------------- /src/ui/ui_menus.h: -------------------------------------------------------------------------------- 1 | void UI_LoadServerNewVersionMenu(uiInfo_t* info, const char* connectadr); 2 | -------------------------------------------------------------------------------- /assets/cod4x/core: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/core -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteammasterserverupdater.h: -------------------------------------------------------------------------------- 1 | #error "This file isn't used any more" 2 | -------------------------------------------------------------------------------- /assets/github/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/github/banner.png -------------------------------------------------------------------------------- /src/bg_shared.h: -------------------------------------------------------------------------------- 1 | double BG_GetBobCycle(playerState_t *ps); 2 | uint16_t BG_VehiclesGetSlotTagName(int seatIndex); 3 | -------------------------------------------------------------------------------- /assets/cod4x/main/jcod4x_00.iwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/main/jcod4x_00.iwd -------------------------------------------------------------------------------- /src/crashrpt/crashrpt_lang.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/src/crashrpt/crashrpt_lang.ini -------------------------------------------------------------------------------- /assets/cod4x/zone/cod4x_ambfix.ff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/zone/cod4x_ambfix.ff -------------------------------------------------------------------------------- /assets/cod4x/zone/cod4x_patch.ff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/zone/cod4x_patch.ff -------------------------------------------------------------------------------- /assets/cod4x/zone/cod4x_patchv2.ff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/assets/cod4x/zone/cod4x_patchv2.ff -------------------------------------------------------------------------------- /src/fsdword.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | SECTION .text 4 | global __readfsdword 5 | __readfsdword: 6 | mov eax, [esp+4] 7 | mov eax, [fs:eax] 8 | ret 9 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steam_shared.h: -------------------------------------------------------------------------------- 1 | 2 | typedef struct 3 | { 4 | uint64_t clanid; 5 | char clanname[32]; 6 | char clantag[16]; 7 | }clan_t; -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steamtypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/steamtypes.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steamhttpenums.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/steamhttpenums.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteamgamecoordinator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/isteamgamecoordinator.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteamgameserverstats.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/isteamgameserverstats.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steamcontrollerpublic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/steamcontrollerpublic.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteamps3overlayrenderer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/isteamps3overlayrenderer.h -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steamencryptedappticket.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callofduty4x/CoD4x_Client_pub/HEAD/external/steam_api/include/steam_api/steamencryptedappticket.h -------------------------------------------------------------------------------- /external/discord-rpc/src/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // outsmart GCC's missing-declarations warning 4 | BOOL WINAPI DllMain(HMODULE, DWORD, LPVOID); 5 | BOOL WINAPI DllMain(HMODULE, DWORD, LPVOID) 6 | { 7 | return TRUE; 8 | } 9 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steam_apix.h: -------------------------------------------------------------------------------- 1 | extern "C" bool SteamAPI_InitX( const wchar_t* dllpath, AppId_t parentAppID, AppId_t gameId, const char* modName, bool overlayrenderer ); 2 | extern "C" void SteamAPI_SetToAuthAppID(bool doauthappid); 3 | -------------------------------------------------------------------------------- /src/bg_items.h: -------------------------------------------------------------------------------- 1 | #ifndef _BG_ITEMS_H_20200506_ 2 | #define _BG_ITEMS_H_20200506_ 3 | 4 | #include "q_shared.h" 5 | 6 | 7 | qboolean BG_CanItemBeGrabbed(playerState_t* ps_, entityState_t* ItemState_, int a3); 8 | 9 | #endif // _BG_ITEMS_H_20200506_ 10 | -------------------------------------------------------------------------------- /src/crc.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned long Crc32_ComputeBuf( unsigned long inCrc32, const void *buf, size_t bufLen ); 4 | /// compute CRC32 (Slicing-by-16 algorithm) 5 | uint32_t crc32_16bytes(const void* data, size_t length, uint32_t previousCrc32); 6 | -------------------------------------------------------------------------------- /src/xassets/menulist.h: -------------------------------------------------------------------------------- 1 | #ifndef _MENULIST_H_20201605_ 2 | #define _MENULIST_H_20201605_ 3 | 4 | typedef struct MenuList 5 | { 6 | const char *name; 7 | int menuCount; 8 | menuDef_t **menus; 9 | } MenuList; 10 | 11 | #endif //_MENULIST_H_20201605_ 12 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -f build/Makefile ] || \ 4 | cmake -S . -B build \ 5 | -DCMAKE_BUILD_TYPE=Release \ 6 | -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc \ 7 | -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ \ 8 | -DOFFICIAL_BUILD=ON 9 | 10 | cmake --build build --parallel $(nproc) 11 | -------------------------------------------------------------------------------- /external/client-auth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | include(FetchContent) 4 | FetchContent_Declare(client-auth 5 | GIT_REPOSITORY git@github.com:callofduty4x/client-auth.git 6 | GIT_TAG 39b9637e9391072ce2bd1beded38da80ac52d3ae 7 | ) 8 | FetchContent_MakeAvailable(client-auth) 9 | -------------------------------------------------------------------------------- /src/msvc_proto.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FILE *__cdecl _fopen(const char *, const char *); 4 | int __cdecl fclose(FILE *File); 5 | size_t __cdecl fread(void *, size_t, size_t, FILE *); 6 | size_t __cdecl fwrite(const void *, size_t, size_t, FILE *); 7 | __int32 __cdecl ftell(FILE *); 8 | int __cdecl fseek(FILE *, __int32, int); -------------------------------------------------------------------------------- /src/callbacks.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALLBACKS_H_20200506_ 2 | #define _CALLBACKS_H_20200506_ 3 | 4 | #include "q_shared.h" 5 | 6 | void __cdecl BG_CanItemBeGrabbed_Hook(); 7 | 8 | char __cdecl WeaponEntCanBeGrabbed(int WeaponIndex_, entityState_t *ItemState_, playerState_t *ps_, int a4); 9 | 10 | #endif // _CALLBACKS_H_20200506_ 11 | -------------------------------------------------------------------------------- /src/cg_scoreboard.h: -------------------------------------------------------------------------------- 1 | #ifndef _CG_SCOREBOARD_H_20200503_ 2 | #define _CG_SCOREBOARD_H_20200503_ 3 | #include "q_shared.h" 4 | 5 | void __cdecl CG_RegisterScoreboardCvars(); 6 | int REGPARM(1) Scoreboard_HandleInput(int a1); 7 | int REGPARM(1) CG_DrawScoreboard(int a1); 8 | 9 | 10 | #endif // _CG_SCOREBOARD_H_20200503_ 11 | -------------------------------------------------------------------------------- /src/null.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void SV_SteamSetUserInfo(uint64_t steamid, int haslicense, int valid) 4 | { 5 | 6 | } 7 | 8 | void SV_SteamStartUserAuthentication(void* cl, void* ticket, unsigned int ticketlen) 9 | { 10 | 11 | } 12 | 13 | int SV_GetSteamUserInfo(uint64_t* steamid, char** playername, int* score) 14 | { 15 | return 0; 16 | } -------------------------------------------------------------------------------- /src/xassets/fx.h: -------------------------------------------------------------------------------- 1 | #ifndef __FX_H__ 2 | #define __FX_H__ 3 | 4 | typedef void FxEffectDef; 5 | 6 | /* 6942 */ 7 | struct FxImpactEntry 8 | { 9 | FxEffectDef *nonflesh[29]; 10 | FxEffectDef *flesh[4]; 11 | }; 12 | 13 | /* 6952 */ 14 | typedef struct 15 | { 16 | const char *name; 17 | struct FxImpactEntry *table; 18 | }FxImpactTable; 19 | 20 | #endif -------------------------------------------------------------------------------- /src/dobj.h: -------------------------------------------------------------------------------- 1 | #ifndef __DOBJ_H__ 2 | #define __DOBJ_H__ 3 | 4 | #include "cg_shared.h" 5 | 6 | signed int DObjGetBoneIndex(DObj_t *obj, unsigned int constBonename, char *index) ; 7 | 8 | int CG_DObjGetLocalBoneMatrix(cpose_t *pose, DObj_t *obj, char index); 9 | DObj_t *Com_GetClientDObj(int handle); 10 | DObjAnimMat * DObjGetRotTransArray(DObj_t *obj); 11 | #endif -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/cg_weapons.h: -------------------------------------------------------------------------------- 1 | #ifndef _CG_WEAPONS_H_20200506_ 2 | #define _CG_WEAPONS_H_20200506_ 3 | 4 | #include "xzone.h" 5 | 6 | // 16 items per weapon asset (view/worldmodels in weapon file). 7 | #define MAX_ITEMS (ASSET_TYPE_WEAPON_COUNT*16) 8 | 9 | extern int bg_itemlist[MAX_ITEMS + 16]; 10 | extern unsigned int itemRegistered[MAX_ITEMS + 16]; 11 | 12 | #endif // _CG_WEAPONS_H_20200506_ 13 | -------------------------------------------------------------------------------- /src/cg_local_mp.h: -------------------------------------------------------------------------------- 1 | #ifndef __CG_LOCAL_MP_H__ 2 | #define __CG_LOCAL_MP_H__ 3 | 4 | #include "cg_shared.h" 5 | 6 | static inline centity_t * CG_GetEntity(int localClientNum, int entityIndex) 7 | { 8 | assert ( (unsigned int)localClientNum < MAX_LOCAL_CLIENTS ); 9 | assert ( (unsigned int)entityIndex < MAX_GENTITIES ); 10 | 11 | //return &cg_entitiesArray[localClientNum][entityIndex]; 12 | return &cgEntities[entityIndex]; 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/dobj.c: -------------------------------------------------------------------------------- 1 | #include "dobj.h" 2 | 3 | 4 | #define clientObjMap ((uint16_t*)(0x14A9F30)) 5 | #define objBuf ((DObj_t*)(0x1477F30)) 6 | 7 | DObj_t *Com_GetClientDObj(int handle) 8 | { 9 | uint16_t index; 10 | 11 | index = clientObjMap[handle]; 12 | 13 | if ( index ) 14 | { 15 | return &objBuf[index]; 16 | } 17 | return NULL; 18 | 19 | } 20 | 21 | DObjAnimMat * DObjGetRotTransArray(DObj_t *obj) 22 | { 23 | return obj->skel.mat; 24 | } -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | ltc_math_descriptor ltc_mp; 14 | -------------------------------------------------------------------------------- /src/xassets/simple.h: -------------------------------------------------------------------------------- 1 | #ifndef __XASSET_SIMPLE_H__ 2 | #define __XASSET_SIMPLE_H__ 3 | 4 | 5 | typedef struct 6 | { 7 | const char *value; 8 | const char *name; 9 | }LocalizeEntry; 10 | 11 | /* 7064 */ 12 | typedef struct 13 | { 14 | const char *name; 15 | int len; 16 | const char *buffer; 17 | }RawFile; 18 | 19 | /* 7065 */ 20 | typedef struct 21 | { 22 | const char *name; 23 | int columnCount; 24 | int rowCount; 25 | const char **values; 26 | }StringTable; 27 | 28 | #endif -------------------------------------------------------------------------------- /external/unzip/include/unzip/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | indent_style = space 11 | indent_size = 4 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | 15 | # Matches multiple files with brace expansion notation 16 | # Set default charset 17 | [*.{hpp,cpp,h,c,ui}] 18 | charset = utf-8 19 | 20 | [*.asm] 21 | indent_style = tab 22 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/opensteamworks/IImportStruct.h: -------------------------------------------------------------------------------- 1 | #ifndef __IIMPORTSTRUCT_H__ 2 | #define __IIMPORTSTRUCT_H__ 3 | 4 | #include "../isteamclient.h" 5 | 6 | typedef struct 7 | { 8 | const char* name; 9 | int index; 10 | }safeimportaccess_t; 11 | 12 | 13 | struct InterfaceDesc_t 14 | { 15 | void* vtable; 16 | const char* classname; 17 | HSteamUser hSteamUser; 18 | HSteamPipe hSteamPipe; 19 | }; 20 | 21 | 22 | typedef uint32_t** classptr_t; 23 | 24 | #define CPPCALL __attribute__((thiscall)) 25 | 26 | #endif -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The following conditions apply: https://support.activision.com/license 2 | 3 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 4 | -------------------------------------------------------------------------------- /external/discord-rpc/src/connection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // This is to wrap the platform specific kinds of connect/read/write. 4 | 5 | #include 6 | #include 7 | 8 | // not really connectiony, but need per-platform 9 | int GetProcessId(); 10 | 11 | struct BaseConnection { 12 | static BaseConnection* Create(); 13 | static void Destroy(BaseConnection*&); 14 | bool isOpen{false}; 15 | bool Open(); 16 | bool Close(); 17 | bool Write(const void* data, size_t length); 18 | bool Read(void* data, size_t length); 19 | }; 20 | -------------------------------------------------------------------------------- /src/server.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | 4 | 5 | #define sv_killserver *(byte*)0x185C410 6 | 7 | void SV_KillLocalServer() 8 | { 9 | if ( com_sv_running->boolean ) 10 | sv_killserver = 1; 11 | } 12 | 13 | void SV_Say_f(); 14 | void SV_Tell_f(); 15 | 16 | void SV_AddDedicatedCommands() 17 | { 18 | Cmd_RemoveCommand("say"); 19 | Cmd_RemoveCommand("tell"); 20 | Cmd_AddCommand("say", Cmd_Stub_f); 21 | Cmd_AddServerCommand("say", SV_Say_f); 22 | Cmd_AddCommand("tell", Cmd_Stub_f); 23 | Cmd_AddServerCommand("tell", SV_Tell_f); 24 | } -------------------------------------------------------------------------------- /src/bg_shared.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | #include "cg_shared.h" 4 | 5 | double BG_GetBobCycle(playerState_t *ps) 6 | { 7 | return (double)(uint8_t)ps->bobCycle / 255.0 * 3.1415927 + (double)(uint8_t)ps->bobCycle / 255.0 * 3.1415927 + 6.2831855; 8 | } 9 | 10 | 11 | uint16_t BG_VehiclesGetSlotTagName(int seatIndex) 12 | { 13 | if ( seatIndex == VEHICLE_RIDESLOT_DRIVER) 14 | return scr_const.tag_driver; 15 | 16 | if ( seatIndex == VEHICLE_RIDESLOT_PASSENGER ) 17 | return scr_const.tag_passenger; 18 | 19 | assert(seatIndex == VEHICLE_RIDESLOT_GUNNER); 20 | 21 | return scr_const.tag_gunner; 22 | } -------------------------------------------------------------------------------- /src/stringed_public.h: -------------------------------------------------------------------------------- 1 | #ifndef COD4X_SRC_STRINGED_PUBLIC_H 2 | #define COD4X_SRC_STRINGED_PUBLIC_H 3 | 4 | enum msgLocErrType_t { 5 | LOCMSG_SAFE = 0x0, 6 | LOCMSG_NOERR = 0x1 7 | }; 8 | 9 | unsigned int SEH_DecodeLetter(unsigned char firstChar, unsigned char secondChar, int *usedCount); 10 | const char* SEH_LocalizeTextMessage(const char *pszInputBuffer, const char *pszMessageType, enum msgLocErrType_t errType); 11 | const char* SEH_StringEd_GetString(const char *pszReference); 12 | int SEH_GetCurrentLanguage(); 13 | int SEH_PrintStrlen(const char *string); 14 | 15 | #endif // COD4X_SRC_STRINGED_PUBLIC_H 16 | -------------------------------------------------------------------------------- /external/steam_api/external/libudis86/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(udis86 VERSION 1.0.0 LANGUAGES C) 3 | include_guard() 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | add_library(udis86 STATIC 10 | src/decode.c 11 | src/itab.c 12 | src/syn.c 13 | src/syn-intel.c 14 | src/udis86.c 15 | ) 16 | 17 | target_include_directories(udis86 PUBLIC 18 | include 19 | ) 20 | 21 | target_compile_options(udis86 PRIVATE -m32 -std=c11) 22 | target_link_options(udis86 PRIVATE -m32) 23 | 24 | -------------------------------------------------------------------------------- /external/discord-rpc/include/discord-rpc/discord_register.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(DISCORD_DYNAMIC_LIB) 4 | #if defined(_WIN32) 5 | #if defined(DISCORD_BUILDING_SDK) 6 | #define DISCORD_EXPORT __declspec(dllexport) 7 | #else 8 | #define DISCORD_EXPORT __declspec(dllimport) 9 | #endif 10 | #else 11 | #define DISCORD_EXPORT __attribute__((visibility("default"))) 12 | #endif 13 | #else 14 | #define DISCORD_EXPORT 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command); 22 | DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/steamuniverse.h: -------------------------------------------------------------------------------- 1 | //========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef STEAMUNIVERSE_H 8 | #define STEAMUNIVERSE_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | // Steam universes. Each universe is a self-contained Steam instance. 15 | enum EUniverse 16 | { 17 | k_EUniverseInvalid = 0, 18 | k_EUniversePublic = 1, 19 | k_EUniverseBeta = 2, 20 | k_EUniverseInternal = 3, 21 | k_EUniverseDev = 4, 22 | // k_EUniverseRC = 5, // no such universe anymore 23 | k_EUniverseMax 24 | }; 25 | 26 | 27 | #endif // STEAMUNIVERSE_H 28 | -------------------------------------------------------------------------------- /external/unzip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(unzip VERSION 1.0.0 LANGUAGES C) 3 | include_guard() 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | add_library(unzip STATIC) 10 | 11 | target_sources(unzip PRIVATE 12 | src/adler32.c 13 | src/crc32.c 14 | src/deflate.c 15 | src/inffast.c 16 | src/inflate.c 17 | src/inftrees.c 18 | src/trees.c 19 | src/unzip.c 20 | ) 21 | 22 | target_include_directories(unzip 23 | PRIVATE include/unzip 24 | PUBLIC include 25 | ) 26 | 27 | target_compile_options(unzip PRIVATE -m32 -std=c11) 28 | target_link_options(unzip PRIVATE -m32) 29 | 30 | -------------------------------------------------------------------------------- /external/steam_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(steam-api VERSION 1.0.0 LANGUAGES C CXX) 3 | include_guard() 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | add_subdirectory(external/libudis86) 10 | 11 | add_library(steam-api STATIC) 12 | 13 | target_sources(steam-api PRIVATE 14 | src/steam_api.cpp 15 | src/steam_interface.cpp 16 | ) 17 | 18 | target_include_directories(steam-api PUBLIC 19 | include 20 | ) 21 | 22 | target_compile_options(steam-api PRIVATE -m32 -std=c++14) 23 | 24 | target_link_options(steam-api PRIVATE -m32) 25 | 26 | target_link_libraries(steam-api PRIVATE 27 | udis86 28 | ) 29 | -------------------------------------------------------------------------------- /external/tomcrypt/include/tomcrypt/tomcrypt_misc.h: -------------------------------------------------------------------------------- 1 | /* ---- LTC_BASE64 Routines ---- */ 2 | #ifdef LTC_BASE64 3 | int base64_encode(const unsigned char *in, unsigned long len, 4 | unsigned char *out, unsigned long *outlen); 5 | 6 | int base64_decode(const unsigned char *in, unsigned long len, 7 | unsigned char *out, unsigned long *outlen); 8 | #endif 9 | 10 | /* ---- MEM routines ---- */ 11 | void zeromem(void *dst, size_t len); 12 | void burn_stack(unsigned long len); 13 | 14 | const char *error_to_string(int err); 15 | 16 | extern const char *crypt_build_settings; 17 | 18 | /* ---- HMM ---- */ 19 | int crypt_fsa(void *mp, ...); 20 | 21 | /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_misc.h,v $ */ 22 | /* $Revision: 1.5 $ */ 23 | /* $Date: 2007/05/12 14:32:35 $ */ 24 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mod_d.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MOD_D_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | int 19 | mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) 20 | { 21 | return mp_div_d(a, b, NULL, c); 22 | } 23 | #endif 24 | 25 | /* $Source$ */ 26 | /* $Revision: 0.41 $ */ 27 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 28 | -------------------------------------------------------------------------------- /src/sys_patch.h: -------------------------------------------------------------------------------- 1 | 2 | #define CALL 0xe8 3 | #define MOV_EAX_ESI 0x89, 0xf0 4 | #define MOV_ESI_EDX 0x89, 0xd6 5 | #define MOV_EDX_ESI 0x89, 0xf2 6 | #define MOV_EDX_ESP 0x89, 0xe2 7 | #define MOV_EAX_EBX 0x89, 0xd8 8 | #define MOV_EAX_EBP 0x89, 0xe8 9 | #define NOP 0x90 10 | #define PUSH_ESI 0x56 11 | #define PUSH_EDI 0x57 12 | #define PUSH_EAX 0x50 13 | #define PUSH_EBX 0x53 14 | #define PUSH_EDX 0x52 15 | #define PUSH_EBP 0x55 16 | #define POP_EBX 0x5b 17 | #define POP_ECX 0x59 18 | #define POP_EDX 0x5a 19 | #define RET 0xc3 20 | #define CALL_ZERO 0xe8, 0x00, 0x00, 0x00, 0x00 21 | #define ADD_ESP 0x83, 0xc4, 22 | #define ADD_EDX_DWORD 0x81, 0xc2, 23 | #define ADD_EDX 0x83, 0xc2, 24 | #define ADD_EAX 0x83, 0xc0, 25 | #define JMP_SHORT 0xeb 26 | 27 | void SetCall(DWORD addr, void* destination); 28 | void SetJump(DWORD addr, void* destination); 29 | void WriteSymbol(DWORD addr, void* symbol); -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_prng_descriptor.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_prng_descriptor.c 15 | Stores the PRNG descriptors, Tom St Denis 16 | */ 17 | struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = { 18 | { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 19 | }; 20 | 21 | LTC_MUTEX_GLOBAL(ltc_prng_mutex) 22 | 23 | 24 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c,v $ */ 25 | /* $Revision: 1.8 $ */ 26 | /* $Date: 2006/12/28 01:27:24 $ */ 27 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_hash_descriptor.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_hash_descriptor.c 15 | Stores the hash descriptor table, Tom St Denis 16 | */ 17 | 18 | struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = { 19 | { NULL, 0, 0, 0, { 0 }, 0, NULL, NULL, NULL, NULL, NULL } 20 | }; 21 | 22 | LTC_MUTEX_GLOBAL(ltc_hash_mutex) 23 | 24 | 25 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c,v $ */ 26 | /* $Revision: 1.10 $ */ 27 | /* $Date: 2006/12/28 01:27:24 $ */ 28 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_radix_smap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_RADIX_SMAP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* chars used in radix conversions */ 19 | const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; 20 | #endif 21 | 22 | /* $Source$ */ 23 | /* $Revision: 0.41 $ */ 24 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 25 | -------------------------------------------------------------------------------- /src/keys.h: -------------------------------------------------------------------------------- 1 | 2 | #define playerKeys (*((PlayerKeyState_t*)(0x8F1CA0))) 3 | 4 | #define MAX_KEYS 256 5 | 6 | typedef struct 7 | { 8 | qboolean down; 9 | int repeats; 10 | const char *binding; 11 | }qkey_t; 12 | 13 | typedef enum 14 | { 15 | LOC_SEL_INPUT_NONE = 0x0, 16 | LOC_SEL_INPUT_CONFIRM = 0x1, 17 | LOC_SEL_INPUT_CANCEL = 0x2, 18 | }LocSelInputState_t; 19 | 20 | 21 | typedef struct 22 | { 23 | int cursor; 24 | int scroll; 25 | int drawWidth; 26 | int widthInPixels; 27 | float charHeight; 28 | int fixedSize; 29 | char buffer[256]; 30 | }field_t; 31 | 32 | typedef struct PlayerKeyState_s 33 | { 34 | field_t chatField; 35 | int chat_team; 36 | int overstrikeMode; 37 | int anyKeyDown; 38 | qkey_t keys[MAX_KEYS]; 39 | LocSelInputState_t locSelInputState; 40 | }PlayerKeyState_t; 41 | 42 | typedef struct keyname_s 43 | { 44 | const char *name; 45 | int keynum; 46 | }keyname_t; -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_signed_bin_size.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SIGNED_BIN_SIZE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* get the size for an signed equivalent */ 19 | int mp_signed_bin_size (mp_int * a) 20 | { 21 | return 1 + mp_unsigned_bin_size (a); 22 | } 23 | #endif 24 | 25 | /* $Source$ */ 26 | /* $Revision: 0.41 $ */ 27 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 28 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_set.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SET_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* set to a digit */ 19 | void mp_set (mp_int * a, mp_digit b) 20 | { 21 | mp_zero (a); 22 | a->dp[0] = b & MP_MASK; 23 | a->used = (a->dp[0] != 0) ? 1 : 0; 24 | } 25 | #endif 26 | 27 | /* $Source$ */ 28 | /* $Revision: 0.41 $ */ 29 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 30 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_argchk.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | #include 13 | 14 | /** 15 | @file crypt_argchk.c 16 | Perform argument checking, Tom St Denis 17 | */ 18 | 19 | #if (ARGTYPE == 0) 20 | void crypt_argchk(char *v, char *s, int d) 21 | { 22 | fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n", 23 | v, d, s); 24 | //(void)raise(SIGABRT); 25 | __asm__("int $3"); 26 | } 27 | #endif 28 | 29 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_argchk.c,v $ */ 30 | /* $Revision: 1.5 $ */ 31 | /* $Date: 2006/12/28 01:27:24 $ */ 32 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/rsa/rsa_free.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file rsa_free.c 15 | Free an RSA key, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_MRSA 19 | 20 | /** 21 | Free an RSA key from memory 22 | @param key The RSA key to free 23 | */ 24 | void rsa_free(rsa_key *key) 25 | { 26 | LTC_ARGCHKVD(key != NULL); 27 | mp_clear_multi(key->e, key->d, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL); 28 | } 29 | 30 | #endif 31 | 32 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_free.c,v $ */ 33 | /* $Revision: 1.10 $ */ 34 | /* $Date: 2007/05/12 14:32:35 $ */ 35 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_unsigned_bin_size.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_UNSIGNED_BIN_SIZE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* get the size for an unsigned equivalent */ 19 | int mp_unsigned_bin_size (mp_int * a) 20 | { 21 | int size = mp_count_bits (a); 22 | return (size / 8 + ((size & 7) != 0 ? 1 : 0)); 23 | } 24 | #endif 25 | 26 | /* $Source$ */ 27 | /* $Revision: 0.41 $ */ 28 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 29 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_init_copy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_INIT_COPY_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* creates "a" then copies b into it */ 19 | int mp_init_copy (mp_int * a, mp_int * b) 20 | { 21 | int res; 22 | 23 | if ((res = mp_init (a)) != MP_OKAY) { 24 | return res; 25 | } 26 | return mp_copy (b, a); 27 | } 28 | #endif 29 | 30 | /* $Source$ */ 31 | /* $Revision: 0.41 $ */ 32 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 33 | -------------------------------------------------------------------------------- /external/discord-rpc/src/backoff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | struct Backoff { 9 | int64_t minAmount; 10 | int64_t maxAmount; 11 | int64_t current; 12 | int fails; 13 | std::mt19937_64 randGenerator; 14 | std::uniform_real_distribution<> randDistribution; 15 | 16 | double rand01() { return randDistribution(randGenerator); } 17 | 18 | Backoff(int64_t min, int64_t max) 19 | : minAmount(min) 20 | , maxAmount(max) 21 | , current(min) 22 | , fails(0) 23 | , randGenerator((uint64_t)time(0)) 24 | { 25 | } 26 | 27 | void reset() 28 | { 29 | fails = 0; 30 | current = minAmount; 31 | } 32 | 33 | int64_t nextDelay() 34 | { 35 | ++fails; 36 | int64_t delay = (int64_t)((double)current * 2.0 * rand01()); 37 | current = std::min(current + delay, maxAmount); 38 | return current; 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /external/discord-rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(discord-rpc VERSION 1.0.0 LANGUAGES CXX) 3 | include_guard() 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | add_library(discord-rpc STATIC) 10 | 11 | target_sources(discord-rpc PRIVATE 12 | src/connection_win.cpp 13 | src/discord_register_win.cpp 14 | src/discord_rpc.cpp 15 | src/rpc_connection.cpp 16 | src/serialization.cpp 17 | ) 18 | 19 | target_include_directories(discord-rpc 20 | PUBLIC include 21 | PRIVATE include/discord-rpc 22 | ) 23 | 24 | target_compile_definitions(discord-rpc PRIVATE 25 | STRICT_ANSI=1 26 | ) 27 | 28 | target_compile_options(discord-rpc PRIVATE 29 | -ansi 30 | -m32 31 | -s 32 | -std=c++14 33 | ) 34 | 35 | target_link_options(discord-rpc PRIVATE 36 | -export-all-symbols 37 | -m32 38 | ) 39 | 40 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_exch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_EXCH_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* swap the elements of two integers, for cases where you can't simply swap the 19 | * mp_int pointers around 20 | */ 21 | void 22 | mp_exch (mp_int * a, mp_int * b) 23 | { 24 | mp_int t; 25 | 26 | t = *a; 27 | *a = *b; 28 | *b = t; 29 | } 30 | #endif 31 | 32 | /* $Source$ */ 33 | /* $Revision: 0.41 $ */ 34 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 35 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_zero.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_ZERO_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* set to zero */ 19 | void mp_zero (mp_int * a) 20 | { 21 | int n; 22 | mp_digit *tmp; 23 | 24 | a->sign = MP_ZPOS; 25 | a->used = 0; 26 | 27 | tmp = a->dp; 28 | for (n = 0; n < a->alloc; n++) { 29 | *tmp++ = 0; 30 | } 31 | } 32 | #endif 33 | 34 | /* $Source$ */ 35 | /* $Revision: 0.41 $ */ 36 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 37 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/zeromem.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file zeromem.c 15 | Zero a block of memory, Tom St Denis 16 | */ 17 | 18 | /** 19 | Zero a block of memory 20 | @param out The destination of the area to zero 21 | @param outlen The length of the area to zero (octets) 22 | */ 23 | void zeromem(void *out, size_t outlen) 24 | { 25 | unsigned char *mem = out; 26 | LTC_ARGCHKVD(out != NULL); 27 | while (outlen-- > 0) { 28 | *mem++ = 0; 29 | } 30 | } 31 | 32 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/zeromem.c,v $ */ 33 | /* $Revision: 1.7 $ */ 34 | /* $Date: 2006/12/28 01:27:24 $ */ 35 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_length_boolean.c 15 | ASN.1 DER, get length of a BOOLEAN, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_DER 19 | /** 20 | Gets length of DER encoding of a BOOLEAN 21 | @param outlen [out] The length of the DER encoding 22 | @return CRYPT_OK if successful 23 | */ 24 | int der_length_boolean(unsigned long *outlen) 25 | { 26 | LTC_ARGCHK(outlen != NULL); 27 | *outlen = 3; 28 | return CRYPT_OK; 29 | } 30 | 31 | #endif 32 | 33 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c,v $ */ 34 | /* $Revision: 1.3 $ */ 35 | /* $Date: 2006/12/28 01:27:24 $ */ 36 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_clear_multi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CLEAR_MULTI_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | #include 18 | 19 | void mp_clear_multi(mp_int *mp, ...) 20 | { 21 | mp_int* next_mp = mp; 22 | va_list args; 23 | va_start(args, mp); 24 | while (next_mp != NULL) { 25 | mp_clear(next_mp); 26 | next_mp = va_arg(args, mp_int*); 27 | } 28 | va_end(args); 29 | } 30 | #endif 31 | 32 | /* $Source$ */ 33 | /* $Revision: 0.41 $ */ 34 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 35 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_to_signed_bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_TO_SIGNED_BIN_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* store in signed [big endian] format */ 19 | int mp_to_signed_bin (mp_int * a, unsigned char *b) 20 | { 21 | int res; 22 | 23 | if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { 24 | return res; 25 | } 26 | b[0] = (unsigned char) ((a->sign == MP_ZPOS) ? 0 : 1); 27 | return MP_OKAY; 28 | } 29 | #endif 30 | 31 | /* $Source$ */ 32 | /* $Revision: 0.41 $ */ 33 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 34 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_reverse.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_REVERSE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* reverse an array, used for radix code */ 19 | void 20 | bn_reverse (unsigned char *s, int len) 21 | { 22 | int ix, iy; 23 | unsigned char t; 24 | 25 | ix = 0; 26 | iy = len - 1; 27 | while (ix < iy) { 28 | t = s[ix]; 29 | s[ix] = s[iy]; 30 | s[iy] = t; 31 | ++ix; 32 | --iy; 33 | } 34 | } 35 | #endif 36 | 37 | /* $Source$ */ 38 | /* $Revision: 0.41 $ */ 39 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 40 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_to_signed_bin_n.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_TO_SIGNED_BIN_N_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* store in signed [big endian] format */ 19 | int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) 20 | { 21 | if (*outlen < (unsigned long)mp_signed_bin_size(a)) { 22 | return MP_VAL; 23 | } 24 | *outlen = mp_signed_bin_size(a); 25 | return mp_to_signed_bin(a, b); 26 | } 27 | #endif 28 | 29 | /* $Source$ */ 30 | /* $Revision: 0.41 $ */ 31 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 32 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_dr_setup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_DR_SETUP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines the setup value */ 19 | void mp_dr_setup(mp_int *a, mp_digit *d) 20 | { 21 | /* the casts are required if DIGIT_BIT is one less than 22 | * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] 23 | */ 24 | *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - 25 | ((mp_word)a->dp[0])); 26 | } 27 | 28 | #endif 29 | 30 | /* $Source$ */ 31 | /* $Revision: 0.41 $ */ 32 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 33 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_to_unsigned_bin_n.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_TO_UNSIGNED_BIN_N_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* store in unsigned [big endian] format */ 19 | int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) 20 | { 21 | if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { 22 | return MP_VAL; 23 | } 24 | *outlen = mp_unsigned_bin_size(a); 25 | return mp_to_unsigned_bin(a, b); 26 | } 27 | #endif 28 | 29 | /* $Source$ */ 30 | /* $Revision: 0.41 $ */ 31 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 32 | -------------------------------------------------------------------------------- /src/pmove.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | 4 | 5 | #define mantle_enable getcvaradr(0x730e58) 6 | #define mantle_view_yawcap getcvaradr(0x730e68) 7 | 8 | 9 | void Mantle_CapView(playerState_t *ps) 10 | { 11 | double v2; 12 | double v3; 13 | 14 | if ( mantle_enable->boolean ) 15 | { 16 | v2 = AngleDelta(ps->mantleState.yaw, ps->viewangles[1]); 17 | v3 = -mantle_view_yawcap->floatval; 18 | if ( v3 > (double)v2 || mantle_view_yawcap->floatval < v2 ) 19 | { 20 | if(mantle_view_yawcap->floatval <= 0.0) 21 | { 22 | Cvar_SetFloat(mantle_view_yawcap, 0.5); 23 | } 24 | 25 | while( v3 > v2 ) 26 | { 27 | v2 += mantle_view_yawcap->floatval; 28 | } 29 | while( mantle_view_yawcap->floatval < v2) 30 | { 31 | v2 -= mantle_view_yawcap->floatval; 32 | } 33 | 34 | if ( v2 <= 0.0 ) 35 | { 36 | v3 = mantle_view_yawcap->floatval; 37 | } 38 | ps->delta_angles[1] = v2 + ps->delta_angles[1]; 39 | ps->viewangles[1] = AngleNormalize360(ps->mantleState.yaw + v3); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file pkcs_1_os2ip.c 15 | Octet to Integer OS2IP, Tom St Denis 16 | */ 17 | #ifdef LTC_PKCS_1 18 | 19 | /** 20 | Read a binary string into an mp_int 21 | @param n [out] The mp_int destination 22 | @param in The binary string to read 23 | @param inlen The length of the binary string 24 | @return CRYPT_OK if successful 25 | */ 26 | int pkcs_1_os2ip(void *n, unsigned char *in, unsigned long inlen) 27 | { 28 | return mp_read_unsigned_bin(n, in, inlen); 29 | } 30 | 31 | #endif /* LTC_PKCS_1 */ 32 | 33 | 34 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c,v $ */ 35 | /* $Revision: 1.7 $ */ 36 | /* $Date: 2007/05/12 14:32:35 $ */ 37 | -------------------------------------------------------------------------------- /external/discord-rpc/src/msg_queue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // A simple queue. No locks, but only works with a single thread as producer and a single thread as 6 | // a consumer. Mutex up as needed. 7 | 8 | template 9 | class MsgQueue { 10 | ElementType queue_[QueueSize]; 11 | std::atomic_uint nextAdd_{0}; 12 | std::atomic_uint nextSend_{0}; 13 | std::atomic_uint pendingSends_{0}; 14 | 15 | public: 16 | MsgQueue() {} 17 | 18 | ElementType* GetNextAddMessage() 19 | { 20 | // if we are falling behind, bail 21 | if (pendingSends_.load() >= QueueSize) { 22 | return nullptr; 23 | } 24 | auto index = (nextAdd_++) % QueueSize; 25 | return &queue_[index]; 26 | } 27 | void CommitAdd() { ++pendingSends_; } 28 | 29 | bool HavePendingSends() const { return pendingSends_.load() != 0; } 30 | ElementType* GetNextSendMessage() 31 | { 32 | auto index = (nextSend_++) % QueueSize; 33 | return &queue_[index]; 34 | } 35 | void CommitSend() { --pendingSends_; } 36 | }; 37 | -------------------------------------------------------------------------------- /external/discord-rpc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 Discord, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_setup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_SETUP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* pre-calculate the value required for Barrett reduction 19 | * For a given modulus "b" it calulates the value required in "a" 20 | */ 21 | int mp_reduce_setup (mp_int * a, mp_int * b) 22 | { 23 | int res; 24 | 25 | if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { 26 | return res; 27 | } 28 | return mp_div (a, b, a, NULL); 29 | } 30 | #endif 31 | 32 | /* $Source$ */ 33 | /* $Revision: 0.41 $ */ 34 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 35 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_neg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_NEG_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* b = -a */ 19 | int mp_neg (mp_int * a, mp_int * b) 20 | { 21 | int res; 22 | if (a != b) { 23 | if ((res = mp_copy (a, b)) != MP_OKAY) { 24 | return res; 25 | } 26 | } 27 | 28 | if (mp_iszero(b) != MP_YES) { 29 | b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; 30 | } else { 31 | b->sign = MP_ZPOS; 32 | } 33 | 34 | return MP_OKAY; 35 | } 36 | #endif 37 | 38 | /* $Source$ */ 39 | /* $Revision: 0.41 $ */ 40 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 41 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_sqrmod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SQRMOD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* c = a * a (mod b) */ 19 | int 20 | mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) 21 | { 22 | int res; 23 | mp_int t; 24 | 25 | if ((res = mp_init (&t)) != MP_OKAY) { 26 | return res; 27 | } 28 | 29 | if ((res = mp_sqr (a, &t)) != MP_OKAY) { 30 | mp_clear (&t); 31 | return res; 32 | } 33 | res = mp_mod (&t, b, c); 34 | mp_clear (&t); 35 | return res; 36 | } 37 | #endif 38 | 39 | /* $Source$ */ 40 | /* $Revision: 0.41 $ */ 41 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 42 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mulmod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MULMOD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* d = a * b (mod c) */ 19 | int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) 20 | { 21 | int res; 22 | mp_int t; 23 | 24 | if ((res = mp_init (&t)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | if ((res = mp_mul (a, b, &t)) != MP_OKAY) { 29 | mp_clear (&t); 30 | return res; 31 | } 32 | res = mp_mod (&t, c, d); 33 | mp_clear (&t); 34 | return res; 35 | } 36 | #endif 37 | 38 | /* $Source$ */ 39 | /* $Revision: 0.41 $ */ 40 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 41 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_hash_is_valid.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_hash_is_valid.c 15 | Determine if hash is valid, Tom St Denis 16 | */ 17 | 18 | /* 19 | Test if a hash index is valid 20 | @param idx The index of the hash to search for 21 | @return CRYPT_OK if valid 22 | */ 23 | int hash_is_valid(int idx) 24 | { 25 | LTC_MUTEX_LOCK(<c_hash_mutex); 26 | if (idx < 0 || idx >= TAB_SIZE || hash_descriptor[idx].name == NULL) { 27 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 28 | return CRYPT_INVALID_HASH; 29 | } 30 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 31 | return CRYPT_OK; 32 | } 33 | 34 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c,v $ */ 35 | /* $Revision: 1.6 $ */ 36 | /* $Date: 2006/12/28 01:27:24 $ */ 37 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_prng_is_valid.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_prng_is_valid.c 15 | Determine if PRNG is valid, Tom St Denis 16 | */ 17 | 18 | /* 19 | Test if a PRNG index is valid 20 | @param idx The index of the PRNG to search for 21 | @return CRYPT_OK if valid 22 | */ 23 | int prng_is_valid(int idx) 24 | { 25 | LTC_MUTEX_LOCK(<c_prng_mutex); 26 | if (idx < 0 || idx >= TAB_SIZE || prng_descriptor[idx].name == NULL) { 27 | LTC_MUTEX_UNLOCK(<c_prng_mutex); 28 | return CRYPT_INVALID_PRNG; 29 | } 30 | LTC_MUTEX_UNLOCK(<c_prng_mutex); 31 | return CRYPT_OK; 32 | } 33 | 34 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c,v $ */ 35 | /* $Revision: 1.6 $ */ 36 | /* $Date: 2006/12/28 01:27:24 $ */ 37 | -------------------------------------------------------------------------------- /external/tomcrypt/include/tomcrypt/tomcrypt_argchk.h: -------------------------------------------------------------------------------- 1 | /* Defines the LTC_ARGCHK macro used within the library */ 2 | /* ARGTYPE is defined in mycrypt_cfg.h */ 3 | #if ARGTYPE == 0 4 | 5 | #include 6 | 7 | /* this is the default LibTomCrypt macro */ 8 | void crypt_argchk(char *v, char *s, int d); 9 | #define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } 10 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 11 | 12 | #elif ARGTYPE == 1 13 | 14 | /* fatal type of error */ 15 | #define LTC_ARGCHK(x) assert((x)) 16 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 17 | 18 | #elif ARGTYPE == 2 19 | 20 | #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); } 21 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 22 | 23 | #elif ARGTYPE == 3 24 | 25 | #define LTC_ARGCHK(x) 26 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 27 | 28 | #elif ARGTYPE == 4 29 | 30 | #define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG; 31 | #define LTC_ARGCHKVD(x) if (!(x)) return; 32 | 33 | #endif 34 | 35 | 36 | /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */ 37 | /* $Revision: 1.5 $ */ 38 | /* $Date: 2006/08/27 20:50:21 $ */ 39 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_ABS_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* b = |a| 19 | * 20 | * Simple function copies the input and fixes the sign to positive 21 | */ 22 | int 23 | mp_abs (mp_int * a, mp_int * b) 24 | { 25 | int res; 26 | 27 | /* copy a to b */ 28 | if (a != b) { 29 | if ((res = mp_copy (a, b)) != MP_OKAY) { 30 | return res; 31 | } 32 | } 33 | 34 | /* force the sign of b to positive */ 35 | b->sign = MP_ZPOS; 36 | 37 | return MP_OKAY; 38 | } 39 | #endif 40 | 41 | /* $Source$ */ 42 | /* $Revision: 0.41 $ */ 43 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 44 | -------------------------------------------------------------------------------- /src/bg_items.c: -------------------------------------------------------------------------------- 1 | #include "bg_items.h" 2 | 3 | #include "callbacks.h" 4 | #include "cg_weapons.h" 5 | 6 | #include "xassets/weapondef.h" 7 | 8 | 9 | qboolean BG_CanItemBeGrabbed(playerState_t *ps_, entityState_t *ItemState_, int a3) 10 | { 11 | if (!ps_ || !ItemState_) 12 | return qfalse; 13 | 14 | if ((ps_->weapFlags & 0xFF) < 0) 15 | return qfalse; 16 | 17 | clipHandle_t itemClipHandle = ItemState_->index; 18 | if (itemClipHandle < 1 || itemClipHandle >= MAX_ITEMS) 19 | { 20 | Com_Error(ERR_DROP, "BG_CanItemBeGrabbed: index out of range (index is %i, eType is %i)", itemClipHandle, ItemState_->eType); 21 | } 22 | 23 | if (ItemState_->clientNum == ps_->clientNum || ps_->pm_flags & 0x100000) 24 | return qfalse; 25 | 26 | int weaponIndex = itemClipHandle % 128; 27 | WeaponDef *weaponItem = bg_weaponDefs[weaponIndex]; 28 | if (!WeaponEntCanBeGrabbed(weaponIndex, ItemState_, ps_, a3)) 29 | { 30 | int altWeaponIndex = weaponItem->altWeaponIndex; 31 | if (!altWeaponIndex || !WeaponEntCanBeGrabbed(altWeaponIndex, ItemState_, ps_, a3)) 32 | return qfalse; 33 | } 34 | return qtrue; 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_cmp_d.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CMP_D_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* compare a digit */ 19 | int mp_cmp_d(mp_int * a, mp_digit b) 20 | { 21 | /* compare based on sign */ 22 | if (a->sign == MP_NEG) { 23 | return MP_LT; 24 | } 25 | 26 | /* compare based on magnitude */ 27 | if (a->used > 1) { 28 | return MP_GT; 29 | } 30 | 31 | /* compare the only digit of a to b */ 32 | if (a->dp[0] > b) { 33 | return MP_GT; 34 | } else if (a->dp[0] < b) { 35 | return MP_LT; 36 | } else { 37 | return MP_EQ; 38 | } 39 | } 40 | #endif 41 | 42 | /* $Source$ */ 43 | /* $Revision: 0.41 $ */ 44 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 45 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_cmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CMP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* compare two ints (signed)*/ 19 | int 20 | mp_cmp (mp_int * a, mp_int * b) 21 | { 22 | /* compare based on sign */ 23 | if (a->sign != b->sign) { 24 | if (a->sign == MP_NEG) { 25 | return MP_LT; 26 | } else { 27 | return MP_GT; 28 | } 29 | } 30 | 31 | /* compare digits */ 32 | if (a->sign == MP_NEG) { 33 | /* if negative compare opposite direction */ 34 | return mp_cmp_mag(b, a); 35 | } else { 36 | return mp_cmp_mag(a, b); 37 | } 38 | } 39 | #endif 40 | 41 | /* $Source$ */ 42 | /* $Revision: 0.41 $ */ 43 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 44 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_clear.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CLEAR_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* clear one (frees) */ 19 | void 20 | mp_clear (mp_int * a) 21 | { 22 | int i; 23 | 24 | /* only do anything if a hasn't been freed previously */ 25 | if (a->dp != NULL) { 26 | /* first zero the digits */ 27 | for (i = 0; i < a->used; i++) { 28 | a->dp[i] = 0; 29 | } 30 | 31 | /* free ram */ 32 | XFREE(a->dp); 33 | 34 | /* reset members to make debugging easier */ 35 | a->dp = NULL; 36 | a->alloc = a->used = 0; 37 | a->sign = MP_ZPOS; 38 | } 39 | } 40 | #endif 41 | 42 | /* $Source$ */ 43 | /* $Revision: 0.41 $ */ 44 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 45 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_2k_setup_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_2K_SETUP_L_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines the setup value */ 19 | int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) 20 | { 21 | int res; 22 | mp_int tmp; 23 | 24 | if ((res = mp_init(&tmp)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { 29 | goto ERR; 30 | } 31 | 32 | if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { 33 | goto ERR; 34 | } 35 | 36 | ERR: 37 | mp_clear(&tmp); 38 | return res; 39 | } 40 | #endif 41 | 42 | /* $Source$ */ 43 | /* $Revision: 0.41 $ */ 44 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 45 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_find_hash.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_find_hash.c 15 | Find a hash, Tom St Denis 16 | */ 17 | 18 | /** 19 | Find a registered hash by name 20 | @param name The name of the hash to look for 21 | @return >= 0 if found, -1 if not present 22 | */ 23 | int find_hash(const char *name) 24 | { 25 | int x; 26 | LTC_ARGCHK(name != NULL); 27 | LTC_MUTEX_LOCK(<c_hash_mutex); 28 | for (x = 0; x < TAB_SIZE; x++) { 29 | if (hash_descriptor[x].name != NULL && XSTRCMP(hash_descriptor[x].name, name) == 0) { 30 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 31 | return x; 32 | } 33 | } 34 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 35 | return -1; 36 | } 37 | 38 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash.c,v $ */ 39 | /* $Revision: 1.7 $ */ 40 | /* $Date: 2006/12/28 01:27:24 $ */ 41 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_count_bits.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_COUNT_BITS_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* returns the number of bits in an int */ 19 | int 20 | mp_count_bits (mp_int * a) 21 | { 22 | int r; 23 | mp_digit q; 24 | 25 | /* shortcut */ 26 | if (a->used == 0) { 27 | return 0; 28 | } 29 | 30 | /* get number of digits and add that */ 31 | r = (a->used - 1) * DIGIT_BIT; 32 | 33 | /* take the last digit and count the bits in it */ 34 | q = a->dp[a->used - 1]; 35 | while (q > ((mp_digit) 0)) { 36 | ++r; 37 | q >>= ((mp_digit) 1); 38 | } 39 | return r; 40 | } 41 | #endif 42 | 43 | /* $Source$ */ 44 | /* $Revision: 0.41 $ */ 45 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 46 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_dr_is_modulus.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_DR_IS_MODULUS_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines if a number is a valid DR modulus */ 19 | int mp_dr_is_modulus(mp_int *a) 20 | { 21 | int ix; 22 | 23 | /* must be at least two digits */ 24 | if (a->used < 2) { 25 | return 0; 26 | } 27 | 28 | /* must be of the form b**k - a [a <= b] so all 29 | * but the first digit must be equal to -1 (mod b). 30 | */ 31 | for (ix = 1; ix < a->used; ix++) { 32 | if (a->dp[ix] != MP_MASK) { 33 | return 0; 34 | } 35 | } 36 | return 1; 37 | } 38 | 39 | #endif 40 | 41 | /* $Source$ */ 42 | /* $Revision: 0.41 $ */ 43 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 44 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MOD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* c = a mod b, 0 <= c < b */ 19 | int 20 | mp_mod (mp_int * a, mp_int * b, mp_int * c) 21 | { 22 | mp_int t; 23 | int res; 24 | 25 | if ((res = mp_init (&t)) != MP_OKAY) { 26 | return res; 27 | } 28 | 29 | if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { 30 | mp_clear (&t); 31 | return res; 32 | } 33 | 34 | if (t.sign != b->sign) { 35 | res = mp_add (b, &t, c); 36 | } else { 37 | res = MP_OKAY; 38 | mp_exch (&t, c); 39 | } 40 | 41 | mp_clear (&t); 42 | return res; 43 | } 44 | #endif 45 | 46 | /* $Source$ */ 47 | /* $Revision: 0.41 $ */ 48 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 49 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_invmod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_INVMOD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* hac 14.61, pp608 */ 19 | int mp_invmod (mp_int * a, mp_int * b, mp_int * c) 20 | { 21 | /* b cannot be negative */ 22 | if (b->sign == MP_NEG || mp_iszero(b) == 1) { 23 | return MP_VAL; 24 | } 25 | 26 | #ifdef BN_FAST_MP_INVMOD_C 27 | /* if the modulus is odd we can use a faster routine instead */ 28 | if (mp_isodd (b) == 1) { 29 | return fast_mp_invmod (a, b, c); 30 | } 31 | #endif 32 | 33 | #ifdef BN_MP_INVMOD_SLOW_C 34 | return mp_invmod_slow(a, b, c); 35 | #endif 36 | 37 | return MP_VAL; 38 | } 39 | #endif 40 | 41 | /* $Source$ */ 42 | /* $Revision: 0.41 $ */ 43 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 44 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_read_signed_bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_READ_SIGNED_BIN_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* read signed bin, big endian, first byte is 0==positive or 1==negative */ 19 | int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) 20 | { 21 | int res; 22 | 23 | /* read magnitude */ 24 | if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | /* first byte is 0 for positive, non-zero for negative */ 29 | if (b[0] == 0) { 30 | a->sign = MP_ZPOS; 31 | } else { 32 | a->sign = MP_NEG; 33 | } 34 | 35 | return MP_OKAY; 36 | } 37 | #endif 38 | 39 | /* $Source$ */ 40 | /* $Revision: 0.41 $ */ 41 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 42 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_clamp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CLAMP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* trim unused digits 19 | * 20 | * This is used to ensure that leading zero digits are 21 | * trimed and the leading "used" digit will be non-zero 22 | * Typically very fast. Also fixes the sign if there 23 | * are no more leading digits 24 | */ 25 | void 26 | mp_clamp (mp_int * a) 27 | { 28 | /* decrease used while the most significant digit is 29 | * zero. 30 | */ 31 | while (a->used > 0 && a->dp[a->used - 1] == 0) { 32 | --(a->used); 33 | } 34 | 35 | /* reset the sign flag if used == 0 */ 36 | if (a->used == 0) { 37 | a->sign = MP_ZPOS; 38 | } 39 | } 40 | #endif 41 | 42 | /* $Source$ */ 43 | /* $Revision: 0.41 $ */ 44 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 45 | -------------------------------------------------------------------------------- /external/tomcrypt/src/mac/hmac/hmac_process.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file hmac_process.c 15 | LTC_HMAC support, process data, Tom St Denis/Dobes Vandermeer 16 | */ 17 | 18 | #ifdef LTC_HMAC 19 | 20 | /** 21 | Process data through LTC_HMAC 22 | @param hmac The hmac state 23 | @param in The data to send through LTC_HMAC 24 | @param inlen The length of the data to LTC_HMAC (octets) 25 | @return CRYPT_OK if successful 26 | */ 27 | int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) 28 | { 29 | int err; 30 | LTC_ARGCHK(hmac != NULL); 31 | LTC_ARGCHK(in != NULL); 32 | if ((err = hash_is_valid(hmac->hash)) != CRYPT_OK) { 33 | return err; 34 | } 35 | return hash_descriptor[hmac->hash].process(&hmac->md, in, inlen); 36 | } 37 | 38 | #endif 39 | 40 | 41 | /* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_process.c,v $ */ 42 | /* $Revision: 1.7 $ */ 43 | /* $Date: 2007/05/12 14:37:41 $ */ 44 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_INIT_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* init a new mp_int */ 19 | int mp_init (mp_int * a) 20 | { 21 | int i; 22 | 23 | /* allocate memory required and clear it */ 24 | a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); 25 | if (a->dp == NULL) { 26 | return MP_MEM; 27 | } 28 | 29 | /* set the digits to zero */ 30 | for (i = 0; i < MP_PREC; i++) { 31 | a->dp[i] = 0; 32 | } 33 | 34 | /* set the used to zero, allocated digits to the default precision 35 | * and sign to positive */ 36 | a->used = 0; 37 | a->alloc = MP_PREC; 38 | a->sign = MP_ZPOS; 39 | 40 | return MP_OKAY; 41 | } 42 | #endif 43 | 44 | /* $Source$ */ 45 | /* $Revision: 0.41 $ */ 46 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 47 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_2k_setup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_2K_SETUP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines the setup value */ 19 | int mp_reduce_2k_setup(mp_int *a, mp_digit *d) 20 | { 21 | int res, p; 22 | mp_int tmp; 23 | 24 | if ((res = mp_init(&tmp)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | p = mp_count_bits(a); 29 | if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { 30 | mp_clear(&tmp); 31 | return res; 32 | } 33 | 34 | if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { 35 | mp_clear(&tmp); 36 | return res; 37 | } 38 | 39 | *d = tmp.dp[0]; 40 | mp_clear(&tmp); 41 | return MP_OKAY; 42 | } 43 | #endif 44 | 45 | /* $Source$ */ 46 | /* $Revision: 0.41 $ */ 47 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 48 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_is_2k_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_IS_2K_L_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines if reduce_2k_l can be used */ 19 | int mp_reduce_is_2k_l(mp_int *a) 20 | { 21 | int ix, iy; 22 | 23 | if (a->used == 0) { 24 | return MP_NO; 25 | } else if (a->used == 1) { 26 | return MP_YES; 27 | } else if (a->used > 1) { 28 | /* if more than half of the digits are -1 we're sold */ 29 | for (iy = ix = 0; ix < a->used; ix++) { 30 | if (a->dp[ix] == MP_MASK) { 31 | ++iy; 32 | } 33 | } 34 | return (iy >= (a->used/2)) ? MP_YES : MP_NO; 35 | 36 | } 37 | return MP_NO; 38 | } 39 | 40 | #endif 41 | 42 | /* $Source$ */ 43 | /* $Revision: 0.41 $ */ 44 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 45 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteamappticket.h: -------------------------------------------------------------------------------- 1 | //====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= 2 | // 3 | // Purpose: a private, but well versioned, interface to get at critical bits 4 | // of a steam3 appticket - consumed by the simple drm wrapper to let it 5 | // ask about ownership with greater confidence. 6 | // 7 | //============================================================================= 8 | 9 | #ifndef ISTEAMAPPTICKET_H 10 | #define ISTEAMAPPTICKET_H 11 | #pragma once 12 | 13 | //----------------------------------------------------------------------------- 14 | // Purpose: hand out a reasonable "future proof" view of an app ownership ticket 15 | // the raw (signed) buffer, and indices into that buffer where the appid and 16 | // steamid are located. the sizes of the appid and steamid are implicit in 17 | // (each version of) the interface - currently uin32 appid and uint64 steamid 18 | //----------------------------------------------------------------------------- 19 | class ISteamAppTicket 20 | { 21 | public: 22 | virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) = 0; 23 | }; 24 | 25 | #define STEAMAPPTICKET_INTERFACE_VERSION "STEAMAPPTICKET_INTERFACE_VERSION001" 26 | 27 | 28 | #endif // ISTEAMAPPTICKET_H 29 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_init_size.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_INIT_SIZE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* init an mp_init for a given size */ 19 | int mp_init_size (mp_int * a, int size) 20 | { 21 | int x; 22 | 23 | /* pad size so there are always extra digits */ 24 | size += (MP_PREC * 2) - (size % MP_PREC); 25 | 26 | /* alloc mem */ 27 | a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); 28 | if (a->dp == NULL) { 29 | return MP_MEM; 30 | } 31 | 32 | /* set the members */ 33 | a->used = 0; 34 | a->alloc = size; 35 | a->sign = MP_ZPOS; 36 | 37 | /* zero the digits */ 38 | for (x = 0; x < size; x++) { 39 | a->dp[x] = 0; 40 | } 41 | 42 | return MP_OKAY; 43 | } 44 | #endif 45 | 46 | /* $Source$ */ 47 | /* $Revision: 0.41 $ */ 48 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 49 | -------------------------------------------------------------------------------- /src/snd_system.h: -------------------------------------------------------------------------------- 1 | #ifndef __SND_SYSTEM_H__ 2 | #define __SND_SYSTEM_H__ 3 | 4 | 5 | 6 | 7 | void SND_LoadEntChannelFile(); 8 | void SND_SetEnvironmentEffects_f(); 9 | void SND_DeactivateEnvironmentEffects_f(); 10 | void SND_PlayLocal_f(); 11 | void SND_SetEq_f(); 12 | void SND_SetEqFreq_f(); 13 | void SND_SetEqGain_f(); 14 | void SND_SetEqQ_f(); 15 | void SND_SetEqType_f(); 16 | void SND_DeactivateEq_f(); 17 | void Voice_Init( ); 18 | qboolean Voice_IsClientTalking(int num); 19 | void sub_57B350( ); 20 | void sub_57B5C0( const char* ); 21 | int sub_57B070( ); 22 | int __cdecl sub_57B1D0(uint16_t a1); 23 | 24 | void sub_57B860( qboolean ); 25 | void sub_4ED0B0( HWND handle ); 26 | void sub_4ECA60( ); 27 | void sub_4EC880( ); 28 | 29 | qboolean __cdecl SND_InitDSCaptureDevice(); 30 | DWORD mixerGetRecordSource(); 31 | qboolean SND_IsInitialized(); 32 | void Voice_GetLocalVoiceData(); 33 | void sub_4ED380(); 34 | void sub_4ED610(int); 35 | void SND_DisconnectListener(); 36 | qboolean IsSelectedVoiceChannelValid(unsigned int channel); 37 | void Voice_IncomingVoiceData(int clnum, byte* voicedata, int size); 38 | int SND_PlayLocalSoundAliasByName(int localClientNum, const char *alias); 39 | void SND_StopBackground(int track, int fadetime); 40 | void SND_StopAmbient(int fadetime); 41 | void SND_UnpauseSounds(); 42 | void SND_PauseSounds(); 43 | void SND_InitDirectSoundHandle(HWND hWnd); 44 | 45 | #endif -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_get_int.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_GET_INT_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* get the lower 32-bits of an mp_int */ 19 | unsigned long mp_get_int(mp_int * a) 20 | { 21 | int i; 22 | unsigned long res; 23 | 24 | if (a->used == 0) { 25 | return 0; 26 | } 27 | 28 | /* get number of digits of the lsb we have to read */ 29 | i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; 30 | 31 | /* get most significant digit of result */ 32 | res = DIGIT(a,i); 33 | 34 | while (--i >= 0) { 35 | res = (res << DIGIT_BIT) | DIGIT(a,i); 36 | } 37 | 38 | /* force result to 32-bits always so it is consistent on non 32-bit platforms */ 39 | return res & 0xFFFFFFFFUL; 40 | } 41 | #endif 42 | 43 | /* $Source$ */ 44 | /* $Revision: 0.41 $ */ 45 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 46 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_set_int.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SET_INT_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* set a 32-bit const */ 19 | int mp_set_int (mp_int * a, unsigned long b) 20 | { 21 | int x, res; 22 | 23 | mp_zero (a); 24 | 25 | /* set four bits at a time */ 26 | for (x = 0; x < 8; x++) { 27 | /* shift the number up four bits */ 28 | if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { 29 | return res; 30 | } 31 | 32 | /* OR in the top four bits of the source */ 33 | a->dp[0] |= (b >> 28) & 15; 34 | 35 | /* shift the source up to the next four bits */ 36 | b <<= 4; 37 | 38 | /* ensure that digits are not clamped off */ 39 | a->used += 1; 40 | } 41 | mp_clamp (a); 42 | return MP_OKAY; 43 | } 44 | #endif 45 | 46 | /* $Source$ */ 47 | /* $Revision: 0.41 $ */ 48 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 49 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_2expt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_2EXPT_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* computes a = 2**b 19 | * 20 | * Simple algorithm which zeroes the int, grows it then just sets one bit 21 | * as required. 22 | */ 23 | int 24 | mp_2expt (mp_int * a, int b) 25 | { 26 | int res; 27 | 28 | /* zero a as per default */ 29 | mp_zero (a); 30 | 31 | /* grow a to accomodate the single bit */ 32 | if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) { 33 | return res; 34 | } 35 | 36 | /* set the used count of where the bit will go */ 37 | a->used = b / DIGIT_BIT + 1; 38 | 39 | /* put the single bit in its place */ 40 | a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); 41 | 42 | return MP_OKAY; 43 | } 44 | #endif 45 | 46 | /* $Source$ */ 47 | /* $Revision: 0.41 $ */ 48 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 49 | -------------------------------------------------------------------------------- /src/steam_interface.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "steam_api/steam_shared.h" 3 | 4 | int Com_SteamServerApi_Load(uint32_t unIP, uint16_t usSteamPort, uint16_t usGamePort, uint16_t usQueryPort, const char *pchVersionString); 5 | void Com_SteamServerApi_RunFrame( ); 6 | void Com_SteamServerApi_Shutdown( ); 7 | uint64_t Com_SteamServerApi_GetHostSteamID( ); 8 | void Com_SteamServerApi_EndAuthSession(uint64_t steamid); 9 | int Com_SteamServerApi_StartAuthentication(uint64_t steamid, const void* pToken, unsigned int uTokenLength); 10 | void Com_SteamServerApi_SteamIDToString(uint64_t steamid, char* string, int length); 11 | 12 | int Com_SteamClientApi_Load( const wchar_t* dllpath, int appID, int gameId, const char* modName, int overlayrenderer ); 13 | uint64_t Com_SteamClientApi_GetSteamID( ); 14 | void Com_SteamClientApi_Shutdown(); 15 | void Com_SteamClientApi_RunFrame( ); 16 | void Com_SteamClientApi_AdvertiseServer(uint32_t unIPServer, uint16_t usPortServer); 17 | void Com_SteamClientApi_StopAdvertisingServer( ); 18 | void Com_SteamClientApi_CancelAuthTicket( ); 19 | uint32_t Com_SteamClientApi_GetAuthTicket(unsigned char* data, int buflen); 20 | void Com_SteamClientApi_SteamIDToString(uint64_t steamid, char* string, int length); 21 | void Com_SteamClientApi_GetLocalPlayerName(char* playername, int len); 22 | int Com_SteamClientApi_IsLoaded(); 23 | int Com_SteamClientApi_GetClans(clan_t* clans, int maxcount); 24 | 25 | 26 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_unregister_hash.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_unregister_hash.c 15 | Unregister a hash, Tom St Denis 16 | */ 17 | 18 | /** 19 | Unregister a hash from the descriptor table 20 | @param hash The hash descriptor to remove 21 | @return CRYPT_OK on success 22 | */ 23 | int unregister_hash(const struct ltc_hash_descriptor *hash) 24 | { 25 | int x; 26 | 27 | LTC_ARGCHK(hash != NULL); 28 | 29 | /* is it already registered? */ 30 | LTC_MUTEX_LOCK(<c_hash_mutex); 31 | for (x = 0; x < TAB_SIZE; x++) { 32 | if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { 33 | hash_descriptor[x].name = NULL; 34 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 35 | return CRYPT_OK; 36 | } 37 | } 38 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 39 | return CRYPT_ERROR; 40 | } 41 | 42 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c,v $ */ 43 | /* $Revision: 1.7 $ */ 44 | /* $Date: 2006/12/28 01:27:24 $ */ 45 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_length_utctime.c 15 | ASN.1 DER, get length of UTCTIME, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_DER 19 | 20 | /** 21 | Gets length of DER encoding of UTCTIME 22 | @param utctime The UTC time structure to get the size of 23 | @param outlen [out] The length of the DER encoding 24 | @return CRYPT_OK if successful 25 | */ 26 | int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen) 27 | { 28 | LTC_ARGCHK(outlen != NULL); 29 | LTC_ARGCHK(utctime != NULL); 30 | 31 | if (utctime->off_hh == 0 && utctime->off_mm == 0) { 32 | /* we encode as YYMMDDhhmmssZ */ 33 | *outlen = 2 + 13; 34 | } else { 35 | /* we encode as YYMMDDhhmmss{+|-}hh'mm' */ 36 | *outlen = 2 + 17; 37 | } 38 | 39 | return CRYPT_OK; 40 | } 41 | 42 | #endif 43 | 44 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c,v $ */ 45 | /* $Revision: 1.5 $ */ 46 | /* $Date: 2006/12/28 01:27:24 $ */ 47 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_decode_boolean.c 15 | ASN.1 DER, decode a BOOLEAN, Tom St Denis 16 | */ 17 | 18 | 19 | #ifdef LTC_DER 20 | 21 | /** 22 | Read a BOOLEAN 23 | @param in The destination for the DER encoded BOOLEAN 24 | @param inlen The size of the DER BOOLEAN 25 | @param out [out] The boolean to decode 26 | @return CRYPT_OK if successful 27 | */ 28 | int der_decode_boolean(const unsigned char *in, unsigned long inlen, 29 | int *out) 30 | { 31 | LTC_ARGCHK(in != NULL); 32 | LTC_ARGCHK(out != NULL); 33 | 34 | if (inlen != 3 || in[0] != 0x01 || in[1] != 0x01 || (in[2] != 0x00 && in[2] != 0xFF)) { 35 | return CRYPT_INVALID_ARG; 36 | } 37 | 38 | *out = (in[2]==0xFF) ? 1 : 0; 39 | 40 | return CRYPT_OK; 41 | } 42 | 43 | #endif 44 | 45 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c,v $ */ 46 | /* $Revision: 1.2 $ */ 47 | /* $Date: 2006/12/28 01:27:24 $ */ 48 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_to_unsigned_bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_TO_UNSIGNED_BIN_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* store in unsigned [big endian] format */ 19 | int mp_to_unsigned_bin (mp_int * a, unsigned char *b) 20 | { 21 | int x, res; 22 | mp_int t; 23 | 24 | if ((res = mp_init_copy (&t, a)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | x = 0; 29 | while (mp_iszero (&t) == 0) { 30 | #ifndef MP_8BIT 31 | b[x++] = (unsigned char) (t.dp[0] & 255); 32 | #else 33 | b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); 34 | #endif 35 | if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { 36 | mp_clear (&t); 37 | return res; 38 | } 39 | } 40 | bn_reverse (b, x); 41 | mp_clear (&t); 42 | return MP_OKAY; 43 | } 44 | #endif 45 | 46 | /* $Source$ */ 47 | /* $Revision: 0.41 $ */ 48 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 49 | -------------------------------------------------------------------------------- /src/xassets/font.h: -------------------------------------------------------------------------------- 1 | #ifndef __FONT_H__ 2 | #define __FONT_H__ 3 | #include "material.h" 4 | #include 5 | 6 | /* 7043 */ 7 | #pragma pack(push, 2) 8 | typedef struct 9 | { 10 | uint16_t letter; 11 | char x0; 12 | char y0; 13 | char dx; 14 | char pixelWidth; 15 | char pixelHeight; 16 | char pad; 17 | float s0; 18 | float t0; 19 | float s1; 20 | float t1; 21 | }Glyph; 22 | #pragma pack(pop) 23 | 24 | /* 7044 */ 25 | typedef struct Font_s 26 | { 27 | const char *fontName; 28 | int pixelHeight; 29 | int glyphCount; 30 | Material *material; 31 | Material *glowMaterial; 32 | Glyph *glyphs; 33 | }Font_t; 34 | 35 | /* 36 | typedef struct 37 | { 38 | Font_t f; 39 | D3DXFontInfo dxf; 40 | }TTFFontStorage_t; 41 | typedef struct 42 | { 43 | IDirect3DTexture9* glyph; 44 | float size; 45 | RECT rect; 46 | POINT pt; 47 | float glyphWidth; 48 | float glyphHeight; 49 | }GlyphInfo_t; 50 | 51 | //Basic settings for ttf fonts 52 | typedef struct 53 | { 54 | struct ID3DXFont* h; 55 | UINT Weight; 56 | UINT MipLevels; 57 | BOOL Italic; 58 | DWORD CharSet; 59 | DWORD OutputPrecision; 60 | DWORD PitchAndFamily; 61 | char fontName[32]; 62 | WORD QuestionGlyphIndex; //if the character is not available we use ? 63 | }D3DXFontInfo; 64 | */ 65 | 66 | void Font_InitTTF(); 67 | struct Font_s* Font_GetSystemFont(); 68 | struct Font_s* Font_GetConsoleFont(); 69 | void Font_InitSystemFonts(); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bncore.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BNCORE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* Known optimal configurations 19 | 20 | CPU /Compiler /MUL CUTOFF/SQR CUTOFF 21 | ------------------------------------------------------------- 22 | Intel P4 Northwood /GCC v3.4.1 / 88/ 128/LTM 0.32 ;-) 23 | AMD Athlon64 /GCC v3.4.4 / 80/ 120/LTM 0.35 24 | 25 | */ 26 | 27 | int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsuba multiplication is used. */ 28 | KARATSUBA_SQR_CUTOFF = 120, /* Min. number of digits before Karatsuba squaring is used. */ 29 | 30 | TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */ 31 | TOOM_SQR_CUTOFF = 400; 32 | #endif 33 | 34 | /* $Source$ */ 35 | /* $Revision: 0.41 $ */ 36 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 37 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_prime_is_divisible.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_PRIME_IS_DIVISIBLE_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines if an integers is divisible by one 19 | * of the first PRIME_SIZE primes or not 20 | * 21 | * sets result to 0 if not, 1 if yes 22 | */ 23 | int mp_prime_is_divisible (mp_int * a, int *result) 24 | { 25 | int err, ix; 26 | mp_digit res; 27 | 28 | /* default to not */ 29 | *result = MP_NO; 30 | 31 | for (ix = 0; ix < PRIME_SIZE; ix++) { 32 | /* what is a mod LBL_prime_tab[ix] */ 33 | if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { 34 | return err; 35 | } 36 | 37 | /* is the residue zero? */ 38 | if (res == 0) { 39 | *result = MP_YES; 40 | return MP_OKAY; 41 | } 42 | } 43 | 44 | return MP_OKAY; 45 | } 46 | #endif 47 | 48 | /* $Source$ */ 49 | /* $Revision: 0.41 $ */ 50 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 51 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_encode_boolean.c 15 | ASN.1 DER, encode a BOOLEAN, Tom St Denis 16 | */ 17 | 18 | 19 | #ifdef LTC_DER 20 | 21 | /** 22 | Store a BOOLEAN 23 | @param in The boolean to encode 24 | @param out [out] The destination for the DER encoded BOOLEAN 25 | @param outlen [in/out] The max size and resulting size of the DER BOOLEAN 26 | @return CRYPT_OK if successful 27 | */ 28 | int der_encode_boolean(int in, 29 | unsigned char *out, unsigned long *outlen) 30 | { 31 | LTC_ARGCHK(outlen != NULL); 32 | LTC_ARGCHK(out != NULL); 33 | 34 | if (*outlen < 3) { 35 | *outlen = 3; 36 | return CRYPT_BUFFER_OVERFLOW; 37 | } 38 | 39 | *outlen = 3; 40 | out[0] = 0x01; 41 | out[1] = 0x01; 42 | out[2] = in ? 0xFF : 0x00; 43 | 44 | return CRYPT_OK; 45 | } 46 | 47 | #endif 48 | 49 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c,v $ */ 50 | /* $Revision: 1.4 $ */ 51 | /* $Date: 2006/12/28 01:27:24 $ */ 52 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file pkcs_1_i2osp.c 15 | Integer to Octet I2OSP, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_PKCS_1 19 | 20 | /* always stores the same # of bytes, pads with leading zero bytes 21 | as required 22 | */ 23 | 24 | /** 25 | LTC_PKCS #1 Integer to binary 26 | @param n The integer to store 27 | @param modulus_len The length of the RSA modulus 28 | @param out [out] The destination for the integer 29 | @return CRYPT_OK if successful 30 | */ 31 | int pkcs_1_i2osp(void *n, unsigned long modulus_len, unsigned char *out) 32 | { 33 | unsigned long size; 34 | 35 | size = mp_unsigned_bin_size(n); 36 | 37 | if (size > modulus_len) { 38 | return CRYPT_BUFFER_OVERFLOW; 39 | } 40 | 41 | /* store it */ 42 | zeromem(out, modulus_len); 43 | return mp_to_unsigned_bin(n, out+(modulus_len-size)); 44 | } 45 | 46 | #endif /* LTC_PKCS_1 */ 47 | 48 | 49 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c,v $ */ 50 | /* $Revision: 1.7 $ */ 51 | /* $Date: 2007/05/12 14:32:35 $ */ 52 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_cmp_mag.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CMP_MAG_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* compare maginitude of two ints (unsigned) */ 19 | int mp_cmp_mag (mp_int * a, mp_int * b) 20 | { 21 | int n; 22 | mp_digit *tmpa, *tmpb; 23 | 24 | /* compare based on # of non-zero digits */ 25 | if (a->used > b->used) { 26 | return MP_GT; 27 | } 28 | 29 | if (a->used < b->used) { 30 | return MP_LT; 31 | } 32 | 33 | /* alias for a */ 34 | tmpa = a->dp + (a->used - 1); 35 | 36 | /* alias for b */ 37 | tmpb = b->dp + (a->used - 1); 38 | 39 | /* compare based on digits */ 40 | for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { 41 | if (*tmpa > *tmpb) { 42 | return MP_GT; 43 | } 44 | 45 | if (*tmpa < *tmpb) { 46 | return MP_LT; 47 | } 48 | } 49 | return MP_EQ; 50 | } 51 | #endif 52 | 53 | /* $Source$ */ 54 | /* $Revision: 0.41 $ */ 55 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 56 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_cnt_lsb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_CNT_LSB_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | static const int lnz[16] = { 19 | 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 20 | }; 21 | 22 | /* Counts the number of lsbs which are zero before the first zero bit */ 23 | int mp_cnt_lsb(mp_int *a) 24 | { 25 | int x; 26 | mp_digit q, qq; 27 | 28 | /* easy out */ 29 | if (mp_iszero(a) == 1) { 30 | return 0; 31 | } 32 | 33 | /* scan lower digits until non-zero */ 34 | for (x = 0; x < a->used && a->dp[x] == 0; x++); 35 | q = a->dp[x]; 36 | x *= DIGIT_BIT; 37 | 38 | /* now scan this digit until a 1 is found */ 39 | if ((q & 1) == 0) { 40 | do { 41 | qq = q & 15; 42 | x += lnz[qq]; 43 | q >>= 4; 44 | } while (qq == 0); 45 | } 46 | return x; 47 | } 48 | 49 | #endif 50 | 51 | /* $Source$ */ 52 | /* $Revision: 0.41 $ */ 53 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 54 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_is_2k.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_IS_2K_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* determines if mp_reduce_2k can be used */ 19 | int mp_reduce_is_2k(mp_int *a) 20 | { 21 | int ix, iy, iw; 22 | mp_digit iz; 23 | 24 | if (a->used == 0) { 25 | return MP_NO; 26 | } else if (a->used == 1) { 27 | return MP_YES; 28 | } else if (a->used > 1) { 29 | iy = mp_count_bits(a); 30 | iz = 1; 31 | iw = 1; 32 | 33 | /* Test every bit from the second digit up, must be 1 */ 34 | for (ix = DIGIT_BIT; ix < iy; ix++) { 35 | if ((a->dp[iw] & iz) == 0) { 36 | return MP_NO; 37 | } 38 | iz <<= 1; 39 | if (iz > (mp_digit)MP_MASK) { 40 | ++iw; 41 | iz = 1; 42 | } 43 | } 44 | } 45 | return MP_YES; 46 | } 47 | 48 | #endif 49 | 50 | /* $Source$ */ 51 | /* $Revision: 0.41 $ */ 52 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 53 | -------------------------------------------------------------------------------- /src/g_team.c: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | Copyright (C) 1999-2005 Id Software, Inc. 4 | 5 | This file is part of Quake III Arena source code. 6 | 7 | Quake III Arena source code is free software; you can redistribute it 8 | and/or modify it under the terms of the GNU General Public License as 9 | published by the Free Software Foundation; either version 2 of the License, 10 | or (at your option) any later version. 11 | 12 | Quake III Arena source code is distributed in the hope that it will be 13 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with Quake III Arena source code; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | =========================================================================== 21 | */ 22 | // 23 | 24 | #include "q_shared.h" 25 | #include "game.h" 26 | 27 | /* 28 | ============== 29 | OnSameTeam 30 | ============== 31 | */ 32 | qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 ) { 33 | if ( !ent1->client || !ent2->client ) { 34 | return qfalse; 35 | } 36 | if ( ent1->client->sess.sessionTeam == TEAM_FREE ) { 37 | return qfalse; 38 | } 39 | 40 | if ( ent1->client->sess.sessionTeam == ent2->client->sess.sessionTeam ) { 41 | return qtrue; 42 | } 43 | 44 | return qfalse; 45 | } -------------------------------------------------------------------------------- /src/cg_font.c: -------------------------------------------------------------------------------- 1 | 2 | #include "q_shared.h" 3 | #include "ui_shared.h" 4 | #include "r_shared.h" 5 | 6 | 7 | 8 | Font_t * UI_GetFontHandle(ScreenPlacement *place, int fontindex, float fontscale) 9 | { 10 | float fontscalea; 11 | if ( fontindex == 2 ) 12 | return uiMem.bigFont; 13 | if ( fontindex == 3 ) 14 | return uiMem.extraSmallFont; 15 | if ( fontindex == 5 ) 16 | return uiMem.font1; 17 | if ( fontindex == 6 ) 18 | return uiMem.font2; 19 | 20 | fontscalea = place->scaleVirtualToReal[1] * fontscale; 21 | 22 | if ( fontindex == 4 ) 23 | { 24 | if ( uiMem.ui_smallFont->floatval >= fontscalea ) 25 | return uiMem.extraSmallFont; 26 | if ( uiMem.ui_bigFont->floatval <= fontscalea ) 27 | return uiMem.font3; 28 | return uiMem.smallFont; 29 | } 30 | if ( uiMem.ui_smallFont->floatval >= fontscalea ) 31 | return uiMem.extraSmallFont; 32 | if ( uiMem.ui_extraBigFont->floatval <= fontscalea ) 33 | return uiMem.extraBigFont; 34 | if ( uiMem.ui_bigFont->floatval > fontscalea ) 35 | return uiMem.smallFont; 36 | return uiMem.bigFont; 37 | } 38 | 39 | int UI_TextWidth(const char* text, int maxChars, Font_t *font, float scale) 40 | { 41 | float normscale; 42 | 43 | normscale = R_NormalizedTextScale(font, scale); 44 | return (int)((float)R_TextWidth(text, maxChars, font) * normscale); 45 | } 46 | 47 | 48 | int UI_TextHeight(Font_t *font, float scale) 49 | { 50 | float normscale; 51 | 52 | normscale = R_NormalizedTextScale(font, scale); 53 | return (int)((float)R_TextHeight(font) * normscale); 54 | } -------------------------------------------------------------------------------- /external/tomcrypt/src/math/multi.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | #ifdef MPI 14 | #include 15 | 16 | int ltc_init_multi(void **a, ...) 17 | { 18 | void **cur = a; 19 | int np = 0; 20 | va_list args; 21 | 22 | va_start(args, a); 23 | while (cur != NULL) { 24 | if (mp_init(cur) != CRYPT_OK) { 25 | /* failed */ 26 | va_list clean_list; 27 | 28 | va_start(clean_list, a); 29 | cur = a; 30 | while (np--) { 31 | mp_clear(*cur); 32 | cur = va_arg(clean_list, void**); 33 | } 34 | va_end(clean_list); 35 | return CRYPT_MEM; 36 | } 37 | ++np; 38 | cur = va_arg(args, void**); 39 | } 40 | va_end(args); 41 | return CRYPT_OK; 42 | } 43 | 44 | void ltc_deinit_multi(void *a, ...) 45 | { 46 | void *cur = a; 47 | va_list args; 48 | 49 | va_start(args, a); 50 | while (cur != NULL) { 51 | mp_clear(cur); 52 | cur = va_arg(args, void *); 53 | } 54 | va_end(args); 55 | } 56 | 57 | #endif 58 | 59 | /* $Source: /cvs/libtom/libtomcrypt/src/math/multi.c,v $ */ 60 | /* $Revision: 1.6 $ */ 61 | /* $Date: 2006/12/28 01:27:23 $ */ 62 | -------------------------------------------------------------------------------- /external/mbedtls/src/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Version information 3 | * 4 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 5 | * SPDX-License-Identifier: Apache-2.0 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 8 | * not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * This file is part of mbed TLS (https://tls.mbed.org) 20 | */ 21 | 22 | #if !defined(MBEDTLS_CONFIG_FILE) 23 | #include "mbedtls/config.h" 24 | #else 25 | #include MBEDTLS_CONFIG_FILE 26 | #endif 27 | 28 | #if defined(MBEDTLS_VERSION_C) 29 | 30 | #include "mbedtls/version.h" 31 | #include 32 | 33 | unsigned int mbedtls_version_get_number() 34 | { 35 | return( MBEDTLS_VERSION_NUMBER ); 36 | } 37 | 38 | void mbedtls_version_get_string( char *string ) 39 | { 40 | memcpy( string, MBEDTLS_VERSION_STRING, 41 | sizeof( MBEDTLS_VERSION_STRING ) ); 42 | } 43 | 44 | void mbedtls_version_get_string_full( char *string ) 45 | { 46 | memcpy( string, MBEDTLS_VERSION_STRING_FULL, 47 | sizeof( MBEDTLS_VERSION_STRING_FULL ) ); 48 | } 49 | 50 | #endif /* MBEDTLS_VERSION_C */ 51 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_read_unsigned_bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_READ_UNSIGNED_BIN_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* reads a unsigned char array, assumes the msb is stored first [big endian] */ 19 | int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) 20 | { 21 | int res; 22 | 23 | /* make sure there are at least two digits */ 24 | if (a->alloc < 2) { 25 | if ((res = mp_grow(a, 2)) != MP_OKAY) { 26 | return res; 27 | } 28 | } 29 | 30 | /* zero the int */ 31 | mp_zero (a); 32 | 33 | /* read the bytes in */ 34 | while (c-- > 0) { 35 | if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { 36 | return res; 37 | } 38 | 39 | #ifndef MP_8BIT 40 | a->dp[0] |= *b++; 41 | a->used += 1; 42 | #else 43 | a->dp[0] = (*b & MP_MASK); 44 | a->dp[1] |= ((*b++ >> 7U) & 1); 45 | a->used += 2; 46 | #endif 47 | } 48 | mp_clamp (a); 49 | return MP_OKAY; 50 | } 51 | #endif 52 | 53 | /* $Source$ */ 54 | /* $Revision: 0.41 $ */ 55 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 56 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_sqr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SQR_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* computes b = a*a */ 19 | int 20 | mp_sqr (mp_int * a, mp_int * b) 21 | { 22 | int res; 23 | 24 | #ifdef BN_MP_TOOM_SQR_C 25 | /* use Toom-Cook? */ 26 | if (a->used >= TOOM_SQR_CUTOFF) { 27 | res = mp_toom_sqr(a, b); 28 | /* Karatsuba? */ 29 | } else 30 | #endif 31 | #ifdef BN_MP_KARATSUBA_SQR_C 32 | if (a->used >= KARATSUBA_SQR_CUTOFF) { 33 | res = mp_karatsuba_sqr (a, b); 34 | } else 35 | #endif 36 | { 37 | #ifdef BN_FAST_S_MP_SQR_C 38 | /* can we use the fast comba multiplier? */ 39 | if ((a->used * 2 + 1) < MP_WARRAY && 40 | a->used < 41 | (1 << (sizeof(mp_word) * CHAR_BIT - 2*DIGIT_BIT - 1))) { 42 | res = fast_s_mp_sqr (a, b); 43 | } else 44 | #endif 45 | #ifdef BN_S_MP_SQR_C 46 | res = s_mp_sqr (a, b); 47 | #else 48 | res = MP_VAL; 49 | #endif 50 | } 51 | b->sign = MP_ZPOS; 52 | return res; 53 | } 54 | #endif 55 | 56 | /* $Source$ */ 57 | /* $Revision: 0.41 $ */ 58 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 59 | -------------------------------------------------------------------------------- /external/discord-rpc/src/rapidjson/internal/swap.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef RAPIDJSON_INTERNAL_SWAP_H_ 16 | #define RAPIDJSON_INTERNAL_SWAP_H_ 17 | 18 | #include "../rapidjson.h" 19 | 20 | #if defined(__clang__) 21 | RAPIDJSON_DIAG_PUSH 22 | RAPIDJSON_DIAG_OFF(c++98-compat) 23 | #endif 24 | 25 | RAPIDJSON_NAMESPACE_BEGIN 26 | namespace internal { 27 | 28 | //! Custom swap() to avoid dependency on C++ header 29 | /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. 30 | \note This has the same semantics as std::swap(). 31 | */ 32 | template 33 | inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT { 34 | T tmp = a; 35 | a = b; 36 | b = tmp; 37 | } 38 | 39 | } // namespace internal 40 | RAPIDJSON_NAMESPACE_END 41 | 42 | #if defined(__clang__) 43 | RAPIDJSON_DIAG_POP 44 | #endif 45 | 46 | #endif // RAPIDJSON_INTERNAL_SWAP_H_ 47 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_2k.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_2K_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* reduces a modulo n where n is of the form 2**p - d */ 19 | int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) 20 | { 21 | mp_int q; 22 | int p, res; 23 | 24 | if ((res = mp_init(&q)) != MP_OKAY) { 25 | return res; 26 | } 27 | 28 | p = mp_count_bits(n); 29 | top: 30 | /* q = a/2**p, a = a mod 2**p */ 31 | if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { 32 | goto ERR; 33 | } 34 | 35 | if (d != 1) { 36 | /* q = q * d */ 37 | if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) { 38 | goto ERR; 39 | } 40 | } 41 | 42 | /* a = a + q */ 43 | if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { 44 | goto ERR; 45 | } 46 | 47 | if (mp_cmp_mag(a, n) != MP_LT) { 48 | s_mp_sub(a, n, a); 49 | goto top; 50 | } 51 | 52 | ERR: 53 | mp_clear(&q); 54 | return res; 55 | } 56 | 57 | #endif 58 | 59 | /* $Source$ */ 60 | /* $Revision: 0.41 $ */ 61 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 62 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_add.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_ADD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* high level addition (handles signs) */ 19 | int mp_add (mp_int * a, mp_int * b, mp_int * c) 20 | { 21 | int sa, sb, res; 22 | 23 | /* get sign of both inputs */ 24 | sa = a->sign; 25 | sb = b->sign; 26 | 27 | /* handle two cases, not four */ 28 | if (sa == sb) { 29 | /* both positive or both negative */ 30 | /* add their magnitudes, copy the sign */ 31 | c->sign = sa; 32 | res = s_mp_add (a, b, c); 33 | } else { 34 | /* one positive, the other negative */ 35 | /* subtract the one with the greater magnitude from */ 36 | /* the one of the lesser magnitude. The result gets */ 37 | /* the sign of the one with the greater magnitude. */ 38 | if (mp_cmp_mag (a, b) == MP_LT) { 39 | c->sign = sb; 40 | res = s_mp_sub (b, a, c); 41 | } else { 42 | c->sign = sa; 43 | res = s_mp_sub (a, b, c); 44 | } 45 | } 46 | return res; 47 | } 48 | 49 | #endif 50 | 51 | /* $Source$ */ 52 | /* $Revision: 0.41 $ */ 53 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 54 | -------------------------------------------------------------------------------- /src/com_stringtable.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | #include "xassets/simple.h" 4 | #include "xzone.h" 5 | 6 | 7 | int __cdecl StringTable_LookupRowNumForValue(StringTable *table, const int comparisonColumn, const char *value); 8 | 9 | const char *StringTable_Lookup(StringTable *table, const int comparisonColumn, const char *value, const int valueColumn) 10 | { 11 | int row; 12 | int valindex; 13 | 14 | if ( !table ) 15 | { 16 | Com_PrintError(CON_CHANNEL_SYSTEM, "Unable to find the lookup table in the fastfile, aborting lookup\n"); 17 | return ""; 18 | } 19 | row = StringTable_LookupRowNumForValue(table, comparisonColumn, value); 20 | if ( valueColumn >= table->columnCount ) 21 | return ""; 22 | if ( row >= table->rowCount ) 23 | return ""; 24 | if ( row < 0 ) 25 | return ""; 26 | if ( valueColumn < 0 ) 27 | return ""; 28 | valindex = valueColumn + row * table->columnCount; 29 | if ( !table->values[valindex] ) 30 | return ""; 31 | return table->values[valindex]; 32 | } 33 | 34 | 35 | void __cdecl StringTable_GetAsset_FastFile(const char *filename, StringTable **tablePtr) 36 | { 37 | *tablePtr = DB_FindXAssetHeader(ASSET_TYPE_STRINGTABLE, filename).stringTable; 38 | } 39 | 40 | void __cdecl StringTable_GetAsset(const char *filename, StringTable **tablePtr) 41 | { 42 | void (__cdecl *f)(const char *, StringTable **); 43 | 44 | if ( com_useFastFiles->boolean ) 45 | { 46 | f = StringTable_GetAsset_FastFile; 47 | } 48 | else 49 | { 50 | Com_Error(ERR_FATAL, "Trying to use a string table with fast file loading disabled."); 51 | return; 52 | } 53 | f(filename, tablePtr); 54 | } 55 | -------------------------------------------------------------------------------- /src/client_callbacks.asm: -------------------------------------------------------------------------------- 1 | 2 | %macro bin_import 2 3 | 4 | SECTION .text 5 | global %1 6 | %1: jmp dword [o%1] 7 | 8 | SECTION .rodata 9 | o%1 dd %2 10 | %endmacro 11 | 12 | bin_import CL_ForwardToServer_f, 0x469dd0 13 | bin_import CL_Clientinfo_f, 0x46a760 14 | bin_import CL_Vid_Restart_f, 0x46a180 15 | bin_import CL_Snd_Restart_f, 0x46a550 16 | bin_import CL_Disconnect_f, 0x46a040 17 | ;bin_import CL_Record_f, 0x468960 18 | bin_import CL_StopRecord_f, 0x4688c0 19 | bin_import CL_PlayCinematic_f, 0x45c8d0 20 | bin_import CL_PlayUnskippableCinematic_f, 0x45c920 21 | bin_import CL_PlayLogo_f, 0x46d030 22 | ;bin_import CL_Connect_f, 0x471050 23 | ;bin_import CL_Reconnect_f, 0x46a090 24 | ;bin_import CL_LocalServers_f, 0x470220 25 | ;bin_import CL_GlobalServers_f, 0x471820 26 | ;bin_import CL_Rcon_f, 0x471af0 27 | ;bin_import CL_Ping_f, 0x471e70 28 | ;bin_import CL_ServerStatus_f, 0x472310 29 | bin_import CL_Setenv_f, 0x469e40 30 | bin_import CL_ShowIP_f, 0x4704f0 31 | bin_import CL_ToggleMenu_f, 0x46d310 32 | bin_import CL_OpenedIWDList_f, 0x46a6b0 33 | bin_import CL_ReferencedIWDList_f, 0x46a6e0 34 | bin_import CL_UpdateLevelHunkUsage, 0x45bab0 35 | bin_import CL_startSingleplayer_f, 0x46ce90 36 | bin_import CL_CubemapShot_f, 0x475200 37 | bin_import CL_OpenScriptMenu_f, 0x46d3f0 38 | bin_import Com_WriteLocalizedSoundAliasFiles, 0x5698d0 39 | bin_import UI_CloseMenu_f, 0x548f20 40 | bin_import CL_SelectStringTableEntryInDvar_f, 0x548dc0 41 | bin_import Con_Init, 0x45d080 42 | bin_import CL_InitInput, 0x4643f0 43 | bin_import Ragdoll_InitCvars, 0x5ba330 44 | bin_import R_Init, 0x46ccb0 45 | bin_import CG_RegisterCvars, 0x43ac60 46 | bin_import Ragdoll_InitCommands, 0x5bb350 47 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_length_bit_string.c 15 | ASN.1 DER, get length of BIT STRING, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_DER 19 | /** 20 | Gets length of DER encoding of BIT STRING 21 | @param nbits The number of bits in the string to encode 22 | @param outlen [out] The length of the DER encoding for the given string 23 | @return CRYPT_OK if successful 24 | */ 25 | int der_length_bit_string(unsigned long nbits, unsigned long *outlen) 26 | { 27 | unsigned long nbytes; 28 | LTC_ARGCHK(outlen != NULL); 29 | 30 | /* get the number of the bytes */ 31 | nbytes = (nbits >> 3) + ((nbits & 7) ? 1 : 0) + 1; 32 | 33 | if (nbytes < 128) { 34 | /* 03 LL PP DD DD DD ... */ 35 | *outlen = 2 + nbytes; 36 | } else if (nbytes < 256) { 37 | /* 03 81 LL PP DD DD DD ... */ 38 | *outlen = 3 + nbytes; 39 | } else if (nbytes < 65536) { 40 | /* 03 82 LL LL PP DD DD DD ... */ 41 | *outlen = 4 + nbytes; 42 | } else { 43 | return CRYPT_INVALID_ARG; 44 | } 45 | 46 | return CRYPT_OK; 47 | } 48 | 49 | #endif 50 | 51 | 52 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c,v $ */ 53 | /* $Revision: 1.3 $ */ 54 | /* $Date: 2006/12/28 01:27:24 $ */ 55 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_reduce_2k_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_REDUCE_2K_L_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* reduces a modulo n where n is of the form 2**p - d 19 | This differs from reduce_2k since "d" can be larger 20 | than a single digit. 21 | */ 22 | int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) 23 | { 24 | mp_int q; 25 | int p, res; 26 | 27 | if ((res = mp_init(&q)) != MP_OKAY) { 28 | return res; 29 | } 30 | 31 | p = mp_count_bits(n); 32 | top: 33 | /* q = a/2**p, a = a mod 2**p */ 34 | if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { 35 | goto ERR; 36 | } 37 | 38 | /* q = q * d */ 39 | if ((res = mp_mul(&q, d, &q)) != MP_OKAY) { 40 | goto ERR; 41 | } 42 | 43 | /* a = a + q */ 44 | if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { 45 | goto ERR; 46 | } 47 | 48 | if (mp_cmp_mag(a, n) != MP_LT) { 49 | s_mp_sub(a, n, a); 50 | goto top; 51 | } 52 | 53 | ERR: 54 | mp_clear(&q); 55 | return res; 56 | } 57 | 58 | #endif 59 | 60 | /* $Source$ */ 61 | /* $Revision: 0.41 $ */ 62 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 63 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_length_octet_string.c 15 | ASN.1 DER, get length of OCTET STRING, Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_DER 19 | /** 20 | Gets length of DER encoding of OCTET STRING 21 | @param noctets The number of octets in the string to encode 22 | @param outlen [out] The length of the DER encoding for the given string 23 | @return CRYPT_OK if successful 24 | */ 25 | int der_length_octet_string(unsigned long noctets, unsigned long *outlen) 26 | { 27 | LTC_ARGCHK(outlen != NULL); 28 | 29 | if (noctets < 128) { 30 | /* 04 LL DD DD DD ... */ 31 | *outlen = 2 + noctets; 32 | } else if (noctets < 256) { 33 | /* 04 81 LL DD DD DD ... */ 34 | *outlen = 3 + noctets; 35 | } else if (noctets < 65536UL) { 36 | /* 04 82 LL LL DD DD DD ... */ 37 | *outlen = 4 + noctets; 38 | } else if (noctets < 16777216UL) { 39 | /* 04 83 LL LL LL DD DD DD ... */ 40 | *outlen = 5 + noctets; 41 | } else { 42 | return CRYPT_INVALID_ARG; 43 | } 44 | 45 | return CRYPT_OK; 46 | } 47 | 48 | #endif 49 | 50 | 51 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c,v $ */ 52 | /* $Revision: 1.3 $ */ 53 | /* $Date: 2006/12/28 01:27:24 $ */ 54 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mod_2d.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MOD_2D_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* calc a value mod 2**b */ 19 | int 20 | mp_mod_2d (mp_int * a, int b, mp_int * c) 21 | { 22 | int x, res; 23 | 24 | /* if b is <= 0 then zero the int */ 25 | if (b <= 0) { 26 | mp_zero (c); 27 | return MP_OKAY; 28 | } 29 | 30 | /* if the modulus is larger than the value than return */ 31 | if (b >= (int) (a->used * DIGIT_BIT)) { 32 | res = mp_copy (a, c); 33 | return res; 34 | } 35 | 36 | /* copy */ 37 | if ((res = mp_copy (a, c)) != MP_OKAY) { 38 | return res; 39 | } 40 | 41 | /* zero digits above the last digit of the modulus */ 42 | for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { 43 | c->dp[x] = 0; 44 | } 45 | /* clear the digit that is not completely outside/inside the modulus */ 46 | c->dp[b / DIGIT_BIT] &= 47 | (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); 48 | mp_clamp (c); 49 | return MP_OKAY; 50 | } 51 | #endif 52 | 53 | /* $Source$ */ 54 | /* $Revision: 0.41 $ */ 55 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 56 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_copy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_COPY_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* copy, b = a */ 19 | int 20 | mp_copy (mp_int * a, mp_int * b) 21 | { 22 | int res, n; 23 | 24 | /* if dst == src do nothing */ 25 | if (a == b) { 26 | return MP_OKAY; 27 | } 28 | 29 | /* grow dest */ 30 | if (b->alloc < a->used) { 31 | if ((res = mp_grow (b, a->used)) != MP_OKAY) { 32 | return res; 33 | } 34 | } 35 | 36 | /* zero b and copy the parameters over */ 37 | { 38 | register mp_digit *tmpa, *tmpb; 39 | 40 | /* pointer aliases */ 41 | 42 | /* source */ 43 | tmpa = a->dp; 44 | 45 | /* destination */ 46 | tmpb = b->dp; 47 | 48 | /* copy all the digits */ 49 | for (n = 0; n < a->used; n++) { 50 | *tmpb++ = *tmpa++; 51 | } 52 | 53 | /* clear high digits */ 54 | for (; n < b->used; n++) { 55 | *tmpb++ = 0; 56 | } 57 | } 58 | 59 | /* copy used count and sign */ 60 | b->used = a->used; 61 | b->sign = a->sign; 62 | return MP_OKAY; 63 | } 64 | #endif 65 | 66 | /* $Source$ */ 67 | /* $Revision: 0.41 $ */ 68 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 69 | -------------------------------------------------------------------------------- /external/tomcrypt/src/misc/crypt/crypt_register_hash.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file crypt_register_hash.c 15 | Register a HASH, Tom St Denis 16 | */ 17 | 18 | /** 19 | Register a hash with the descriptor table 20 | @param hash The hash you wish to register 21 | @return value >= 0 if successfully added (or already present), -1 if unsuccessful 22 | */ 23 | int register_hash(const struct ltc_hash_descriptor *hash) 24 | { 25 | int x; 26 | 27 | LTC_ARGCHK(hash != NULL); 28 | 29 | /* is it already registered? */ 30 | LTC_MUTEX_LOCK(<c_hash_mutex); 31 | for (x = 0; x < TAB_SIZE; x++) { 32 | if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { 33 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 34 | return x; 35 | } 36 | } 37 | 38 | /* find a blank spot */ 39 | for (x = 0; x < TAB_SIZE; x++) { 40 | if (hash_descriptor[x].name == NULL) { 41 | XMEMCPY(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)); 42 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 43 | return x; 44 | } 45 | } 46 | 47 | /* no spot */ 48 | LTC_MUTEX_UNLOCK(<c_hash_mutex); 49 | return -1; 50 | } 51 | 52 | /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_hash.c,v $ */ 53 | /* $Revision: 1.7 $ */ 54 | /* $Date: 2006/12/28 01:27:24 $ */ 55 | -------------------------------------------------------------------------------- /external/discord-rpc/src/rpc_connection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "connection.h" 4 | #include "serialization.h" 5 | 6 | // I took this from the buffer size libuv uses for named pipes; I suspect ours would usually be much 7 | // smaller. 8 | constexpr size_t MaxRpcFrameSize = 64 * 1024; 9 | 10 | struct RpcConnection { 11 | enum class ErrorCode : int { 12 | Success = 0, 13 | PipeClosed = 1, 14 | ReadCorrupt = 2, 15 | }; 16 | 17 | enum class Opcode : uint32_t { 18 | Handshake = 0, 19 | Frame = 1, 20 | Close = 2, 21 | Ping = 3, 22 | Pong = 4, 23 | }; 24 | 25 | struct MessageFrameHeader { 26 | Opcode opcode; 27 | uint32_t length; 28 | }; 29 | 30 | struct MessageFrame : public MessageFrameHeader { 31 | char message[MaxRpcFrameSize - sizeof(MessageFrameHeader)]; 32 | }; 33 | 34 | enum class State : uint32_t { 35 | Disconnected, 36 | SentHandshake, 37 | AwaitingResponse, 38 | Connected, 39 | }; 40 | 41 | BaseConnection* connection{nullptr}; 42 | State state{State::Disconnected}; 43 | void (*onConnect)(JsonDocument& message){nullptr}; 44 | void (*onDisconnect)(int errorCode, const char* message){nullptr}; 45 | char appId[64]{}; 46 | int lastErrorCode{0}; 47 | char lastErrorMessage[256]{}; 48 | RpcConnection::MessageFrame sendFrame; 49 | 50 | static RpcConnection* Create(const char* applicationId); 51 | static void Destroy(RpcConnection*&); 52 | 53 | inline bool IsOpen() const { return state == State::Connected; } 54 | 55 | void Open(); 56 | void Close(); 57 | bool Write(const void* data, size_t length); 58 | bool Read(JsonDocument& message); 59 | }; 60 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - develop 8 | tags: 9 | - '*' 10 | pull_request: 11 | branches: 12 | - master 13 | - develop 14 | 15 | jobs: 16 | linux: 17 | name: Linux 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout code 22 | uses: actions/checkout@v2 23 | with: 24 | fetch-depth: 0 25 | 26 | - name: Install prerequisites 27 | run: | 28 | sudo apt-get install cmake g++-mingw-w64-i686-posix mingw-w64-i686-dev 29 | sudo dpkg --add-architecture i386 30 | sudo apt-get update 31 | sudo apt-get install nasm:i386 32 | 33 | - name: Start SSH agent and add private key 34 | uses: webfactory/ssh-agent@v0.9.1 35 | with: 36 | ssh-private-key: ${{ secrets.CLIENT_AUTH_DEPLOY_KEY }} 37 | 38 | - name: CMake Configure 39 | run: | 40 | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -DOFFICIAL_BUILD=ON 41 | 42 | - name: Build 43 | run: | 44 | cmake --build build --parallel 45 | ln -s build/bin/cod4x_*.dll . 46 | ln -s assets/cod4x/main/*.iwd . 47 | ln -s assets/cod4x/zone/*.ff . 48 | sha1sum cod4x_*.dll *.iwd *.ff > hashes.txt 49 | 50 | - name: Publish release 51 | if: startsWith(github.ref, 'refs/tags/') 52 | uses: ncipollo/release-action@v1 53 | with: 54 | allowUpdates: true 55 | tag: ${{ github.ref_name }} 56 | artifacts: "build/bin/cod4x_*.dll,assets/cod4x/main/*.iwd,assets/cod4x/zone/*.ff,assets/cod4x/core,assets/cod4x/mss,hashes.txt" 57 | token: ${{ secrets.GITHUB_TOKEN }} 58 | 59 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_decode_short_integer.c 15 | ASN.1 DER, decode an integer, Tom St Denis 16 | */ 17 | 18 | 19 | #ifdef LTC_DER 20 | 21 | /** 22 | Read a short integer 23 | @param in The DER encoded data 24 | @param inlen Size of data 25 | @param num [out] The integer to decode 26 | @return CRYPT_OK if successful 27 | */ 28 | int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsigned long *num) 29 | { 30 | unsigned long len, x, y; 31 | 32 | LTC_ARGCHK(num != NULL); 33 | LTC_ARGCHK(in != NULL); 34 | 35 | /* check length */ 36 | if (inlen < 2) { 37 | return CRYPT_INVALID_PACKET; 38 | } 39 | 40 | /* check header */ 41 | x = 0; 42 | if ((in[x++] & 0x1F) != 0x02) { 43 | return CRYPT_INVALID_PACKET; 44 | } 45 | 46 | /* get the packet len */ 47 | len = in[x++]; 48 | 49 | if (x + len > inlen) { 50 | return CRYPT_INVALID_PACKET; 51 | } 52 | 53 | /* read number */ 54 | y = 0; 55 | while (len--) { 56 | y = (y<<8) | (unsigned long)in[x++]; 57 | } 58 | *num = y; 59 | 60 | return CRYPT_OK; 61 | 62 | } 63 | 64 | #endif 65 | 66 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c,v $ */ 67 | /* $Revision: 1.7 $ */ 68 | /* $Date: 2006/12/28 01:27:24 $ */ 69 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_grow.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_GROW_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* grow as required */ 19 | int mp_grow (mp_int * a, int size) 20 | { 21 | int i; 22 | mp_digit *tmp; 23 | 24 | /* if the alloc size is smaller alloc more ram */ 25 | if (a->alloc < size) { 26 | /* ensure there are always at least MP_PREC digits extra on top */ 27 | size += (MP_PREC * 2) - (size % MP_PREC); 28 | 29 | /* reallocate the array a->dp 30 | * 31 | * We store the return in a temporary variable 32 | * in case the operation failed we don't want 33 | * to overwrite the dp member of a. 34 | */ 35 | tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); 36 | if (tmp == NULL) { 37 | /* reallocation failed but "a" is still valid [can be freed] */ 38 | return MP_MEM; 39 | } 40 | 41 | /* reallocation succeeded so set a->dp */ 42 | a->dp = tmp; 43 | 44 | /* zero excess digits */ 45 | i = a->alloc; 46 | a->alloc = size; 47 | for (; i < a->alloc; i++) { 48 | a->dp[i] = 0; 49 | } 50 | } 51 | return MP_OKAY; 52 | } 53 | #endif 54 | 55 | /* $Source$ */ 56 | /* $Revision: 0.41 $ */ 57 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 58 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_lcm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_LCM_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* computes least common multiple as |a*b|/(a, b) */ 19 | int mp_lcm (mp_int * a, mp_int * b, mp_int * c) 20 | { 21 | int res; 22 | mp_int t1, t2; 23 | 24 | 25 | if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) { 26 | return res; 27 | } 28 | 29 | /* t1 = get the GCD of the two inputs */ 30 | if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) { 31 | goto LBL_T; 32 | } 33 | 34 | /* divide the smallest by the GCD */ 35 | if (mp_cmp_mag(a, b) == MP_LT) { 36 | /* store quotient in t2 such that t2 * b is the LCM */ 37 | if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { 38 | goto LBL_T; 39 | } 40 | res = mp_mul(b, &t2, c); 41 | } else { 42 | /* store quotient in t2 such that t2 * a is the LCM */ 43 | if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { 44 | goto LBL_T; 45 | } 46 | res = mp_mul(a, &t2, c); 47 | } 48 | 49 | /* fix the sign to positive */ 50 | c->sign = MP_ZPOS; 51 | 52 | LBL_T: 53 | mp_clear_multi (&t1, &t2, NULL); 54 | return res; 55 | } 56 | #endif 57 | 58 | /* $Source$ */ 59 | /* $Revision: 0.41 $ */ 60 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 61 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_length_short_integer.c 15 | ASN.1 DER, get length of encoding, Tom St Denis 16 | */ 17 | 18 | 19 | #ifdef LTC_DER 20 | /** 21 | Gets length of DER encoding of num 22 | @param num The integer to get the size of 23 | @param outlen [out] The length of the DER encoding for the given integer 24 | @return CRYPT_OK if successful 25 | */ 26 | int der_length_short_integer(unsigned long num, unsigned long *outlen) 27 | { 28 | unsigned long z, y, len; 29 | 30 | LTC_ARGCHK(outlen != NULL); 31 | 32 | /* force to 32 bits */ 33 | num &= 0xFFFFFFFFUL; 34 | 35 | /* get the number of bytes */ 36 | z = 0; 37 | y = num; 38 | while (y) { 39 | ++z; 40 | y >>= 8; 41 | } 42 | 43 | /* handle zero */ 44 | if (z == 0) { 45 | z = 1; 46 | } 47 | 48 | /* we need a 0x02 to indicate it's INTEGER */ 49 | len = 1; 50 | 51 | /* length byte */ 52 | ++len; 53 | 54 | /* bytes in value */ 55 | len += z; 56 | 57 | /* see if msb is set */ 58 | len += (num&(1UL<<((z<<3) - 1))) ? 1 : 0; 59 | 60 | /* return length */ 61 | *outlen = len; 62 | 63 | return CRYPT_OK; 64 | } 65 | 66 | #endif 67 | 68 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c,v $ */ 69 | /* $Revision: 1.6 $ */ 70 | /* $Date: 2006/12/28 01:27:24 $ */ 71 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_montgomery_calc_normalization.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* 19 | * shifts with subtractions when the result is greater than b. 20 | * 21 | * The method is slightly modified to shift B unconditionally upto just under 22 | * the leading bit of b. This saves alot of multiple precision shifting. 23 | */ 24 | int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) 25 | { 26 | int x, bits, res; 27 | 28 | /* how many bits of last digit does b use */ 29 | bits = mp_count_bits (b) % DIGIT_BIT; 30 | 31 | if (b->used > 1) { 32 | if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { 33 | return res; 34 | } 35 | } else { 36 | mp_set(a, 1); 37 | bits = 1; 38 | } 39 | 40 | 41 | /* now compute C = A * B mod b */ 42 | for (x = bits - 1; x < (int)DIGIT_BIT; x++) { 43 | if ((res = mp_mul_2 (a, a)) != MP_OKAY) { 44 | return res; 45 | } 46 | if (mp_cmp_mag (a, b) != MP_LT) { 47 | if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { 48 | return res; 49 | } 50 | } 51 | } 52 | 53 | return MP_OKAY; 54 | } 55 | #endif 56 | 57 | /* $Source$ */ 58 | /* $Revision: 0.41 $ */ 59 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 60 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_div_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_DIV_2_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* b = a/2 */ 19 | int mp_div_2(mp_int * a, mp_int * b) 20 | { 21 | int x, res, oldused; 22 | 23 | /* copy */ 24 | if (b->alloc < a->used) { 25 | if ((res = mp_grow (b, a->used)) != MP_OKAY) { 26 | return res; 27 | } 28 | } 29 | 30 | oldused = b->used; 31 | b->used = a->used; 32 | { 33 | register mp_digit r, rr, *tmpa, *tmpb; 34 | 35 | /* source alias */ 36 | tmpa = a->dp + b->used - 1; 37 | 38 | /* dest alias */ 39 | tmpb = b->dp + b->used - 1; 40 | 41 | /* carry */ 42 | r = 0; 43 | for (x = b->used - 1; x >= 0; x--) { 44 | /* get the carry for the next iteration */ 45 | rr = *tmpa & 1; 46 | 47 | /* shift the current digit, add in carry and store */ 48 | *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); 49 | 50 | /* forward carry to next iteration */ 51 | r = rr; 52 | } 53 | 54 | /* zero excess digits */ 55 | tmpb = b->dp + b->used; 56 | for (x = b->used; x < oldused; x++) { 57 | *tmpb++ = 0; 58 | } 59 | } 60 | b->sign = a->sign; 61 | mp_clamp (b); 62 | return MP_OKAY; 63 | } 64 | #endif 65 | 66 | /* $Source$ */ 67 | /* $Revision: 0.41 $ */ 68 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 69 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_montgomery_setup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MONTGOMERY_SETUP_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* setups the montgomery reduction stuff */ 19 | int 20 | mp_montgomery_setup (mp_int * n, mp_digit * rho) 21 | { 22 | mp_digit x, b; 23 | 24 | /* fast inversion mod 2**k 25 | * 26 | * Based on the fact that 27 | * 28 | * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) 29 | * => 2*X*A - X*X*A*A = 1 30 | * => 2*(1) - (1) = 1 31 | */ 32 | b = n->dp[0]; 33 | 34 | if ((b & 1) == 0) { 35 | return MP_VAL; 36 | } 37 | 38 | x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ 39 | x *= 2 - b * x; /* here x*a==1 mod 2**8 */ 40 | #if !defined(MP_8BIT) 41 | x *= 2 - b * x; /* here x*a==1 mod 2**16 */ 42 | #endif 43 | #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) 44 | x *= 2 - b * x; /* here x*a==1 mod 2**32 */ 45 | #endif 46 | #ifdef MP_64BIT 47 | x *= 2 - b * x; /* here x*a==1 mod 2**64 */ 48 | #endif 49 | 50 | /* rho = -1/m mod b */ 51 | *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; 52 | 53 | return MP_OKAY; 54 | } 55 | #endif 56 | 57 | /* $Source$ */ 58 | /* $Revision: 0.41 $ */ 59 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 60 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_lshd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_LSHD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* shift left a certain amount of digits */ 19 | int mp_lshd (mp_int * a, int b) 20 | { 21 | int x, res; 22 | 23 | /* if its less than zero return */ 24 | if (b <= 0) { 25 | return MP_OKAY; 26 | } 27 | 28 | /* grow to fit the new digits */ 29 | if (a->alloc < a->used + b) { 30 | if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { 31 | return res; 32 | } 33 | } 34 | 35 | { 36 | register mp_digit *top, *bottom; 37 | 38 | /* increment the used by the shift amount then copy upwards */ 39 | a->used += b; 40 | 41 | /* top */ 42 | top = a->dp + a->used - 1; 43 | 44 | /* base */ 45 | bottom = a->dp + a->used - 1 - b; 46 | 47 | /* much like mp_rshd this is implemented using a sliding window 48 | * except the window goes the otherway around. Copying from 49 | * the bottom to the top. see bn_mp_rshd.c for more info. 50 | */ 51 | for (x = a->used - 1; x >= b; x--) { 52 | *top-- = *bottom--; 53 | } 54 | 55 | /* zero the lower digits */ 56 | top = a->dp; 57 | for (x = 0; x < b; x++) { 58 | *top++ = 0; 59 | } 60 | } 61 | return MP_OKAY; 62 | } 63 | #endif 64 | 65 | /* $Source$ */ 66 | /* $Revision: 0.41 $ */ 67 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 68 | -------------------------------------------------------------------------------- /src/ui/menudefinition.h: -------------------------------------------------------------------------------- 1 | // Update menudefinition.h in the code source if you change this file. 2 | 3 | #define MENU_TRUE 1 4 | #define MENU_FALSE 0 5 | 6 | #define RANGETYPE_ABSOLUTE 0 7 | #define RANGETYPE_RELATIVE 1 8 | 9 | // display flags 10 | #define CG_SHOW_BLUE_TEAM_HAS_REDFLAG 0x00000001 11 | #define CG_SHOW_RED_TEAM_HAS_BLUEFLAG 0x00000002 12 | #define CG_SHOW_ANYTEAMGAME 0x00000004 13 | #define CG_SHOW_CTF 0x00000020 14 | #define CG_SHOW_OBELISK 0x00000040 15 | #define CG_SHOW_HEALTHCRITICAL 0x00000080 16 | #define CG_SHOW_SINGLEPLAYER 0x00000100 17 | #define CG_SHOW_TOURNAMENT 0x00000200 18 | #define CG_SHOW_DURINGINCOMINGVOICE 0x00000400 19 | #define CG_SHOW_IF_PLAYER_HAS_FLAG 0x00000800 20 | #define CG_SHOW_LANPLAYONLY 0x00001000 21 | #define CG_SHOW_MINED 0x00002000 22 | #define CG_SHOW_HEALTHOK 0x00004000 23 | #define CG_SHOW_TEAMINFO 0x00008000 24 | #define CG_SHOW_NOTEAMINFO 0x00010000 25 | #define CG_SHOW_OTHERTEAMHASFLAG 0x00020000 26 | #define CG_SHOW_YOURTEAMHASENEMYFLAG 0x00040000 27 | #define CG_SHOW_ANYNONTEAMGAME 0x00080000 28 | #define CG_SHOW_TEXTASINT 0x00200000 29 | #define CG_SHOW_HIGHLIGHTED 0x00100000 30 | 31 | #define CG_SHOW_NOT_V_CLEAR 0x02000000 32 | 33 | #define CG_SHOW_2DONLY 0x10000000 34 | 35 | 36 | #define UI_SHOW_LEADER 0x00000001 37 | #define UI_SHOW_NOTLEADER 0x00000002 38 | #define UI_SHOW_FAVORITESERVERS 0x00000004 39 | #define UI_SHOW_ANYNONTEAMGAME 0x00000008 40 | #define UI_SHOW_ANYTEAMGAME 0x00000010 41 | #define UI_SHOW_NEWHIGHSCORE 0x00000020 42 | #define UI_SHOW_DEMOAVAILABLE 0x00000040 43 | #define UI_SHOW_NEWBESTTIME 0x00000080 44 | #define UI_SHOW_FFA 0x00000100 45 | #define UI_SHOW_NOTFFA 0x00000200 46 | #define UI_SHOW_NETANYNONTEAMGAME 0x00000400 47 | #define UI_SHOW_NETANYTEAMGAME 0x00000800 48 | #define UI_SHOW_NOTFAVORITESERVERS 0x00001000 49 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_sub.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_SUB_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* high level subtraction (handles signs) */ 19 | int 20 | mp_sub (mp_int * a, mp_int * b, mp_int * c) 21 | { 22 | int sa, sb, res; 23 | 24 | sa = a->sign; 25 | sb = b->sign; 26 | 27 | if (sa != sb) { 28 | /* subtract a negative from a positive, OR */ 29 | /* subtract a positive from a negative. */ 30 | /* In either case, ADD their magnitudes, */ 31 | /* and use the sign of the first number. */ 32 | c->sign = sa; 33 | res = s_mp_add (a, b, c); 34 | } else { 35 | /* subtract a positive from a positive, OR */ 36 | /* subtract a negative from a negative. */ 37 | /* First, take the difference between their */ 38 | /* magnitudes, then... */ 39 | if (mp_cmp_mag (a, b) != MP_LT) { 40 | /* Copy the sign from the first */ 41 | c->sign = sa; 42 | /* The first has a larger or equal magnitude */ 43 | res = s_mp_sub (a, b, c); 44 | } else { 45 | /* The result has the *opposite* sign from */ 46 | /* the first number. */ 47 | c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; 48 | /* The second has a larger magnitude */ 49 | res = s_mp_sub (b, a, c); 50 | } 51 | } 52 | return res; 53 | } 54 | 55 | #endif 56 | 57 | /* $Source$ */ 58 | /* $Revision: 0.41 $ */ 59 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 60 | -------------------------------------------------------------------------------- /src/other.c: -------------------------------------------------------------------------------- 1 | #include "qcommon.h" 2 | #include "ui_shared.h" 3 | #include "client.h" 4 | #include "stringed_public.h" 5 | 6 | #include 7 | 8 | void Scr_UpdateLoadScreen2( ); 9 | 10 | void Scr_UpdateLoadScreen() 11 | { 12 | if ( !com_useFastFiles->boolean ) 13 | Scr_UpdateLoadScreen2(); 14 | } 15 | 16 | 17 | signed int GetKeyBindingLocalizedString(int localClientNum, char *search, char *out, char a4) 18 | { 19 | signed int bindings; 20 | char bindingString[256]; 21 | const char* translated; 22 | const char* translated2; 23 | 24 | bindings = CL_GetKeyBinding(localClientNum, search, bindingString); 25 | 26 | if ( !bindings ) 27 | { 28 | Q_strncpyz(out, UI_SafeTranslateString("KEY_UNBOUND"), 256); 29 | return bindings; 30 | } 31 | 32 | if ( a4 && bindings > 1 ) 33 | { 34 | bindings = 1; 35 | } 36 | if ( bindings == 1 ) 37 | { 38 | translated = SEH_StringEd_GetString(bindingString); 39 | if ( !translated ) 40 | translated = bindingString; 41 | Q_strncpyz(out, translated, 256); 42 | return bindings; 43 | } 44 | 45 | translated = SEH_StringEd_GetString(bindingString); 46 | translated2 = SEH_StringEd_GetString(bindingString +128); 47 | 48 | if ( !translated2 ) 49 | { 50 | translated2 = &bindingString[128]; 51 | } 52 | if ( !translated ) 53 | { 54 | translated = bindingString; 55 | } 56 | Com_sprintf(out, 256, "%s %s %s", translated, UI_SafeTranslateString("KEY_OR"), translated2); 57 | return bindings; 58 | } 59 | 60 | int __stdcall MSS_FileSeekCallback(fileHandle_t f, int offset, unsigned int org) 61 | { 62 | if ( org == 1 ) 63 | { 64 | FS_Seek(f, offset, 0); 65 | return FS_FTell(f); 66 | } 67 | if ( org >= 1 ) 68 | { 69 | if ( org == 2 ) 70 | { 71 | FS_Seek(f, offset, 1); 72 | return FS_FTell(f); 73 | } 74 | return 0; 75 | } 76 | FS_Seek(f, offset, 2); 77 | return FS_FTell(f); 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_rshd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_RSHD_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* shift right a certain amount of digits */ 19 | void mp_rshd (mp_int * a, int b) 20 | { 21 | int x; 22 | 23 | /* if b <= 0 then ignore it */ 24 | if (b <= 0) { 25 | return; 26 | } 27 | 28 | /* if b > used then simply zero it and return */ 29 | if (a->used <= b) { 30 | mp_zero (a); 31 | return; 32 | } 33 | 34 | { 35 | register mp_digit *bottom, *top; 36 | 37 | /* shift the digits down */ 38 | 39 | /* bottom */ 40 | bottom = a->dp; 41 | 42 | /* top [offset into digits] */ 43 | top = a->dp + b; 44 | 45 | /* this is implemented as a sliding window where 46 | * the window is b-digits long and digits from 47 | * the top of the window are copied to the bottom 48 | * 49 | * e.g. 50 | 51 | b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> 52 | /\ | ----> 53 | \-------------------/ ----> 54 | */ 55 | for (x = 0; x < (a->used - b); x++) { 56 | *bottom++ = *top++; 57 | } 58 | 59 | /* zero the top digits */ 60 | for (; x < a->used; x++) { 61 | *bottom++ = 0; 62 | } 63 | } 64 | 65 | /* remove excess digits */ 66 | a->used -= b; 67 | } 68 | #endif 69 | 70 | /* $Source$ */ 71 | /* $Revision: 0.41 $ */ 72 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 73 | -------------------------------------------------------------------------------- /external/tomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file der_sequence_free.c 15 | ASN.1 DER, free's a structure allocated by der_decode_sequence_flexi(), Tom St Denis 16 | */ 17 | 18 | #ifdef LTC_DER 19 | 20 | /** 21 | Free memory allocated by der_decode_sequence_flexi() 22 | @param in The list to free 23 | */ 24 | void der_sequence_free(ltc_asn1_list *in) 25 | { 26 | ltc_asn1_list *l; 27 | 28 | /* walk to the start of the chain */ 29 | while (in->prev != NULL || in->parent != NULL) { 30 | if (in->parent != NULL) { 31 | in = in->parent; 32 | } else { 33 | in = in->prev; 34 | } 35 | } 36 | 37 | /* now walk the list and free stuff */ 38 | while (in != NULL) { 39 | /* is there a child? */ 40 | if (in->child) { 41 | /* disconnect */ 42 | in->child->parent = NULL; 43 | der_sequence_free(in->child); 44 | } 45 | 46 | switch (in->type) { 47 | case LTC_ASN1_SET: 48 | case LTC_ASN1_SETOF: 49 | case LTC_ASN1_SEQUENCE: break; 50 | case LTC_ASN1_INTEGER : if (in->data != NULL) { mp_clear(in->data); } break; 51 | default : if (in->data != NULL) { XFREE(in->data); } 52 | } 53 | 54 | /* move to next and free current */ 55 | l = in->next; 56 | free(in); 57 | in = l; 58 | } 59 | } 60 | 61 | #endif 62 | 63 | /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c,v $ */ 64 | /* $Revision: 1.4 $ */ 65 | /* $Date: 2006/12/28 01:27:24 $ */ 66 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/isteammusic.h: -------------------------------------------------------------------------------- 1 | //============ Copyright (c) Valve Corporation, All rights reserved. ============ 2 | 3 | #ifndef ISTEAMMUSIC_H 4 | #define ISTEAMMUSIC_H 5 | #ifdef _WIN32 6 | #pragma once 7 | #endif 8 | 9 | #include "isteamclient.h" 10 | 11 | //----------------------------------------------------------------------------- 12 | // Purpose: 13 | //----------------------------------------------------------------------------- 14 | enum AudioPlayback_Status 15 | { 16 | AudioPlayback_Undefined = 0, 17 | AudioPlayback_Playing = 1, 18 | AudioPlayback_Paused = 2, 19 | AudioPlayback_Idle = 3 20 | }; 21 | 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Functions to control music playback in the steam client 25 | //----------------------------------------------------------------------------- 26 | class ISteamMusic 27 | { 28 | public: 29 | virtual bool BIsEnabled() = 0; 30 | virtual bool BIsPlaying() = 0; 31 | 32 | virtual AudioPlayback_Status GetPlaybackStatus() = 0; 33 | 34 | virtual void Play() = 0; 35 | virtual void Pause() = 0; 36 | virtual void PlayPrevious() = 0; 37 | virtual void PlayNext() = 0; 38 | 39 | // volume is between 0.0 and 1.0 40 | virtual void SetVolume( float flVolume ) = 0; 41 | virtual float GetVolume() = 0; 42 | 43 | }; 44 | 45 | #define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" 46 | 47 | // callbacks 48 | #if defined( VALVE_CALLBACK_PACK_SMALL ) 49 | #pragma pack( push, 4 ) 50 | #elif defined( VALVE_CALLBACK_PACK_LARGE ) 51 | #pragma pack( push, 8 ) 52 | #else 53 | #error isteamclient.h must be included 54 | #endif 55 | 56 | 57 | DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) 58 | END_DEFINE_CALLBACK_0() 59 | 60 | DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) 61 | CALLBACK_MEMBER( 0, float, m_flNewVolume ) 62 | END_DEFINE_CALLBACK_1() 63 | 64 | #pragma pack( pop ) 65 | 66 | 67 | #endif // #define ISTEAMMUSIC_H 68 | -------------------------------------------------------------------------------- /src/com_findxassets.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | #include "xassets/sounds.h" 4 | #include "xzone.h" 5 | 6 | 7 | snd_alias_list_t *__cdecl Com_FindSoundAlias_FastFile(const char *soundname); 8 | snd_alias_list_t *__cdecl Com_PickSoundAliasFromList(const char *soundname); 9 | 10 | snd_alias_list_t* Com_FindSoundAlias(const char *name) 11 | { 12 | if ( com_useFastFiles->boolean ) 13 | { 14 | return Com_FindSoundAlias_FastFile(name); 15 | } 16 | return Com_PickSoundAliasFromList(name); 17 | 18 | } 19 | 20 | snd_alias_list_t *__cdecl Com_FindSoundAlias_FastFile(const char *name) 21 | { 22 | XAssetHeader header; 23 | 24 | header = DB_FindXAssetHeader(ASSET_TYPE_SOUND, name); 25 | 26 | if ( DB_IsXAssetDefault(ASSET_TYPE_SOUND, name) ) 27 | { 28 | Com_PrintError(CON_CHANNEL_ERROR, "Missing soundalias \"%s\".\n", name); 29 | return NULL; 30 | } 31 | return header.sound; 32 | } 33 | 34 | const char *__cdecl SE_GetString_FastFile(const char *name) 35 | { 36 | XAssetHeader header; 37 | 38 | header = DB_FindXAssetHeader(ASSET_TYPE_LOCALIZE_ENTRY, name); 39 | if ( header.localize ) 40 | return header.localize->value; 41 | else 42 | return NULL; 43 | } 44 | 45 | const char *__cdecl SE_GetString_LoadObj(const char *name); 46 | 47 | const char* SE_GetString(const char* findentry) 48 | { 49 | if ( com_useFastFiles->boolean ) 50 | return SE_GetString_FastFile(findentry); 51 | else 52 | return SE_GetString_LoadObj(findentry); 53 | } 54 | 55 | XAssetHeader Com_FindXAsset(XAssetType type, const char *name) 56 | { 57 | XAssetHeader header; 58 | switch(type) 59 | { 60 | case ASSET_TYPE_SOUND: 61 | header.sound = Com_FindSoundAlias(name); 62 | break; 63 | case ASSET_TYPE_MATERIAL: 64 | header.material = Material_RegisterHandle(name, 0); 65 | break; 66 | default: 67 | Com_Error(ERR_FATAL, "Com_FindXAsset: Invalid xasset type %d", type); 68 | } 69 | 70 | return header; 71 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoD4x Client 2 |

3 | 4 |

5 | 6 | A [CoD4x Server](https://github.com/callofduty4x/CoD4x_Server)-compatible client. 7 | 8 | This client version isn't compatible with CoD4x servers that require client authentication, however, it is compatible with servers that have client authentication disabled (`sv_noauth 1`). 9 | 10 | Modifications of this client **may** end up in the official release, so merge requests are very welcome. 11 | 12 | # Build: 13 | 14 | ## Build prerequisites: 15 | - [CMake](https://cmake.org/) 16 | - [MinGW](http://www.mingw.org/) 17 | - [NASM](http://www.nasm.us/) 18 | 19 | Make sure you've got the necessary binaries in the system `$PATH` environment variable. [Click here to learn more.](https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them) 20 | 21 | ## Building on Windows: 22 | ```shell 23 | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -G "MinGW Makefiles" 24 | cmake --build build --parallel 25 | ``` 26 | 27 | ## Cross-compiling on Linux: 28 | ```shell 29 | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ 30 | cmake --build build --parallel 31 | ``` 32 | 33 | --- 34 | 35 | After a successful build, the build artifact is located in `build/bin/cod4x_021.dll`. 36 | 37 | ## License: 38 | The following conditions apply: https://support.activision.com/license 39 | 40 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 41 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_init_multi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_INIT_MULTI_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | #include 18 | 19 | int mp_init_multi(mp_int *mp, ...) 20 | { 21 | mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ 22 | int n = 0; /* Number of ok inits */ 23 | mp_int* cur_arg = mp; 24 | va_list args; 25 | 26 | va_start(args, mp); /* init args to next argument from caller */ 27 | while (cur_arg != NULL) { 28 | if (mp_init(cur_arg) != MP_OKAY) { 29 | /* Oops - error! Back-track and mp_clear what we already 30 | succeeded in init-ing, then return error. 31 | */ 32 | va_list clean_args; 33 | 34 | /* end the current list */ 35 | va_end(args); 36 | 37 | /* now start cleaning up */ 38 | cur_arg = mp; 39 | va_start(clean_args, mp); 40 | while (n--) { 41 | mp_clear(cur_arg); 42 | cur_arg = va_arg(clean_args, mp_int*); 43 | } 44 | va_end(clean_args); 45 | res = MP_MEM; 46 | break; 47 | } 48 | n++; 49 | cur_arg = va_arg(args, mp_int*); 50 | } 51 | va_end(args); 52 | return res; /* Assumed ok, if error flagged above. */ 53 | } 54 | 55 | #endif 56 | 57 | /* $Source$ */ 58 | /* $Revision: 0.41 $ */ 59 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 60 | -------------------------------------------------------------------------------- /src/cl_rank.c: -------------------------------------------------------------------------------- 1 | #include "q_shared.h" 2 | #include "qcommon.h" 3 | #include "xassets/simple.h" 4 | #include "xassets/material.h" 5 | 6 | const char *StringTable_Lookup(StringTable *table, const int comparisonColumn, const char *value, const int valueColumn); 7 | void __cdecl StringTable_GetAsset(const char *filename, StringTable **tablePtr); 8 | 9 | cvar_t* cl_ranktablename; 10 | 11 | void __cdecl CL_InitRanktableVars() 12 | { 13 | cl_ranktablename = Cvar_RegisterString("g_ranktablename", "", CVAR_INIT, "Changes name of ranktable when set by server"); 14 | } 15 | 16 | 17 | 18 | void __cdecl CL_GetRankIcon(int rank, int prestige, Material **handle) 19 | { 20 | StringTable *table; 21 | const char *rankIconName; 22 | char id[5]; 23 | 24 | if ( com_useFastFiles->boolean ) 25 | { 26 | assert(rank >= 0); 27 | assert(prestige >= 0); 28 | assert(handle); 29 | 30 | char ranktablepath[128]; 31 | 32 | if(cl_ranktablename == NULL) 33 | { 34 | CL_InitRanktableVars(); 35 | } 36 | 37 | Com_sprintf(ranktablepath, sizeof(ranktablepath), "mp/rankIconTable%s.csv", cl_ranktablename->string); 38 | 39 | StringTable_GetAsset(ranktablepath, &table); 40 | assert(table); 41 | 42 | Com_sprintf(id, sizeof(id), "%i", rank); 43 | rankIconName = StringTable_Lookup(table, 0, id, prestige + 1); 44 | *handle = Material_RegisterHandle(rankIconName, 7); 45 | if ( Material_IsDefault(*handle) ) 46 | { 47 | *handle = 0; 48 | } 49 | }else{ 50 | } 51 | } 52 | 53 | 54 | const char *__cdecl CL_GetRankData(int rank) 55 | { 56 | StringTable *table; 57 | char llevel[5]; 58 | 59 | char ranktablepath[128]; 60 | 61 | if(cl_ranktablename == NULL) 62 | { 63 | CL_InitRanktableVars(); 64 | } 65 | 66 | Com_sprintf(ranktablepath, sizeof(ranktablepath), "mp/rankTable%s.csv", cl_ranktablename->string); 67 | 68 | StringTable_GetAsset(ranktablepath, &table); 69 | assert(table); 70 | Com_sprintf(llevel, sizeof(llevel), "%i", rank); 71 | return StringTable_Lookup(table, 0, llevel, 14); 72 | } 73 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_toradix.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_TORADIX_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* stores a bignum as a ASCII string in a given radix (2..64) */ 19 | int mp_toradix (mp_int * a, char *str, int radix) 20 | { 21 | int res, digs; 22 | mp_int t; 23 | mp_digit d; 24 | char *_s = str; 25 | 26 | /* check range of the radix */ 27 | if (radix < 2 || radix > 64) { 28 | return MP_VAL; 29 | } 30 | 31 | /* quick out if its zero */ 32 | if (mp_iszero(a) == 1) { 33 | *str++ = '0'; 34 | *str = '\0'; 35 | return MP_OKAY; 36 | } 37 | 38 | if ((res = mp_init_copy (&t, a)) != MP_OKAY) { 39 | return res; 40 | } 41 | 42 | /* if it is negative output a - */ 43 | if (t.sign == MP_NEG) { 44 | ++_s; 45 | *str++ = '-'; 46 | t.sign = MP_ZPOS; 47 | } 48 | 49 | digs = 0; 50 | while (mp_iszero (&t) == 0) { 51 | if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { 52 | mp_clear (&t); 53 | return res; 54 | } 55 | *str++ = mp_s_rmap[d]; 56 | ++digs; 57 | } 58 | 59 | /* reverse the digits of the string. In this case _s points 60 | * to the first digit [exluding the sign] of the number] 61 | */ 62 | bn_reverse ((unsigned char *)_s, digs); 63 | 64 | /* append a NULL so the string is properly terminated */ 65 | *str = '\0'; 66 | 67 | mp_clear (&t); 68 | return MP_OKAY; 69 | } 70 | 71 | #endif 72 | 73 | /* $Source$ */ 74 | /* $Revision: 0.41 $ */ 75 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 76 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/opensteamworks/ContentServerCommon.h: -------------------------------------------------------------------------------- 1 | //========================== Open Steamworks ================================ 2 | // 3 | // This file is part of the Open Steamworks project. All individuals associated 4 | // with this project do not claim ownership of the contents 5 | // 6 | // The code, comments, and all related files, projects, resources, 7 | // redistributables included with this project are Copyright Valve Corporation. 8 | // Additionally, Valve, the Valve logo, Half-Life, the Half-Life logo, the 9 | // Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo, 10 | // Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the 11 | // Counter-Strike logo, Source, the Source logo, and Counter-Strike Condition 12 | // Zero are trademarks and or registered trademarks of Valve Corporation. 13 | // All other trademarks are property of their respective owners. 14 | // 15 | //============================================================================= 16 | 17 | #ifndef CONTENTSERVERCOMMON_H 18 | #define CONTENTSERVERCOMMON_H 19 | #ifdef _WIN32 20 | #pragma once 21 | #endif 22 | 23 | 24 | 25 | #define CLIENTCONTENTSERVER_INTERFACE_VERSION "CLIENTCONTENTSERVER_INTERFACE_VERSION001" 26 | 27 | #define STEAMCONTENTSERVER_INTERFACE_VERSION_001 "SteamContentServer001" 28 | #define STEAMCONTENTSERVER_INTERFACE_VERSION_002 "SteamContentServer002" 29 | 30 | 31 | 32 | typedef enum EConnectionPriority 33 | { 34 | k_EConnectionPriorityLow = 0, 35 | k_EConnectionPriorityMedium = 1, 36 | k_EConnectionPriorityHigh = 2, 37 | } EConnectionPriority; 38 | 39 | 40 | #pragma pack( push, 8 ) 41 | struct CSClientApprove_t 42 | { 43 | enum { k_iCallback = k_iSteamContentServerCallbacks + 1 }; 44 | 45 | CSteamID m_SteamID; 46 | uint32 m_uContentID; 47 | }; 48 | 49 | struct CSClientDeny_t 50 | { 51 | enum { k_iCallback = k_iSteamContentServerCallbacks + 2 }; 52 | 53 | CSteamID m_SteamID; 54 | uint32 m_uContentID; 55 | EDenyReason m_eDenyReason; 56 | }; 57 | #pragma pack( pop ) 58 | 59 | #endif // CONTENTSERVERCOMMON_H 60 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mul.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MUL_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* high level multiplication (handles sign) */ 19 | int mp_mul (mp_int * a, mp_int * b, mp_int * c) 20 | { 21 | int res, neg; 22 | neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; 23 | 24 | /* use Toom-Cook? */ 25 | #ifdef BN_MP_TOOM_MUL_C 26 | if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { 27 | res = mp_toom_mul(a, b, c); 28 | } else 29 | #endif 30 | #ifdef BN_MP_KARATSUBA_MUL_C 31 | /* use Karatsuba? */ 32 | if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { 33 | res = mp_karatsuba_mul (a, b, c); 34 | } else 35 | #endif 36 | { 37 | /* can we use the fast multiplier? 38 | * 39 | * The fast multiplier can be used if the output will 40 | * have less than MP_WARRAY digits and the number of 41 | * digits won't affect carry propagation 42 | */ 43 | int digs = a->used + b->used + 1; 44 | 45 | #ifdef BN_FAST_S_MP_MUL_DIGS_C 46 | if ((digs < MP_WARRAY) && 47 | MIN(a->used, b->used) <= 48 | (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { 49 | res = fast_s_mp_mul_digs (a, b, c, digs); 50 | } else 51 | #endif 52 | #ifdef BN_S_MP_MUL_DIGS_C 53 | res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ 54 | #else 55 | res = MP_VAL; 56 | #endif 57 | 58 | } 59 | c->sign = (c->used > 0) ? neg : MP_ZPOS; 60 | return res; 61 | } 62 | #endif 63 | 64 | /* $Source$ */ 65 | /* $Revision: 0.41 $ */ 66 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 67 | -------------------------------------------------------------------------------- /external/mbedtls/include/mbedtls/havege.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file havege.h 3 | * 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion 5 | * 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 7 | * SPDX-License-Identifier: Apache-2.0 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * This file is part of mbed TLS (https://tls.mbed.org) 22 | */ 23 | #ifndef MBEDTLS_HAVEGE_H 24 | #define MBEDTLS_HAVEGE_H 25 | 26 | #include 27 | 28 | #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * \brief HAVEGE state structure 36 | */ 37 | typedef struct 38 | { 39 | int PT1, PT2, offset[2]; 40 | int pool[MBEDTLS_HAVEGE_COLLECT_SIZE]; 41 | int WALK[8192]; 42 | } 43 | mbedtls_havege_state; 44 | 45 | /** 46 | * \brief HAVEGE initialization 47 | * 48 | * \param hs HAVEGE state to be initialized 49 | */ 50 | void mbedtls_havege_init( mbedtls_havege_state *hs ); 51 | 52 | /** 53 | * \brief Clear HAVEGE state 54 | * 55 | * \param hs HAVEGE state to be cleared 56 | */ 57 | void mbedtls_havege_free( mbedtls_havege_state *hs ); 58 | 59 | /** 60 | * \brief HAVEGE rand function 61 | * 62 | * \param p_rng A HAVEGE state 63 | * \param output Buffer to fill 64 | * \param len Length of buffer 65 | * 66 | * \return 0 67 | */ 68 | int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len ); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif /* havege.h */ 75 | -------------------------------------------------------------------------------- /src/xassets/gfximage.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFXIMAGE_H__ 2 | #define __GFXIMAGE_H__ 3 | 4 | #include 5 | 6 | typedef struct IDirect3DBaseTexture9 D3DBaseTexture; 7 | typedef struct IDirect3DTexture9 D3DTexture; 8 | typedef struct IDirect3DVolumeTexture9 D3DVolumeTexture; 9 | typedef struct IDirect3DCubeTexture9 D3DCubeTexture; 10 | typedef struct IDirect3DSurface9 D3DSurface; 11 | 12 | typedef enum MapType_s 13 | { 14 | MAPTYPE_NONE = 0x0, 15 | MAPTYPE_INVALID1 = 0x1, 16 | MAPTYPE_INVALID2 = 0x2, 17 | MAPTYPE_2D = 0x3, 18 | MAPTYPE_3D = 0x4, 19 | MAPTYPE_CUBE = 0x5, 20 | MAPTYPE_COUNT = 0x6, 21 | }MapType_t; 22 | 23 | 24 | struct GfxImageLoadDef 25 | { 26 | char levelCount; 27 | char flags; 28 | int16_t dimensions[3]; 29 | enum _D3DFORMAT format; 30 | int resourceSize; 31 | byte data[1]; 32 | }; 33 | 34 | 35 | 36 | union GfxTexture { 37 | struct IDirect3DBaseTexture9 * basemap; 38 | struct IDirect3DTexture9 * map; 39 | struct IDirect3DVolumeTexture9 * volmap; 40 | struct IDirect3DCubeTexture9 * cubemap; 41 | struct GfxImageLoadDef * loadDef; 42 | }; 43 | 44 | struct Picmip 45 | { 46 | char platform[2]; 47 | }; 48 | 49 | struct CardMemory 50 | { 51 | int platform[2]; 52 | }; 53 | 54 | 55 | struct GfxImage 56 | { 57 | MapType_t mapType; 58 | union GfxTexture texture; 59 | struct Picmip picmip; 60 | byte noPicmip; 61 | byte semantic; 62 | byte track; 63 | byte field_05; 64 | unsigned __int16 field_06; 65 | struct CardMemory cardMemory; 66 | unsigned __int16 width; 67 | unsigned __int16 height; 68 | unsigned __int16 depth; 69 | byte category; 70 | byte delayLoadPixels; 71 | const char *name; 72 | }; 73 | 74 | enum $B2FD3713A7CE728D7D4B9B08B4C380D8 75 | { 76 | IMG_CATEGORY_UNKNOWN = 0x0, 77 | IMG_CATEGORY_AUTO_GENERATED = 0x1, 78 | IMG_CATEGORY_LIGHTMAP = 0x2, 79 | IMG_CATEGORY_LOAD_FROM_FILE = 0x3, 80 | IMG_CATEGORY_RAW = 0x4, 81 | IMG_CATEGORY_FIRST_UNMANAGED = 0x5, 82 | IMG_CATEGORY_WATER = 0x5, 83 | IMG_CATEGORY_RENDERTARGET = 0x6, 84 | IMG_CATEGORY_TEMP = 0x7, 85 | }; 86 | 87 | 88 | 89 | #endif -------------------------------------------------------------------------------- /src/sv_main.c: -------------------------------------------------------------------------------- 1 | #include "server.h" 2 | #include "sys_patch.h" 3 | #include "qcommon.h" 4 | 5 | #include "cg_weapons.h" 6 | 7 | void SV_SetMapCenterInSVSHeader(float* center) 8 | { 9 | svsHeader.mapCenter[0] = center[0]; 10 | svsHeader.mapCenter[1] = center[1]; 11 | svsHeader.mapCenter[2] = center[2]; 12 | } 13 | 14 | void SV_GetMapCenterFromSVSHeader(float* center) 15 | { 16 | center[0] = svsHeader.mapCenter[0]; 17 | center[1] = svsHeader.mapCenter[1]; 18 | center[2] = svsHeader.mapCenter[2]; 19 | } 20 | 21 | void SaveRegisteredItems() 22 | { 23 | byte bits[MAX_ITEMS / 8]; 24 | char itemstring[MAX_ITEMS]; 25 | int i, bitpos; 26 | 27 | *((int*)0x13EE494) = 0; 28 | 29 | 30 | Com_Memset(bits, 0 , sizeof(bits)); 31 | 32 | for(i = 0; i < MAX_ITEMS; ++i) 33 | { 34 | if(itemRegistered[i]) 35 | { 36 | bitpos = i & 3; 37 | if((i & 7) > 3) 38 | { 39 | bits[i / 8] |= 1 << bitpos; 40 | }else{ 41 | bits[i / 8] |= 1 << (bitpos + 4); 42 | } 43 | 44 | 45 | } 46 | } 47 | 48 | for(i = 0; i < (MAX_ITEMS / 8); i++) 49 | { 50 | sprintf(&itemstring[2*i], "%02x", bits[i]); 51 | } 52 | itemstring[2*i] = '\0'; 53 | 54 | // Com_Printf("ItemString: %s\n", itemstring); 55 | 56 | SV_SetConfigString(2314, itemstring); 57 | } 58 | 59 | 60 | int SV_GetPredirectedOriginAndTimeForClientNum(int clientNum, float *origin) 61 | { 62 | client_t* client = &svs.clients[clientNum]; 63 | origin[0] = client->predictedOrigin[0]; 64 | origin[1] = client->predictedOrigin[1]; 65 | origin[2] = client->predictedOrigin[2]; 66 | return client->predictedOriginServerTime; 67 | } 68 | 69 | 70 | void SV_Patches() 71 | { 72 | WriteSymbol(0x4bcbfa, itemRegistered); 73 | WriteSymbol(0x4bcca6, itemRegistered); 74 | WriteSymbol(0x4c298b, itemRegistered); 75 | WriteSymbol(0x4e87d4, itemRegistered); 76 | WriteSymbol(0x4ea41c, itemRegistered); 77 | WriteSymbol(0x4ea434, itemRegistered); 78 | 79 | SetJump(0x4BCBE0, SaveRegisteredItems); 80 | } 81 | 82 | 83 | int __regparm1 __MSG_ReadBitsCompress_Server(const byte* input, byte* outputBuf, int readsize) 84 | { 85 | return MSG_ReadBitsCompress(input, readsize, outputBuf, 0x800); 86 | } 87 | -------------------------------------------------------------------------------- /external/tomcrypt/src/hashes/hash_memory.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include "tomcrypt.h" 12 | 13 | /** 14 | @file hash_memory.c 15 | Hash memory helper, Tom St Denis 16 | */ 17 | 18 | /** 19 | Hash a block of memory and store the digest. 20 | @param hash The index of the hash you wish to use 21 | @param in The data you wish to hash 22 | @param inlen The length of the data to hash (octets) 23 | @param out [out] Where to store the digest 24 | @param outlen [in/out] Max size and resulting size of the digest 25 | @return CRYPT_OK if successful 26 | */ 27 | int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) 28 | { 29 | hash_state *md; 30 | int err; 31 | 32 | LTC_ARGCHK(in != NULL); 33 | LTC_ARGCHK(out != NULL); 34 | LTC_ARGCHK(outlen != NULL); 35 | 36 | if ((err = hash_is_valid(hash)) != CRYPT_OK) { 37 | return err; 38 | } 39 | 40 | if (*outlen < hash_descriptor[hash].hashsize) { 41 | *outlen = hash_descriptor[hash].hashsize; 42 | return CRYPT_BUFFER_OVERFLOW; 43 | } 44 | 45 | md = XMALLOC(sizeof(hash_state)); 46 | if (md == NULL) { 47 | return CRYPT_MEM; 48 | } 49 | 50 | if ((err = hash_descriptor[hash].init(md)) != CRYPT_OK) { 51 | goto LBL_ERR; 52 | } 53 | if ((err = hash_descriptor[hash].process(md, in, inlen)) != CRYPT_OK) { 54 | goto LBL_ERR; 55 | } 56 | err = hash_descriptor[hash].done(md, out); 57 | *outlen = hash_descriptor[hash].hashsize; 58 | LBL_ERR: 59 | #ifdef LTC_CLEAN_STACK 60 | zeromem(md, sizeof(hash_state)); 61 | #endif 62 | XFREE(md); 63 | 64 | return err; 65 | } 66 | 67 | /* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory.c,v $ */ 68 | /* $Revision: 1.6 $ */ 69 | /* $Date: 2006/12/28 01:27:23 $ */ 70 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_div_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_DIV_3_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* divide by three (based on routine from MPI and the GMP manual) */ 19 | int 20 | mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) 21 | { 22 | mp_int q; 23 | mp_word w, t; 24 | mp_digit b; 25 | int res, ix; 26 | 27 | /* b = 2**DIGIT_BIT / 3 */ 28 | b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); 29 | 30 | if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { 31 | return res; 32 | } 33 | 34 | q.used = a->used; 35 | q.sign = a->sign; 36 | w = 0; 37 | for (ix = a->used - 1; ix >= 0; ix--) { 38 | w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); 39 | 40 | if (w >= 3) { 41 | /* multiply w by [1/3] */ 42 | t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); 43 | 44 | /* now subtract 3 * [w/3] from w, to get the remainder */ 45 | w -= t+t+t; 46 | 47 | /* fixup the remainder as required since 48 | * the optimization is not exact. 49 | */ 50 | while (w >= 3) { 51 | t += 1; 52 | w -= 3; 53 | } 54 | } else { 55 | t = 0; 56 | } 57 | q.dp[ix] = (mp_digit)t; 58 | } 59 | 60 | /* [optional] store the remainder */ 61 | if (d != NULL) { 62 | *d = (mp_digit)w; 63 | } 64 | 65 | /* [optional] store the quotient */ 66 | if (c != NULL) { 67 | mp_clamp(&q); 68 | mp_exch(&q, c); 69 | } 70 | mp_clear(&q); 71 | 72 | return res; 73 | } 74 | 75 | #endif 76 | 77 | /* $Source$ */ 78 | /* $Revision: 0.41 $ */ 79 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 80 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mul_d.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MUL_D_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* multiply by a digit */ 19 | int 20 | mp_mul_d (mp_int * a, mp_digit b, mp_int * c) 21 | { 22 | mp_digit u, *tmpa, *tmpc; 23 | mp_word r; 24 | int ix, res, olduse; 25 | 26 | /* make sure c is big enough to hold a*b */ 27 | if (c->alloc < a->used + 1) { 28 | if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { 29 | return res; 30 | } 31 | } 32 | 33 | /* get the original destinations used count */ 34 | olduse = c->used; 35 | 36 | /* set the sign */ 37 | c->sign = a->sign; 38 | 39 | /* alias for a->dp [source] */ 40 | tmpa = a->dp; 41 | 42 | /* alias for c->dp [dest] */ 43 | tmpc = c->dp; 44 | 45 | /* zero carry */ 46 | u = 0; 47 | 48 | /* compute columns */ 49 | for (ix = 0; ix < a->used; ix++) { 50 | /* compute product and carry sum for this term */ 51 | r = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); 52 | 53 | /* mask off higher bits to get a single digit */ 54 | *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); 55 | 56 | /* send carry into next iteration */ 57 | u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); 58 | } 59 | 60 | /* store final carry [if any] and increment ix offset */ 61 | *tmpc++ = u; 62 | ++ix; 63 | 64 | /* now zero digits above the top */ 65 | while (ix++ < olduse) { 66 | *tmpc++ = 0; 67 | } 68 | 69 | /* set used count */ 70 | c->used = a->used + 1; 71 | mp_clamp(c); 72 | 73 | return MP_OKAY; 74 | } 75 | #endif 76 | 77 | /* $Source$ */ 78 | /* $Revision: 0.41 $ */ 79 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 80 | -------------------------------------------------------------------------------- /external/steam_api/include/steam_api/opensteamworks/ECurrencyCode.h: -------------------------------------------------------------------------------- 1 | //========================== Open Steamworks ================================ 2 | // 3 | // This file is part of the Open Steamworks project. All individuals associated 4 | // with this project do not claim ownership of the contents 5 | // 6 | // The code, comments, and all related files, projects, resources, 7 | // redistributables included with this project are Copyright Valve Corporation. 8 | // Additionally, Valve, the Valve logo, Half-Life, the Half-Life logo, the 9 | // Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo, 10 | // Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the 11 | // Counter-Strike logo, Source, the Source logo, and Counter-Strike Condition 12 | // Zero are trademarks and or registered trademarks of Valve Corporation. 13 | // All other trademarks are property of their respective owners. 14 | // 15 | //============================================================================= 16 | 17 | #ifndef ECURRENCYCODE_H 18 | #define ECURRENCYCODE_H 19 | #ifdef _WIN32 20 | #pragma once 21 | #endif 22 | 23 | 24 | typedef enum ECurrencyCode 25 | { 26 | k_ECurrencyCodeInvalid = 0, 27 | k_ECurrencyCodeUSD = 1, 28 | k_ECurrencyCodeGBP = 2, 29 | k_ECurrencyCodeEUR = 3, 30 | k_ECurrencyCodeCHF = 4, 31 | k_ECurrencyCodeRUB = 5, 32 | k_ECurrencyCodePLN = 6, 33 | k_ECurrencyCodeBRL = 7, 34 | k_ECurrencyCodeJPY = 8, 35 | k_ECurrencyCodeNOK = 9, 36 | k_ECurrencyCodeIDR = 10, 37 | k_ECurrencyCodeMYR = 11, 38 | k_ECurrencyCodePHP = 12, 39 | k_ECurrencyCodeSGD = 13, 40 | k_ECurrencyCodeTHB = 14, 41 | k_ECurrencyCodeVND = 15, 42 | k_ECurrencyCodeKRW = 16, 43 | k_ECurrencyCodeTRY = 17, 44 | k_ECurrencyCodeUAH = 18, 45 | k_ECurrencyCodeMXN = 19, 46 | k_ECurrencyCodeCAD = 20, 47 | k_ECurrencyCodeAUD = 21, 48 | k_ECurrencyCodeNZD = 22, 49 | k_ECurrencyCodeCNY = 23, 50 | k_ECurrencyCodeINR = 24, 51 | k_ECurrencyCodeCLP = 25, 52 | k_ECurrencyCodePEN = 26, 53 | k_ECurrencyCodeCOP = 27, 54 | k_ECurrencyCodeZAR = 28, 55 | k_ECurrencyCodeHKD = 29, 56 | k_ECurrencyCodeTWD = 30, 57 | k_ECurrencyCodeSAR = 31, 58 | k_ECurrencyCodeAED = 32, 59 | //k_ECurrencyCodeMax = 33, 60 | } ECurrencyCode; 61 | 62 | #endif // ECURRENCYCODE_H 63 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_prime_is_prime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_PRIME_IS_PRIME_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* performs a variable number of rounds of Miller-Rabin 19 | * 20 | * Probability of error after t rounds is no more than 21 | 22 | * 23 | * Sets result to 1 if probably prime, 0 otherwise 24 | */ 25 | int mp_prime_is_prime (mp_int * a, int t, int *result) 26 | { 27 | mp_int b; 28 | int ix, err, res; 29 | 30 | /* default to no */ 31 | *result = MP_NO; 32 | 33 | /* valid value of t? */ 34 | if (t <= 0 || t > PRIME_SIZE) { 35 | return MP_VAL; 36 | } 37 | 38 | /* is the input equal to one of the primes in the table? */ 39 | for (ix = 0; ix < PRIME_SIZE; ix++) { 40 | if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) { 41 | *result = 1; 42 | return MP_OKAY; 43 | } 44 | } 45 | 46 | /* first perform trial division */ 47 | if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { 48 | return err; 49 | } 50 | 51 | /* return if it was trivially divisible */ 52 | if (res == MP_YES) { 53 | return MP_OKAY; 54 | } 55 | 56 | /* now perform the miller-rabin rounds */ 57 | if ((err = mp_init (&b)) != MP_OKAY) { 58 | return err; 59 | } 60 | 61 | for (ix = 0; ix < t; ix++) { 62 | /* set the prime */ 63 | mp_set (&b, ltm_prime_tab[ix]); 64 | 65 | if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { 66 | goto LBL_B; 67 | } 68 | 69 | if (res == MP_NO) { 70 | goto LBL_B; 71 | } 72 | } 73 | 74 | /* passed the test */ 75 | *result = MP_YES; 76 | LBL_B:mp_clear (&b); 77 | return err; 78 | } 79 | #endif 80 | 81 | /* $Source$ */ 82 | /* $Revision: 0.41 $ */ 83 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 84 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/bn_mp_mul_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef BN_MP_MUL_2_C 3 | /* LibTomMath, multiple-precision integer library -- Tom St Denis 4 | * 5 | * LibTomMath is a library that provides multiple-precision 6 | * integer arithmetic as well as number theoretic functionality. 7 | * 8 | * The library was designed directly after the MPI library by 9 | * Michael Fromberger but has been written from scratch with 10 | * additional optimizations in place. 11 | * 12 | * The library is free for all purposes without any express 13 | * guarantee it works. 14 | * 15 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 16 | */ 17 | 18 | /* b = a*2 */ 19 | int mp_mul_2(mp_int * a, mp_int * b) 20 | { 21 | int x, res, oldused; 22 | 23 | /* grow to accomodate result */ 24 | if (b->alloc < a->used + 1) { 25 | if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { 26 | return res; 27 | } 28 | } 29 | 30 | oldused = b->used; 31 | b->used = a->used; 32 | 33 | { 34 | register mp_digit r, rr, *tmpa, *tmpb; 35 | 36 | /* alias for source */ 37 | tmpa = a->dp; 38 | 39 | /* alias for dest */ 40 | tmpb = b->dp; 41 | 42 | /* carry */ 43 | r = 0; 44 | for (x = 0; x < a->used; x++) { 45 | 46 | /* get what will be the *next* carry bit from the 47 | * MSB of the current digit 48 | */ 49 | rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); 50 | 51 | /* now shift up this digit, add in the carry [from the previous] */ 52 | *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; 53 | 54 | /* copy the carry that would be from the source 55 | * digit into the next iteration 56 | */ 57 | r = rr; 58 | } 59 | 60 | /* new leading digit? */ 61 | if (r != 0) { 62 | /* add a MSB which is always 1 at this point */ 63 | *tmpb = 1; 64 | ++(b->used); 65 | } 66 | 67 | /* now zero any excess digits on the destination 68 | * that we didn't write to 69 | */ 70 | tmpb = b->dp + b->used; 71 | for (x = b->used; x < oldused; x++) { 72 | *tmpb++ = 0; 73 | } 74 | } 75 | b->sign = a->sign; 76 | return MP_OKAY; 77 | } 78 | #endif 79 | 80 | /* $Source$ */ 81 | /* $Revision: 0.41 $ */ 82 | /* $Date: 2007-04-18 09:58:18 +0000 $ */ 83 | -------------------------------------------------------------------------------- /external/tomcrypt/src/math/rand_prime.c: -------------------------------------------------------------------------------- 1 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis 2 | * 3 | * LibTomCrypt is a library that provides various cryptographic 4 | * algorithms in a highly modular and flexible manner. 5 | * 6 | * The library is free for all purposes without any express 7 | * guarantee it works. 8 | * 9 | * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 10 | */ 11 | #include 12 | 13 | /** 14 | @file rand_prime.c 15 | Generate a random prime, Tom St Denis 16 | */ 17 | 18 | #define USE_BBS 1 19 | 20 | int rand_prime(void *N, long len, prng_state *prng, int wprng) 21 | { 22 | int err, res, type; 23 | unsigned char *buf; 24 | 25 | LTC_ARGCHK(N != NULL); 26 | 27 | /* get type */ 28 | if (len < 0) { 29 | type = USE_BBS; 30 | len = -len; 31 | } else { 32 | type = 0; 33 | } 34 | 35 | /* allow sizes between 2 and 512 bytes for a prime size */ 36 | if (len < 2 || len > 512) { 37 | return CRYPT_INVALID_PRIME_SIZE; 38 | } 39 | 40 | /* valid PRNG? Better be! */ 41 | if ((err = prng_is_valid(wprng)) != CRYPT_OK) { 42 | return err; 43 | } 44 | 45 | /* allocate buffer to work with */ 46 | buf = XCALLOC(1, len); 47 | if (buf == NULL) { 48 | return CRYPT_MEM; 49 | } 50 | 51 | do { 52 | /* generate value */ 53 | if (prng_descriptor[wprng].read(buf, len, prng) != (unsigned long)len) { 54 | XFREE(buf); 55 | return CRYPT_ERROR_READPRNG; 56 | } 57 | 58 | /* munge bits */ 59 | buf[0] |= 0x80 | 0x40; 60 | buf[len-1] |= 0x01 | ((type & USE_BBS) ? 0x02 : 0x00); 61 | 62 | /* load value */ 63 | if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) { 64 | XFREE(buf); 65 | return err; 66 | } 67 | 68 | /* test */ 69 | if ((err = mp_prime_is_prime(N, 8, &res)) != CRYPT_OK) { 70 | XFREE(buf); 71 | return err; 72 | } 73 | } while (res == LTC_MP_NO); 74 | 75 | #ifdef LTC_CLEAN_STACK 76 | zeromem(buf, len); 77 | #endif 78 | 79 | XFREE(buf); 80 | return CRYPT_OK; 81 | } 82 | 83 | 84 | 85 | /* $Source: /cvs/libtom/libtomcrypt/src/math/rand_prime.c,v $ */ 86 | /* $Revision: 1.7 $ */ 87 | /* $Date: 2006/12/28 01:27:23 $ */ 88 | -------------------------------------------------------------------------------- /src/httpftp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * httpftp.h 3 | * 4 | */ 5 | #ifndef _HTTPFTP_H_ 6 | #define _HTTPFTP_H_ 7 | 8 | #include "q_shared.h" 9 | #include "qcommon.h" 10 | 11 | typedef enum 12 | { 13 | FT_PROTO_HTTP, 14 | FT_PROTO_HTTPS, 15 | FT_PROTO_FTP 16 | }ftprotocols_t; 17 | 18 | typedef struct 19 | { 20 | qboolean lock; 21 | qboolean active; 22 | qboolean transferactive; 23 | int transferStartTime; 24 | int socket; 25 | int transfersocket; 26 | int sentBytes; 27 | int finallen; 28 | int totalreceivedbytes; 29 | int transfertotalreceivedbytes; 30 | msg_t *extrecvmsg; 31 | msg_t *extsendmsg; 32 | msg_t sendmsg; 33 | msg_t recvmsg; 34 | msg_t transfermsg; 35 | qboolean complete; 36 | int code; 37 | int version; 38 | char status[32]; 39 | char url[MAX_STRING_CHARS]; 40 | char address[MAX_STRING_CHARS]; 41 | char username[256]; 42 | char password[256]; 43 | char contentType[64]; 44 | char cookie[MAX_STRING_CHARS]; 45 | int mode; 46 | int headerLength; 47 | int contentLength; 48 | int contentLengthArrived; 49 | int currentChunkLength; 50 | int currentChunkReadOffset; 51 | int chunkedEncoding; 52 | int startTime; 53 | int stage; 54 | int rangeTotLength; 55 | int rangeLow; 56 | int rangeHigh; 57 | ftprotocols_t protocol; 58 | netadr_t remote; 59 | #ifndef NO_TLS 60 | struct tlsstate_s *tls; 61 | #endif 62 | }ftRequest_t; 63 | 64 | 65 | typedef enum 66 | { 67 | HTTP_GET, 68 | HTTP_POST, 69 | HTTP_HEAD 70 | }httpMethod_t; 71 | 72 | 73 | #define MAX_POST_VALS 32 74 | typedef struct 75 | { 76 | char name[MAX_STRING_CHARS]; 77 | char value[MAX_STRING_CHARS]; 78 | }httpPostVals_t; 79 | 80 | void FileDownloadFreeRequest(ftRequest_t* request); 81 | ftRequest_t* FileDownloadRequest( const char* url); 82 | int FileDownloadSendReceive( ftRequest_t* request ); 83 | const char* FileDownloadGenerateProgress( ftRequest_t* request ); 84 | ftRequest_t* HTTPRequest(const char* url, const char* method, msg_t* msg, const char* additionalheaderlines); 85 | qboolean HTTP_BuildNewRequest( ftRequest_t* request, const char* method, msg_t* msg, const char* additionalheaderlines); 86 | void HTTP_DecodeURLFormData(char* url); 87 | void HTTP_DecodeURL(char* url); 88 | void HTTP_ParseFormDataBody(char* body, httpPostVals_t* values); 89 | const char* HTTP_GetFormDataItem(httpPostVals_t* values, const char* search); 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /external/steam_api/external/libudis86/include/udis86/syn.h: -------------------------------------------------------------------------------- 1 | /* udis86 - libudis86/syn.h 2 | * 3 | * Copyright (c) 2002-2009 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without modification, 7 | * are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef UD_SYN_H 27 | #define UD_SYN_H 28 | 29 | #include "types.h" 30 | #ifndef __UD_STANDALONE__ 31 | # include 32 | #endif /* __UD_STANDALONE__ */ 33 | 34 | extern const char* ud_reg_tab[]; 35 | 36 | uint64_t ud_syn_rel_target(struct ud*, struct ud_operand*); 37 | 38 | #ifdef __GNUC__ 39 | int ud_asmprintf(struct ud *u, const char *fmt, ...) 40 | __attribute__ ((format (printf, 2, 3))); 41 | #else 42 | int ud_asmprintf(struct ud *u, const char *fmt, ...); 43 | #endif 44 | 45 | void ud_syn_print_addr(struct ud *u, uint64_t addr); 46 | void ud_syn_print_imm(struct ud* u, const struct ud_operand *op); 47 | void ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *, int sign); 48 | 49 | #endif /* UD_SYN_H */ 50 | 51 | /* 52 | vim: set ts=2 sw=2 expandtab 53 | */ 54 | -------------------------------------------------------------------------------- /src/net_reliabletransport.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #define MAX_PACKETLEN 1400 // max size of a network packet 4 | #define MAX_FRAGMENT_SIZE ( MAX_PACKETLEN - 200 ) 5 | 6 | typedef struct 7 | { 8 | byte data[MAX_FRAGMENT_SIZE]; 9 | int len; 10 | int ack; 11 | int packetnum; 12 | int senttime; 13 | }fragment_t; 14 | 15 | typedef struct 16 | { 17 | int nextRateCntTime; //Used by bytesPerSecond to know when to calculate the current rate 18 | //This counts only the sent bytes 19 | int bytes; 20 | int lastBytesSnap; 21 | int bytesPerSec; 22 | //This counts overhead like headers and retransmissions as well 23 | int bytesTotal; 24 | int lastBytesSnapTotal; 25 | int bytesPerSecTotal; 26 | }rateTracker_t; 27 | 28 | 29 | typedef struct 30 | { 31 | int sequence; //Highest numbered packet in queue 32 | int bufferlen; //Length of the whole buffer 33 | int acknowledge; //Lowest numbered packet in queue 34 | int selackoffset; //Used to send not always the same selective acknowledges 35 | int frame; //Current numbered packet which is going to be sent next. Any value in range of acknowledge and sequence 36 | int windowsize; //Current size of our window 37 | fragment_t *fragments; 38 | int packets; 39 | msg_t fragmentbuffer; 40 | byte fragmentdata[MAX_FRAGMENT_SIZE]; 41 | rateTracker_t rateInfo; 42 | int unsentmillipackets; 43 | }framedata_t; 44 | 45 | typedef struct 46 | { 47 | framedata_t txwindow; 48 | framedata_t rxwindow; 49 | int sock; 50 | netadr_t remoteAddress; 51 | int time; 52 | int nextacktime; 53 | int qport; 54 | }netreliablemsg_t; 55 | 56 | void ReliableMessagesFrame(netreliablemsg_t *chan, int msec); 57 | void ReliableMessagesReceiveNextFragment(netreliablemsg_t *chan, msg_t* buf); 58 | int ReliableMessageReceive(netreliablemsg_t *chan, byte* outdata, int len); 59 | int ReliableMessageReceiveSingleFragment(netreliablemsg_t *chan, byte* outdata, int len); 60 | int ReliableMessageSend(netreliablemsg_t *chan, byte* indata, int len); 61 | netreliablemsg_t* ReliableMessageSetup(int netsrc, int qport, netadr_t* remote); 62 | void Net_TestingFunction(netreliablemsg_t *chan); 63 | void ReliableMessageDisconnect(netreliablemsg_t *chan); 64 | //Check how much data is inside the buffer. fragmentcnt * MAX_FRAGMENT_SIZE is in many cases the amount of bytes 65 | int ReliableMessageGetUsedFragmentCnt(netreliablemsg_t *chan); 66 | -------------------------------------------------------------------------------- /external/mbedtls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(mbedtls VERSION 1.0.0 LANGUAGES C) 3 | include_guard() 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | set(SRC_CRYPTO 10 | src/aes.c 11 | src/aesni.c 12 | src/arc4.c 13 | src/asn1parse.c 14 | src/asn1write.c 15 | src/base64.c 16 | src/bignum.c 17 | src/blowfish.c 18 | src/camellia.c 19 | src/ccm.c 20 | src/cipher.c 21 | src/cipher_wrap.c 22 | src/ctr_drbg.c 23 | src/des.c 24 | src/dhm.c 25 | src/ecdh.c 26 | src/ecdsa.c 27 | src/ecjpake.c 28 | src/ecp.c 29 | src/ecp_curves.c 30 | src/entropy.c 31 | src/entropy_poll.c 32 | src/error.c 33 | src/gcm.c 34 | src/havege.c 35 | src/hmac_drbg.c 36 | src/md.c 37 | src/md2.c 38 | src/md4.c 39 | src/md5.c 40 | src/md_wrap.c 41 | src/memory_buffer_alloc.c 42 | src/oid.c 43 | src/padlock.c 44 | src/pem.c 45 | src/pk.c 46 | src/pk_wrap.c 47 | src/pkcs12.c 48 | src/pkcs5.c 49 | src/pkparse.c 50 | src/pkwrite.c 51 | src/platform.c 52 | src/ripemd160.c 53 | src/rsa.c 54 | src/sha1.c 55 | src/sha256.c 56 | src/sha512.c 57 | src/threading.c 58 | src/timing.c 59 | src/version.c 60 | src/version_features.c 61 | src/xtea.c 62 | ) 63 | 64 | set(SRC_X509 65 | src/certs.c 66 | src/pkcs11.c 67 | src/x509.c 68 | src/x509_create.c 69 | src/x509_crl.c 70 | src/x509_crt.c 71 | src/x509_csr.c 72 | src/x509write_crt.c 73 | src/x509write_csr.c 74 | ) 75 | 76 | set(SRC_TLS 77 | src/debug.c 78 | src/net.c 79 | src/ssl_cache.c 80 | src/ssl_ciphersuites.c 81 | src/ssl_cli.c 82 | src/ssl_cookie.c 83 | src/ssl_srv.c 84 | src/ssl_ticket.c 85 | src/ssl_tls.c 86 | ) 87 | 88 | add_library(mbedtls STATIC 89 | ${SRC_CRYPTO} 90 | ${SRC_X509} 91 | ${SRC_TLS} 92 | ) 93 | 94 | target_include_directories(mbedtls PUBLIC 95 | include 96 | ) 97 | 98 | target_compile_options(mbedtls PRIVATE -m32 -std=c11) 99 | target_link_options(mbedtls PRIVATE -m32) 100 | 101 | --------------------------------------------------------------------------------