feat: implement global ESP and stabilize message hooks
- Added PLAYER_DATA for global player state tracking. - Hooked Radar, Health, ScoreAttrib, and ResetHUD messages. - Fixed PVS-limited ESP by utilizing radar data fallback. - Secured message hooks by removing fragile offsets and adding safety checks. - Fixed i32/usize type mismatches and ensured stable compilation.
This commit is contained in:
367
Cargo.lock
generated
367
Cargo.lock
generated
@@ -8,9 +8,67 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ctor",
|
"ctor",
|
||||||
"gl",
|
"gl",
|
||||||
|
"glow",
|
||||||
|
"imgui",
|
||||||
|
"imgui-glow-renderer",
|
||||||
|
"imgui-sdl2-support",
|
||||||
"libc",
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"sdl2-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.20.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.62"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
|
||||||
|
dependencies = [
|
||||||
|
"find-msvc-tools",
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "0.1.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chlorine"
|
||||||
|
version = "1.0.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c00d31b1d19317b4777ec879192d3745bd97d05262b4b19cb1dda284b9d22f19"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctor"
|
name = "ctor"
|
||||||
version = "0.2.9"
|
version = "0.2.9"
|
||||||
@@ -21,6 +79,36 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "find-msvc-tools"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"pin-project-lite",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gl"
|
name = "gl"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@@ -41,24 +129,159 @@ dependencies = [
|
|||||||
"xml-rs",
|
"xml-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glow"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"slotmap",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "imgui"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "122d677d0efcd64ca15f12907beaf46b26bbd2cdc855ee5b227f29cf50f75bb5"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"cfg-if 1.0.4",
|
||||||
|
"imgui-sys",
|
||||||
|
"mint",
|
||||||
|
"parking_lot",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "imgui-glow-renderer"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "15334602cc59b50210529885eb1db8571dc41bc08521be0de648cfb206bc1dff"
|
||||||
|
dependencies = [
|
||||||
|
"glow",
|
||||||
|
"imgui",
|
||||||
|
"memoffset",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "imgui-sdl2-support"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d038368d619b25dc3b1dae4ac894a5781b99247cedb2b9d5c93b9909f56cd135"
|
||||||
|
dependencies = [
|
||||||
|
"imgui",
|
||||||
|
"sdl2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "imgui-sys"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d785272a57cb8058a53a1e6f376f48e2ec4f40fbc6a9bb197dabf7b6b59c03bf"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"cfg-if 1.0.4",
|
||||||
|
"chlorine",
|
||||||
|
"mint",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.4",
|
||||||
|
"futures-util",
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "khronos_api"
|
name = "khronos_api"
|
||||||
version = "3.1.0"
|
version = "3.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.186"
|
version = "0.2.186"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.4.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
||||||
|
dependencies = [
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.29"
|
version = "0.4.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mint"
|
||||||
|
version = "0.5.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.21.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.12.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
"parking_lot_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.9.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.4",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"smallvec",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.106"
|
version = "1.0.106"
|
||||||
@@ -77,6 +300,77 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.5.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scopeguard"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2"
|
||||||
|
version = "0.34.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "deecbc3fa9460acff5a1e563e05cb5f31bba0aa0c214bb49a43db8159176d54b"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"sdl2-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2-sys"
|
||||||
|
version = "0.34.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41a29aa21f175b5a41a6e26da572d5e5d1ee5660d35f9f9d0913e8a802098f74"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
"libc",
|
||||||
|
"version-compare",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slotmap"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"
|
||||||
|
dependencies = [
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "1.15.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.117"
|
version = "2.0.117"
|
||||||
@@ -94,6 +388,79 @@ version = "1.0.24"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version-compare"
|
||||||
|
version = "0.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.4",
|
||||||
|
"once_cell",
|
||||||
|
"rustversion",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xml-rs"
|
name = "xml-rs"
|
||||||
version = "0.8.28"
|
version = "0.8.28"
|
||||||
|
|||||||
@@ -10,3 +10,9 @@ crate-type = ["cdylib"]
|
|||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
ctor = "0.2"
|
ctor = "0.2"
|
||||||
gl = "0.14"
|
gl = "0.14"
|
||||||
|
glow = "0.12"
|
||||||
|
imgui = "0.11"
|
||||||
|
imgui-glow-renderer = "0.11"
|
||||||
|
imgui-sdl2-support = "0.11"
|
||||||
|
sdl2-sys = "0.34"
|
||||||
|
once_cell = "1.19"
|
||||||
|
|||||||
1580
src/lib.rs
1580
src/lib.rs
File diff suppressed because it is too large
Load Diff
129
src/sdk.rs
129
src/sdk.rs
@@ -2,14 +2,42 @@ use std::ffi::c_char;
|
|||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone, Default)]
|
#[derive(Debug, Copy, Clone, Default)]
|
||||||
pub struct Vector {
|
pub struct Vector { pub x: f32, pub y: f32, pub z: f32 }
|
||||||
pub x: f32,
|
|
||||||
pub y: f32,
|
|
||||||
pub z: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// --- HLSDK button bits (from deboogerxyz/ahc sdk.h) ---
|
||||||
pub const IN_ATTACK: u16 = 1 << 0;
|
pub const IN_ATTACK: u16 = 1 << 0;
|
||||||
pub const IN_JUMP: u16 = 1 << 1;
|
pub const IN_JUMP: u16 = 1 << 1;
|
||||||
|
pub const IN_DUCK: u16 = 1 << 2;
|
||||||
|
pub const IN_FORWARD: u16 = 1 << 3;
|
||||||
|
pub const IN_BACK: u16 = 1 << 4;
|
||||||
|
pub const IN_USE: u16 = 1 << 5;
|
||||||
|
pub const IN_CANCEL: u16 = 1 << 6;
|
||||||
|
pub const IN_LEFT: u16 = 1 << 7;
|
||||||
|
pub const IN_RIGHT: u16 = 1 << 8;
|
||||||
|
pub const IN_MOVELEFT: u16 = 1 << 9;
|
||||||
|
pub const IN_MOVERIGHT: u16 = 1 << 10;
|
||||||
|
pub const IN_ATTACK2: u16 = 1 << 11;
|
||||||
|
pub const IN_RUN: u16 = 1 << 12;
|
||||||
|
pub const IN_RELOAD: u16 = 1 << 13;
|
||||||
|
pub const IN_ALT1: u16 = 1 << 14;
|
||||||
|
pub const IN_SCORE: u16 = 1 << 15;
|
||||||
|
|
||||||
|
// --- UserMsg for message handling ---
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct UserMsg {
|
||||||
|
pub msg: i32,
|
||||||
|
pub size: i32,
|
||||||
|
pub name: [c_char; 16],
|
||||||
|
pub next: *mut UserMsg,
|
||||||
|
pub fn_: unsafe extern "C" fn(usize, *const c_char, i32, *mut std::ffi::c_void) -> i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- move types (subset used by isalive) ---
|
||||||
|
pub const MOVETYPE_NONE: i32 = 0;
|
||||||
|
pub const MOVETYPE_TOSS: i32 = 6;
|
||||||
|
|
||||||
|
// --- PlayerMove flags (subset used by movement helpers) ---
|
||||||
|
pub const FL_ONGROUND: i32 = 1 << 9;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct UserCmd {
|
pub struct UserCmd {
|
||||||
@@ -27,16 +55,26 @@ pub struct UserCmd {
|
|||||||
pub struct EntityState {
|
pub struct EntityState {
|
||||||
pub _pad0: [u8; 12],
|
pub _pad0: [u8; 12],
|
||||||
pub msgnum: i32,
|
pub msgnum: i32,
|
||||||
pub _pad1: [u8; 72],
|
pub origin: Vector,
|
||||||
|
pub angles: Vector,
|
||||||
|
pub _pad1: [u8; 48],
|
||||||
pub movetype: i32,
|
pub movetype: i32,
|
||||||
pub _pad2: [u8; 248],
|
pub animtime: f32,
|
||||||
|
pub framerate: f32,
|
||||||
|
pub body: i32,
|
||||||
|
pub controller: [u8; 4],
|
||||||
|
pub blending: [u8; 4],
|
||||||
|
pub velocity: Vector,
|
||||||
|
pub mins: Vector,
|
||||||
|
pub maxs: Vector,
|
||||||
|
pub _pad2: [u8; 192],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Entity {
|
pub struct Entity {
|
||||||
pub i: i32,
|
pub i: i32,
|
||||||
pub player: i32,
|
pub player: i32,
|
||||||
pub _pad0: [u8; 2 * 340],
|
pub _pad0: [u8; 2 * std::mem::size_of::<EntityState>()],
|
||||||
pub curstate: EntityState,
|
pub curstate: EntityState,
|
||||||
pub _pad1: [u8; 1860],
|
pub _pad1: [u8; 1860],
|
||||||
pub origin: Vector,
|
pub origin: Vector,
|
||||||
@@ -49,49 +87,42 @@ pub struct EventAPI {
|
|||||||
pub _pad1: [u8; 0x40],
|
pub _pad1: [u8; 0x40],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct PlayerInfo {
|
||||||
|
pub name: *const c_char,
|
||||||
|
pub ping: i16,
|
||||||
|
pub thisplayer: u8,
|
||||||
|
pub spectator: u8,
|
||||||
|
pub packetloss: u8,
|
||||||
|
pub _pad: [u8; 3], // Alignment padding
|
||||||
|
pub model: *const c_char,
|
||||||
|
pub topcolor: i16,
|
||||||
|
pub bottomcolor: i16,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for PlayerInfo {
|
||||||
|
fn default() -> Self {
|
||||||
|
unsafe { std::mem::zeroed() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Engine {
|
pub struct Engine {
|
||||||
pub _pad0: [u8; 0x8C],
|
pub _pad0: [u8; 0x54],
|
||||||
|
pub getplayerinfo: unsafe extern "C" fn(i32, *mut PlayerInfo),
|
||||||
|
pub _pad1: [u8; 0x8C - 0x54 - 4],
|
||||||
pub setviewangles: extern "C" fn(*const Vector),
|
pub setviewangles: extern "C" fn(*const Vector),
|
||||||
pub getmaxclients: extern "C" fn() -> i32,
|
pub getmaxclients: extern "C" fn() -> i32,
|
||||||
pub _pad1: [u8; 0xC],
|
pub _pad2: [u8; 0xC],
|
||||||
pub con_printf: extern "C" fn(*const c_char, ...),
|
pub con_printf: extern "C" fn(*const c_char, ...),
|
||||||
pub _pad2: [u8; 0x28],
|
pub _pad3: [u8; 0x28],
|
||||||
pub getlocalplayer: extern "C" fn() -> *mut Entity,
|
pub getlocalplayer: extern "C" fn() -> *mut Entity,
|
||||||
pub _pad3: [u8; 0x4],
|
pub _pad4: [u8; 0x4],
|
||||||
pub getentitybyindex: extern "C" fn(i: i32) -> *mut Entity,
|
pub getentitybyindex: extern "C" fn(i32) -> *mut Entity,
|
||||||
pub _pad4: [u8; 0x78],
|
pub _pad5: [u8; 0x78],
|
||||||
pub eventapi: *mut EventAPI,
|
pub eventapi: *mut EventAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct RefParams {
|
|
||||||
pub vieworigin: Vector,
|
|
||||||
pub viewangles: Vector,
|
|
||||||
pub forward: Vector,
|
|
||||||
pub right: Vector,
|
|
||||||
pub up: Vector,
|
|
||||||
pub _pad0: [u8; 0x64],
|
|
||||||
pub punchangle: Vector,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct Client {
|
|
||||||
pub _pad0: [u8; 0xC],
|
|
||||||
pub hudredraw: extern "C" fn(f32, i32) -> i32,
|
|
||||||
pub _pad1: [u8; 0x18], // Пропускаем до HUD_Key_Event (индекс 10)
|
|
||||||
pub hudkeyevent: extern "C" fn(i32, i32, *const c_char) -> i32,
|
|
||||||
pub _pad2: [u8; 0xC], // До CreateMove (индекс 14)
|
|
||||||
pub createmove: extern "C" fn(f32, *mut UserCmd, i32),
|
|
||||||
pub is3rdperson: extern "C" fn() -> i32,
|
|
||||||
pub cameraoffset: extern "C" fn(*mut Vector),
|
|
||||||
pub _pad3: [u8; 0x8],
|
|
||||||
pub calcrefdef: extern "C" fn(*mut RefParams),
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const FL_ONGROUND: i32 = 1 << 9;
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct PlayerMove {
|
pub struct PlayerMove {
|
||||||
pub _pad0: [u8; 56],
|
pub _pad0: [u8; 56],
|
||||||
@@ -101,3 +132,17 @@ pub struct PlayerMove {
|
|||||||
pub _pad2: [u8; 80],
|
pub _pad2: [u8; 80],
|
||||||
pub flags: i32,
|
pub flags: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct Client {
|
||||||
|
pub _pad0: [u8; 12],
|
||||||
|
// В Steam Legacy Linux функции принимают скрытый usize первым аргументом
|
||||||
|
pub hudredraw: unsafe extern "C" fn(usize, f32, i32) -> i32,
|
||||||
|
pub _pad1: [u8; 24],
|
||||||
|
pub hudkeyevent: unsafe extern "C" fn(usize, i32, i32, *const c_char) -> i32,
|
||||||
|
pub _pad2: [u8; 12],
|
||||||
|
// CreateMove in HLSDK is (frametime, cmd, active). It does NOT take the hidden usize arg.
|
||||||
|
pub createmove: unsafe extern "C" fn(f32, *mut UserCmd, i32),
|
||||||
|
pub _pad3: [u8; 32],
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user