[freespace2] Patches for music and movies

Pierre Willenbrock pierre at linux-net.dnsalias.org
Wed Mar 30 11:30:46 EST 2005


Taylor Richards wrote:
> It's got a lot of code
> reorg and bug/memory fixes and the video is about 12 times faster, at
> least, with it being even faster than that on older cards.  

The speedup is very noticable(only 30% load, no skipped frames).
The timer code seems to be problematic, though. Sometimes the entire 
movie or part of it is played too fast.
I experienced audio lag, too. The buffer ring is filled too fast at the 
beginning. When playing, it always contains about 62 buffers to be 
played. That equals to about 2 seconds. Reducing the size of the ring to 
32 helped that, the lag is near to unnoticeable(but i get some queue 
full warnings).

The opengl part looks a bit bloated to me. Expecting w and h to be the 
width/height of the output area, and g_screenWidth/Height to be the size 
of the input image, i think this will do the same job:

         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, g_screenWidth,
g_screenHeight, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);

         glBegin(GL_QUADS);
                 glTexCoord2f(0, 0);
                         glVertex2i(x, y);
                 glTexCoord2f(0, i2fl(g_screenHeight)/i2fl(hp2));
                         glVertex2i(x, y+h);
              	glTexCoord2f(i2fl(g_screenWidth)/i2fl(wp2), 
i2fl(g_screenHeight)/i2fl(hp2));
                         glVertex2i(x+w, y+h);
                 glTexCoord2f(i2fl(g_screenWidth)/i2fl(wp2), 0);
                         glVertex2i(x+w, y);
         glEnd();

When allocating the backbuf it is no longer needed to allocate twice the 
needed memory(or there is still a bug left after the decoder16-fix - 
just tell me which movie, i will let valgrind check that). The memset 
needs to be changed then, too(i forgot to do so).

Some more problems i noticed(the first two while trying to get 
Freespace1 running without knowing about the extra .vp needed):
palman/palman.cpp:261: missing setjmp for read_file_text
weapons/muzzleflash:106: missing setjmp for read_file_text

src/ui/timer: timer_get_microseconds() wraps around(if we are lucky it 
simply wraps) after about 1:11h(or half)

src/mission/missionload.cpp:240: there is still an instance of '\\' left
src/network/multi_update.cpp:155: here too

> CD detection!  I've still got my go at this in my older code trees too.
> Never got CD ejecting and mounting working right though.  Basic
> detection and use wasn't a problem, even for movies, but I couldn't
> figure out a (easy) cross-platform way of swapping the discs.  Send what
> you've got though since that's something I've been wanting to work for a
> while now (not the copy protection though, I hate games that require a
> CD in the drive to work).

My code is currently working for my linux. It does handle multiple discs 
in multiple drives correctly, and ejects the current freespace disc if 
it does not find the needed one. It relies on (u)mount and eject. It 
also needs warble_fs2.vp to be on hard disc. Is this file normally 
installed onto hard disc? if not the cfile-code must be changed to be 
able to close and reopen file descriptors while the rest of the game 
thinks it still keeps the files open. This may be problematic in the 
case of audiostreams, which do their own io(and do read from 
warble_fs2.vp...). There still may be all kinds of problems with 
automounters.

Pierre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdrom.dif
Type: video/x-dv
Size: 13966 bytes
Desc: not available
URL: <http://icculus.org/pipermail/freespace2/attachments/20050330/53b9315d/attachment.bin>


More information about the freespace2 mailing list