FloooD / custom_cs2dsrv

Jermuk's custom Counter Strike 2D Server written in C and modified by FloooD and leegao.
173.192.35.85:36000
3 stars 0 forks source link

Spray logo #30

Closed leegao closed 13 years ago

leegao commented 13 years ago

Any idea what this does?

00 78 9c 63 60 c0 0 9c 6a ec 98 82 40 c0 8 26 99 18 d9 a5 d8 b0 ca b c9 71 8b 9 f3 2b e8 88 71 61 91 e4 10 15 34 28 cd 6e ae cd cc ce 4d 4e 51 17 60 67 66 41 91 66 d2 6a 29 af a9 ed e8 eb a8 29 ce ab 6a ed ed 8d 95 44 76 3 b 8f 4f 51 41 4d 76 4a 76 5e 51 6b 43 7e f3 94 e9 fd 33 82 f8 90 e4 c5 43 4a 72 8a 4b a3 d 34 d 8d c2 33 a 6a 6a 1a db 27 f4 44 8b 8b 73 40 a5 c5 42 63 b3 4b 82 c4 b9 d8 59 99 18 18 4 64 65 23 b db 7a e7 ce e 4f 17 81 ba 3b 34 3e 28 40 8a 9d 8d 5d 48 9a 8b 9d 85 81 95 81 27 a1 ba 7f c2 cc 16 5d 4e 70 68 28 45 64 65 a4 c4 5 85 45 46 c4 26 46 86 fb 29 f2 32 30 70 49 55 4d 9f 3b 39 55 10 28 cd 2e 1a 97 d4 78 e2 e0 de 9d 5b d7 ae 5c 3c 7b c6 cc 99 93 b e5 80 5e d3 9f be 62 5a 7f 2 50 a9 90 6a 52 68 db 93 1b 97 ce 1c 3b b0 6b cb ba 65 f3 e7 ac d9 d3 2d cf c0 ad 50 b8 7c cd 8a 4e 45 6 6 e5 b0 60 a5 f6 cf cf 1e dc bd 79 e5 ec f1 3 5b 97 4e 9f b6 e3 62 91 80 5c 90 c6 e2 63 db 3a 64 19 18 2 93 c4 4 27 fc 7 81 7f 3f bf be 7b 70 78 e9 94 45 37 b6 68 32 73 f0 75 dc db bc 34 8a 81 21 22 96 95 27 7b c6 8c e9 d3 a7 4e 1 82 be ae be 29 73 4f 5c 4f 64 67 60 4b 7b 7c ee 70 21 17 a3 86 a 3 3 bf 98 a8 88 88 8 10 8b 8a 8a e9 56 cd 39 f4 a4 81 8f 81 35 e5 de a5 83 99 82 ac b2 12 68 91 1f 3b fd f0 ab 49 2 c 5c b9 37 cf 1d 6a 10 60 10 11 40 95 67 9 9d 7e ec e5 4 41 6 81 fa fb 17 e 74 49 71 f1 73 a3 ca f3 a5 2c 38 ff b6 47 56 5c 63 c1 83 53 7b 5b d5 95 38 39 18 58 a5 15 21 40 49 49 51 35 a2 75 e3 ed 17 5 92 41 71 e7 ef 9e 3e df 2c c0 c6 c6 c2 20 58 b9 72 c9 a2 79 b3 a7 4f 99 d8 db d9 36 71 d9 a1 b7 57 c3 19 5 1a 7e 3c bc 70 bb 4a 9b 97 89 91 41 a8 fd f9 ed 2b e7 4e 1c de b5 79 dd ca a5 6b f6 dc fc ba 4e 8e d5 f0 f8 ff 67 f 2e 47 b b2 33 32 32 8 b4 bf ba 73 fd f2 d9 13 87 f7 6d df b6 fb c4 dd 6f d7 52 38 d5 d7 fd ff ff e1 ed 1 65 26 50 2a 13 9c 8 a be 5f df 3e bd 79 f5 e2 cd d7 ef 67 4a 84 78 2a df 3 45 3e 37 2b 24 4b 3 e5 5 9a 2e 9d 39 7d ea f8 d1 c3 87 e 1c 3c b8 a1 3b 4c 84 41 74 f6 ff ff 7f fe bf cf 93 8a 1 f9 9e 4d 4e 5d 45 45 45 19 4 54 54 64 85 81 89 5f a0 f1 37 50 ff 83 2c 6c 9 1d 1c 88 71 67 fe ff ff ba 29 0 7b 3e 1 2 89 ec e5 87 96 a5 88 e3 92 6 46 99 aa bf 96 8 13 6e 79 6 16 2e 66 3c b2 c4 3 0 47 10 14 e6

