Source-Python-Dev-Team / Source.Python

This plugin aims to use boost::python and create an easily accessible wrapper around the Source Engine API for scripter use.
http://forums.sourcepython.com
GNU General Public License v3.0
163 stars 31 forks source link

The last update in CSGO has broken addons (ValueError: Could not find signature) #462

Closed DiDHack closed 1 year ago

DiDHack commented 1 year ago
[SP] Encountered a Warning:
  File '../addons/source-python/packages/source-python/__init__.py', line 183: UserWarning
    Did not find address for BaseEntityOutput.fire_output. OnEntityOutput listener
        will not fire.

[Source.Python] Failed to load the main module due to following exception:
Traceback (most recent call last):

  File "csgo/csgo/addons/source-python/packages/source-python/__init__.py", line 88, in load
    setup_global_pointers()

  File "csgo/csgo/addons/source-python/packages/source-python/__init__.py", line 307, in setup_global                                                                                                                                _pointers
    SP_DATA_PATH / 'memory' / 'global_pointers.ini'))

  File "csgo/csgo/addons/source-python/packages/source-python/memory/manager.py", line 765, in create                                                                                                                                _global_pointers_from_file
    self.global_pointer(cls, *data)

  File "csgo/csgo/addons/source-python/packages/source-python/memory/manager.py", line 734, in global                                                                                                                                _pointer
    ptr = binary.find_pointer(identifier, offset, level)

ValueError: Could not find signature: 5589e583ec28803d2a2a2a2a00742ac9b82a2a2a2ac38d76008dbc2700000000c704242a2a2a2ae82a2a2a2 a85c0742ac704242a2a2a2ae82a2a2a2ac704242a2a2a2ae82a2a2a2ac74424082a2a2a2ac74424042a2a2a2ac704242a2a2a2ae82a2a2a2ab82a2a2a2ac9 c38945f4c704242a2a2a2ae82a2a2a2a8b45f4890424e82a2a2a2a908d76008dbc27000000005589e557

DiDHack commented 1 year ago

If developers don't want to update can somebody help to explain how to get new signatures?

RaviLotus commented 1 year ago

same problem linux server [Source.Python] Loading... [Source.Python] [SP] Encountered a Warning: File '../addons/source-python/packages/source-python/init.py', line 183: UserWarning Did not find address for BaseEntityOutput.fire_output. OnEntityOutput listener will not fire.

[Source.Python] Failed to load the main module due to following exception: Traceback (most recent call last):

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 88, in load setup_global_pointers()

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 307, in setup_global_pointers SP_DATA_PATH / 'memory' / 'global_pointers.ini'))

File "/srv/csgo/addons/source-python/packages/source-python/memory/manager.py", line 765, in create_global_pointers_from_file self.global_pointer(cls, *data)

File "/srv/csgo/addons/source-python/packages/source-python/memory/manager.py", line 734, in global_pointer ptr = binary.find_pointer(identifier, offset, level)

ValueError: Could not find signature: 5589e583ec28803d2a2a2a2a00742ac9b82a2a2a2ac38d76008dbc2700000000c704242a2a2a2ae82a2a2a2a85c0742ac704242a2a2a2ae82a2a2a2ac704242a2a2a2ae82a2a2a2ac74424082a2a2a2ac74424042a2a2a2ac704242a2a2a2ae82a2a2a2ab82a2a2a2ac9c38945f4c704242a2a2a2ae82a2a2a2a8b45f4890424e82a2a2a2a908d76008dbc27000000005589e557 [Source.Python] Could not initialize python. Failed to load plugin "addons/source-python" [Source.Python] Unloading... [Source.Python] Unloaded successfully.

DiDHack commented 1 year ago

I understand the issue but I don't understand how to get new byte-signatures from the updated binaries of the game. I used a guide https://wiki.alliedmods.net/Signature_Scanning but I don't understand what function of the ini-file matches the code of the game and how to find the one in the disassembled code.

RaviLotus commented 1 year ago

Я понимаю проблему, но я не понимаю, как получить новые байтовые подписи из обновленных двоичных файлов игры. Я использовал руководство https://wiki .alliedmods.net/Signature_Scanning но я не понимаю, какая функция ini-файла соответствует коду игры и как оштрафовать ту, что находится в дизассемблированном коде.

Didn't find a solution to the problem?

