mojodds.c
author Ryan C. Gordon <icculus@icculus.org>
Tue, 10 May 2011 00:08:55 -0400
changeset 7 341c4de6ffd3
parent 5 ab7382a45d11
child 8 506dbbccee95
permissions -rw-r--r--
Deal with DDS files that specify neither pitch nor linearsize.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/**
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
 * MojoDDS; tools for dealing with DDS files.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
 *
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
 * Please see the file LICENSE.txt in the source's root directory.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
 *
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
 *  This file written by Ryan C. Gordon.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
 */
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
// Specs on DDS format: http://msdn.microsoft.com/en-us/library/bb943991.aspx/
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
#include <stdio.h>
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
#include <string.h>
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
#include <stdlib.h>
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
    14
#include <assert.h>
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
#ifdef _MSC_VER
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
typedef unsigned __int8 uint8;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
typedef unsigned __int32 uint32;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
#else
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
#include <stdint.h>
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
typedef uint8_t uint8;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
typedef uint32_t uint32;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
#endif
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
#define STATICARRAYLEN(x) ( (sizeof ((x))) / (sizeof ((x)[0])) )
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
#define DDS_MAGIC 0x20534444  // 'DDS ' in littleendian.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
#define DDS_HEADERSIZE 124
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#define DDS_PIXFMTSIZE 32
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
#define DDSD_CAPS 0x1
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#define DDSD_HEIGHT 0x2
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
#define DDSD_WIDTH 0x4
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
#define DDSD_PITCH 0x8
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
#define DDSD_FMT 0x1000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
#define DDSD_MIPMAPCOUNT 0x20000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
#define DDSD_LINEARSIZE 0x80000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
#define DDSD_DEPTH 0x800000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
#define DDSD_REQ (DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_FMT)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
#define DDSCAPS_COMPLEX 0x8
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
#define DDSCAPS_MIPMAP 0x400000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
#define DDSCAPS_TEXTURE 0x1000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
#define DDPF_ALPHAPIXELS 0x1
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
#define DDPF_ALPHA 0x2
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
#define DDPF_FOURCC 0x4
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
#define DDPF_RGB 0x40
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
#define DDPF_YUV 0x200
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
#define DDPF_LUMINANCE 0x20000
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
#define FOURCC_DXT1 0x31545844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
#define FOURCC_DXT2 0x32545844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
#define FOURCC_DXT3 0x33545844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
#define FOURCC_DXT4 0x34545844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
#define FOURCC_DXT5 0x35545844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
#define FOURCC_DX10 0x30315844
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
typedef struct
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
{
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
    uint32 dwSize;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
    uint32 dwFlags;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
    uint32 dwFourCC;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
    uint32 dwRGBBitCount;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
    uint32 dwRBitMask;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
    uint32 dwGBitMask;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
    uint32 dwBBitMask;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
    uint32 dwABitMask;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
} MOJODDS_PixelFormat;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
typedef struct
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
{
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    uint32 dwSize;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    uint32 dwFlags;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    uint32 dwHeight;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
    uint32 dwWidth;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
    uint32 dwPitchOrLinearSize;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
    uint32 dwDepth;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
    uint32 dwMipMapCount;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
    uint32 dwReserved1[11];
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
    MOJODDS_PixelFormat ddspf;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
    uint32 dwCaps;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
    uint32 dwCaps2;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
    uint32 dwCaps3;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    uint32 dwCaps4;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
    uint32 dwReserved2;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
} MOJODDS_Header;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
static uint32 readui32(const uint8 **_ptr, size_t *_len)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
{
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
    uint32 retval = 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
    if (*_len < sizeof (retval))
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
        *_len = 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
    else
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    {
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
        const uint8 *ptr = *_ptr;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
        retval = (((uint32) ptr[0]) <<  0) | (((uint32) ptr[1]) <<  8) |
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
                 (((uint32) ptr[2]) << 16) | (((uint32) ptr[3]) << 24) ;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
        *_ptr += sizeof (retval);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
        *_len -= sizeof (retval);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
    } // else
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
    return retval;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
} // readui32
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
static int parse_dds(MOJODDS_Header *header, const uint8 **ptr, size_t *len)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
{
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   106
    const uint32 pitchAndLinear = (DDSD_PITCH | DDSD_LINEARSIZE);
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   107
    uint32 width = 0;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   108
    uint32 height = 0;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   109
    uint32 calcSize = 0;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   110
    uint32 calcSizeFlag = DDSD_LINEARSIZE;
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
    int i;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
    // Files start with magic value...
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
    if (readui32(ptr, len) != DDS_MAGIC)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
        return 0;  // not a DDS file.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
    // Then comes the DDS header...
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
    if (*len < DDS_HEADERSIZE)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
    header->dwSize = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
    header->dwFlags = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    header->dwHeight = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
    header->dwWidth = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
    header->dwPitchOrLinearSize = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
    header->dwDepth = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
    header->dwMipMapCount = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    for (i = 0; i < STATICARRAYLEN(header->dwReserved1); i++)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
        header->dwReserved1[i] = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
    header->ddspf.dwSize = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
    header->ddspf.dwFlags = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
    header->ddspf.dwFourCC = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
    header->ddspf.dwRGBBitCount = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
    header->ddspf.dwRBitMask = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
    header->ddspf.dwGBitMask = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
    header->ddspf.dwBBitMask = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
    header->ddspf.dwABitMask = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
    header->dwCaps = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
    header->dwCaps2 = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    header->dwCaps3 = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
    header->dwCaps4 = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
    header->dwReserved2 = readui32(ptr, len);
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   144
    width = header->dwWidth;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   145
    height = header->dwHeight;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   146
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    if (header->dwSize != DDS_HEADERSIZE)   // header size must be 124.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
    else if (header->ddspf.dwSize != DDS_PIXFMTSIZE)   // size must be 32.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
    else if ((header->dwFlags & DDSD_REQ) != DDSD_REQ)  // must have these bits.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
    else if (header->dwCaps != DDSCAPS_TEXTURE)  // !!! FIXME
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
    else if (header->dwCaps2 != 0)  // !!! FIXME (non-zero with other bits in dwCaps set)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
        return 0;
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   157
    else if ((header->dwFlags & pitchAndLinear) == pitchAndLinear)
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   158
        return 0;  // can't specify both.
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
    if ((header->ddspf.dwFlags & DDPF_FOURCC) == 0)  // !!! FIXME
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
    if (header->ddspf.dwFlags & DDPF_FOURCC)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
    {
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
        switch (header->ddspf.dwFourCC)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
        {
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
            case FOURCC_DXT1:
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   168
                calcSize = ((width ? ((width + 3) / 4) : 1) * 8) * height;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   169
                break;
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
            case FOURCC_DXT2:
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
            case FOURCC_DXT3:
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
            case FOURCC_DXT4:
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
            case FOURCC_DXT5:
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   174
                calcSize = ((width ? ((width + 3) / 4) : 1) * 16) * height;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   175
                break;
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
            // !!! FIXME: DX10 is an extended header, introduced by DirectX 10.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
            //case FOURCC_DX10:
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
            default:
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
                return 0;  // unsupported data format.
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
        } // switch
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
    } // if
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   183
    // no pitch or linear size? Calculate it.
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   184
    if ((header->dwFlags & pitchAndLinear) == 0)
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   185
    {
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   186
        if (!calcSizeFlag)
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   187
        {
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   188
            assert(0 && "should have caught this up above");
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   189
            return 0;  // uh oh.
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   190
        } // if
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   191
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   192
        header->dwPitchOrLinearSize = calcSize;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   193
        header->dwFlags |= calcSizeFlag;
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   194
    } // if
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   195
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
    return 1;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
} // parse_dds
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
// !!! FIXME: improve the crap out of this API later.
5
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   201
int MOJODDS_isDDS(const void *_ptr, const unsigned long _len)
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   202
{
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   203
    size_t len = (size_t) _len;
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   204
    const uint8 *ptr = (const uint8 *) _ptr;
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   205
    return (readui32(&ptr, &len) == DDS_MAGIC);
7
341c4de6ffd3 Deal with DDS files that specify neither pitch nor linearsize.
Ryan C. Gordon <icculus@icculus.org>
parents: 5
diff changeset
   206
} // MOJODDS_isDDS
5
ab7382a45d11 Added MOJODDS_isDDS().
Ryan C. Gordon <icculus@icculus.org>
parents: 2
diff changeset
   207
