freesci-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesci-develop] r1569 - in freesci/trunk: . src/gfx/drivers src/includ


From: freesci
Subject: [freesci-develop] r1569 - in freesci/trunk: . src/gfx/drivers src/include src/win32/msvc6
Date: Mon, 13 Mar 2006 22:48:31 +0100

Author: arangas
Date: 2006-03-13 22:48:20 +0100 (Mon, 13 Mar 2006)
New Revision: 1569

Modified:
   freesci/trunk/ChangeLog
   freesci/trunk/README.Win32
   freesci/trunk/src/gfx/drivers/dx_driver.cpp
   freesci/trunk/src/include/graphics_directx.h
   freesci/trunk/src/win32/msvc6/fsci_dll.dsp
   freesci/trunk/src/win32/msvc6/sciv.dsp
Log:
Mainly fix to a crash in the DirectX driver on exit. Fixes to Visual C++ 6 
project files.

-- Alex Angas

Modified: freesci/trunk/ChangeLog
===================================================================
--- freesci/trunk/ChangeLog     2006-03-09 18:55:37 UTC (rev 1568)
+++ freesci/trunk/ChangeLog     2006-03-13 21:48:20 UTC (rev 1569)
@@ -1,3 +1,14 @@
+2006-03-14  Alex Angas <address@hidden>
+
+       * src/include/graphics_directx.h:
+       * src/gfx/drivers/dx_driver.cpp: Fixed crash on exit. Now starts at same
+       size as SDL driver always.
+
+       * src/win32/msvc6/fsci_dll.dsp:
+       * src/win32/msvc6/sciv.dsp: More fixes from move to new folder.
+
+       * src/README.Win32: Updated instructions on paths to Vis Studio 
projects.
+
 2006-03-04  Alex Angas <address@hidden>
 
        * src/win32/msvc8-2005/fsci_dll/fsci_dll.vcproj: Keeps intermediate 
files

Modified: freesci/trunk/README.Win32
===================================================================
--- freesci/trunk/README.Win32  2006-03-09 18:55:37 UTC (rev 1568)
+++ freesci/trunk/README.Win32  2006-03-13 21:48:20 UTC (rev 1569)
@@ -108,11 +108,13 @@
 2.3 How to build
 ----------------
 
-1. Go to the src\win32 directory.
-   For Visual C++ or Studio 6, load freesci.dsw.
-   For Visual C++ or Studio 2003, load freesci.sln.
-   For Visual C++ or Studio 2005, load msvc8-2005\freesci.sln.
+1. Go to the src\win32 directory and open the solution according to your
+version of Visual C++.
 
+   Visual C++/Studio 6:    msvc6\freesci.dsw
+   Visual C++/Studio 2003: msvc71-2003\freesci.sln
+   Visual C++/Studio 2005: msvc8-2005\freesci.sln
+
 2. Set the active project to "freesci - Win32 Release". Rebuild all.
 
 3. The fsci.dll and freesci.exe binaries should be in freesci\bin. 
@@ -123,10 +125,10 @@
    FreeSCI bin directory, or use the -d command line option (see README).
 
 
-IMPORTANT NOTE: With this release, you may discover what appears to be a bug
-in Visual C++ 6.0. If you find that the linking of sciv produces LNK2001
-errors the first time you build, just build again (don't rebuild or clean
-first) and it should link OK.
+IMPORTANT NOTE: If compiling in Visual C++ 6.0 you may discover what appears
+to be a bug in that product. If you find that the linking of sciv produces
+LNK2001 errors the first time you build, just build again (don't rebuild or
+clean first) and it should link OK.
 
 
 
@@ -198,6 +200,8 @@
 4.1.2 DirectX
 -------------
 
+ * Cursor image corrupt unless scaling set to -x4 and -y4.
+
  * Fullscreen mode does not work.
 
  * You are unable to move the FreeSCI window.

