{"action":"created","issue":{"url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/64","repository_url":"https://api.github.com/repos/FWGS/hlsdk-xash3d","labels_url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/64/comments","events_url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/64/events","html_url":"https://github.com/FWGS/hlsdk-xash3d/issues/64","id":348051609,"node_id":"MDU6SXNzdWUzNDgwNTE2MDk=","number":64,"title":"Segfault on Mac: g_engfuncs interface is NULL in client.dylib","user":{"login":"x6herbius","id":3692034,"node_id":"MDQ6VXNlcjM2OTIwMzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3692034?v=4","gravatar_id":"","url":"https://api.github.com/users/x6herbius","html_url":"https://github.com/x6herbius","followers_url":"https://api.github.com/users/x6herbius/followers","following_url":"https://api.github.com/users/x6herbius/following{/other_user}","gists_url":"https://api.github.com/users/x6herbius/gists{/gist_id}","starred_url":"https://api.github.com/users/x6herbius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/x6herbius/subscriptions","organizations_url":"https://api.github.com/users/x6herbius/orgs","repos_url":"https://api.github.com/users/x6herbius/repos","events_url":"https://api.github.com/users/x6herbius/events{/privacy}","received_events_url":"https://api.github.com/users/x6herbius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-06T19:25:16Z","updated_at":"2018-08-06T21:28:08Z","closed_at":null,"author_association":"NONE","body":"When I load certain maps (for example, `bounce.bsp`), using the game libraries built from this repo with the Xash3D engine, the game crashes when executing the code in the `LINK_ENTITY_TO_CLASS` macro for `CWorld`.\r\n\r\nThe exact crash I get is in the client's `cbase.h:222` when executing `operator new`: the `ALLOC_PRIVATE()` macro that resolves to `(*g_engfuncs.pfnPvAllocEntPrivateData)` fails, because the `g_engfuncs` struct in the client is completely zeroed. As far as I can see, `g_engfuncs` isn't referred to from anything within the client library, so I'm a bit confused as to how the system is supposed to work.\r\n\r\nThe exact details of the crash are as follows:\r\n\r\n```\r\nException has occurred.\r\nEXC_BAD_ACCESS (code=1, address=0x0)\r\n\r\n[Unknown/Just-In-Time compiled code] (Unknown Source:0)\r\nclient.dylib!CBaseEntity::operator new(unsigned long, entvars_s*) (/Users/vesper/Desktop/hlsdk-xash3d/dlls/cbase.h:224)\r\nhl.dylib!CWorld* GetClassPtr<CWorld>(CWorld*) (/Users/vesper/Desktop/hlsdk-xash3d/dlls/cbase.h:734)\r\nhl.dylib!::worldspawn(entvars_t *) (/Users/vesper/Desktop/hlsdk-xash3d/dlls/world.cpp:446)\r\nlibxash.dylib!SV_AllocPrivateData (/Users/vesper/Desktop/xash3d/engine/server/sv_game.c:984)\r\nlibxash.dylib!SV_ParseEdict (/Users/vesper/Desktop/xash3d/engine/server/sv_game.c:4980)\r\nlibxash.dylib!SV_LoadFromFile (/Users/vesper/Desktop/xash3d/engine/server/sv_game.c:5071)\r\nlibxash.dylib!SV_SpawnEntities (/Users/vesper/Desktop/xash3d/engine/server/sv_game.c:5141)\r\nlibxash.dylib!SV_LevelInit (/Users/vesper/Desktop/xash3d/engine/server/sv_init.c:474)\r\nlibxash.dylib!SV_Map_f (/Users/vesper/Desktop/xash3d/engine/server/sv_cmds.c:279)\r\nlibxash.dylib!Cmd_ExecuteString (/Users/vesper/Desktop/xash3d/engine/common/cmd.c:1082)\r\nlibxash.dylib!Cbuf_Execute (/Users/vesper/Desktop/xash3d/engine/common/cmd.c:359)\r\nlibxash.dylib!Host_Main (/Users/vesper/Desktop/xash3d/engine/common/host.c:1374)\r\nxash3d!Sys_Start (/Users/vesper/Desktop/xash3d/game_launch/xash.c:161)\r\nxash3d!main (/Users/vesper/Desktop/xash3d/game_launch/xash.c:173)\r\nlibdyld.dylib!start (Unknown Source:0)\r\n[Unknown/Just-In-Time compiled code] (Unknown Source:0)\r\n```\r\n\r\nThis crash can be reproduced by taking the current master branches for the `xash3d` and `hlsdk-xash3d` repos and following these steps:\r\n\r\n```\r\nIn the xash3d clone:\r\n\r\nexport CFLAGS=\"-m32\"\r\nexport CXXFLAGS=\"-m32\"\r\nmkdir build && cd build\r\ncmake -DCMAKE_BUILD_TYPE=Debug -DXASH_VGUI=off ..\r\nmake -j8\r\n\r\nIn the hlsdk-xash3d clone:\r\n\r\nexport CFLAGS=\"-m32\"\r\nexport CXXFLAGS=\"-m32\"\r\nmkdir build && cd build\r\ncmake -DCMAKE_BUILD_TYPE=Debug ..\r\nmake -j8\r\n\r\nCopy relevant xash3d libraries into the same folder as the xash3d executable\r\nCopy the valve folder from the Mac version of Half Life into this folder\r\nReplace the default .dylibs with those built from the hlsdk-xash3d clone\r\n\r\nRun:\r\nexport DYLD_LIBRARY_PATH=.\r\n./xash3d -dev 5 -toconsole +map bounce\r\n```"},"comment":{"url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/comments/410858650","html_url":"https://github.com/FWGS/hlsdk-xash3d/issues/64#issuecomment-410858650","issue_url":"https://api.github.com/repos/FWGS/hlsdk-xash3d/issues/64","id":410858650,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDg1ODY1MA==","user":{"login":"x6herbius","id":3692034,"node_id":"MDQ6VXNlcjM2OTIwMzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3692034?v=4","gravatar_id":"","url":"https://api.github.com/users/x6herbius","html_url":"https://github.com/x6herbius","followers_url":"https://api.github.com/users/x6herbius/followers","following_url":"https://api.github.com/users/x6herbius/following{/other_user}","gists_url":"https://api.github.com/users/x6herbius/gists{/gist_id}","starred_url":"https://api.github.com/users/x6herbius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/x6herbius/subscriptions","organizations_url":"https://api.github.com/users/x6herbius/orgs","repos_url":"https://api.github.com/users/x6herbius/repos","events_url":"https://api.github.com/users/x6herbius/events{/privacy}","received_events_url":"https://api.github.com/users/x6herbius/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T21:28:08Z","updated_at":"2018-08-06T21:28:08Z","author_association":"NONE","body":"That's part of the reason I'm confused - I don't know. I haven't modified the code in any way. "}}
{"actor":{"display_login":"x6herbius"}}