1 Commits

Author SHA1 Message Date
7af8d821f8 fix: change map addr offset to +384 2025-03-11 04:13:47 -04:00
6 changed files with 47 additions and 141 deletions

View File

@@ -16,15 +16,12 @@ pub struct PlayerData {
has_awp: bool, has_awp: bool,
#[serde(rename = "isScoped")] #[serde(rename = "isScoped")]
is_scoped: bool, is_scoped: bool
#[serde(rename = "playerName")]
player_name: String
} }
impl PlayerData { impl PlayerData {
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool, player_name: String) -> PlayerData { pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool) -> PlayerData {
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped, player_name } PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped }
} }
} }

View File

@@ -97,7 +97,6 @@ impl DmaCtx {
let mut team = 0i32; let mut team = 0i32;
let mut clipping_weapon = 0u64; let mut clipping_weapon = 0u64;
let mut is_scoped = 0u8; let mut is_scoped = 0u8;
let mut player_name_ptr = 0u64;
{ {
let mut batcher = MemoryViewBatcher::new(&mut self.process); let mut batcher = MemoryViewBatcher::new(&mut self.process);
@@ -107,23 +106,8 @@ impl DmaCtx {
batcher.read_into(controller + cs2dumper::client::C_BaseEntity::m_iTeamNum, &mut team); batcher.read_into(controller + cs2dumper::client::C_BaseEntity::m_iTeamNum, &mut team);
batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_pClippingWeapon, &mut clipping_weapon); batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_pClippingWeapon, &mut clipping_weapon);
batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawn::m_bIsScoped, &mut is_scoped); batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawn::m_bIsScoped, &mut is_scoped);
batcher.read_into(controller + cs2dumper::client::CCSPlayerController::m_sSanitizedPlayerName, &mut player_name_ptr);
} }
let player_name = if player_name_ptr != 0 {
let mut name_buffer = [0u8; 32];
self.process.read_raw_into(player_name_ptr.into(), &mut name_buffer)?;
let name_len = name_buffer.iter().position(|&c| c == 0).unwrap_or(name_buffer.len());
String::from_utf8_lossy(&name_buffer[..name_len]).to_string()
} else {
match team {
2 => format!("T Player"),
3 => format!("CT Player"),
_ => format!("Unknown Player"),
}
};
let team = TeamID::from_i32(team); let team = TeamID::from_i32(team);
let has_awp = { let has_awp = {
@@ -142,8 +126,7 @@ impl DmaCtx {
team, team,
health, health,
has_awp, has_awp,
is_scoped: is_scoped != 0, is_scoped: is_scoped != 0
player_name,
}) })
} }
@@ -269,5 +252,4 @@ pub struct BatchedPlayerData {
pub health: u32, pub health: u32,
pub has_awp: bool, pub has_awp: bool,
pub is_scoped: bool, pub is_scoped: bool,
pub player_name: String,
} }

View File

@@ -165,8 +165,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
PlayerType::Local, PlayerType::Local,
has_bomb, has_bomb,
local_data.has_awp, local_data.has_awp,
local_data.is_scoped, local_data.is_scoped
local_data.player_name
) )
) )
); );
@@ -203,8 +202,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
player_type, player_type,
has_bomb, has_bomb,
player_data.has_awp, player_data.has_awp,
player_data.is_scoped, player_data.is_scoped
player_data.player_name
) )
) )
); );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 MiB

View File