Modified: freesci/trunk/src/gfx/drivers/dx_driver.cpp
===================================================================
--- freesci/trunk/src/gfx/drivers/dx_driver.cpp 2006-03-09 18:55:37 UTC (rev 
1568)
+++ freesci/trunk/src/gfx/drivers/dx_driver.cpp 2006-03-13 21:48:20 UTC (rev 
1569)
@@ -28,14 +28,16 @@
        20060201 (AAngas) - Fixed wrong format for texture priority maps
        20060205 (AAngas) - Changed pointer to use D3DXSprite
        20060208 (AAngas) - Fixed pointer alpha blending bug
+       20060307 (AAngas) - Fixed crash on exit
 
 
 TODO:
+       Corrupt cursor at different resolutions
        Full screen
        Lost devices
        Moving and activating window
        Allow user to specify hardware or software vertex processing
-       Add fancies
+       Fancies
 
 ***************************************************************************/
 
@@ -155,7 +157,7 @@
        dx_state->wc.lpszClassName = DX_CLASS_NAME;
        if ( RegisterClassEx( &dx_state->wc ) == 0 )
        {
-               sciprintf("dx_init_specific(): RegisterClassEx failed (%u)\n", 
GetLastError());
+               sciprintf("InitWindow(): RegisterClassEx failed (%u)\n", 
GetLastError());
                return GFX_FATAL;
        }
 
@@ -168,7 +170,7 @@
 
        if ( dx_state->hWnd == NULL )
        {
-               sciprintf("dx_init_specific(): CreateWindow failed (%u)\n", 
GetLastError());
+               sciprintf("InitWindow(): CreateWindow failed (%u)\n", 
GetLastError());
                return GFX_FATAL;
        }
 
@@ -239,12 +241,9 @@
                }
        }
 
-       // Get current display mode and optimise for this screen
+       // Get current display mode
        DODX( (dx_state->pD3d->GetAdapterDisplayMode( dx_state->adapterId, 
&dx_state->displayMode )), InitD3D );
        sciprintf("   Display %lu x %lu\n", dx_state->displayMode.Width, 
dx_state->displayMode.Height);
-       if (dx_state->xfact == 0)
-               dx_state->xfact = (int)(dx_state->displayMode.Width / 320);
-       dx_state->yfact = dx_state->xfact;
 
        // Turn off Windows mouse pointer
        ShowCursor(FALSE);
@@ -309,26 +308,31 @@
        int alpha_mask = 0x00000000, red_mask = 0x00ff0000, green_mask = 
0x0000ff00, blue_mask = 0x000000ff;
        gfx_return_value_t d3dret;
 
+       // Error checking
+       if (xfact < 1 || yfact < 1 || bytespp < 1 || bytespp > 4) {
+               sciprintf("Attempt to open window with invalid scale factors 
(%d,%d) and bpp=%d!\n",
+                xfact, yfact, bytespp);
+               return GFX_ERROR;
+       }
+
+       // Prepare memory for gfx_dx_struct_t
        drv->state = (struct gfx_dx_struct_t *) 
sci_malloc(sizeof(gfx_dx_struct_t));
        ZeroMemory(drv->state, sizeof(gfx_dx_struct_t));
        dx_state->adapterId = -1;       // we will set this later
 
-       // Check for scaling
-       if (xfact != 0)
-               dx_state->xfact = xfact;
-       if (yfact != 0)
-               dx_state->yfact = yfact;
+       // Set window size factor
+       dx_state->xfact = xfact;
+       dx_state->yfact = yfact;
+       dx_state->xsize = dx_state->xfact * 320;
+       dx_state->ysize = dx_state->yfact * 200;
+       dx_state->bpp = bytespp;
+       sciprintf("   Window %d x %d @ %d bpp\n", dx_state->xsize, 
dx_state->ysize, dx_state->bpp << 3);
 
        // Set up Direct3D
        d3dret = InitD3D(drv);
        if (d3dret != GFX_OK)
                return d3dret;
 
