Annotation of quake2/win32/rw_ddraw.c, revision 1.1.1.1

1.1       root        1: /*
                      2: ** RW_DDRAW.C
                      3: **
                      4: ** This handles DirecTDraw management under Windows.
                      5: */
                      6: #ifndef _WIN32
                      7: #  error You should not be compiling this file on this platform
                      8: #endif
                      9: 
                     10: #include <float.h>
                     11: 
                     12: #include "..\ref_soft\r_local.h"
                     13: #define INITGUID
                     14: #include "rw_win.h"
                     15: 
                     16: static const char *DDrawError( int code );
                     17: 
                     18: /*
                     19: ** DDRAW_Init
                     20: **
                     21: ** Builds our DDRAW stuff
                     22: */
                     23: qboolean DDRAW_Init( unsigned char **ppbuffer, int *ppitch )
                     24: {
                     25:        HRESULT ddrval;
                     26:        DDSURFACEDESC ddsd;
                     27:        DDSCAPS ddscaps;
                     28:        PALETTEENTRY palentries[256];
                     29:        int i;
                     30:        extern cvar_t *sw_allow_modex;
                     31: 
                     32:        HRESULT (WINAPI *QDirectDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR * lplpDDRAW, IUnknown FAR * pUnkOuter );
                     33: 
                     34: ri.Con_Printf( PRINT_ALL, "Initializing DirectDraw\n");
                     35: 
                     36: 
                     37:        for ( i = 0; i < 256; i++ )
                     38:        {
                     39:                palentries[i].peRed             = ( d_8to24table[i] >> 0  ) & 0xff;
                     40:                palentries[i].peGreen   = ( d_8to24table[i] >> 8  ) & 0xff;
                     41:                palentries[i].peBlue    = ( d_8to24table[i] >> 16 ) & 0xff;
                     42:        }
                     43: 
                     44:        /*
                     45:        ** load DLL and fetch pointer to entry point
                     46:        */
                     47:        if ( !sww_state.hinstDDRAW )
                     48:        {
                     49:                ri.Con_Printf( PRINT_ALL, "...loading DDRAW.DLL: ");
                     50:                if ( ( sww_state.hinstDDRAW = LoadLibrary( "ddraw.dll" ) ) == NULL )
                     51:                {
                     52:                        ri.Con_Printf( PRINT_ALL, "failed\n" );
                     53:                        goto fail;
                     54:                }
                     55:                ri.Con_Printf( PRINT_ALL, "ok\n" );
                     56:        }
                     57: 
                     58:        if ( ( QDirectDrawCreate = ( HRESULT (WINAPI *)( GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR * ) ) GetProcAddress( sww_state.hinstDDRAW, "DirectDrawCreate" ) ) == NULL )
                     59:        {
                     60:                ri.Con_Printf( PRINT_ALL, "*** DirectDrawCreate == NULL ***\n" );
                     61:                goto fail;
                     62:        }
                     63: 
                     64:        /*
                     65:        ** create the direct draw object
                     66:        */
                     67:        ri.Con_Printf( PRINT_ALL, "...creating DirectDraw object: ");
                     68:        if ( ( ddrval = QDirectDrawCreate( NULL, &sww_state.lpDirectDraw, NULL ) ) != DD_OK )
                     69:        {
                     70:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                     71:                goto fail;
                     72:        }
                     73:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                     74: 
                     75:        /*
                     76:        ** see if linear modes exist first
                     77:        */
                     78:        sww_state.modex = false;
                     79: 
                     80:        ri.Con_Printf( PRINT_ALL, "...setting exclusive mode: ");
                     81:        if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->SetCooperativeLevel( sww_state.lpDirectDraw, 
                     82:                                                                                                                                                 sww_state.hWnd,
                     83:                                                                                                                                                 DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) ) != DD_OK )
                     84:        {
                     85:                ri.Con_Printf( PRINT_ALL, "failed - %s\n",DDrawError (ddrval) );
                     86:                goto fail;
                     87:        }
                     88:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                     89: 
                     90:        /*
                     91:        ** try changing the display mode normally
                     92:        */
                     93:        ri.Con_Printf( PRINT_ALL, "...finding display mode\n" );
                     94:        ri.Con_Printf( PRINT_ALL, "...setting linear mode: " );
                     95:        if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->SetDisplayMode( sww_state.lpDirectDraw, vid.width, vid.height, 8 ) ) == DD_OK )
                     96:        {
                     97:                ri.Con_Printf( PRINT_ALL, "ok\n" );
                     98:        }
                     99:        /*
                    100:        ** if no linear mode found, go for modex if we're trying 320x240
                    101:        */
                    102:        else if ( ( sw_mode->value == 0 ) && sw_allow_modex->value )
                    103:        {
                    104:                ri.Con_Printf( PRINT_ALL, "failed\n" );
                    105:                ri.Con_Printf( PRINT_ALL, "...attempting ModeX 320x240: ");
                    106: 
                    107:                /*
                    108:                ** reset to normal cooperative level
                    109:                */
                    110:                sww_state.lpDirectDraw->lpVtbl->SetCooperativeLevel( sww_state.lpDirectDraw, 
                    111:                                                                                                                         sww_state.hWnd,
                    112:                                                                                                                         DDSCL_NORMAL );
                    113: 
                    114:                /*                                                                                                                       
                    115:                ** set exclusive mode
                    116:                */
                    117:                if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->SetCooperativeLevel( sww_state.lpDirectDraw, 
                    118:                                                                                                                                                         sww_state.hWnd,
                    119:                                                                                                                                                         DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_NOWINDOWCHANGES | DDSCL_ALLOWMODEX ) ) != DD_OK )
                    120:                {
                    121:                        ri.Con_Printf( PRINT_ALL, "failed SCL - %s\n",DDrawError (ddrval) );
                    122:                        goto fail;
                    123:                }
                    124: 
                    125:                /*
                    126:                ** change our display mode
                    127:                */
                    128:                if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->SetDisplayMode( sww_state.lpDirectDraw, vid.width, vid.height, 8 ) ) != DD_OK )
                    129:                {
                    130:                        ri.Con_Printf( PRINT_ALL, "failed SDM - %s\n", DDrawError( ddrval ) );
                    131:                        goto fail;
                    132:                }
                    133:                ri.Con_Printf( PRINT_ALL, "ok\n" );
                    134: 
                    135:                sww_state.modex = true;
                    136:        }
                    137:        else
                    138:        {
                    139:                ri.Con_Printf( PRINT_ALL, "failed\n" );
                    140:                goto fail;
                    141:        }
                    142: 
                    143:        /*
                    144:        ** create our front buffer
                    145:        */
                    146:        memset( &ddsd, 0, sizeof( ddsd ) );
                    147:        ddsd.dwSize = sizeof( ddsd );
                    148:        ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
                    149:        ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
                    150:        ddsd.dwBackBufferCount = 1;
                    151: 
                    152:        ri.Con_Printf( PRINT_ALL, "...creating front buffer: ");
                    153:        if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->CreateSurface( sww_state.lpDirectDraw, &ddsd, &sww_state.lpddsFrontBuffer, NULL ) ) != DD_OK )
                    154:        {
                    155:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    156:                goto fail;
                    157:        }
                    158:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                    159: 
                    160:        /*
                    161:        ** see if we're a ModeX mode
                    162:        */
                    163:        sww_state.lpddsFrontBuffer->lpVtbl->GetCaps( sww_state.lpddsFrontBuffer, &ddscaps );
                    164:        if ( ddscaps.dwCaps & DDSCAPS_MODEX )
                    165:                ri.Con_Printf( PRINT_ALL, "...using ModeX\n" );
                    166: 
                    167:        /*
                    168:        ** create our back buffer
                    169:        */
                    170:        ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
                    171: 
                    172:        ri.Con_Printf( PRINT_ALL, "...creating back buffer: " );
                    173:        if ( ( ddrval = sww_state.lpddsFrontBuffer->lpVtbl->GetAttachedSurface( sww_state.lpddsFrontBuffer, &ddsd.ddsCaps, &sww_state.lpddsBackBuffer ) ) != DD_OK )
                    174:        {
                    175:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    176:                goto fail;
                    177:        }
                    178:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                    179: 
                    180:        /*
                    181:        ** create our rendering buffer
                    182:        */
                    183:        memset( &ddsd, 0, sizeof( ddsd ) );
                    184:        ddsd.dwSize = sizeof( ddsd );
                    185:        ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
                    186:        ddsd.dwHeight = vid.height;
                    187:        ddsd.dwWidth = vid.width;
                    188:        ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
                    189: 
                    190:        ri.Con_Printf( PRINT_ALL, "...creating offscreen buffer: " );
                    191:        if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->CreateSurface( sww_state.lpDirectDraw, &ddsd, &sww_state.lpddsOffScreenBuffer, NULL ) ) != DD_OK )
                    192:        {
                    193:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    194:                goto fail;
                    195:        }
                    196:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                    197: 
                    198:        /*
                    199:        ** create our DIRECTDRAWPALETTE
                    200:        */
                    201:        ri.Con_Printf( PRINT_ALL, "...creating palette: " );
                    202:        if ( ( ddrval = sww_state.lpDirectDraw->lpVtbl->CreatePalette( sww_state.lpDirectDraw,
                    203:                                                                                                                DDPCAPS_8BIT | DDPCAPS_ALLOW256,
                    204:                                                                                                                palentries,
                    205:                                                                                                                &sww_state.lpddpPalette,
                    206:                                                                                                                NULL ) ) != DD_OK )
                    207:        {
                    208:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    209:                goto fail;
                    210:        }
                    211:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                    212: 
                    213:        ri.Con_Printf( PRINT_ALL, "...setting palette: " );
                    214:        if ( ( ddrval = sww_state.lpddsFrontBuffer->lpVtbl->SetPalette( sww_state.lpddsFrontBuffer,
                    215:                                                                                                                 sww_state.lpddpPalette ) ) != DD_OK )
                    216:        {
                    217:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    218:                goto fail;
                    219:        }
                    220:        ri.Con_Printf( PRINT_ALL, "ok\n" );
                    221: 
                    222:        DDRAW_SetPalette( ( const unsigned char * ) sw_state.currentpalette );
                    223: 
                    224:        /*
                    225:        ** lock the back buffer
                    226:        */
                    227:        memset( &ddsd, 0, sizeof( ddsd ) );
                    228:        ddsd.dwSize = sizeof( ddsd );
                    229:        
                    230: ri.Con_Printf( PRINT_ALL, "...locking backbuffer: " );
                    231:        if ( ( ddrval = sww_state.lpddsOffScreenBuffer->lpVtbl->Lock( sww_state.lpddsOffScreenBuffer, NULL, &ddsd, DDLOCK_WAIT, NULL ) ) != DD_OK )
                    232:        {
                    233:                ri.Con_Printf( PRINT_ALL, "failed - %s\n", DDrawError( ddrval ) );
                    234:                goto fail;
                    235:        }
                    236: ri.Con_Printf( PRINT_ALL, "ok\n" );
                    237: 
                    238:        *ppbuffer = ddsd.lpSurface;
                    239:        *ppitch   = ddsd.lPitch;
                    240: 
                    241:        for ( i = 0; i < vid.height; i++ )
                    242:        {
                    243:                memset( *ppbuffer + i * *ppitch, 0, *ppitch );
                    244:        }
                    245: 
                    246:        sww_state.palettized = true;
                    247: 
                    248:        return true;
                    249: fail:
                    250:        ri.Con_Printf( PRINT_ALL, "*** DDraw init failure ***\n" );
                    251: 
                    252:        DDRAW_Shutdown();
                    253:        return false;
                    254: }
                    255: 
                    256: /*
                    257: ** DDRAW_SetPalette
                    258: **
                    259: ** Sets the color table in our DIB section, and also sets the system palette
                    260: ** into an identity mode if we're running in an 8-bit palettized display mode.
                    261: **
                    262: ** The palette is expected to be 1024 bytes, in the format:
                    263: **
                    264: ** R = offset 0
                    265: ** G = offset 1
                    266: ** B = offset 2
                    267: ** A = offset 3
                    268: */
                    269: void DDRAW_SetPalette( const unsigned char *pal )
                    270: {
                    271:        PALETTEENTRY palentries[256];
                    272:        int i;
                    273: 
                    274:        if (!sww_state.lpddpPalette)
                    275:                return;
                    276: 
                    277:        for ( i = 0; i < 256; i++, pal += 4 )
                    278:        {
                    279:                palentries[i].peRed   = pal[0];
                    280:                palentries[i].peGreen = pal[1];
                    281:                palentries[i].peBlue  = pal[2];
                    282:                palentries[i].peFlags = PC_RESERVED | PC_NOCOLLAPSE;
                    283:        }
                    284: 
                    285:        if ( sww_state.lpddpPalette->lpVtbl->SetEntries( sww_state.lpddpPalette,
                    286:                                                        0,
                    287:                                                                                                0,
                    288:                                                                                                256,
                    289:                                                                                                palentries ) != DD_OK )
                    290:        {
                    291:                ri.Con_Printf( PRINT_ALL, "DDRAW_SetPalette() - SetEntries failed\n" );
                    292:        }
                    293: }
                    294: 
                    295: /*
                    296: ** DDRAW_Shutdown
                    297: */
                    298: void DDRAW_Shutdown( void )
                    299: {
                    300:        if ( sww_state.lpddsOffScreenBuffer )
                    301:        {
                    302:                ri.Con_Printf( PRINT_ALL, "...releasing offscreen buffer\n");
                    303:                sww_state.lpddsOffScreenBuffer->lpVtbl->Unlock( sww_state.lpddsOffScreenBuffer, vid.buffer );
                    304:                sww_state.lpddsOffScreenBuffer->lpVtbl->Release( sww_state.lpddsOffScreenBuffer );
                    305:                sww_state.lpddsOffScreenBuffer = NULL;
                    306:        }
                    307: 
                    308:        if ( sww_state.lpddsBackBuffer )
                    309:        {
                    310:                ri.Con_Printf( PRINT_ALL, "...releasing back buffer\n");
                    311:                sww_state.lpddsBackBuffer->lpVtbl->Release( sww_state.lpddsBackBuffer );
                    312:                sww_state.lpddsBackBuffer = NULL;
                    313:        }
                    314: 
                    315:        if ( sww_state.lpddsFrontBuffer )
                    316:        {
                    317:                ri.Con_Printf( PRINT_ALL, "...releasing front buffer\n");
                    318:                sww_state.lpddsFrontBuffer->lpVtbl->Release( sww_state.lpddsFrontBuffer );
                    319:                sww_state.lpddsFrontBuffer = NULL;
                    320:        }
                    321: 
                    322:        if (sww_state.lpddpPalette)
                    323:        {
                    324:                ri.Con_Printf( PRINT_ALL, "...releasing palette\n");
                    325:                sww_state.lpddpPalette->lpVtbl->Release ( sww_state.lpddpPalette );
                    326:                sww_state.lpddpPalette = NULL;
                    327:        }
                    328: 
                    329:        if ( sww_state.lpDirectDraw )
                    330:        {
                    331:                ri.Con_Printf( PRINT_ALL, "...restoring display mode\n");
                    332:                sww_state.lpDirectDraw->lpVtbl->RestoreDisplayMode( sww_state.lpDirectDraw );
                    333:                ri.Con_Printf( PRINT_ALL, "...restoring normal coop mode\n");
                    334:            sww_state.lpDirectDraw->lpVtbl->SetCooperativeLevel( sww_state.lpDirectDraw, sww_state.hWnd, DDSCL_NORMAL );
                    335:                ri.Con_Printf( PRINT_ALL, "...releasing lpDirectDraw\n");
                    336:                sww_state.lpDirectDraw->lpVtbl->Release( sww_state.lpDirectDraw );
                    337:                sww_state.lpDirectDraw = NULL;
                    338:        }
                    339: 
                    340:        if ( sww_state.hinstDDRAW )
                    341:        {
                    342:                ri.Con_Printf( PRINT_ALL, "...freeing library\n");
                    343:                FreeLibrary( sww_state.hinstDDRAW );
                    344:                sww_state.hinstDDRAW = NULL;
                    345:        }
                    346: }
                    347: 
                    348: static const char *DDrawError (int code)
                    349: {
                    350:     switch(code) {
                    351:         case DD_OK:
                    352:             return "DD_OK";
                    353:         case DDERR_ALREADYINITIALIZED:
                    354:             return "DDERR_ALREADYINITIALIZED";
                    355:         case DDERR_BLTFASTCANTCLIP:
                    356:             return "DDERR_BLTFASTCANTCLIP";
                    357:         case DDERR_CANNOTATTACHSURFACE:
                    358:             return "DDER_CANNOTATTACHSURFACE";
                    359:         case DDERR_CANNOTDETACHSURFACE:
                    360:             return "DDERR_CANNOTDETACHSURFACE";
                    361:         case DDERR_CANTCREATEDC:
                    362:             return "DDERR_CANTCREATEDC";
                    363:         case DDERR_CANTDUPLICATE:
                    364:             return "DDER_CANTDUPLICATE";
                    365:         case DDERR_CLIPPERISUSINGHWND:
                    366:             return "DDER_CLIPPERUSINGHWND";
                    367:         case DDERR_COLORKEYNOTSET:
                    368:             return "DDERR_COLORKEYNOTSET";
                    369:         case DDERR_CURRENTLYNOTAVAIL:
                    370:             return "DDERR_CURRENTLYNOTAVAIL";
                    371:         case DDERR_DIRECTDRAWALREADYCREATED:
                    372:             return "DDERR_DIRECTDRAWALREADYCREATED";
                    373:         case DDERR_EXCEPTION:
                    374:             return "DDERR_EXCEPTION";
                    375:         case DDERR_EXCLUSIVEMODEALREADYSET:
                    376:             return "DDERR_EXCLUSIVEMODEALREADYSET";
                    377:         case DDERR_GENERIC:
                    378:             return "DDERR_GENERIC";
                    379:         case DDERR_HEIGHTALIGN:
                    380:             return "DDERR_HEIGHTALIGN";
                    381:         case DDERR_HWNDALREADYSET:
                    382:             return "DDERR_HWNDALREADYSET";
                    383:         case DDERR_HWNDSUBCLASSED:
                    384:             return "DDERR_HWNDSUBCLASSED";
                    385:         case DDERR_IMPLICITLYCREATED:
                    386:             return "DDERR_IMPLICITLYCREATED";
                    387:         case DDERR_INCOMPATIBLEPRIMARY:
                    388:             return "DDERR_INCOMPATIBLEPRIMARY";
                    389:         case DDERR_INVALIDCAPS:
                    390:             return "DDERR_INVALIDCAPS";
                    391:         case DDERR_INVALIDCLIPLIST:
                    392:             return "DDERR_INVALIDCLIPLIST";
                    393:         case DDERR_INVALIDDIRECTDRAWGUID:
                    394:             return "DDERR_INVALIDDIRECTDRAWGUID";
                    395:         case DDERR_INVALIDMODE:
                    396:             return "DDERR_INVALIDMODE";
                    397:         case DDERR_INVALIDOBJECT:
                    398:             return "DDERR_INVALIDOBJECT";
                    399:         case DDERR_INVALIDPARAMS:
                    400:             return "DDERR_INVALIDPARAMS";
                    401:         case DDERR_INVALIDPIXELFORMAT:
                    402:             return "DDERR_INVALIDPIXELFORMAT";
                    403:         case DDERR_INVALIDPOSITION:
                    404:             return "DDERR_INVALIDPOSITION";
                    405:         case DDERR_INVALIDRECT:
                    406:             return "DDERR_INVALIDRECT";
                    407:         case DDERR_LOCKEDSURFACES:
                    408:             return "DDERR_LOCKEDSURFACES";
                    409:         case DDERR_NO3D:
                    410:             return "DDERR_NO3D";
                    411:         case DDERR_NOALPHAHW:
                    412:             return "DDERR_NOALPHAHW";
                    413:         case DDERR_NOBLTHW:
                    414:             return "DDERR_NOBLTHW";
                    415:         case DDERR_NOCLIPLIST:
                    416:             return "DDERR_NOCLIPLIST";
                    417:         case DDERR_NOCLIPPERATTACHED:
                    418:             return "DDERR_NOCLIPPERATTACHED";
                    419:         case DDERR_NOCOLORCONVHW:
                    420:             return "DDERR_NOCOLORCONVHW";
                    421:         case DDERR_NOCOLORKEY:
                    422:             return "DDERR_NOCOLORKEY";
                    423:         case DDERR_NOCOLORKEYHW:
                    424:             return "DDERR_NOCOLORKEYHW";
                    425:         case DDERR_NOCOOPERATIVELEVELSET:
                    426:             return "DDERR_NOCOOPERATIVELEVELSET";
                    427:         case DDERR_NODC:
                    428:             return "DDERR_NODC";
                    429:         case DDERR_NODDROPSHW:
                    430:             return "DDERR_NODDROPSHW";
                    431:         case DDERR_NODIRECTDRAWHW:
                    432:             return "DDERR_NODIRECTDRAWHW";
                    433:         case DDERR_NOEMULATION:
                    434:             return "DDERR_NOEMULATION";
                    435:         case DDERR_NOEXCLUSIVEMODE:
                    436:             return "DDERR_NOEXCLUSIVEMODE";
                    437:         case DDERR_NOFLIPHW:
                    438:             return "DDERR_NOFLIPHW";
                    439:         case DDERR_NOGDI:
                    440:             return "DDERR_NOGDI";
                    441:         case DDERR_NOHWND:
                    442:             return "DDERR_NOHWND";
                    443:         case DDERR_NOMIRRORHW:
                    444:             return "DDERR_NOMIRRORHW";
                    445:         case DDERR_NOOVERLAYDEST:
                    446:             return "DDERR_NOOVERLAYDEST";
                    447:         case DDERR_NOOVERLAYHW:
                    448:             return "DDERR_NOOVERLAYHW";
                    449:         case DDERR_NOPALETTEATTACHED:
                    450:             return "DDERR_NOPALETTEATTACHED";
                    451:         case DDERR_NOPALETTEHW:
                    452:             return "DDERR_NOPALETTEHW";
                    453:         case DDERR_NORASTEROPHW:
                    454:             return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0";
                    455:         case DDERR_NOROTATIONHW:
                    456:             return "Operation could not be carried out because there is no rotation hardware present or available.\0";
                    457:         case DDERR_NOSTRETCHHW:
                    458:             return "Operation could not be carried out because there is no hardware support for stretching.\0";
                    459:         case DDERR_NOT4BITCOLOR:
                    460:             return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0";
                    461:         case DDERR_NOT4BITCOLORINDEX:
                    462:             return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0";
                    463:         case DDERR_NOT8BITCOLOR:
                    464:             return "DDERR_NOT8BITCOLOR";
                    465:         case DDERR_NOTAOVERLAYSURFACE:
                    466:             return "Returned when an overlay member is called for a non-overlay surface.\0";
                    467:         case DDERR_NOTEXTUREHW:
                    468:             return "Operation could not be carried out because there is no texture mapping hardware present or available.\0";
                    469:         case DDERR_NOTFLIPPABLE:
                    470:             return "DDERR_NOTFLIPPABLE";
                    471:         case DDERR_NOTFOUND:
                    472:             return "DDERR_NOTFOUND";
                    473:         case DDERR_NOTLOCKED:
                    474:             return "DDERR_NOTLOCKED";
                    475:         case DDERR_NOTPALETTIZED:
                    476:             return "DDERR_NOTPALETTIZED";
                    477:         case DDERR_NOVSYNCHW:
                    478:             return "DDERR_NOVSYNCHW";
                    479:         case DDERR_NOZBUFFERHW:
                    480:             return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0";
                    481:         case DDERR_NOZOVERLAYHW:
                    482:             return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0";
                    483:         case DDERR_OUTOFCAPS:
                    484:             return "The hardware needed for the requested operation has already been allocated.\0";
                    485:         case DDERR_OUTOFMEMORY:
                    486:             return "DDERR_OUTOFMEMORY";
                    487:         case DDERR_OUTOFVIDEOMEMORY:
                    488:             return "DDERR_OUTOFVIDEOMEMORY";
                    489:         case DDERR_OVERLAYCANTCLIP:
                    490:             return "The hardware does not support clipped overlays.\0";
                    491:         case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
                    492:             return "Can only have ony color key active at one time for overlays.\0";
                    493:         case DDERR_OVERLAYNOTVISIBLE:
                    494:             return "Returned when GetOverlayPosition is called on a hidden overlay.\0";
                    495:         case DDERR_PALETTEBUSY:
                    496:             return "DDERR_PALETTEBUSY";
                    497:         case DDERR_PRIMARYSURFACEALREADYEXISTS:
                    498:             return "DDERR_PRIMARYSURFACEALREADYEXISTS";
                    499:         case DDERR_REGIONTOOSMALL:
                    500:             return "Region passed to Clipper::GetClipList is too small.\0";
                    501:         case DDERR_SURFACEALREADYATTACHED:
                    502:             return "DDERR_SURFACEALREADYATTACHED";
                    503:         case DDERR_SURFACEALREADYDEPENDENT:
                    504:             return "DDERR_SURFACEALREADYDEPENDENT";
                    505:         case DDERR_SURFACEBUSY:
                    506:             return "DDERR_SURFACEBUSY";
                    507:         case DDERR_SURFACEISOBSCURED:
                    508:             return "Access to surface refused because the surface is obscured.\0";
                    509:         case DDERR_SURFACELOST:
                    510:             return "DDERR_SURFACELOST";
                    511:         case DDERR_SURFACENOTATTACHED:
                    512:             return "DDERR_SURFACENOTATTACHED";
                    513:         case DDERR_TOOBIGHEIGHT:
                    514:             return "Height requested by DirectDraw is too large.\0";
                    515:         case DDERR_TOOBIGSIZE:
                    516:             return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0";
                    517:         case DDERR_TOOBIGWIDTH:
                    518:             return "Width requested by DirectDraw is too large.\0";
                    519:         case DDERR_UNSUPPORTED:
                    520:             return "DDERR_UNSUPPORTED";
                    521:         case DDERR_UNSUPPORTEDFORMAT:
                    522:             return "FOURCC format requested is unsupported by DirectDraw.\0";
                    523:         case DDERR_UNSUPPORTEDMASK:
                    524:             return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0";
                    525:         case DDERR_VERTICALBLANKINPROGRESS:
                    526:             return "Vertical blank is in progress.\0";
                    527:         case DDERR_WASSTILLDRAWING:
                    528:             return "DDERR_WASSTILLDRAWING";
                    529:         case DDERR_WRONGMODE:
                    530:             return "This surface can not be restored because it was created in a different mode.\0";
                    531:         case DDERR_XALIGN:
                    532:             return "Rectangle provided was not horizontally aligned on required boundary.\0";
                    533:         default:
                    534:             return "UNKNOWN\0";
                    535:        }
                    536: }
                    537: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.