Merge pull request from superyu1337/development

merge development into master
This commit is contained in:
Janek 2024-04-12 16:16:44 +02:00 committed by GitHub
commit a75925f07d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 55 additions and 6030 deletions

6
.gitignore vendored

@ -1,4 +1,4 @@
/target
/src/dma/cs2dumper/offsets.rs
/src/dma/cs2dumper/client.rs
/src/dma/cs2dumper/engine2.rs
/src/dma/cs2dumper/offsets_mod.rs
/src/dma/cs2dumper/client_mod.rs
/src/dma/cs2dumper/engine2_mod.rs

@ -68,6 +68,9 @@ pub struct RadarData {
#[serde(rename = "bombDefuseTimeleft")]
bomb_defuse_timeleft: f32,
#[serde(rename = "bombDefuseEnd")]
bomb_defuse_end: f32,
#[serde(rename = "mapName")]
map_name: String,
@ -79,8 +82,8 @@ pub struct RadarData {
}
impl RadarData {
pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32) -> RadarData {
RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length }
pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32, bomb_defuse_end: f32) -> RadarData {
RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length, bomb_defuse_end }
}
/// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame
@ -95,7 +98,8 @@ impl RadarData {
bomb_defuse_timeleft: 0.0,
bomb_exploded: false,
bomb_being_defused: false,
bomb_defuse_length: 0.0
bomb_defuse_length: 0.0,
bomb_defuse_end: 0.0
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,79 +0,0 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-04-02 16:10:48.961749300 UTC
#![allow(non_upper_case_globals, non_camel_case_types, unused)]
pub mod cs2_dumper {
pub mod schemas {
// Module: engine2.dll
// Classes count: 2
// Enums count: 4
pub mod engine2_dll {
// Alignment: 4
// Members count: 3
#[repr(u32)]
pub enum SpawnDebugOverrideState_t {
SPAWN_DEBUG_OVERRIDE_NONE = 0x0,
SPAWN_DEBUG_OVERRIDE_FORCE_ENABLED = 0x1,
SPAWN_DEBUG_OVERRIDE_FORCE_DISABLED = 0x2
}
// Alignment: 4
// Members count: 5
#[repr(u32)]
pub enum SpawnDebugRestrictionOverrideState_t {
SPAWN_DEBUG_RESTRICT_NONE = 0x0,
SPAWN_DEBUG_RESTRICT_IGNORE_MANAGER_DISTANCE_REQS = 0x1,
SPAWN_DEBUG_RESTRICT_IGNORE_TEMPLATE_DISTANCE_LOS_REQS = 0x2,
SPAWN_DEBUG_RESTRICT_IGNORE_TEMPLATE_COOLDOWN_LIMITS = 0x4,
SPAWN_DEBUG_RESTRICT_IGNORE_TARGET_COOLDOWN_LIMITS = 0x8
}
// Alignment: 4
// Members count: 3
#[repr(u32)]
pub enum EntityDormancyType_t {
ENTITY_NOT_DORMANT = 0x0,
ENTITY_DORMANT = 0x1,
ENTITY_SUSPENDED = 0x2
}
// Alignment: 4
// Members count: 4
#[repr(u32)]
pub enum EntityIOTargetType_t {
ENTITY_IO_TARGET_INVALID = 0xFFFFFFFFFFFFFFFF,
ENTITY_IO_TARGET_ENTITYNAME = 0x2,
ENTITY_IO_TARGET_EHANDLE = 0x6,
ENTITY_IO_TARGET_ENTITYNAME_OR_CLASSNAME = 0x7
}
// Parent: None
// Fields count: 11
//
// Metadata:
// NetworkVarNames: m_nameStringableIndex (int32)
pub mod CEntityIdentity {
pub const m_nameStringableIndex: usize = 0x14; // int32
pub const m_name: usize = 0x18; // CUtlSymbolLarge
pub const m_designerName: usize = 0x20; // CUtlSymbolLarge
pub const m_flags: usize = 0x30; // uint32
pub const m_worldGroupId: usize = 0x38; // WorldGroupId_t
pub const m_fDataObjectTypes: usize = 0x3C; // uint32
pub const m_PathIndex: usize = 0x40; // ChangeAccessorFieldPathIndex_t
pub const m_pPrev: usize = 0x58; // CEntityIdentity*
pub const m_pNext: usize = 0x60; // CEntityIdentity*
pub const m_pPrevByClass: usize = 0x68; // CEntityIdentity*
pub const m_pNextByClass: usize = 0x70; // CEntityIdentity*
}
// Parent: None
// Fields count: 4
//
// Metadata:
// NetworkVarNames: m_pEntity (CEntityIdentity*)
// NetworkVarNames: m_CScriptComponent (CScriptComponent::Storage_t)
pub mod CEntityInstance {
pub const m_iszPrivateVScripts: usize = 0x8; // CUtlSymbolLarge
pub const m_pEntity: usize = 0x10; // CEntityIdentity*
pub const m_CScriptComponent: usize = 0x28; // CScriptComponent*
pub const m_bVisibleinPVS: usize = 0x30; // bool
}
}
}
}

@ -1,48 +0,0 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-04-02 16:10:48.961749300 UTC
#![allow(non_upper_case_globals, non_camel_case_types, unused)]
pub mod cs2_dumper {
pub mod offsets {
// Module: client.dll
pub mod client_dll {
pub const dwCSGOInput: usize = 0x192B620;
pub const dwEntityList: usize = 0x18C2D58;
pub const dwGameEntitySystem: usize = 0x19E0790;
pub const dwGameEntitySystem_getHighestEntityIndex: usize = 0x1510;
pub const dwGameRules: usize = 0x191FCA0;
pub const dwGlobalVars: usize = 0x172ABA0;
pub const dwGlowManager: usize = 0x19200C0;
pub const dwLocalPlayerController: usize = 0x1912578;
pub const dwLocalPlayerPawn: usize = 0x17371A8;
pub const dwPlantedC4: usize = 0x1928AD8;
pub const dwPrediction: usize = 0x1737070;
pub const dwSensitivity: usize = 0x19209E8;
pub const dwSensitivity_sensitivity: usize = 0x40;
pub const dwViewAngles: usize = 0x19309B0;
pub const dwViewMatrix: usize = 0x19241A0;
pub const dwViewRender: usize = 0x1924A20;
}
// Module: engine2.dll
pub mod engine2_dll {
pub const dwBuildNumber: usize = 0x514574;
pub const dwNetworkGameClient: usize = 0x513AC8;
pub const dwNetworkGameClient_deltaTick: usize = 0x258;
pub const dwNetworkGameClient_getLocalPlayer: usize = 0xF0;
pub const dwNetworkGameClient_getMaxClients: usize = 0x250;
pub const dwNetworkGameClient_signOnState: usize = 0x240;
pub const dwWindowHeight: usize = 0x5CCCDC;
pub const dwWindowWidth: usize = 0x5CCCD8;
}
// Module: inputsystem.dll
pub mod inputsystem_dll {
pub const dwInputSystem: usize = 0x367A0;
}
// Module: matchmaking.dll
pub mod matchmaking_dll {
pub const dwGameTypes: usize = 0x1D21E0;
pub const dwGameTypes_mapName: usize = 0x1D2300;
}
}
}

@ -81,6 +81,19 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
}
};
let bomb_defuse_end: f32 = {
if bomb_can_defuse {
if let (Some(bomb_stamp), Some(defuse_stamp)) = (data.bomb_planted_stamp, data.bomb_defuse_stamp) {
let defuse_left = data.bomb_defuse_length - defuse_stamp.elapsed().as_secs_f32();
(data.bomb_plant_timer - bomb_stamp.elapsed().as_secs_f32()) - defuse_left
} else {
0.0
}
} else {
0.0
}
};
last_bomb_dropped = data.bomb_dropped;
last_bomb_planted = data.bomb_planted;
@ -204,7 +217,8 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
bomb_defuse_timeleft,
data.bomb_exploded,
data.bomb_being_defused,
data.bomb_defuse_length
data.bomb_defuse_length,
bomb_defuse_end
);
} else {
let mut radar = radar_data.write().await;

0
webradar/assets/image/cs_italy_radar_psd.png Executable file → Normal file

Before

(image error) Size: 101 KiB

After

(image error) Size: 101 KiB

0
webradar/assets/image/cs_office_radar_psd.png Executable file → Normal file

Before

(image error) Size: 186 KiB

After

(image error) Size: 186 KiB

0
webradar/assets/image/de_ancient_radar_psd.png Executable file → Normal file

Before

(image error) Size: 152 KiB

After

(image error) Size: 152 KiB

0
webradar/assets/image/de_anubis_radar_psd.png Executable file → Normal file

Before

(image error) Size: 212 KiB

After

(image error) Size: 212 KiB

0
webradar/assets/image/de_dust2_radar_psd.png Executable file → Normal file

Before

(image error) Size: 156 KiB

After

(image error) Size: 156 KiB

0
webradar/assets/image/de_inferno_radar_psd.png Executable file → Normal file

Before

(image error) Size: 126 KiB

After

(image error) Size: 126 KiB

0
webradar/assets/image/de_mirage_radar_psd.png Executable file → Normal file

Before

(image error) Size: 137 KiB

After

(image error) Size: 137 KiB

0
webradar/assets/image/de_nuke_radar_psd.png Executable file → Normal file

Before

(image error) Size: 76 KiB

After

(image error) Size: 76 KiB

0
webradar/assets/image/de_overpass_radar_psd.png Executable file → Normal file

Before

(image error) Size: 196 KiB

After

(image error) Size: 196 KiB

0
webradar/assets/image/de_vertigo_radar_psd.png Executable file → Normal file

Before

(image error) Size: 97 KiB

After

(image error) Size: 97 KiB

0
webradar/assets/json/cs_italy.json Executable file → Normal file

0
webradar/assets/json/cs_office.json Executable file → Normal file

0
webradar/assets/json/de_ancient.json Executable file → Normal file

0
webradar/assets/json/de_anubis.json Executable file → Normal file

0
webradar/assets/json/de_dust2.json Executable file → Normal file

0
webradar/assets/json/de_inferno.json Executable file → Normal file

0
webradar/assets/json/de_mirage.json Executable file → Normal file

0
webradar/assets/json/de_nuke.json Executable file → Normal file

0
webradar/assets/json/de_overpass.json Executable file → Normal file

0
webradar/assets/json/de_vertigo.json Executable file → Normal file

10
webradar/index.html Executable file → Normal file

@ -10,8 +10,14 @@
<div id="canvasContainer">
<div id="settingsHolder">
<div class="settings">
<button onclick="toggleZoom()">Toggle Zoom</button>
<button onclick="toggleStats()">Toggle Stats</button>
<div>
<input type="checkbox" onclick="toggleZoom()" id="zoomCheck" name="zoom"/>
<label for="zoomCheck">Zoom</label>
</div>
<div>
<input type="checkbox" onclick="toggleStats()" id="statsCheck" name="stats"/>
<label for="statsCheck">Stats</label>
</div>
</div>
</div>
<canvas id="canvas"></canvas>

18
webradar/script.js Executable file → Normal file

@ -7,7 +7,7 @@ const textColor = "#d1d1d1"
// Settings
shouldZoom = true
drawStats = true
drawStats = false
// Common
canvas = null
@ -35,7 +35,7 @@ if (location.protocol == 'https:') {
} else {
websocketAddr = `ws://${window.location.host}/ws`
}
//websocketAddr = "ws://localhost:8001/ws"
websocketAddr = "ws://192.168.0.235:8000/ws"
// Util functions
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
@ -185,7 +185,6 @@ function render() {
let maxWidth = 1024-128-128;
let timeleft = radarData.bombDefuseTimeleft;
//let canDefuse = (timeleft - radarData.bombDefuseLength) > 0
// Base bar
ctx.fillStyle = "black"
@ -225,6 +224,16 @@ function render() {
ctx.moveTo(130 + (maxWidth-2) * (10 / 40), 16)
ctx.lineTo(130 + (maxWidth-2) * (10 / 40), 32)
ctx.stroke()
// Defuse stamp line
if (radarData.bombCanDefuse) {
console.log(radarData.bombDefuseEnd)
ctx.strokeStyle = "green"
ctx.beginPath()
ctx.moveTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 16)
ctx.lineTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 32)
ctx.stroke()
}
}
}
@ -511,6 +520,9 @@ function connect() {
}
addEventListener("DOMContentLoaded", (e) => {
document.getElementById("zoomCheck").checked = true;
canvas = document.getElementById('canvas');
canvas.width = 1024;
canvas.height = 1024;

10
webradar/styles.css Executable file → Normal file

@ -9,11 +9,10 @@ body {
}
#canvasContainer {
aspect-ratio: 1 / 1;
height: 100vh;
width: 100vmin;
height: 100vmin;
position: relative;
overflow: hidden;
transition: width 0.5s ease; /* Smooth transition */
float: left;
object-fit: contain;
}
@ -37,6 +36,11 @@ canvas {
}
.settings {
display: flex;
flex-direction: column;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: white;
visibility: visible;
opacity: 0;
padding: 10px;