1
90603fda7444 Make buffer sizes unsigned.
Ryan C. Gordon <icculus@icculus.org>
parents: 0
diff changeset
   208
int MOJODDS_getTexture(const void *_ptr, const unsigned long _len,
2
3c16e81ac188 Added a width and height query.
Ryan C. Gordon <icculus@icculus.org>
parents: 1
diff changeset
   209
                       const void **_tex, unsigned long *_texlen, int *_dxtver,
3c16e81ac188 Added a width and height query.
Ryan C. Gordon <icculus@icculus.org>
parents: 1
diff changeset
   210
                       unsigned int *_w, unsigned int *_h)
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
{
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
    size_t len = (size_t) _len;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
    const uint8 *ptr = (const uint8 *) _ptr;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
    MOJODDS_Header header;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
    if (!parse_dds(&header, &ptr, &len))
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
        return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
    *_tex = (const void *) ptr;
2
3c16e81ac188 Added a width and height query.
Ryan C. Gordon <icculus@icculus.org>
parents: 1
diff changeset
   219
    *_texlen = (unsigned long) header.dwPitchOrLinearSize;
3c16e81ac188 Added a width and height query.
Ryan C. Gordon <icculus@icculus.org>
parents: 1
diff changeset
   220
    *_w = (unsigned int) header.dwWidth;
3c16e81ac188 Added a width and height query.
Ryan C. Gordon <icculus@icculus.org>
parents: 1
diff changeset
   221
    *_h = (unsigned int) header.dwHeight;
0
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
    switch (header.ddspf.dwFourCC)
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
    {
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
        case FOURCC_DXT1: *_dxtver = 1; break;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
        case FOURCC_DXT2: *_dxtver = 2; break;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
        case FOURCC_DXT3: *_dxtver = 3; break;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
        case FOURCC_DXT4: *_dxtver = 4; break;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
        case FOURCC_DXT5: *_dxtver = 5; break;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
        default: *_dxtver = 0; return 0;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
    } // switch
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
    return 1;
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
} // MOJODDS_getTexture
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
// end of mojodds.c ...
8daba3cc1efb Initial bit of code I scratched out. Not nearly complete, no real API yet.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237