@@ -6,9 +6,8 @@ const bombColor = "#eda338"
const textColor = "#d1d1d1" const textColor = "#d1d1d1"
// Settings // Settings
shouldZoom = false shouldZoom = true
drawStats = false
drawStats = true
// Common // Common
canvas = null canvas = null
@@ -111,47 +110,6 @@ function mapCoordinates(coordinates) {
return {x: offset_x, y: offset_y} return {x: offset_x, y: offset_y}
} }
function drawPlayerName(pos, playerName, playerType, hasAwp, hasBomb) {
if (!map) return;
if (zoomSet) {
pos = boundingCoordinates(mapCoordinates(pos), boundingRect);
textSize = boundingScale(12, boundingRect);
} else {
pos = mapCoordinates(pos);
textSize = 12;
}
const textY = pos.y + 20;
let displayName = playerName;
if (playerType === "Local") {
displayName = "YOU";
ctx.fillStyle = localColor;
} else if (playerType === "Team") {
ctx.fillStyle = teamColor;
} else if (playerType === "Enemy") {
ctx.fillStyle = enemyColor;
}
if (hasAwp) {
displayName += " [AWP]";
}
if (hasBomb) {
displayName += " [C4]";
}
ctx.font = `${textSize}px Arial`;
ctx.textAlign = "center";
ctx.textBaseline = "top";
ctx.lineWidth = 2;
ctx.strokeStyle = "black";
ctx.strokeText(displayName, pos.x, textY);
ctx.fillText(displayName, pos.x, textY);
}
function render() { function render() {
if (update) { if (update) {
fillCanvas() fillCanvas()
@@ -181,6 +139,7 @@ function render() {
maxY = Math.max(maxY, mapCords.y); maxY = Math.max(maxY, mapCords.y);
}); });
boundingRect = makeBoundingRect(minX-safetyBound, minY-safetyBound, maxX+safetyBound, maxY+safetyBound, image.width/image.height) boundingRect = makeBoundingRect(minX-safetyBound, minY-safetyBound, maxX+safetyBound, maxY+safetyBound, image.width/image.height)
zoomSet = true zoomSet = true
@@ -216,11 +175,7 @@ function render() {
data.Player.hasAwp, data.Player.hasAwp,
data.Player.playerType, data.Player.playerType,
data.Player.isScoped data.Player.isScoped
); )
if (drawStats && data.Player.playerName) {
drawPlayerName(data.Player.pos, data.Player.playerName, data.Player.playerType);
}
} }
}); });
} }
@@ -354,7 +309,7 @@ function drawBomb(pos, planted) {
} }
} }
function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped, playerName) { function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped) {
if (map == null) if (map == null)
return return
@@ -515,14 +470,6 @@ function connect() {
radarData = data; radarData = data;
freq = data.freq; freq = data.freq;
if (data.entityData) {
data.entityData.forEach(entity => {
if (entity.Player) {
console.log(`Player: ${entity.Player.playerType}, Name: ${entity.Player.playerName || 'undefined'}`);
}
});
}
if (data.ingame == false) { if (data.ingame == false) {
mapName = null mapName = null
entityData = null entityData = null
@@ -573,8 +520,8 @@ function connect() {
} }
addEventListener("DOMContentLoaded", (e) => { addEventListener("DOMContentLoaded", (e) => {
document.getElementById("zoomCheck").checked = false; document.getElementById("zoomCheck").checked = true;
document.getElementById("statsCheck").checked = true;
canvas = document.getElementById('canvas'); canvas = document.getElementById('canvas');
canvas.width = 1024; canvas.width = 1024;

View File

@@ -6,9 +6,6 @@ body {
align-items: center; align-items: center;
height: 100vh; height: 100vh;
background-color: #000000; /* Change the background color as needed */ background-color: #000000; /* Change the background color as needed */
background-image: url('assets/image/background.png');
background-repeat: repeat;
background-size: 128px 128px;
} }
#canvasContainer { #canvasContainer {
@@ -26,27 +23,12 @@ canvas {
} }
#settingsHolder { #settingsHolder {
visibility: visible; visibility: hidden;
position: fixed; position: absolute;
top: 50%; top: inherit;
left: 0; left: inherit;
transform: translateY(-50%); width: inherit;
width: auto; height: 20%;
height: auto;
z-index: 100;
}
#settingsHolder .settings {
display: flex;
flex-direction: column;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: white;
visibility: visible;
opacity: 0.8;
padding: 10px;
background-color: rgba(25, 25, 25, 0.7);
border-radius: 5px;
transition: opacity 0.3s ease;
} }
#settingsHolder:hover .settings { #settingsHolder:hover .settings {