Index: trunk/src/ddraw/OS2DDRAW.CPP
===================================================================
--- trunk/src/ddraw/OS2DDRAW.CPP	(revision 8602)
+++ trunk/src/ddraw/OS2DDRAW.CPP	(revision 8604)
@@ -1,3 +1,3 @@
-/* $Id: OS2DDRAW.CPP,v 1.34 2002-03-22 13:49:54 sandervl Exp $ */
+/* $Id: OS2DDRAW.CPP,v 1.35 2002-06-08 13:12:33 sandervl Exp $ */
 
 /*
@@ -48,5 +48,10 @@
 BOOL bUseFSDD = FALSE;
 
-FOURCC  SupportedFourCCs[] = {FOURCC_SCRN,FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_RGB4};
+FOURCC SupportedFourCCs[]   = {FOURCC_SCRN,FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_RGB4};
+
+#define MAX_DIVE_FOURCC   32
+int    nrOfDiveFourCCs              = 0;
+FOURCC DiveFOURCCs[MAX_DIVE_FOURCC] = {0};
+
 //******************************************************************************
 //******************************************************************************
@@ -60,5 +65,4 @@
   DWORD dwVSize, dwVType;
   ULONG rc;
-  FOURCC fccModes[100];
 
   // Setup table for 3d devices
@@ -198,11 +202,19 @@
           sizeof(DIVE_CAPS) );
   dCaps.ulStructLen = sizeof(DIVE_CAPS);
-  dCaps.ulFormatLength = 100;
-  dCaps.pFormatData = &fccModes[0];
-
-  rc = DiveQueryCaps( &dCaps,
-                      DIVE_BUFFER_SCREEN);
+  dCaps.ulFormatLength = sizeof(DiveFOURCCs);
+  dCaps.pFormatData    = &DiveFOURCCs[0];
+
+  rc = DiveQueryCaps( &dCaps, DIVE_BUFFER_SCREEN);
 
   dprintf(("DDRAW: DiveQueryCaps rc=0x%08X\n",rc));
+
+  FOURCC *pFourCC = (FOURCC *)dCaps.pFormatData;
+  nrOfDiveFourCCs = dCaps.ulInputFormats;
+  for(i=0;i<dCaps.ulInputFormats+dCaps.ulOutputFormats;i++) {
+      if(i < dCaps.ulInputFormats) {
+           dprintf(("INPUT FOURCC %C%C%C%C", (char)(pFourCC[i]), (char)(pFourCC[i] >> 8), (char)(pFourCC[i] >> 16), (char)(pFourCC[i] >> 24)));
+      }
+      else dprintf(("OUTPUT FOURCC %C%C%C%C", (char)(pFourCC[i]), (char)(pFourCC[i] >> 8), (char)(pFourCC[i] >> 16), (char)(pFourCC[i] >> 24)));
+  }
 
   pdwUnknownData[235] = dCaps.ulHorizontalResolution;
@@ -275,5 +287,16 @@
 FOURCC OS2IDirectDraw::GetScreenFourCC()
 {
-  return SupportedFourCCs[screenbpp>>3];
+    return SupportedFourCCs[screenbpp>>3];
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OS2IDirectDraw::IsFourCCSupported(FOURCC fourcc)
+{
+    for(int i=0;i<nrOfDiveFourCCs;i++) {
+        if(DiveFOURCCs[i] == fourcc) {
+            return TRUE;
+        }
+    }
+    return FALSE;
 }
 //******************************************************************************
@@ -1199,5 +1222,4 @@
 //                             DDCAPS_READSCANLINE |
                              DDCAPS_BLTFOURCC;
-
     lpDDDriverCaps->dwCaps2 = DDCAPS2_CERTIFIED |         // Who cares so say yes
                               DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
@@ -1218,4 +1240,5 @@
     lpDDDriverCaps->dwVidMemTotal = me->dCaps.ulApertureSize;          // total video memory
     lpDDDriverCaps->dwVidMemFree  = me->dCaps.ulApertureSize;          // total free video memory
+
     lpDDDriverCaps->dwNumFourCCCodes = MAX_FOURCC_CODES;        // number of supported FOURCC codes
 /*
@@ -1645,5 +1668,4 @@
 HRESULT WIN32API DrawGetFourCCCodes(THIS This, LPDWORD lpNumCodes, LPDWORD lpCodes)
 {
-//  DWORD dwFCC[MAX_FOURCC_CODES] = {FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_YUY2};
   DWORD dwFCC[MAX_FOURCC_CODES] = {FOURCC_LUT8,FOURCC_R565,FOURCC_R555,FOURCC_RGB3};
 
@@ -1655,8 +1677,20 @@
   if(NULL==lpCodes)
   {
+#ifdef SUPPORT_ALL_DIVE_FOURCCS
+    *lpNumCodes = nrOfDiveFourCCs;
+#else
     *lpNumCodes = MAX_FOURCC_CODES; // LUT8, R565, RGB3 are the FourCC we support for now
+#endif
   }
   else
   {
+#ifdef SUPPORT_ALL_DIVE_FOURCCS
+    for(int i=0;(i<nrOfDiveFourCCs)&&(i<*lpNumCodes);i++)
+    {
+      *lpCodes = DiveFOURCCs[i];
+      lpCodes++;
+    }
+    *lpNumCodes = nrOfDiveFourCCs;
+#else
     for(int i=0;(i<MAX_FOURCC_CODES)&&(i<*lpNumCodes);i++)
     {
@@ -1665,4 +1699,5 @@
     }
     *lpNumCodes = MAX_FOURCC_CODES;
+#endif
   }
   return(DD_OK);
Index: trunk/src/ddraw/OS2DDRAW.H
===================================================================
--- trunk/src/ddraw/OS2DDRAW.H	(revision 8602)
+++ trunk/src/ddraw/OS2DDRAW.H	(revision 8604)
@@ -1,3 +1,3 @@
-/* $Id: OS2DDRAW.H,v 1.15 2001-10-05 12:33:09 sandervl Exp $ */
+/* $Id: OS2DDRAW.H,v 1.16 2002-06-08 13:12:33 sandervl Exp $ */
 
 /*
@@ -25,4 +25,8 @@
 #undef THIS
 #define THIS VOID*
+
+//testestest
+//#define SUPPORT_ALL_DIVE_FOURCCS
+//testestest
 
 #define MAX_FOURCC_CODES        4
@@ -75,4 +79,5 @@
     inline  int           GetScreenBpp()    { return screenbpp;}
     FOURCC        GetScreenFourCC();
+    BOOL          IsFourCCSupported(FOURCC fourcc);
     // We should be able to use any mode with less or same bits and same or
     // smaller size to be able to report all supported mode in the enum
