| 951 | demo_s *demorecord = NULL; |
| 952 | |
| 953 | void writedemo(int chan, void *data, int len) |
| 954 | { |
| 955 | if(demorecord && !demorecord->sequence) demorecord = NULL; |
| 956 | if(!demorecord || !demorecord->rb) return; |
| 957 | int stamp[3] = { sg->gamemillis, chan, len }; |
| 958 | if(demorecord->rb->maxsize() - demorecord->rb->length() > int(sizeof(stamp)) + len) |
| 959 | { |
| 960 | lilswap(stamp, 3); |
| 961 | demorecord->rb->add((uchar *)stamp, sizeof(stamp)); |
| 962 | tigerhash_add(demorecord->tiger, (uchar *)stamp, sizeof(stamp), demorecord->tigerstate); |
| 963 | demorecord->rb->add((uchar *)data, len); |
| 964 | tigerhash_add(demorecord->tiger, (uchar *)data, len, demorecord->tigerstate); |
| 965 | sem_demoworkerthread.post(); |
| 966 | } |
| 967 | else |
| 968 | { |
| 969 | if(!demorecord->error) mlog(ACLOG_ERROR, "demorecord ringbuffer overflow -> discarding demo #%d", demorecord->sequence); |
| 970 | demorecord->error = true; // ringbuffer-overflow: discard demo |
| 971 | } |
| 972 | } |
| 973 | |
| 974 | void recordpacket(int chan, void *data, int len) |
| 975 | { |