kaimallea / demoinfogo-linux Goto Github PK
View Code? Open in Web Editor NEWLinux, OSX port of Valve's demoinfogo tool
License: BSD 2-Clause "Simplified" License
Linux, OSX port of Valve's demoinfogo tool
License: BSD 2-Clause "Simplified" License
Hello,
I compiled your code on Ubuntu 16.04.3 LTS
and I saw many warnings (I am able to fix it, so stay tuned):
celestian@vega:~/demoinfogo-linux$ make
g++ -m32 -O3 -Wall -fpermissive --std=c++0x -Iprotobuf-2.5.0/src -c src/demofile.cpp -o src/demofile.o
src/demofile.cpp: In member function ‘bool CDemoFile::Open(const char*)’:
src/demofile.cpp:150:56: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread( &m_DemoHeader, 1, sizeof( m_DemoHeader ), fp );
^
src/demofile.cpp:168:45: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread( &m_fileBuffer[ 0 ], 1, Length, fp );
^
mkdir -p src/generated_proto
protobuf-2.5.0/src/protoc --proto_path=./src --proto_path=protobuf-2.5.0/src --cpp_out=./src/generated_proto src/steammessages.proto
mkdir -p src/generated_proto
protobuf-2.5.0/src/protoc --proto_path=./src --proto_path=protobuf-2.5.0/src --cpp_out=./src/generated_proto src/cstrike15_gcmessages.proto
mkdir -p src/generated_proto
protobuf-2.5.0/src/protoc --proto_path=./src --proto_path=protobuf-2.5.0/src --cpp_out=./src/generated_proto src/netmessages_public.proto
mkdir -p src/generated_proto
protobuf-2.5.0/src/protoc --proto_path=./src --proto_path=protobuf-2.5.0/src --cpp_out=./src/generated_proto src/cstrike15_usermessages_public.proto
g++ -m32 -O3 -Wall -fpermissive --std=c++0x -Iprotobuf-2.5.0/src -c src/demofiledump.cpp -o src/demofiledump.o
In file included from src/demofiledump.h:30:0,
from src/demofiledump.cpp:27:
src/demofilepropdecode.h: In member function ‘void Prop_t::Print(int)’:
src/demofilepropdecode.h:88:10: warning: enumeration value ‘DPT_NUMSendPropTypes’ not handled in switch [-Wswitch]
switch ( m_type )
^
src/demofiledump.cpp: In function ‘void ParseStringTableUpdate(CBitRead&, int, int, int, int, int, bool)’:
src/demofiledump.cpp:678:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( nBytes > sizeof( tempbuf ) )
^
src/demofiledump.cpp:728:73: warning: format ‘%s’ expects argument of type ‘char*’, but argument 5 has type ‘const void*’ [-Wformat=]
printf( " %d, %s, %d, %s \n", entryIndex, pEntry, nBytes, pUserData );
^
src/demofiledump.cpp:595:6: warning: unused variable ‘lastDictionaryIndex’ [-Wunused-variable]
int lastDictionaryIndex = -1;
^
src/demofiledump.cpp: In function ‘CSVCMsg_SendTable* GetTableByClassID(uint32)’:
src/demofiledump.cpp:835:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( s_ServerClasses[ i ].nClassID == nClassID )
^
src/demofiledump.cpp: In function ‘void FlattenDataTable(int)’:
src/demofiledump.cpp:1003:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (prop->priority() == priority || (priority == 64 && (SPROP_CHANGES_OFTEN & prop->flags())))
^
src/demofiledump.cpp: In function ‘void PrintNetMessage(CDemoFileDump&, const void*, int) [with T = CSVCMsg_PacketEntities; int msgType = 26]’:
src/demofiledump.cpp:1159:7: warning: unused variable ‘nBaseline’ [-Wunused-variable]
int nBaseline = msg.baseline();
^
src/demofiledump.cpp:1160:8: warning: unused variable ‘bUpdateBaselines’ [-Wunused-variable]
bool bUpdateBaselines = msg.update_baseline();
^
src/demofiledump.cpp: In function ‘bool ParseDataTable(CBitRead&)’:
src/demofiledump.cpp:1453:7: warning: unused variable ‘type’ [-Wunused-variable]
int type = buf.ReadVarInt32();
^
g++ -m32 -O3 -Wall -fpermissive --std=c++0x -Iprotobuf-2.5.0/src -c src/demoinfogo.cpp -o src/demoinfogo.o
In file included from src/demofiledump.h:30:0,
from src/demoinfogo.cpp:25:
src/demofilepropdecode.h: In member function ‘void Prop_t::Print(int)’:
src/demofilepropdecode.h:88:10: warning: enumeration value ‘DPT_NUMSendPropTypes’ not handled in switch [-Wswitch]
switch ( m_type )
^
g++ -m32 -O3 -Wall -fpermissive --std=c++0x -Iprotobuf-2.5.0/src -c src/demofilebitbuf.cpp -o src/demofilebitbuf.o
src/demofilebitbuf.cpp: In member function ‘float CBitRead::ReadBitFloat()’:
src/demofilebitbuf.cpp:691:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
return *( ( float * ) &nvalue );
^
g++ -m32 -O3 -Wall -fpermissive --std=c++0x -Iprotobuf-2.5.0/src -c src/demofilepropdecode.cpp -o src/demofilepropdecode.o
In file included from src/demofiledump.h:30:0,
from src/demofilepropdecode.cpp:25:
src/demofilepropdecode.h: In member function ‘void Prop_t::Print(int)’:
src/demofilepropdecode.h:88:10: warning: enumeration value ‘DPT_NUMSendPropTypes’ not handled in switch [-Wswitch]
switch ( m_type )
^
g++ -Iprotobuf-2.5.0/src src/demofile.o src/demofiledump.o src/demoinfogo.o src/demofilebitbuf.o src/demofilepropdecode.o src/generated_proto/steammessages.pb.cc src/generated_proto/cstrike15_gcmessages.pb.cc src/generated_proto/netmessages_public.pb.cc src/generated_proto/cstrike15_usermessages_public.pb.cc protobuf-2.5.0/src/.libs/libprotobuf.a -m32 -pthread -static -o demoinfogo
I'm trying to get demoinfogo on to run on linux subsystem for windows, which does not execute 32bit ELF binaries.
protobuf compiles cleanly but demoinfogo doesn't. I'm aware that this is not a bug but its still desirable update the code to compile on 64bit, so perhaps give it a shot :)
demoinfogo fails with assertion error on this .dem
demoinfogo: src/demofiledump.cpp:1277: void PrintNetMessage(CDemoFileDump&, const void*, int) [with T = CSVCMsg_PacketEntities; int msgType = 26]: Assertion `0' failed.
demoinfogo-linux/src/demofiledump.cpp
Line 1277 in a6c2086
I've checked out master and produced that demo on up-to-date CSGO (3054311).
I can't reference the old issue (can't find it, it seems you moved the repo). The issue persists for me.
It should be built for 32-bit now:
demoinfogo: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32
Recursion leading to segmentation fault. I'm on Debian 7. Not sure what the issue is, I built it as advised (make get_protobuf instead of make protobuf though).
The port is a lot slower than demoinfogo.exe when doing -deathscsv:
wine demoinfogo.exe --deathscsv demo.dem > /dev/null
10.19s user
0.24s system
97% cpu
10.712 total
./demoinfogo --deathscsv demo.dem > /dev/null
40.86s user
0.06s system
99% cpu
40.926 total
wine demoinfogo.exe demo.dem > /dev/null
42.27s user
7.44s system
99% cpu
50.006 total
./demoinfogo demo.dem > /dev/null
50.80s user
0.09s system
99% cpu
50.897 total
O3 optimization makes it faster than demoinfogo.exe with no parameters, and brings -deathscsv closer to valves version.
./demoinfogo --deathscsv demo.dem > /dev/null
17.75s user
0.06s system
99% cpu
17.817 total
./demoinfogo demo.dem > /dev/null
26.93s user
0.10s system
99% cpu
27.035 total
Just to show that there is room for optimization, I'm sadly a little rusty in C++, so I don't think I can be of much assistance. Is there any negatives of compiling with -O3?
The current Makefile is a joke I hacked together. Autotools or something similar would be nice.
This command will no longer work since protobuf moved to github from googlecode. You need to update the url to
https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
and include the -L command to follow redirects. Possibly -k as well as I know I've had to use this before when downloading from github. I didn't try without as I was just trying to get this up and running as quick as possible.
Hey, i'm trying to "make" the project, but i get this error, i don't understand it... I'm only trained for basic C so makefiles are way simpler usually. (my goal is to parse info from the generated file using yac/lex to generate statistics and probabilities)
mkdir -p src/generated_proto
protobuf-2.5.0/src/protoc --proto_path=./src --proto_path=protobuf-2.5.0/src --cpp_out=./src/generated_proto src/steammessages.proto
make: protobuf-2.5.0/src/protoc: Command not found
Makefile:39: recipe for target 'src/generated_proto/steammessages.pb.cc' failed
make: *** [src/generated_proto/steammessages.pb.cc] Error 127
processing this GOTV demo i get a segfault after receiving Player Toby (id:21) disconnected. reason:Kicked by Console
no problems playing the demo in-game, any ideas?
On some demos the deathscsv
command produces output like.
, ,<weapon>, <headshot>
Instead of the expected
<attacker_name>, <victim_name>, <weapon>, <headshot>
A demo file that presents this issue is found in #21. This is due to the format of player_info_t
changing. Luckily, it looks like that struct is meant to be versioned. The player_info_t
that works for the demo file in #21 looks like this
struct player_info_t
{
// version for future compatibility
uint32 version;
// network xuid
uint32 xuid;
// scoreboard information
char name[ 32 ];
... <the rest is the same, I think> ...
Note: this is many bytes shorter than the currently defined player_info_t
The first 4 bytes of player_info_t seems to always be a version. The rest of the structure changes depending on that version. The parsing code should be updated to act differently on different versions and should raise an error when an unknown version is encountered.
I am running demoinfogo
with no optional arguments on the .dem
files downloaded from http://www.hltv.org/interfaces/download.php?demoid=19005 and I get a free() error.
*** Error in `./demoinfogo': free(): invalid next size (fast): 0x00000000023ac540 ***
Aborted (core dumped)
My operating system info:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
is this a bug or am i getting something wrong
thanks in advance
Thanks for this nice parser!
I got around 1500 replays from gosugamers and I am checking if they are parsable.
For that I just do a ./demoingogo $filename || echo "problem"
I have an exit code of 1 for a lot a replays, but when I look the output, it seems that the parsing is done correctly, See e.g. "2779_R1_logiX eSp_TCM-Gamin.dem" on gosugamers.
Any idea? Is this a problem?
Btw, I d like to know if this projet is still maintained, as I might use it quite a lot.
Thanks a lot!!
Cheers
It'd be nice if the output could be easily ingested. The current output format is lame and requires parsing.
Example of current output:
---- CSVCMsg_TempEntities (11 bytes) -----------------
num_entries: 1
entity_data: "\302\236\377\337\000\330\265"
player_death eventid:23
userid: 33
attacker: 33
assister: 0
weapon: world
weapon_itemid:
weapon_fauxitemid:
weapon_originalowner_xuid:
headshot: 0
dominated: 0
revenge: 0
penetrated: 0
demoinfogo-linux/protobuf-2.5.0/src/.libs/lt-protoc: error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory
make[3]: *** [unittest_proto_middleman] Error 127
An assertion is failing on OSX:
Assertion failed: (( ( unsigned long )pData & 3 ) == 0), function StartReading, file src/demofilebitbuf.cpp, line 273.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.