SpiritQuaddicted / reQuiem

reQuiem is a custom OpenGL Quake engine for Windows and Linux. It's designed for maximum compatibility with all things Quake - past, present and future. It's fast, reliable, and easy to configure. In short: it fixes what was broken, improves what needed improving, and leaves the rest alone. It was developed by jdhack.
GNU General Public License v2.0
17 stars 2 forks source link

demo compression fails on Linux #31

Open SpiritQuaddicted opened 10 years ago

SpiritQuaddicted commented 10 years ago

Both dz and zip compression fail for me. Archlinux 64 bit.

Ignore the different timestamps and percentages.

Engine stdout


]record 
recording to ./id1/start-Jun-28-2014-121122-SpiritQuaddict.dem
]stop
Completed demo
compressing start-Jun-28-2014-121122-SpiritQuaddict.dem (84.1%)
Compressing demo... Verifying start-Jun-28-2014-121122-SpiritQuaddict.dz... 
[02]Warning: demo compression failed

strace -e file

stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2309, ...}) = 0
stat64("./id1/start-Jun-28-2014-120705-SpiritQuaddict.dem", 0xff914a10) = -1 ENOENT (No such file or directory)
open("./id1/start-Jun-28-2014-120705-SpiritQuaddict.dem", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 274
open("./id1/start-Jun-28-2014-120705-SpiritQuaddict.dz", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./dzip-linux", O_RDONLY)          = 274
getcwd("/home/me/spiele/quake", 4096) = 26
getcwd("/home/me/spiele/quake", 4096) = 26
lstat64("/home/me/spiele/quake/id1", {st_mode=S_IFDIR|0755, st_size=65536, ...}) = 0
chdir("/home/me/spiele/quake/id1")  = 0
compressing start-Jun-28-2014-120705-SpiritQuaddict.dem (92.8%)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20473, si_status=0, si_utime=0, si_stime=0} ---
chdir("/home/me/spiele/quake")      = 0
unlink("./id1/start-Jun-28-2014-120705-SpiritQuaddict.dz") = 0

The code handling this is in https://github.com/SpiritQuaddicted/reQuiem/blob/e976d4d4a1afc1da80ac102b7a1033a7d2b1741b/cl_demo.c

neogeographica commented 10 years ago

(Ignore most of this first part; cf. the update edit below.)

Any idea why it is using the external dzip-linux app instead of using dzlib.so? Did the console log show "Failed to load dzlib!" earlier?

In any case, a weird thing: it should be forking off dzip-linux both for the demo compress as well as for the verification. But that strace output only shows one child exit. I think it's for the compress. So what happened to the verification?

It's like the execvp in DZStartProcess failed (I don't think we'd see the Con_Printf in that case since the child process is doing it) but I don't know why execvp would work in the compress case but fail in the verify case.

Well... sleepytime now.

Quick edit: Actually it looks like the external app was used for compression because for some reason reQuiem will preferentially use the app (if available) over the library for compression. But for verification it will always use the library if it's available. Soooo that means that Dzip_Verify is returning false. Given that strace doesn't even show the dz file being opened, that means something is up with dzlib.so.

On Windows this code path works (using dzlib.dll)... I haven't explicitly traced through it, but I have made some dzipped demos. It would be worth dropping in a few debug printfs to see which part of Dzip_Verify is returning false when you use it on Linux.

SpiritQuaddicted commented 10 years ago

Nice catch, I did not even think about that. Above examples were using dzlib.so. If I rename dzlib.so and thus force reQuiem to use the dzip-linux binary, demo compression works:

[02]Failed to load dzlib! (dzlib.so: cannot open shared object file: No such file or directory)
...
...
[02]Introduction
Playing audio track track004.ogg from id1
SpiritQuaddict entered the game
]record 
recording to ./id1/start-Jul-02-2014-150245-SpiritQuaddict.dem
]stop
Completed demo
compressing start-Jul-02-2014-150245-SpiritQuaddict.dem (81.1%)
start-Jul-02-2014-150245-SpiritQuaddict.dz created using v2.9
checking start-Jul-02-2014-150245-SpiritQuaddict.dem: ok

Compressing demo... Verifying start-Jul-02-2014-150245-SpiritQuaddict.dz... Deleting start-Jul-02-2014-150245-SpiritQuaddict.dem... Done!
]quit 
Client SpiritQuaddict removed

I wonder if there is any benefit of using the library instead of the binary for now. I think we do not have the source for the library while dzip-linux is freely available at http://speeddemosarchive.com/dzip/download.html . Of course using a library would be "cleaner".

neogeographica commented 10 years ago

I've been messing around with using the app and/or the library as part of debugging issue #30. I did come across a downside to using the app, filed as issue #43.