nvm it's the spray, it seems to use some weird serialization for the bitmap

Edit 2: I think \x1c\0\1 requests for the spray logo o_O Plan of attack: create 262144 (3232 \ 256, 32/32 for the number of white squares that we're going to stack on each other contiguously, 256 for the shades of gray for each) tiles and then individually profile them or ask DC... I vote that we ask DC :P

FloooD commented 13 years ago

i vote for decompiling cs2d_dedicated... somehow

ya ask dc

leegao commented 13 years ago

lawlz, blitz compiled code doesn't leave any stack markers so it's literally like trying to read a soup of jumbled asm code <_<

anyways, DC said that it's preprocessed into grayscale (/4) and then compressed using zlib (which kind of groups contiguous regions together) When decompressed, it should be a grayscale bitmap of 32x32 (1 byte for each pixel -> 1024 bytes)

So to get it back to a bitmap again, we just have to mod the sequence by 32, flip it vertically (pivoted by the x-axis), and then add a fixed bmp header and save (and make sure that we get the same thing back.)

I'll get back once I have the patch up

FloooD commented 13 years ago

wait hold on... u dont even need to decompress it just send the same data to the clients when they connect.... :D? i assume that the server also uses zlib

i.e. player 1 joins server and sends myspray=102398710847395 to server.

player 2 joins server and sends myspray=134570123487083 to server. server sends player2spray=134570123487083 to player 1. server sends player1spray=102398710847395 to player 2.

player 3 joins server and sends 253098741038100 to server. server sends player3spray=253098741038100 to player 1 and player 2 server sends player1spray=102398710847395 to player 3 server sends player2spray=134570123487083 to player 3

etc...

and the server has absolutely no idea that's encoded in those messages.

leegao commented 13 years ago

yeah, but that's less fun <_<, need something to help me procrastinate :D

leegao commented 13 years ago

oh, btw, I just grabbed the last copy of K&R's "The C Programming Language" off the shelf, not to actually read, but to make other people think that I am a programmer :D

FloooD commented 13 years ago

lol u know you can download the pdf online nvm didn't read ur last line lol

ill finish grenade buying stuff today

leegao commented 13 years ago

lol, yeah, I've already read it 4 times, it's actually an interesting read as far as tech manuals go.

leegao commented 13 years ago

btw how did prelims/midterms go?

FloooD commented 13 years ago

did well on first. failed second one kinda what i expectd

leegao commented 13 years ago

it's okay, it'll be another 15 years before people begins catching up with you xD

FloooD commented 13 years ago

lol..

btw clang is only 3 seconds faster -.-

eh@netbook:~/customcs2dsrv$ time make clang clang -lm -lrt -I"include" -I"lua/src" src/.c lua/src/_.c -o bin/clang_srv src/cross_layer.c:164:2: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration] gettimeofday(&tv,NULL); ^ 1 diagnostic generated. src/lua_env.c:408:39: warning: if statement has empty body [-Wempty-body] if (luaL_dostring(_G, strict_print)); ^ 1 diagnostic generated. /tmp/cc-jKnKZa.o: In function os_tmpname': lua/src/loslib.c:(.text+0x893): warning: the use oftmpnam' is dangerous, better use `mkstemp'

real 0m9.620s user 0m8.689s sys 0m1.076s eh@netbook:~/custom_cs2dsrv$ time make gcc -O3 -lm -lrt -I"include" -I"lua/src" src/*.c -L. -llua -o bin/custom_cs2dsrv

real 0m12.864s user 0m12.253s sys 0m0.500s eh@netbook:~/customcs2dsrv$ time make no-shared gcc -O3 -lm -lrt -I"include" -I"lua/src" src/.c lua/src/_.c -o bin/custom_cs2dsrv /tmp/ccWPOkAI.o: In function os_tmpname': loslib.c:(.text+0x46): warning: the use oftmpnam' is dangerous, better use `mkstemp'

real 0m42.677s user 0m39.978s sys 0m1.724s

leegao commented 13 years ago

ps I got the decompression working too, patched in the for_the_lawlz branch, which will use zlib if needed (zlib comes standard on linux) (only the clang target will build on zlib by default)

leegao commented 13 years ago

also, clang doesn't require a dynamic library, which means that it's "sort of" portable on linux machines

FloooD commented 13 years ago

but still whats the point in having the server see people's sprays???

leegao commented 13 years ago

none <_<, I was bored okay?

but we do need to zlib map data and file transfer data

btw, each datagram holds only 0xffff bytes, so there must be some way of splitting larger files using zlib's upperbound compressBound(int) method and some way of denoting file transfer (the upper bound on a 32x32 bitmap is less than 1024, so no worries here)

FloooD commented 13 years ago

oh right it's in the forthelawlz branch :P