Foros del Web » Programando para Internet » PHP »

Leer fichero binario he interpretalo

Estas en el tema de Leer fichero binario he interpretalo en el foro de PHP en Foros del Web. Es la tercera vez q intento escribir el mensaje y mas tan largo... q si no se puede poner enlaces q si no estas identificado ...
  #1 (permalink)  
Antiguo 08/08/2007, 13:18
Avatar de SkyWalker  
Fecha de Ingreso: enero-2002
Mensajes: 39
Antigüedad: 22 años, 3 meses
Puntos: 0
Leer fichero binario he interpretalo

Es la tercera vez q intento escribir el mensaje y mas tan largo... q si no se puede poner enlaces q si no estas identificado (aunque lo este) yo no se... (mi miniqueja del cabreo de llevar media hora escribiendo .... ya se me pasara...)


En fin, necesito una mano con la lectura de un fichero q se llama csstats.dat que contiene las estadisticas de jugadores de un servidor de counter strike, la idea es hacer q dichas estadísticas salgan en la web leyendo este fichero con php.

Conozco del fichero:
(como no se pueden poner enlaces pos...)

Código:
How to Interpret
int8/uint8 - Signed or Unsigned Byte (8 bits). C types: char, unsigned char 
int16/uint16 - Signed or Unsigned Word (16 bits). C types: short, unsigned short 
int32/uint16 - Signed or Unsigned Doubleword (32 bits). C types: int, unsigned int 
sz - Zero-terminated C-style string 
If a size is followed by [N], for example, int8[9], this would mean 9 blocks of int8 data must be read. 

CSX (csstats.dat)
The CSSTATS format has RANK_VERSION of 11. The version numbers are considered isolated rather than backwards or forward compatible. 

int16 - RANK_VERSION 
uint16 - Bytes in first string (if 0, no entries) 
sz - Name (read N bytes, where N is previous uint16) 
uint16 - Bytes of next string 
sz - Steam ID (read N bytes, where N is previous uint16) 
uint32 - Team kills 
uint32 - Damage 
uint32 - Deaths 
int32 - Kills 
uint32 - Shots 
uint32 - Hits 
uint32 - Headshots 
uint32 - Defusions 
uint32 - Defusal Attempts 
uint32 - Plants 
uint32 - Explosions 
uint32[9] - Body Hits (array of ints, one for each body hit area) 
uint16 - If zero, end of file. Otherwise, loop back up and read the next name for this many bytes.
Mas o menos claro, pero no se como leer los uint que es lo que se me escapa, a lo mas que llego es a leer la version del archivo. Creo que la solucion esta usando unpack() pero no se hacerlo, aunque lo he intentado

Para abreviar he encontrado scripts q hacen lo que pretendo pero de versiones antiguas del fichero csstats.dat (de más de 3 años) si alguien quiere para ver si se le enciende la bombilla y tambien puedo dar el codigo para interpretar el archivo pero escrito en perl que no tengo ni idea (he intentado probarlo sin exito) y en c# que menos todavia por si ayuda también.

Pos nada espero su ayuda yo y la comunidad de gente que juega al counter strike quedará seguro muy agradecida.

Se me olvidaba... falta el fichero lo puen descargar de busqo.com/mank0s/csstats.zip

Saludos

Última edición por SkyWalker; 08/08/2007 a las 13:21 Razón: el fichero se me olvidaba
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:44.