-       // Set window size factor (now that InitD3D has told us how big the 
window is)
-       dx_state->xsize = dx_state->xfact * 320;
-       dx_state->ysize = dx_state->yfact * 200;
-       dx_state->bpp = bytespp;
-
        // Create window
        InitWindow(drv);
 
@@ -406,11 +410,10 @@
                           (dx_state->bpp == 1) ? 256 : 0, 0);
 
        // Set up graphics mode for pointer
-       gfx_mode_t *mode = gfx_new_mode(dx_state->xfact, dx_state->yfact, 
dx_state->bpp,
+       dx_state->pointerMode = gfx_new_mode(dx_state->xfact, dx_state->yfact, 
dx_state->bpp,
                                                                        
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000,
                                                                                
        24,         16,          8,          0,
                                                                                
0, GFX_MODE_FLAG_REVERSE_ALPHA);
-       dx_state->pointerMode = *mode;
 
        return GFX_OK;
 }
@@ -420,7 +423,7 @@
 static int
 dx_init(struct _gfx_driver *drv)
 {
-       return dx_init_specific(drv, NULL, NULL, 4);
+       return dx_init_specific(drv, 2, 2, 4);
 }
 
 
@@ -443,7 +446,10 @@
     SAFE_RELEASE( dx_state->pDevice );
     SAFE_RELEASE( dx_state->pD3d );
 
-       gfx_free_mode(&dx_state->pointerMode);
+       if ( dx_state->pointerMode )
+               gfx_free_mode(dx_state->pointerMode);
+       if ( drv->mode )
+               gfx_free_mode(drv->mode);
 
        if ( dx_state->event_queue )
                sci_free(dx_state->event_queue);
@@ -854,7 +860,7 @@
 
        // Recreate pointer data according to the graphics mode we need
        gfx_pixmap_free_data(pointer);
-       gfx_xlate_pixmap(pointer, &dx_state->pointerMode, 
GFX_XLATE_FILTER_NONE);
+       gfx_xlate_pixmap(pointer, dx_state->pointerMode, GFX_XLATE_FILTER_NONE);
 
        // Create texture and fill with pointer data
        DODX( (dx_state->pDevice->CreateTexture(pointer->xl, pointer->yl, 1, 0, 
dx_state->d3dFormat, D3DPOOL_MANAGED, &pntTex )), dx_set_pointer );
@@ -1136,7 +1142,7 @@
 extern "C"
 gfx_driver_t gfx_driver_dx = {
        "directx",
-       "0.4.1",
+       "0.4.2",
        SCI_GFX_DRIVER_MAGIC,
        SCI_GFX_DRIVER_VERSION,
        NULL,   /* mode */

Modified: freesci/trunk/src/include/graphics_directx.h
===================================================================
--- freesci/trunk/src/include/graphics_directx.h        2006-03-09 18:55:37 UTC 
(rev 1568)
+++ freesci/trunk/src/include/graphics_directx.h        2006-03-13 21:48:20 UTC 
(rev 1569)
@@ -113,7 +113,7 @@
        LPDIRECT3DTEXTURE8 pTexPrioritys[NUM_PRIORITY_BUFFERS]; // Array of 
priority textures
        gfx_pixmap_t *priority_maps[NUM_PRIORITY_BUFFERS];              // 
Array of SCI priority maps
 
-       gfx_mode_t pointerMode;                 // SCI graphics mode for pointer
+       gfx_mode_t *pointerMode;                        // SCI graphics mode 
for pointer
        LPDIRECT3DTEXTURE8 pTexPointer; // Mouse pointer texture
        LPD3DXSPRITE pSPointer;                 // Mouse pointer sprite
        POINTS pointerDims;                             // Pointer dimensions

Modified: freesci/trunk/src/win32/msvc6/fsci_dll.dsp
===================================================================
(Binary files differ)

Modified: freesci/trunk/src/win32/msvc6/sciv.dsp
===================================================================
(Binary files differ)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]