Velocity-plus commented 1 year ago

Here is the updated signature for linux:

# ../data/source-python/entity_output/csgo/CBaseEntityOutput.ini

binary = server
srv_check = False

[function]
    [[fire_output]]
        # identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
        identifier_linux =  55 89 E5 57 56 53 81 EC 8C 01 00 00 8B 55 08
        identifier_windows = 55 8B EC 83 2A 2A 81 EC 2A 2A 2A 2A 8B C1 53 56 57 8B 2A 2A 89 2A 2A 2A 33
        arguments_linux = POINTER, POINTER, POINTER, FLOAT
        arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
DiDHack commented 1 year ago

Thanks! I'm going to test it now. Can you explain how you get this for future?

DiDHack commented 1 year ago

No. It's not enough. At least addons\source-python\data\source-python\memory\csgo\global_pointer.ini is wrong https://github.com/alliedmodders/sourcemod/commit/a253d35bcd3baccca1c3dae5df91ccd this is sourcemod changes.

Velocity-plus commented 1 year ago

Yeah I see that. I tried updating the EntityFactoryDictionary in global_pointer and it worked, but the server crash on load with no error.

DiDHack commented 1 year ago

Yeah I see that. I tried updating the EntityFactoryDictionary in global_pointer and it worked, but the server crash on load with no error.

Do you have any news? And can you give the signature in global_pointer?

vinci6k commented 1 year ago

Give this a try:

# ../data/source-python/memory/csgo/global_pointers.ini

[CEntityFactoryDictionary]
binary = server
srv_check = False
# identifier_linux = _ZZ23EntityFactoryDictionaryvE15s_EntityFactory
identifier_linux = 55 89 E5 53 83 EC 04 8B 5D 08 E8 2A 2A 2A 2A 83 EC 08 8B 10 53
identifier_windows = A1 2A 2A 2A 2A B9 2A 2A 2A 2A 56 FF 75 08 FF 50 04 8B C8 C7 05 2A 2A 2A 2A 00 00 00 00 85 C9 75 2A 33 F6 EB
offset_windows = 6
offset_linux = 17
level = 1

[CGlobalEntityList]
binary = server
srv_check = False
identifier_linux = E8 2A 2A 2A 2A E8 2A 2A 2A 2A C7 2A 2A 2A 2A 2A 2A E8 2A 2A 2A 2A E8
# Search the signature of OnCBaseEntityList::AddNonNetworkableEntity(IHandleEntity *)
# Note: The Linux binary does not contain the gEntList pointer in that function!
identifier_windows = 55 8B EC 8B 0D 2A 2A 2A 2A 53
offset_windows = 101
offset_linux = 14
level = 1

[IServer]
binary = bin/engine
srv_check = False
# identifier_linux = sv
identifier_linux = 55 89 E5 57 56 53 83 EC 0C 8B 45 2A 8B 75 2A 85 C0 0F 84 2A 2A 2A 2A 8B 10
identifier_windows = 55 8B EC 56 FF 2A 2A B9 2A 2A 2A 2A E8 2A 2A 2A 2A 8B
offset_windows = 8
offset_linux = 13
level = 1

[CBaseTempEntity]
binary = server
srv_check = False
# identifier_linux = _ZN15CBaseTempEntity15s_pTempEntitiesE
identifier_linux = 55 89 E5 8B 45 08 8B 55 0C C7 00 2A 2A 2A 2A 89 50 04 8B 15 2A 2A 2A 2A
identifier_windows = 89 41 04 A1 2A 2A 2A 2A 89 41 08 89 0D 2A 2A 2A 2A C7
offset_windows = 4
offset_linux = 20
level = 2
DiDHack commented 1 year ago

@vinci6k

[SP] Encountered a Warning:
  File '../addons/source-python/packages/source-python/__init__.py', line 183: UserWarning
    Did not find address for BaseEntityOutput.fire_output. OnEntityOutput listener
        will not fire.

Segmentation fault (core dumped)

I have tried "fire_output" from the source and from the post above.

DiDHack commented 1 year ago

Working fire_output

