Skip to content

Commit 87ad44f

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into engine_sdk2013
2 parents 05ad2dd + 8b0290b commit 87ad44f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1203
-1144
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ addons/source-python/bin/
3030
addons/source-python/data/custom/
3131
addons/source-python/data/plugins/
3232
addons/source-python/data/source-python/settings/
33+
addons/source-python/data/source-python-data.zip
3334
addons/source-python/packages/custom/
3435
addons/source-python/plugins/
3536
cfg/source-python/*

addons/source-python/data/source-python/client/csgo/CBaseClient.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
[virtual_function]
44
[[set_name]]
5-
offset_linux = 67
6-
offset_windows = 29
5+
offset_linux = 68
6+
offset_windows = 30
77
arguments = STRING

addons/source-python/data/source-python/entities/CBaseEntity.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
elasticity = m_flElasticity
8080
ground_entity = m_hGroundEntity
8181
owner_handle = m_hOwnerEntity
82-
team = m_iTeamNum
82+
team_index = m_iTeamNum
8383
render_fx = m_nRenderFX
8484
render_mode_prop = m_nRenderMode
8585
move_type = movetype

addons/source-python/data/source-python/entities/csgo/CBaseCombatWeapon.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ srv_check = False
55

66
# _ZN17CBaseCombatWeapon13PrimaryAttackEv
77
[[primary_attack]]
8-
offset_linux = 314
9-
offset_windows = 308
8+
offset_linux = 313
9+
offset_windows = 307
1010

1111
# _ZN17CBaseCombatWeapon13SecondaryAttackEv
1212
[[secondary_attack]]
13-
offset_linux = 315
14-
offset_windows = 309
13+
offset_linux = 314
14+
offset_windows = 308
1515

1616

1717
[property]

addons/source-python/data/source-python/entities/csgo/CBasePlayer.ini

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,33 @@ srv_check = False
1818

1919
# _ZN11CBasePlayer13GiveNamedItemEPKciP13CEconItemViewb
2020
[[give_named_item]]
21-
offset_linux = 450
22-
offset_windows = 449
21+
offset_linux = 451
22+
offset_windows = 450
2323
arguments = STRING, INT, POINTER, BOOL
2424
return_type = POINTER
2525

2626
# _ZN11CBasePlayer21IncrementAssistsCountEi
2727
[[increment_assists_count]]
28-
offset_linux = 492
29-
offset_windows = 491
28+
offset_linux = 493
29+
offset_windows = 492
3030
arguments = INT
3131

3232
# _ZN11CBasePlayer19IncrementDeathCountEi
3333
[[increment_death_count]]
34-
offset_linux = 493
35-
offset_windows = 492
34+
offset_linux = 494
35+
offset_windows = 493
3636
arguments = INT
3737

3838
# _ZN11CBasePlayer18IncrementFragCountEii
3939
[[increment_frag_count]]
40-
offset_linux = 491
41-
offset_windows = 490
40+
offset_linux = 492
41+
offset_windows = 491
4242
arguments = INT, INT
4343

4444
# _ZN11CBasePlayer16PlayerRunCommandEP8CUserCmdP11IMoveHelper
4545
[[run_command]]
46-
offset_linux = 470
47-
offset_windows = 469
46+
offset_linux = 471
47+
offset_windows = 470
4848
arguments = POINTER, POINTER
4949

5050
# _ZN11CBasePlayer8PreThinkEv
@@ -61,8 +61,8 @@ srv_check = False
6161
[instance_attribute]
6262

6363
[[assists]]
64-
offset_windows = 3908
65-
offset_linux = 3932
64+
offset_windows = 3816
65+
offset_linux = 3840
6666
type = INT
6767

6868

addons/source-python/data/source-python/entities/csgo/CCSPlayer.ini

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ srv_check = False
1010
arguments = INT, BOOL, BOOL, STRING
1111

1212
[[buy_internal]]
13-
identifier_windows = 55 8B EC 83 E4 F8 81 EC 7C 01 00 00 53 56 57
13+
identifier_windows = 55 8B EC 83 E4 F8 83 EC 0C 53 56 57 6A 01
1414
# indentifier_linux = _ZN9CCSPlayer26HandleCommand_Buy_InternalEPKcib
15-
identifier_linux = 55 89 E5 57 56 53 81 EC 9C 01 00 00 0F B6 55 14
16-
arguments = STRING, INT, BOOL
15+
identifier_linux = 55 89 E5 83 EC 68 0F B6 55 14
16+
arguments = INT, STRING, BOOL
1717
return_type = INT
1818

1919
[[deafen]]
@@ -43,8 +43,8 @@ srv_check = False
4343

4444
# _ZN9CCSPlayer5BlindEfff
4545
[[blind]]
46-
offset_linux = 541
47-
offset_windows = 538
46+
offset_linux = 542
47+
offset_windows = 539
4848
arguments = FLOAT, FLOAT, FLOAT
4949

5050

@@ -56,13 +56,13 @@ srv_check = False
5656
[instance_attribute]
5757

5858
[[mvps]]
59-
offset_windows = 11752
60-
offset_linux = 11776
59+
offset_windows = 11472
60+
offset_linux = 11496
6161
type = INT
6262

6363
[[clan_tag]]
64-
offset_windows = 10588
65-
offset_linux = 10612
64+
offset_windows = 9524
65+
offset_linux = 9548
6666
type = STRING_ARRAY
6767

6868

addons/source-python/data/source-python/weapons/csgo.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
# no real way to determine this, unfortunately
1111
inferno = "molotov"
1212
knife_default_ct = "knife"
13+
usp_silencer_off = "usp_silencer"
14+
m4a1_silencer_off = "m4a1_silencer"
1315

1416

1517
[projectiles]

addons/source-python/docs/source-python/source/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,7 @@
310310
autodoc_member_order = 'groupwise'
311311

312312
# Directives that should be used by default
313-
autodoc_default_flags = [
314-
'private-members',
315-
]
313+
# autodoc_default_flags = []
316314

317315
# Add names (e.g. magic methods) you always want to skip
318316
names_to_skip = [

addons/source-python/docs/source-python/source/contributing/building.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To build Source.Python on Windows, you need the following requirements:
4747

4848
* `CMake 2.8 or later <https://cmake.org/download/>`_
4949
* `Git <https://git-scm.com/downloads>`_
50-
* `Visual C++ 2010 <http://download.microsoft.com/download/1/E/5/1E5F1C0A-0D5B-426A-A603-1798B951DDAE/VS2010Express1.iso>`_
50+
* `Visual C++ 2010 <https://my.visualstudio.com/Downloads?q=visual%20studio%202010&wt.mc_id=o~msft~vscom~older-downloads>`_
5151
* `Microsoft Build Tools (optional, to build directly via Build.bat) <https://www.microsoft.com/en-us/download/details.aspx?id=48159>`_
5252

5353
Once you have installed the requirements, follow these steps to build Source.Python:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
core.update module
2+
===================
3+
4+
.. automodule:: core.update
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
entities.entity module
22
=======================
33

4-
.. automodule:: entities._base
4+
.. autoclass:: _entities._entity.BaseEntity
55
:members:
66
:undoc-members:
77
:show-inheritance:
8+
9+
.. automodule:: entities._base
10+
:members:
11+
:undoc-members:
12+
:show-inheritance:

addons/source-python/docs/source-python/source/general/installation.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,25 @@ Installation
44
Requirements
55
------------
66

7-
1. On Linux GLIBC 2.17 or later is required. Check your version by typing ``ld -version``.
8-
2. On Windows `Visual C++ Redistributable for Visual Studio 2015 <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`_ is required. Most machines already have a redistributable installed, so you only need to install it if Source.Python didn't load properly due to the missing redistributable.
7+
Linux
8+
^^^^^
9+
10+
1. GLIBC 2.17 or later is required. Check your version by typing ``ld -version``.
11+
2. The 32 bit version of ``libz.so.1`` and ``libffi.so.6`` is required. See the table below to install the proper packages.
12+
13+
================================= ================================== ======================================
14+
Distribution libz.so.1 libffi.so.6
15+
================================= ================================== ======================================
16+
Debian/Ubuntu 32 bit apt-get install zlib1g apt-get install libffi6
17+
Debian/Ubuntu 64 bit apt-get install zlib1g:i386 apt-get install libffi6:i386
18+
================================= ================================== ======================================
19+
20+
21+
22+
Windows
23+
^^^^^^^
24+
25+
1. `Visual C++ Redistributable for Visual Studio 2015 <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`_ is required. Most machines already have a redistributable installed, so you only need to install it if Source.Python didn't load properly due to the missing redistributable.
926

1027

1128
Installation steps

addons/source-python/packages/source-python/__init__.py

Lines changed: 118 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,45 @@
2626
# all respects for all other code used. Additionally, the Source.Python
2727
# Development Team grants this exception to all derivative works.
2828

29+
30+
# =============================================================================
31+
# >> FILE ACCESS LOGGER
32+
# =============================================================================
33+
# If True, all calls to open() with a path to a Source.Python data file will be
34+
# logged in ../logs/file_access.log. The log entry will contain the file that
35+
# is being accessed and a full stack trace. The logger will be removed as soon
36+
# as setup_data_update() is called.
37+
# This is a debug option to ensure that no data files are being accessed before
38+
# the data has been updated. Release builds should have this option set to
39+
# False.
40+
LOG_FILE_OPERATIONS = False
41+
42+
if LOG_FILE_OPERATIONS:
43+
import builtins
44+
import traceback
45+
from paths import SP_DATA_PATH
46+
from paths import LOG_PATH
47+
48+
LOG_FILE = LOG_PATH / 'file_access.log'
49+
50+
# Clear log file
51+
LOG_FILE.open('w').close()
52+
53+
old_open = builtins.open
54+
55+
def new_open(f, *args, **kwargs):
56+
if isinstance(f, str) and f.startswith(SP_DATA_PATH):
57+
print(f)
58+
with LOG_FILE.open('a') as log_f:
59+
log_f.write('File access: {}\n'.format(f))
60+
traceback.print_stack(file=log_f)
61+
log_f.write('\n\n')
62+
63+
return old_open(f, *args, **kwargs)
64+
65+
builtins.open = new_open
66+
67+
2968
# =============================================================================
3069
# >> IMPORTS
3170
# =============================================================================
@@ -46,8 +85,10 @@ def load():
4685
setup_stdout_redirect()
4786
setup_core_settings()
4887
setup_logging()
49-
setup_hooks()
88+
setup_exception_hooks()
89+
setup_data_update()
5090
setup_translations()
91+
setup_data()
5192
setup_global_pointers()
5293
setup_sp_command()
5394
setup_auth()
@@ -65,6 +106,71 @@ def unload():
65106
unload_auth()
66107

67108

109+
# =============================================================================
110+
# >> DATA UPDATE
111+
# =============================================================================
112+
def setup_data_update():
113+
"""Setup data update."""
114+
_sp_logger.log_debug('Setting up data update...')
115+
116+
if LOG_FILE_OPERATIONS:
117+
builtins.open = old_open
118+
119+
from core.settings import _core_settings
120+
121+
if not _core_settings.auto_data_update:
122+
_sp_logger.log_debug('Automatic data updates are disable.')
123+
return
124+
125+
_sp_logger.log_info('Checking for data updates...')
126+
127+
from core.update import is_new_data_available, update_data
128+
from translations.manager import language_manager
129+
130+
try:
131+
if is_new_data_available():
132+
_sp_logger.log_info('New data is available. Downloading...')
133+
update_data()
134+
135+
# languages.ini is loaded before the data has been updated. Thus,
136+
# we need to reload the file.
137+
language_manager.reload()
138+
else:
139+
_sp_logger.log_info('No new data is available.')
140+
except:
141+
_sp_logger.log_exception(
142+
'An error occured during the data update.', exc_info=True)
143+
144+
def setup_data():
145+
"""Setup data."""
146+
_sp_logger.log_debug('Setting up data...')
147+
148+
from core import GameConfigObj
149+
from memory.manager import manager
150+
from paths import SP_DATA_PATH
151+
152+
import players
153+
players.BaseClient = manager.create_type_from_dict(
154+
'BaseClient',
155+
GameConfigObj(SP_DATA_PATH / 'client' / 'CBaseClient.ini'))
156+
157+
import listeners
158+
listeners.BaseEntityOutput = manager.create_type_from_dict(
159+
'BaseEntityOutput',
160+
GameConfigObj(SP_DATA_PATH / 'entity_output' / 'CBaseEntityOutput.ini'))
161+
162+
try:
163+
_fire_output = listeners.BaseEntityOutput.fire_output
164+
except AttributeError:
165+
from warnings import warn
166+
warn(
167+
'BaseEntityOutput.fire_output not found. '
168+
'OnEntityOutput listener will not fire.'
169+
)
170+
else:
171+
_fire_output.add_pre_hook(listeners._pre_fire_output)
172+
173+
68174
# =============================================================================
69175
# >> CORE SETTINGS
70176
# =============================================================================
@@ -121,24 +227,13 @@ def setup_logging():
121227
# =============================================================================
122228
# >> HOOKS
123229
# =============================================================================
124-
def setup_hooks():
230+
def setup_exception_hooks():
125231
"""Set up hooks."""
126-
_sp_logger.log_debug('Setting up hooks...')
232+
_sp_logger.log_debug('Setting up exception hooks...')
127233

128234
from hooks.exceptions import except_hooks
129235
from hooks.warnings import warning_hooks
130236

131-
# This is added to warn about BaseEntityOutput.fire_output.
132-
# Sending the warning on its initial import will happen prior
133-
# to these hooks being setup.
134-
from listeners._entity_output import _fire_output
135-
if _fire_output is None:
136-
from warnings import warn
137-
warn(
138-
'BaseEntityOutput.fire_output not found. '
139-
'OnEntityOutput listener will not fire.'
140-
)
141-
142237

143238
# =============================================================================
144239
# >> TRANSLATIONS
@@ -390,6 +485,15 @@ def flush(self):
390485
if sys.stderr is None:
391486
sys.stderr = OutputRedirect()
392487

488+
from engines.server import engine_server
489+
490+
if not engine_server.is_dedicated_server():
491+
# Return here for listen servers, because we only want to see the
492+
# warning if reconnecting the output streams failed, which is only
493+
# done on dedicated servers. For listen servers creating OutputRedirect
494+
# instances is the proper fix.
495+
return
496+
393497
from warnings import warn
394498
warn(
395499
'sys.stdout and/or sys.stderr is None. All data will be redirected through '

0 commit comments

Comments
 (0)