]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - dpvsimpledecode.c
provide a list of all gamedirs with modinfo.txt in fs_all_gamedirs for later use...
[xonotic/darkplaces.git] / dpvsimpledecode.c
index 28536526448f9b584d50e44e1a8a3de012bc9d86..202cd6a72a59a4086c90d502d06b9c39097fdb92 100644 (file)
@@ -38,7 +38,7 @@ hz_bitstream_read_t *hz_bitstream_read_open(char *filename)
 {
        qfile_t *file;
        hz_bitstream_read_t *stream;
-       if ((file = FS_Open (filename, "rb", false, false)))
+       if ((file = FS_OpenVirtualFile(filename, false)))
        {
                stream = (hz_bitstream_read_t *)Z_Malloc(sizeof(hz_bitstream_read_t));
                memset(stream, 0, sizeof(*stream));
@@ -333,30 +333,6 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i
 
 // opening and closing streams
 
-static void StripExtension(char *in, char *out)
-{
-       char *dot, *c;
-       dot = NULL;
-       for (c = in;*c;c++)
-       {
-               if (*c == ':' || *c == '\\' || *c == '/')
-                       dot = NULL;
-               if (*c == '.')
-                       dot = c;
-       }
-       if (dot == NULL)
-       {
-               // nothing to remove
-               strcpy(out, in);
-               return;
-       }
-       else
-       {
-               memcpy(out, in, dot - in);
-               out[dot - in] = 0;
-       }
-}
-
 // opens a stream
 void *dpvsimpledecode_open(char *filename, char **errorstring)
 {
@@ -393,14 +369,14 @@ void *dpvsimpledecode_open(char *filename, char **errorstring)
                                                        if (s->videopixels != NULL)
                                                        {
                                                                size_t namelen;
-                                                               
+
                                                                namelen = strlen(filename) + 10;
                                                                wavename = (char *)Z_Malloc(namelen);
                                                                if (wavename)
                                                                {
                                                                        sfx_t* sfx;
 
-                                                                       StripExtension(filename, wavename);
+                                                                       FS_StripExtension(filename, wavename, namelen);
                                                                        strlcat(wavename, ".wav", namelen);
                                                                        sfx = S_PrecacheSound (wavename, false, false);
                                                                        if (sfx != NULL)
@@ -448,7 +424,7 @@ void dpvsimpledecode_close(void *stream)
        if (s->videopixels)
                Z_Free(s->videopixels);
        if (s->sndchan != -1)
-               S_StopChannel (s->sndchan);
+               S_StopChannel (s->sndchan, true);
        if (s->framedatablocks)
                hz_bitstream_read_blocks_free(s->framedatablocks);
        if (s->bitstream)