[function]
    [[fire_output]]
        # identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
        identifier_linux =  55 89 E5 57 56 53 81 EC 4C 01 00 00 8B 45 08 65 8B 1D 14 00 00 00
        identifier_windows = 55 8B EC 83 2A 2A 81 EC 2A 2A 2A 2A 8B C1 53 56 57 8B 2A 2A 89 2A 2A 2A 33
        arguments_linux = POINTER, POINTER, POINTER, FLOAT
        arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT

But anyway I get "Segmentation fault"

DiDHack commented 1 year ago

Debug log

[New LWP 4172771]
[New LWP 4172772]
Core was generated by `./srcds_linux srcds -debug -debuglog debug.log -game csgo -ip 0.0.0.0 -port 270'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xef374da0 in ?? ()
[Current thread is 1 (LWP 4172771)]
#0  0xef374da0 in ?? ()
Backtrace stopped: Cannot access memory at address 0xa9a99bc
No symbol table info available.
eax            0xb                 11
ecx            0xa9a9a4c           177904204
edx            0xa9a99cc           177904076
ebx            0x53108b08          1393593096
esp            0xa9a99bc           0xa9a99bc
ebp            0x1                 0x1
esi            0xf12a3068          -248893336
edi            0x53108b08          1393593096
eip            0xef374da0          0xef374da0
eflags         0x210282            [ SF IF RF ID ]
cs             0x23                35
ss             0x2b                43
ds             0x2b                43
es             0x2b                43
fs             0x0                 0
gs             0x63                99
No shared libraries loaded at this time.
End of Source crash report
DiDHack commented 1 year ago

Has somebody fixed "Segmentation Fault"?

RaviLotus commented 1 year ago

Кто-нибудь исправил "Ошибку сегментации"?

Nothing happens, the server does not earn Has anyone found a fix?

DiDHack commented 1 year ago

Where is the developers of the addon? I think I will use sourcemod they fixed the issue after 1 day. Silence is here already 4 days... And nobody can't explain how to get signatures. I have tried to get it from the old binary. I got some the true signatures for functions but some ones are wrong. What sigmaker the developers use nobody knows. I haven't found any full guide.

Velocity-plus commented 1 year ago

Tried correcting the signatures, but yeah it results in a segmentation fault, which I'm not sure how to go about.

DiDHack commented 1 year ago

I did a full log. It can help to resolve the issue

#0  0xf74353f9 in __dynamic_cast () from /usr/lib32/libstdc++.so.6
#1  0xeb2492b7 in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<CEntityFactoryDictionary* (*)(CPointer*), boost::python::return_value_policy<boost::python::reference_existing_object, boost::python::default_call_policies>, boost::mpl::vector2<CEntityFactoryDictionary*, CPointer*> > >::operator()(_object*, _object*) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#2  0xeb6d2078 in boost::python::objects::function::call(_object*, _object*) const () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#3  0xeb6d2285 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) ()
   from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#4  0xeb6db48a in boost::python::handle_exception_impl(boost::function0<void>) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#5  0xeb6d0cc2 in function_call () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#6  0xebaee046 in PyObject_Call (func=func@entry=0xb8e2da0, args=args@entry=0xea9398cc, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2246
#7  0xebbd9279 in PyEval_CallObjectWithKeywords (func=func@entry=0xb8e2da0, args=args@entry=0xea9398cc, kwargs=kwargs@entry=0x0) at Python/ceval.c:4718
#8  0xebc05672 in PyEval_CallFunction (obj=0xb8e2da0, format=0xeb7b9d54 "(O)") at Python/modsupport.c:504
#9  0xeb164722 in MakeObject(boost::python::api::object, CPointer*) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#10 0xeb14e268 in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<boost::python::api::object (*)(boost::python::api::object, CPointer*), boost::python::default_call_policies, boost::mpl::vector3<boost::python::api::object, boost::python::api::object, CPointer*> > >::operator()(_object*, _object*) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#11 0xeb6d2078 in boost::python::objects::function::call(_object*, _object*) const () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#12 0xeb6d2285 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) ()
   from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#13 0xeb6db48a in boost::python::handle_exception_impl(boost::function0<void>) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#14 0xeb6d0cc2 in function_call () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#15 0xebaee1ac in _PyObject_FastCallDict (func=func@entry=0xb8aee50, args=args@entry=0xea35630c, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#16 0xebaee69c in _PyObject_FastCallKeywords (func=func@entry=0xb8aee50, stack=stack@entry=0xea35630c, nargs=2, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#17 0xebbd881a in call_function (pp_stack=pp_stack@entry=0xffa8a33c, oparg=oparg@entry=2, kwnames=kwnames@entry=0x0) at Python/ceval.c:4822
#18 0xebbdc9e3 in _PyEval_EvalFrameDefault (f=0xea3561ac, throwflag=0) at Python/ceval.c:3284
#19 0xebbd7cbc in PyEval_EvalFrameEx (f=f@entry=0xea3561ac, throwflag=throwflag@entry=0) at Python/ceval.c:718
#20 0xebbd8683 in _PyEval_EvalCodeWithName (_co=_co@entry=0xea90b9c0, globals=globals@entry=0xea95a4dc, locals=locals@entry=0x0, args=args@entry=0xffa8a4e0, argcount=argcount@entry=7, 
    kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x4, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0xea986f88, defcount=3, kwdefs=kwdefs@entry=0x0, closure=0x0, name=name@entry=0xea986ef8, 
    qualname=qualname@entry=0xea9894b8) at Python/ceval.c:4128
#21 0xebbe0bdb in _PyFunction_FastCallDict (func=func@entry=0xea913974, args=args@entry=0xffa8a4e0, nargs=nargs@entry=7, kwargs=kwargs@entry=0x0) at Python/ceval.c:5031
#22 0xebaee29c in _PyObject_FastCallDict (func=func@entry=0xea913974, args=args@entry=0xffa8a4e0, nargs=nargs@entry=7, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#23 0xebaee3be in _PyObject_Call_Prepend (func=0xea913974, obj=0xea91411c, args=args@entry=0xea34d17c, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2358
#24 0xebb05789 in method_call (method=0xeae4a9ec, args=0xea34d17c, kwargs=0x0) at Objects/classobject.c:317
#25 0xebaee046 in PyObject_Call (func=func@entry=0xeae4a9ec, args=args@entry=0xea34d17c, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2246
#26 0xebbdcd42 in do_call_core (kwdict=0x0, callargs=0xea34d17c, func=0xeae4a9ec) at Python/ceval.c:5067
#27 _PyEval_EvalFrameDefault (f=0xea35302c, throwflag=0) at Python/ceval.c:3366
#28 0xebbd7cbc in PyEval_EvalFrameEx (f=f@entry=0xea35302c, throwflag=throwflag@entry=0) at Python/ceval.c:718
#29 0xebbd7d7d in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=2, globals=0xea95a4dc) at Python/ceval.c:4880
#30 0xebbd8c91 in fast_function (kwnames=0x0, nargs=<optimized out>, stack=0xea4c6740, func=0xea9139bc) at Python/ceval.c:4915
#31 call_function (pp_stack=pp_stack@entry=0xffa8a77c, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at Python/ceval.c:4819
#32 0xebbdc9e3 in _PyEval_EvalFrameDefault (f=0xea4c65e4, throwflag=0) at Python/ceval.c:3284
#33 0xebbd7cbc in PyEval_EvalFrameEx (f=f@entry=0xea4c65e4, throwflag=throwflag@entry=0) at Python/ceval.c:718
#34 0xebbd7d7d in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=0, globals=0xead53edc) at Python/ceval.c:4880
#35 0xebbd8c91 in fast_function (kwnames=0x0, nargs=<optimized out>, stack=0xeae5f30c, func=0xea95580c) at Python/ceval.c:4915
#36 call_function (pp_stack=pp_stack@entry=0xffa8a91c, oparg=oparg@entry=0, kwnames=kwnames@entry=0x0) at Python/ceval.c:4819
#37 0xebbdc9e3 in _PyEval_EvalFrameDefault (f=0xeae5f1cc, throwflag=0) at Python/ceval.c:3284
#38 0xebbd7cbc in PyEval_EvalFrameEx (f=f@entry=0xeae5f1cc, throwflag=throwflag@entry=0) at Python/ceval.c:718
#39 0xebbd8683 in _PyEval_EvalCodeWithName (_co=_co@entry=0xead4f338, globals=globals@entry=0xead53edc, locals=locals@entry=0x0, args=args@entry=0xec521038, argcount=argcount@entry=0, 
    kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x4, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x0, qualname=qualname@entry=0x0) at Python/ceval.c:4128
#40 0xebbd8d56 in PyEval_EvalCodeEx (_co=0xead4f338, globals=0xead53edc, locals=locals@entry=0x0, args=args@entry=0xec521038, argcount=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
    defcount=defcount@entry=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:4149
#41 0xebb2275d in function_call (func=0xead3bc44, arg=0xec52102c, kw=0x0) at Objects/funcobject.c:604
#42 0xebaee046 in PyObject_Call (func=func@entry=0xead3bc44, args=args@entry=0xec52102c, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2246
#43 0xebbd9279 in PyEval_CallObjectWithKeywords (func=func@entry=0xead3bc44, args=args@entry=0xec52102c, kwargs=kwargs@entry=0x0) at Python/ceval.c:4718
#44 0xebc05672 in PyEval_CallFunction (obj=0xead3bc44, format=0xeb7b9d59 "()") at Python/modsupport.c:504
#45 0xeb11d185 in CPythonManager::Initialize() () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#46 0xeb12142b in CSourcePython::Load(void* (*)(char const*, int*), void* (*)(char const*, int*)) () from /home/hack/servers/csgo/csgo/addons/source-python/bin/core.so
#47 0xec573304 in CSourcePython::Load(void* (*)(char const*, int*), void* (*)(char const*, int*)) () from /home/hack/servers/csgo/csgo/addons/source-python.so
#48 0xf37645ce in ?? () from /home/hack/servers/csgo/bin/engine.so
#49 0xf3764cd1 in ?? () from /home/hack/servers/csgo/bin/engine.so
#50 0xf3764f10 in ?? () from /home/hack/servers/csgo/bin/engine.so
#51 0xf3747b46 in ?? () from /home/hack/servers/csgo/bin/engine.so
#52 0xf3810c45 in ?? () from /home/hack/servers/csgo/bin/engine.so
#53 0xf3884e37 in ?? () from /home/hack/servers/csgo/bin/engine.so
#54 0xf38887dc in ?? () from /home/hack/servers/csgo/bin/engine.so
#55 0xf3885755 in ?? () from /home/hack/servers/csgo/bin/engine.so
#56 0xf39c0209 in ?? () from /home/hack/servers/csgo/bin/engine.so
#57 0xf3886ae2 in ?? () from /home/hack/servers/csgo/bin/engine.so
#58 0xf6e21a70 in ?? () from /home/hack/servers/csgo/bin/dedicated.so
#59 0xf6e80b69 in ?? () from /home/hack/servers/csgo/bin/dedicated.so
#60 0xf6e80b69 in ?? () from /home/hack/servers/csgo/bin/dedicated.so
#61 0xf6e1a45d in ?? () from /home/hack/servers/csgo/bin/dedicated.so
#62 0x08048749 in main ()
KirillMysnik commented 1 year ago

Hello. Unfortunately, more capable devs are currently unavailable, and I'm only really good at the Python side of things, so here's a temporary fix. I basically borrowed everything from Sourcemod.

./addons/source-python/data/source-python/memory/csgo/global_pointers.ini

# ../data/source-python/memory/csgo/global_pointers.ini

[CEntityFactoryDictionary]
binary = server
srv_check = False
# identifier_linux = _ZZ23EntityFactoryDictionaryvE15s_EntityFactory
identifier_linux = 55 89 E5 83 EC 28 80 3D 2A 2A 2A 2A 00 74 2A C9 B8 2A 2A 2A 2A C3 8D 76 00 8D BC 27 00 00 00 00 C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A 85 C0 74 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A C7 44 24 08 2A 2A 2A 2A C7 44 24 04 2A 2A 2A 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A B8 2A 2A 2A 2A C9 C3 89 45 F4 C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A 8B 45 F4 89 04 24 E8 2A 2A 2A 2A 90 8D 76 00 8D BC 27 00 00 00 00 55 89 E5 57
identifier_windows = A1 2A 2A 2A 2A B9 2A 2A 2A 2A 56 FF 75 08 FF 50 04 8B C8 C7 05 2A 2A 2A 2A 00 00 00 00 85 C9 75 2A 33 F6 EB
offset_windows = 6
offset_linux = 17
level = 1

[CGlobalEntityList]
binary = server
srv_check = False
identifier_linux = E8 2A 2A 2A 2A E8 2A 2A 2A 2A 83 EC 0C 68 2A 2A 2A 2A
# Search the signature of OnCBaseEntityList::AddNonNetworkableEntity(IHandleEntity *)
# Note: The Linux binary does not contain the gEntList pointer in that function!
identifier_windows = 55 8B EC 8B 0D 2A 2A 2A 2A 53
offset_windows = 101
offset_linux = 14
level = 1

[IServer]
binary = bin/engine
srv_check = False
# identifier_linux = sv
identifier_linux = 55 89 E5 53 83 EC 0C FF 75 0C 68 2A 2A 2A 2A
identifier_windows = 55 8B EC 56 FF 2A 2A B9 2A 2A 2A 2A E8 2A 2A 2A 2A 8B
offset_windows = 8
offset_linux = 11
level = 1

[CBaseTempEntity]
binary = server
srv_check = False
# identifier_linux = _ZN15CBaseTempEntity15s_pTempEntitiesE
identifier_linux = 55 89 E5 8B 45 08 8B 55 0C C7 00 2A 2A 2A 2A 89 50 04 8B 15 2A 2A 2A 2A
identifier_windows = 89 41 04 A1 2A 2A 2A 2A 89 41 08 89 0D 2A 2A 2A 2A C7
offset_windows = 4
offset_linux = 20
level = 2

./addons/source-python/data/source-python/entity_output/csgo/CBaseEntityOutput.ini

# ../data/source-python/entity_output/csgo/CBaseEntityOutput.ini

binary = server
srv_check = False

[function]
    [[fire_output]]
        # identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
        identifier_linux =  55 89 E5 57 56 53 81 EC 4C 01 00 00 8B 45 08 65 8B 1D 14 00 00 00
        identifier_windows = 55 8B EC 83 2A 2A 81 EC 2A 2A 2A 2A 8B C1 53 56 57 8B 2A 2A 89 2A 2A 2A 33
        arguments_linux = POINTER, POINTER, POINTER, FLOAT
        arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT

./addons/source-python/packages/source-python/memory/manager.py Replace this code (lines 724--742):

    def global_pointer(
            self, cls, binary, identifier, offset=0, level=0, srv_check=True):
        """Search for a global pointer and wrap the it."""
        manager_logger.log_debug(
            'Retrieving global pointer for {}...'.format(cls.__name__))

        # Get the binary
        binary = find_binary(binary, srv_check)

        # Get the global pointer
        ptr = binary.find_pointer(identifier, offset, level)

        # Raise an error if the pointer is invalid
        if not ptr:
            raise ValueError('Unable to find the global pointer.')

        # Wrap the pointer using the given class and save the instance
        ptr = self.global_pointers[cls.__name__] = make_object(cls, ptr)
        return ptr

with this code:

    def _global_pointer_for_entity_factory(self, cls):
        # Credits to https://github.com/alliedmodders/sourcemod/blob/e34e9b9869915bd2f82446cc64ddedf06586722d/extensions/sdktools/vhelpers.cpp#L742
        manager_logger.log_debug("(Hacky) Retrieving global pointer for EntityFactoryDictionary...")

        # EntityFactoryCaller
        ent_caller_sig = b"\x55\x89\xE5\x53\x83\xEC\x14\x8B\x5D\x08\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\xE8"

        # EntityFactoryCallOffset
        ent_call_offset = 11

        binary = find_binary('server', srv_check=False)
        func_offset = binary.find_pointer(ent_caller_sig, ent_call_offset, 1)
        addr = binary[ent_caller_sig] + (ent_call_offset + 4 + int(func_offset))

        func = addr.make_function(
            Convention.CDECL,
            [],
            DataType.POINTER
        )

        manager_logger.log_debug("(Hacky) Calling a function...")
        ptr = func()

        manager_logger.log_debug("(Hacky) We're still here, saving the object.")
        self.global_pointers[cls.__name__] = make_object(cls, ptr)
        return ptr

    def global_pointer(
            self, cls, binary, identifier, offset=0, level=0, srv_check=True):
        """Search for a global pointer and wrap the it."""
        manager_logger.log_debug(
            'Retrieving global pointer for {}...'.format(cls.__name__))

        # TODO: Remove this ASAP
        from core import PLATFORM, GAME_NAME
        if (PLATFORM, GAME_NAME, cls.__name__) == ('linux', 'csgo', 'EntityFactoryDictionary'):
            return self._global_pointer_for_entity_factory(cls)

        # Get the binary
        binary = find_binary(binary, srv_check)

        # Get the global pointer
        ptr = binary.find_pointer(identifier, offset, level)

        # Raise an error if the pointer is invalid
        if not ptr:
            raise ValueError('Unable to find the global pointer.')

        # Wrap the pointer using the given class and save the instance
        ptr = self.global_pointers[cls.__name__] = make_object(cls, ptr)
        return ptr

This is a very dirty fix and we should wait for a full solution, but at least this should get you back up.

DiDHack commented 1 year ago

@KirillMysnik Thank you, Kirill. I'll try it. I knew it that issue in EntityFactoryDictionary and its offset but don't have enough experience in CS modding/hacking.

DiDHack commented 1 year ago

It's working!!! Thank you very much

RaviLotus commented 1 year ago

I don't have a file ./addons/source-python/packages/source-python/manager/memory.py There is only /csgo/addons/source-python/packages/source-python/memory/manager.py

DiDHack commented 1 year ago

memory/manager.py - it's correct manager/memory.py - typo

RaviLotus commented 1 year ago

image should i replace it?

RaviLotus commented 1 year ago

image Right?

DiDHack commented 1 year ago

Yes. But I would do it a little bit differently

RaviLotus commented 1 year ago

As if everything was done as it is said, but the server is not used

RaviLotus commented 1 year ago

Can you give me your file for me to replace. Maybe I'm doing something wrong?

DiDHack commented 1 year ago

In your screenshot all is correct. Did you replace signatures?

RaviLotus commented 1 year ago

[Source.Python] Loading... [Source.Python] Failed to load the main module due to following exception: Traceback (most recent call last):

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 82, in load setup_core_settings()

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 204, in setup_core_settings _core_settings.load()

File "/srv/csgo/addons/source-python/packages/source-python/core/settings.py", line 47, in load self._check_settings()

File "/srv/csgo/addons/source-python/packages/source-python/core/settings.py", line 68, in _check_settings self._check_auth_settings()

File "/srv/csgo/addons/source-python/packages/source-python/core/settings.py", line 199, in _check_auth_settings from auth.manager import auth_manager

File "/srv/csgo/addons/source-python/packages/source-python/auth/manager.py", line 19, in from listeners import OnLevelEnd

File "/srv/csgo/addons/source-python/packages/source-python/listeners/init.py", line 29, in from entities.helpers import find_output_name

File "/srv/csgo/addons/source-python/packages/source-python/entities/helpers.py", line 54, in from memory.manager import MemberFunction

File "/srv/csgo/addons/source-python/packages/source-python/memory/manager.py", line 724

def _global_pointer_for_entity_factory(self, cls):

                                                 ^

IndentationError: unindent does not match any outer indentation level [Source.Python] Could not initialize python. Failed to load plugin "addons/source-python" [Source.Python] Unloading... [Source.Python] Failed to unload the main module. Traceback (most recent call last):

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 99, in unload unload_plugins()

File "/srv/csgo/addons/source-python/packages/source-python/init.py", line 441, in unload_plugins from plugins.manager import plugin_manager

File "/srv/csgo/addons/source-python/packages/source-python/plugins/manager.py", line 29, in from listeners import on_plugin_loaded_manager

File "/srv/csgo/addons/source-python/packages/source-python/listeners/init.py", line 29, in from entities.helpers import find_output_name

File "/srv/csgo/addons/source-python/packages/source-python/entities/helpers.py", line 54, in from memory.manager import MemberFunction

File "/srv/csgo/addons/source-python/packages/source-python/memory/manager.py", line 724

def _global_pointer_for_entity_factory(self, cls):

                                                 ^

IndentationError: unindent does not match any outer indentation level [Source.Python] Unloaded successfully.

RaviLotus commented 1 year ago

laughing out loud. The indent was incorrect. sorry everything worked

DiDHack commented 1 year ago

https://github.com/Source-Python-Dev-Team/Source.Python/commit/0171b36297c23d480c17631561c98c0ff2afca28

Ayuto commented 1 year ago

Thank you all for your input and sorry for the late reply. I guess all of us were quite busy in the last few days. Also thank you @jordanbriere for supplying the final fix. A new release will be published in a few hours when I'm back home.