This is _the_ Operation Flashpoint patch :-)
After this you get all the intro logos, main menu, and I started a
mission and saw the long details, and could walk around the field.
Mouse is _very_ awful in this game for some reason though, I dont know
why. Its slow and very jumpy, darts left it I click the left mouse
button quickly, and is reluctant to go diagonally?
Changelog
Implement UpdateTexture for 2D textures only
Handle alphaop disabled but color op not-disable in a more appropriate
way (Docs
say this is an illegal state and then proceed to use it).
Trace out textures as they are created
Update the comments around the debug code and complete the debugging set
so textures
which are used in the game can also be viewed
Jason
Index: d3d8_private.h
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/d3d8_private.h,v
retrieving revision 1.39
diff -u -r1.39 d3d8_private.h
--- d3d8_private.h 27 Jun 2003 22:20:44 -0000 1.39
+++ d3d8_private.h 2 Jul 2003 21:20:39 -0000
@@ -1274,15 +1274,22 @@
# define FRAME_DEBUGGING
/* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
the file is deleted */
-# if 1
+# if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
# define SINGLE_FRAME_DEBUGGING
# endif
/* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
- A check is made for the existence of C:\D3DSHOWFRAME, and if it exists will write the
- contents of the back buffer into /tmp/backbuffer_* after each primitive array is drawn
- for a single frame. At the end of the frame, the file is deleted. */
-# if 1
+ It can only be enabled when FRAME_DEBUGGING is also enabled
+ The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
+ array is drawn. */
+# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
# define SHOW_FRAME_MAKEUP 1
+# endif
+ /* The following, when enabled, lets you see the makeup of the all the textures used during each
+ of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
+ The contents of the textures assigned to each stage are written into
+ /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
+# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
+# define SHOW_TEXTURE_MAKEUP 0
# endif
extern BOOL isOn;
extern BOOL isDumpingFrames;
Index: device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.73
diff -u -r1.73 device.c
--- device.c 18 Jun 2003 03:17:42 -0000 1.73
+++ device.c 2 Jul 2003 21:20:44 -0000
@@ -462,6 +462,7 @@
}
*ppTexture = (LPDIRECT3DTEXTURE8) object;
+ TRACE("(%p) : Created texture %p\n", This, object);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface,
@@ -552,6 +553,7 @@
}
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object;
+ TRACE("(%p) : Created volume texture %p\n", This, object);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage,
@@ -809,7 +811,6 @@
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) dst, &lrDst, NULL, 0L);
TRACE("Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d\n", dst->myDesc.Width, dst->myDesc.Height);
- /*memcpy(dst->allocatedMemory, src->allocatedMemory, src->myDesc.Size);*/
memcpy(lrDst.pBits, lrSrc.pBits, src->myDesc.Size);
IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
@@ -917,7 +918,11 @@
IDirect3DSurface8* dstSur = NULL;
hr = IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) src, i, &srcSur);
hr = IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) dst, i - skipLevels, &dstSur);
- /*IDirect3DDevice8_CopyRects*/
+
+ /* Fixme: Work out how to just do the dirty regions (src or dst dirty region, and what
+ about dst with less levels than the source?) */
+ IDirect3DDevice8Impl_CopyRects(iface, srcSur, NULL, 0, dstSur, NULL);
+
IDirect3DSurface8Impl_Release(srcSur);
IDirect3DSurface8Impl_Release(dstSur);
}
@@ -934,7 +939,7 @@
for (j = 0; j < 5; ++j) {
hr = IDirect3DCubeTexture8Impl_GetCubeMapSurface((LPDIRECT3DCUBETEXTURE8) src, j, i, &srcSur);
hr = IDirect3DCubeTexture8Impl_GetCubeMapSurface((LPDIRECT3DCUBETEXTURE8) dst, j, i - skipLevels, &srcSur);
- /*IDirect3DDevice8_CopyRects*/
+ FIXME("D3DRTYPE_CUBETEXTURE does not support UpdateTexture yet\n");
IDirect3DSurface8Impl_Release(srcSur);
IDirect3DSurface8Impl_Release(dstSur);
}
@@ -2999,16 +3004,14 @@
case D3DTSS_COLOROP :
{
- if (Value == D3DTOP_DISABLE) {
+ if ((Value == D3DTOP_DISABLE) && (Type == D3DTSS_COLOROP)) {
/* TODO: Disable by making this and all later levels disabled */
- if (Type == D3DTSS_COLOROP) {
- glDisable(GL_TEXTURE_1D);
- checkGLcall("Disable GL_TEXTURE_1D");
- glDisable(GL_TEXTURE_2D);
- checkGLcall("Disable GL_TEXTURE_2D");
- glDisable(GL_TEXTURE_3D);
- checkGLcall("Disable GL_TEXTURE_3D");
- }
+ glDisable(GL_TEXTURE_1D);
+ checkGLcall("Disable GL_TEXTURE_1D");
+ glDisable(GL_TEXTURE_2D);
+ checkGLcall("Disable GL_TEXTURE_2D");
+ glDisable(GL_TEXTURE_3D);
+ checkGLcall("Disable GL_TEXTURE_3D");
break; /* Dont bother setting the texture operations */
} else {
/* Enable only the appropriate texture dimension */
Index: drawprim.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/drawprim.c,v
retrieving revision 1.4
diff -u -r1.4 drawprim.c
--- drawprim.c 2 Jul 2003 00:36:59 -0000 1.4
+++ drawprim.c 2 Jul 2003 21:20:46 -0000
@@ -1343,10 +1343,26 @@
D3DLOCKED_RECT r;
char buffer[80];
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) This->backBuffer, &r, NULL, D3DLOCK_READONLY);
- sprintf(buffer, "/tmp/backbuffer_%ld.ppm", primCounter++);
+ sprintf(buffer, "/tmp/backbuffer_%ld.ppm", primCounter);
TRACE("Saving screenshot %s\n", buffer);
IDirect3DSurface8Impl_SaveSnapshot((LPDIRECT3DSURFACE8) This->backBuffer, buffer);
IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) This->backBuffer);
+
+#if defined(SHOW_TEXTURE_MAKEUP)
+ {
+ LPDIRECT3DSURFACE8 pSur;
+ int textureNo;
+ for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
+ if (This->StateBlock->textures[textureNo] != NULL) {
+ sprintf(buffer, "/tmp/texture_%ld_%d.ppm", primCounter, textureNo);
+ TRACE("Saving texture %s\n", buffer);
+ IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur);
+ IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer);
+ }
+ }
+ }
+#endif
+ primCounter = primCounter + 1;
}
}
#endif
Index: surface.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/surface.c,v
retrieving revision 1.19
diff -u -r1.19 surface.c
--- surface.c 18 Jun 2003 03:17:42 -0000 1.19
+++ surface.c 2 Jul 2003 21:20:47 -0000
@@ -120,8 +120,11 @@
/* fixme: should we really lock as such? */
if (FALSE == This->lockable) {
- ERR("trying to lock unlockable surf@%p\n", This);
- return D3DERR_INVALIDCALL;
+ /* Note: UpdateTextures calls CopyRects which calls this routine to populate the
+ texture regions, and since the destination is an unlockable region we need
+ to tolerate this */
+ TRACE("Warning: trying to lock unlockable surf@%p\n", This);
+ //return D3DERR_INVALIDCALL;
}
if (This == This->Device->backBuffer || This == This->Device->renderTarget || This == This->Device->frontBuffer || This->Device->depthStencilBuffer) {
Index: utils.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/utils.c,v
retrieving revision 1.8
diff -u -r1.8 utils.c
--- utils.c 18 Jun 2003 03:17:42 -0000 1.8
+++ utils.c 2 Jul 2003 21:20:49 -0000
@@ -689,7 +689,6 @@
ICOM_THIS(IDirect3DDevice8Impl,iface);
TRACE("Alpha?(%d), Stage:%d Op(%d), a1(%ld), a2(%ld), a3(%ld)\n", isAlpha, Stage, op, arg1, arg2, arg3);
- if (op == D3DTOP_DISABLE) return;
ENTER_GL();
@@ -741,6 +740,16 @@
Handled = TRUE; /* Assume will be handled */
switch (op) {
+ case D3DTOP_DISABLE: /* Only for alpha */
+ glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
+ checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
+ glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
+ checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
+ glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
+ checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
+ glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
+ checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
+ break;
case D3DTOP_SELECTARG1:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");