From 5357480f24c77f1f4b36c19f3ee64dc5e1fe381f Mon Sep 17 00:00:00 2001 From: F1ssi0N Date: Sat, 17 Mar 2018 19:27:56 +0000 Subject: [PATCH] Update attach.sh, add linux equivilents of make and create_projects, update gitignore and update premake with c++20 for linux builds (#20) --- .gitignore | 5 ++++- attach.sh | 13 +++++++------ create_projects.sh | 6 ++++++ make.sh | 11 +++++++++++ premake5.lua | 11 +++++++---- src/sdk/player.cc | 2 ++ 6 files changed, 37 insertions(+), 11 deletions(-) create mode 100755 create_projects.sh create mode 100755 make.sh diff --git a/.gitignore b/.gitignore index c472cde..553ae21 100644 --- a/.gitignore +++ b/.gitignore @@ -610,4 +610,7 @@ __pycache__/ bin/ *.vcxproj *.sln -premake/ \ No newline at end of file +premake/ +gdb.txt +core + diff --git a/attach.sh b/attach.sh index 2a84d20..7b56f53 100755 --- a/attach.sh +++ b/attach.sh @@ -18,11 +18,15 @@ if [ -z "$pid" ]; then fi # Get the full path of the .so that we'll be faking -victim_lib=$(cat /proc/${pid}/maps | grep /usr/lib32/ | shuf -n 1) +victim_lib=$(cat /proc/${pid}/maps | grep ".so" | shuf -n 1) + +echo $victim_lib + victim_lib=${victim_lib##* } # Some magic that I copied straight from StackOverflow victim_lib_array=(${victim_lib//./ }) + number_to_spoof=${victim_lib_array[-1]} library_path=$(IFS=. ; echo "${victim_lib_array[*]}") @@ -66,8 +70,7 @@ sudo killall -19 steam sudo killall -19 steamwebhelper # Uses dlmopen instead of normal dlopen - Credit to LWSS -input="$( -sudo gdb -n -q -batch \ +sudo gdb -n \ -ex "set logging on" \ -ex "set logging file /dev/null" \ -ex "attach $pid" \ @@ -82,9 +85,7 @@ sudo gdb -n -q -batch \ -ex "call \$dlmopen(0, \"$library_path\", 1)" \ -ex "set \$error = call dlerror()" \ -ex "x/s \$error" \ - -ex "detach" \ - -ex "quit" -)" + -ex "catch syscall exit exit_group" # Resume Steam sleep 1 diff --git a/create_projects.sh b/create_projects.sh new file mode 100755 index 0000000..8710907 --- /dev/null +++ b/create_projects.sh @@ -0,0 +1,6 @@ +echo creating projects... + +./premake5 "gmake" +./premake5 "export-compile-commands" + +echo finished. diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..8dad445 --- /dev/null +++ b/make.sh @@ -0,0 +1,11 @@ +# set cwd to script directory +cd "${0%/*}" + +./create_projects.sh + +echo building... +cd premake/ +make -j4 + +echo done. +exit diff --git a/premake5.lua b/premake5.lua index 4925e74..42570e4 100644 --- a/premake5.lua +++ b/premake5.lua @@ -15,17 +15,20 @@ workspace "doghook" filter "platforms:x32" architecture "x32" - filter "configurations:Debug" + filter "system:windows" cppdialect "C++17" - + filter "system:linux" + buildoptions "-std=c++2a" + filter {} + + + filter "configurations:Debug" defines { "DEBUG", "_DEBUG" } optimize "Off" symbols "Full" runtime "Debug" filter "configurations:Release" - cppdialect "C++17" - defines { "NDEBUG" } optimize "Full" symbols "Off" diff --git a/src/sdk/player.cc b/src/sdk/player.cc index 9c85abf..0feac29 100644 --- a/src/sdk/player.cc +++ b/src/sdk/player.cc @@ -149,7 +149,9 @@ static auto player_anim_layer_vector(Player *p) -> UtlVector & { UtlVector *anim_overlays = reinterpret_cast *>(p + 2216); return *anim_overlays; } else if constexpr (doghook_platform::linux()) { + assert(0); } else if constexpr (doghook_platform::osx()) { + assert(0); } }