Defined RESTORE_SIGNALS by default and call SIGNAL_EmulatorInit
through a function pointer instead. Added a few traces. Fixed the
"Memory corruption !" message in DGA mode. Commented out an
unnecessary TSXF86VidModeSetViewPort that caused my X server to
act up, relying on TSXF86DGASetViewPort instead.
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index 8461693..366bfe3 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -67,9 +67,9 @@
#undef DIABLO_HACK
/* Restore signal handlers overwritten by XF86DGA
- * this is a define, for it will only work in emulator mode
*/
-#undef RESTORE_SIGNALS
+#define RESTORE_SIGNALS
+BOOL32 (*SIGNAL_Reinit)(void); /* didn't find any obvious place to put this */
/* Where do these GUIDs come from? mkuuid.
* They exist solely to distinguish between the targets Wine support,
@@ -390,6 +390,8 @@
/* First, copy the Surface description */
*lpddsd = this->s.surface_desc;
+ TRACE(ddraw,"locked surface: height=%ld, width=%ld, pitch=%ld\n",
+ lpddsd->dwHeight,lpddsd->dwWidth,lpddsd->lPitch);
/* If asked only for a part, change the surface pointer */
if (lprect) {
@@ -2103,6 +2105,7 @@
(*lpdsf)->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_LPSURFACE;
(*lpdsf)->s.surface_desc.dwWidth = this->d.width;
(*lpdsf)->s.surface_desc.dwHeight = this->d.height;
+ TRACE(ddraw,"primary surface: dwWidth=%ld, dwHeight=%ld, lPitch=%ld\n",this->d.width,this->d.height,lpddsd->lPitch);
/* We put our surface always in video memory */
(*lpdsf)->s.surface_desc.ddsCaps.dwCaps |= DDSCAPS_VISIBLE|DDSCAPS_VIDEOMEMORY;
_getpixelformat(this,&((*lpdsf)->s.surface_desc.ddpfPixelFormat));
@@ -2443,6 +2446,9 @@
TRACE(ddraw, "(%p)->(%ld,%ld,%ld)\n", this, width, height, depth);
+ /* We hope getting the asked for depth */
+ this->d.screen_depth = depth;
+
depths = TSXListDepths(display,DefaultScreen(display),&depcount);
for (i=0;i<depcount;i++)
if (depths[i]==depth)
@@ -2496,6 +2502,7 @@
} else
TSXFree(all_modes[i]->private);
}
+ for (i++;i<mode_count;i++) TSXFree(all_modes[i]->private);
TSXFree(all_modes);
if (!vidmode)
@@ -2503,8 +2510,11 @@
if (vidmode)
{
+ TRACE(ddraw,"SwitchToMode(%dx%d)\n",vidmode->hdisplay,vidmode->vdisplay);
TSXF86VidModeSwitchToMode(display, DefaultScreen(display), vidmode);
+#if 0 /* This messes up my screen (XF86_Mach64, 3.3.2.3a) for some reason, and should now be unnecessary */
TSXF86VidModeSetViewPort(display, DefaultScreen(display), 0, 0);
+#endif
}
}
#endif
@@ -2516,10 +2526,12 @@
TSXF86DGADirectVideo(display,DefaultScreen(display),XF86DGADirectGraphics);
#ifdef DIABLO_HACK
TSXF86DGASetViewPort(display,DefaultScreen(display),0,this->e.dga.fb_height);
+#else
+ TSXF86DGASetViewPort(display,DefaultScreen(display),0,0);
#endif
#ifdef RESTORE_SIGNALS
- SIGNAL_InitEmulator();
+ if (SIGNAL_Reinit) SIGNAL_Reinit();
#endif
return DD_OK;
#else /* defined(HAVE_LIBXXF86DGA) */
@@ -2688,7 +2700,7 @@
} break;
default:
- ERR(ddraw, "Memory corruption !\n");
+ ERR(ddraw, "Memory corruption ! (depth=%ld, screen_depth=%ld)\n",this->d.depth,this->d.screen_depth);
break;
}
}
@@ -2765,7 +2777,7 @@
Sleep(1000);
TSXF86DGADirectVideo(display,DefaultScreen(display),0);
#ifdef RESTORE_SIGNALS
- SIGNAL_InitEmulator();
+ if (SIGNAL_Reinit) SIGNAL_Reinit();
#endif
return DD_OK;
#else /* defined(HAVE_LIBXXF86DGA) */
@@ -2813,7 +2825,7 @@
#endif
#ifdef RESTORE_SIGNALS
- SIGNAL_InitEmulator();
+ if (SIGNAL_Reinit) SIGNAL_Reinit();
#endif
HeapFree(GetProcessHeap(),0,this);
return 0;
@@ -3391,9 +3403,10 @@
#endif
/* just assume the default depth is the DGA depth too */
+ (*lplpDD)->d.screen_depth = DefaultDepthOfScreen(screen);
(*lplpDD)->d.depth = DefaultDepthOfScreen(screen);
#ifdef RESTORE_SIGNALS
- SIGNAL_InitEmulator();
+ if (SIGNAL_Reinit) SIGNAL_Reinit();
#endif
return DD_OK;
diff --git a/include/miscemu.h b/include/miscemu.h
index f8231b6..2314389 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -102,6 +102,7 @@
/* if1632/signal.c */
extern BOOL32 SIGNAL_InitEmulator(void);
+extern BOOL32 (*SIGNAL_Reinit)(void);
/* misc/aspi.c */
extern void ASPI_DOS_HandleInt(CONTEXT *context);
diff --git a/miscemu/main.c b/miscemu/main.c
index c9a2375..cda9fca 100644
--- a/miscemu/main.c
+++ b/miscemu/main.c
@@ -34,6 +34,7 @@
/* Initialize signal handling */
if (!SIGNAL_InitEmulator()) return FALSE;
+ SIGNAL_Reinit=SIGNAL_InitEmulator;
/* Create the Win16 printer driver */
if (!WIN16DRV_Init()) return FALSE;