#8 API wrapper functions wrongly assume globals to be unused.

closed-fixed
None
5
2005-08-10
2005-04-21
Jussi Kivilinna
No

API wrapper functions in metamod (dllapi.cpp,
newapi.cpp, engine_api.cpp) wrongly assume that
'PublicMetaGlobals' is not used by other wrapper
function earlier in call stack.

Calls do go throught multiple wrapper functions:
engine-main -> metamod-dllapi.cpp:mm_StartFrame ->
gamedll:StartFrame ->
metamod-engine_api.cpp:mm_MakeVectors ->
engine-MakeVectors. This example doesn't cause problems
but looking in to code shows that this hasn't been
think of. Checking wrapper function macros in metamod.h
shows that 'PublicMetaGlobals' is zeroed for
pre-plugin-function loop but not post-plugin-function loop.

This assumption causes problems when plugins call some
engine-callback-functions: engine-main ->
metamod-dllapi.cpp:mm_StartFrame:plugin-loop ->
plugin:StartFrame -> engine:RunPlayerMove ->
metamod-dllapi.cpp:Cmd_Start -> gamedll:Cmd_Start.
When execution enters metamod:Cmd_Start,
'PublicMetaGlobals' is zeroed and loses information it
stored for metamod:StartFrame:plugin-loop. This causes
problems especially with bots build as metamod-plugins.

Jussi Kivilinna

(ps. Metamod-P v21 has fix for this. (Check
'api_hook.cpp:call_count'))

Discussion

  • David Anderson
    David Anderson
    2005-07-12

    Logged In: YES
    user_id=589889

    Should be closed, patched by hullu

     
    • assigned_to: nobody --> bailopan
    • status: open --> closed-fixed