Replaced Windows critical section with mutex - fixes some issues with window movement/resizing when using Direct3D output.
This commit is contained in:
parent
6aef53e854
commit
d27c7a0947
11 changed files with 22 additions and 25 deletions
|
|
@ -380,13 +380,12 @@ void cga_poll(void *p)
|
|||
updatewindowsize(xsize, (ysize << 1) + 16);
|
||||
}
|
||||
|
||||
startblit();
|
||||
if (cga->composite)
|
||||
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, cga->firstline - 4, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
frames++;
|
||||
endblit();
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
if (cga->cgamode & 1)
|
||||
|
|
|
|||
|
|
@ -561,9 +561,7 @@ void ega_poll(void *p)
|
|||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
|
||||
startblit();
|
||||
video_blit_memtoscreen(32, 0, ega->firstline, ega->lastline, xsize, ega->lastline - ega->firstline);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
|
||||
|
|
|
|||
|
|
@ -269,9 +269,9 @@ void hercules_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen_8(0, hercules->firstline, xsize, ysize);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -961,9 +961,9 @@ void incolor_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen(0, incolor->firstline, 0, incolor->lastline - incolor->firstline, xsize, incolor->lastline - incolor->firstline);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
if ((incolor->ctrl & INCOLOR_CTRL_GRAPH) && (incolor->ctrl2 & INCOLOR_CTRL2_GRAPH))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -235,9 +235,9 @@ void mda_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen_8(0, mda->firstline, xsize, mda->lastline - mda->firstline);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
video_res_x = mda->crtc[1];
|
||||
video_res_y = mda->crtc[6];
|
||||
|
|
|
|||
|
|
@ -395,10 +395,10 @@ void m24_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize + 16);
|
||||
}
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16);
|
||||
frames++;
|
||||
endblit();
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
if (m24->cgamode & 1)
|
||||
|
|
|
|||
|
|
@ -403,14 +403,14 @@ static void pc1512_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, (ysize << 1) + 16);
|
||||
}
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8);
|
||||
// blit(buffer,vbuf,0,firstline-4,0,0,xsize,(lastline-firstline)+8+1);
|
||||
// if (vid_resize) stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,winsizex,winsizey);
|
||||
// else stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,xsize,((lastline-firstline)<<1)+16+2);
|
||||
// if (readflash) rectfill(screen,winsizex-40,8,winsizex-8,14,0xFFFFFFFF);
|
||||
// readflash=0;
|
||||
endblit();
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
if (pc1512->cgamode & 1)
|
||||
|
|
|
|||
|
|
@ -576,12 +576,12 @@ void pcjr_poll(void *p)
|
|||
}
|
||||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
startblit();
|
||||
|
||||
if (cga_comp)
|
||||
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, pcjr->firstline-4, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
|
|
|
|||
|
|
@ -614,12 +614,12 @@ void tandy_poll(void *p)
|
|||
}
|
||||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
startblit();
|
||||
|
||||
if (cga_comp)
|
||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
|
|
|
|||
|
|
@ -630,9 +630,9 @@ static void tandysl_poll(void *p)
|
|||
}
|
||||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
startblit();
|
||||
|
||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
endblit();
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
|
|
|
|||
10
src/win.c
10
src/win.c
|
|
@ -70,8 +70,8 @@ static struct
|
|||
|
||||
int winsizex=640,winsizey=480;
|
||||
int gfx_present[GFX_MAX];
|
||||
#undef cs
|
||||
CRITICAL_SECTION cs;
|
||||
|
||||
HANDLE ghMutex;
|
||||
|
||||
HANDLE mainthreadh;
|
||||
|
||||
|
|
@ -124,12 +124,12 @@ void releasemouse()
|
|||
|
||||
void startblit()
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
WaitForSingleObject(ghMutex, INFINITE);
|
||||
}
|
||||
|
||||
void endblit()
|
||||
{
|
||||
LeaveCriticalSection(&cs);
|
||||
ReleaseMutex(ghMutex);
|
||||
}
|
||||
|
||||
void leave_fullscreen()
|
||||
|
|
@ -637,7 +637,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
/// QueryPerformanceCounter(&counter_posold);
|
||||
// counter_posold.QuadPart*=100;
|
||||
|
||||
InitializeCriticalSection(&cs);
|
||||
ghMutex = CreateMutex(NULL, FALSE, NULL);
|
||||
mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL);
|
||||
SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue