GithubHelp home page GithubHelp logo

kaimallea / demoinfogo-linux Goto Github PK

View Code? Open in Web Editor NEW
152.0 152.0 38.0 2.63 MB

Linux, OSX port of Valve's demoinfogo tool

License: BSD 2-Clause "Simplified" License

Makefile 2.40% C++ 91.90% C 5.71%

demoinfogo-linux's People

Contributors

celestian avatar kaimallea avatar rchh avatar spotify-kai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demoinfogo-linux's Issues

Compilation warnings

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

64bit build

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 :)

Assertion error

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.

I've checked out master and produced that demo on up-to-date CSGO (3054311).

Segmentation fault and recursion

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).

Slow with -deathscsv

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?

compiling error

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

Player info struct is not correct for older demos.

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.

free(): invalid next size

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

float decoding - player entity

when printing out vectors for player entities the values seem to be decoded wrong.
while the m_vecOrigin of non-player entities are shown as mapcoordinates,
the player m_vecOrigin is not given as mapcoordinate.
here is an example with the prop-decoding-flags printed out

Entity Enters PVS: id:2, class:35, serial:781
Table: DT_CSPlayer
Field: 2, m_vecOrigin = SPROP_NOSCALESPROP_NOSCALE3295974912.000000, 3255495936.000000
Field: 3, m_vecOrigin[2] = SPROP_NOSCALE1098924032.000000
Field: 4, m_vecVelocity[0] = SPROP_NOSCALE3227493120.000000
Field: 5, m_vecVelocity[1] = SPROP_NOSCALE3279223296.000000
Field: 7, m_vecOrigin = SPROP_NOSCALESPROP_NOSCALE3295974912.000000, 3255495936.000000
Field: 8, m_vecOrigin[2] = SPROP_NOSCALE1098924032.000000
Field: 14, m_vecViewOffset[2] = 64.062561
Field: 17, m_flFOVTime = SPROP_NOSCALE1128479744.000000
Field: 20, m_angEyeAngles[0] = SPROP_NOSCALE1103372544.000000
Field: 21, m_angEyeAngles[1] = SPROP_NOSCALE1132894976.000000

Entity Enters PVS: id:155, class:126, serial:953
Table: DT_RopeKeyframe
Field: 14, m_Width = SPROP_NOSCALE1073741824.000000
Field: 16, m_vecOrigin = SPROP_COORDSPROP_COORDSPROP_COORD3622.000000, -1014.000000, 264.000000

is this a bug or am i getting something wrong
thanks in advance

Exit code 1 for several replays that seem to work.

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

Implement JSON-formatted output

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

build fails under ubuntu 14.04 64 bit

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

Currently broken on OSX

An assertion is failing on OSX:

Assertion failed: (( ( unsigned long )pData & 3 ) == 0), function StartReading, file src/demofilebitbuf.cpp, line 273.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.