Applied mainline commit 631a8e4: Move video blit to seperate thread.

This commit is contained in:
OBattler
2016-07-19 23:51:00 +02:00
parent 4d6c878fb6
commit 0d1e5c7439
17 changed files with 272 additions and 102 deletions

View File

@@ -148,6 +148,7 @@ void cga_poll(void *p)
if (cga->displine < cga->firstline)
{
cga->firstline = cga->displine;
video_wait_for_buffer();
// printf("Firstline %i\n",firstline);
}
cga->lastline = cga->displine;

View File

@@ -330,7 +330,10 @@ void ega_poll(void *p)
if (ega->dispon)
{
if (ega->firstline == 2000)
{
ega->firstline = ega->displine;
video_wait_for_buffer();
}
if (ega->scrblank)
{

View File

@@ -142,6 +142,7 @@ void hercules_poll(void *p)
if (hercules->displine < hercules->firstline)
{
hercules->firstline = hercules->displine;
video_wait_for_buffer();
}
hercules->lastline = hercules->displine;
cols[0] = 0;

View File

@@ -865,6 +865,7 @@ void incolor_poll(void *p)
if (incolor->displine < incolor->firstline)
{
incolor->firstline = incolor->displine;
video_wait_for_buffer();
}
incolor->lastline = incolor->displine;
if ((incolor->ctrl & INCOLOR_CTRL_GRAPH) && (incolor->ctrl2 & INCOLOR_CTRL2_GRAPH))

View File

@@ -180,7 +180,10 @@ static void pc1512_poll(void *p)
if (pc1512->dispon)
{
if (pc1512->displine < pc1512->firstline)
{
pc1512->firstline = pc1512->displine;
video_wait_for_buffer();
}
pc1512->lastline = pc1512->displine;
for (c = 0; c < 8; c++)
{

View File

@@ -218,7 +218,10 @@ void pcjr_poll(void *p)
uint16_t mask = 0x1fff;
if (pcjr->displine < pcjr->firstline)
{
pcjr->firstline = pcjr->displine;
video_wait_for_buffer();
}
pcjr->lastline = pcjr->displine;
cols[0] = (pcjr->array[2] & 0xf) + 16;
for (c = 0; c < 8; c++)

View File

@@ -523,7 +523,10 @@ void svga_poll(void *p)
svga->ma &= svga->vrammask;
if (svga->firstline == 2000)
{
svga->firstline = svga->displine;
video_wait_for_buffer();
}
if (svga->hwcursor_on || svga->overlay_on)
svga->changedvram[svga->ma >> 12] = svga->changedvram[(svga->ma >> 12) + 1] = 2;

View File

@@ -237,6 +237,7 @@ void tandy_poll(void *p)
if (tandy->displine < tandy->firstline)
{
tandy->firstline = tandy->displine;
video_wait_for_buffer();
// printf("Firstline %i\n",firstline);
}
tandy->lastline = tandy->displine;

View File

@@ -284,6 +284,7 @@ static void tandysl_poll(void *p)
if (tandy->displine < tandy->firstline)
{
tandy->firstline = tandy->displine;
video_wait_for_buffer();
// printf("Firstline %i\n",firstline);
}
tandy->lastline = tandy->displine;

View File

@@ -4224,7 +4224,10 @@ void voodoo_callback(void *p)
voodoo->dirty_line[voodoo->line] = 0;
if (voodoo->line < voodoo->dirty_line_low)
{
voodoo->dirty_line_low = voodoo->line;
video_wait_for_buffer();
}
if (voodoo->line > voodoo->dirty_line_high)
voodoo->dirty_line_high = voodoo->line;

View File

@@ -11,6 +11,7 @@
#include "io.h"
#include "cpu.h"
#include "rom.h"
#include "thread.h"
#include "timer.h"
#include "vid_ati18800.h"
@@ -227,8 +228,8 @@ int video_timing_b, video_timing_w, video_timing_l;
int video_res_x, video_res_y, video_bpp;
void (*video_blit_memtoscreen)(int x, int y, int y1, int y2, int w, int h);
void (*video_blit_memtoscreen_8)(int x, int y, int w, int h);
void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
void video_init()
{
@@ -373,6 +374,19 @@ void loadfont(char *s, int format)
fclose(f);
}
static struct
{
int x, y, y1, y2, w, h, blit8;
int busy;
int buffer_in_use;
thread_t *blit_thread;
event_t *wake_blit_thread;
event_t *blit_complete;
event_t *buffer_not_in_use;
} blit_data;
static void blit_thread(void *param);
void initvideo()
{
@@ -428,16 +442,89 @@ void initvideo()
for (c = 0; c < 65536; c++)
video_16to32[c] = ((c & 31) << 3) | (((c >> 5) & 63) << 10) | (((c >> 11) & 31) << 19);
blit_data.wake_blit_thread = thread_create_event();
blit_data.blit_complete = thread_create_event();
blit_data.buffer_not_in_use = thread_create_event();
blit_data.blit_thread = thread_create(blit_thread, NULL);
}
void closevideo()
{
free(video_15to32);
thread_kill(blit_data.blit_thread);
thread_destroy_event(blit_data.buffer_not_in_use);
thread_destroy_event(blit_data.blit_complete);
thread_destroy_event(blit_data.wake_blit_thread);
free(video_15to32);
free(video_16to32);
destroy_bitmap(buffer);
destroy_bitmap(buffer32);
}
static void blit_thread(void *param)
{
while (1)
{
thread_wait_event(blit_data.wake_blit_thread, -1);
thread_reset_event(blit_data.wake_blit_thread);
if (blit_data.blit8)
video_blit_memtoscreen_8_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h);
else
video_blit_memtoscreen_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
blit_data.busy = 0;
thread_set_event(blit_data.blit_complete);
}
}
void video_blit_complete()
{
blit_data.buffer_in_use = 0;
thread_set_event(blit_data.buffer_not_in_use);
}
void video_wait_for_blit()
{
while (blit_data.busy)
thread_wait_event(blit_data.blit_complete, -1);
thread_reset_event(blit_data.blit_complete);
}
void video_wait_for_buffer()
{
while (blit_data.buffer_in_use)
thread_wait_event(blit_data.buffer_not_in_use, -1);
thread_reset_event(blit_data.buffer_not_in_use);
}
void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
{
video_wait_for_blit();
blit_data.busy = 1;
blit_data.buffer_in_use = 1;
blit_data.x = x;
blit_data.y = y;
blit_data.y1 = y1;
blit_data.y2 = y2;
blit_data.w = w;
blit_data.h = h;
blit_data.blit8 = 0;
thread_set_event(blit_data.wake_blit_thread);
}
void video_blit_memtoscreen_8(int x, int y, int w, int h)
{
video_wait_for_blit();
blit_data.busy = 1;
blit_data.x = x;
blit_data.y = y;
blit_data.w = w;
blit_data.h = h;
blit_data.blit8 = 1;
thread_set_event(blit_data.wake_blit_thread);
}
#ifdef __unix
void d3d_fs_take_screenshot(char *fn)
{

View File

@@ -67,8 +67,11 @@ extern int readflash;
extern void (*video_recalctimings)();
extern void (*video_blit_memtoscreen)(int x, int y, int y1, int y2, int w, int h);
extern void (*video_blit_memtoscreen_8)(int x, int y, int w, int h);
void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
void video_blit_memtoscreen_8(int x, int y, int w, int h);
extern void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
extern void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
/* Enable EGA/(S)VGA overscan border. */
extern int enable_overscan;
@@ -85,6 +88,9 @@ extern int video_res_x, video_res_y, video_bpp;
extern int vid_resize;
void video_wait_for_blit();
void video_wait_for_buffer();
extern int winsizex,winsizey;
#ifdef __cplusplus

View File

@@ -18,6 +18,8 @@ static void d3d_fs_close_objects();
static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h);
extern "C" void video_blit_complete();
static LPDIRECT3D9 d3d = NULL;
static LPDIRECT3DDEVICE9 d3ddev = NULL;
static LPDIRECT3DVERTEXBUFFER9 v_buffer = NULL;
@@ -121,8 +123,8 @@ void d3d_fs_init(HWND h)
d3d_fs_init_objects();
video_blit_memtoscreen = d3d_fs_blit_memtoscreen;
video_blit_memtoscreen_8 = d3d_fs_blit_memtoscreen_8;
video_blit_memtoscreen_func = d3d_fs_blit_memtoscreen;
video_blit_memtoscreen_8_func = d3d_fs_blit_memtoscreen_8;
}
static void d3d_fs_close_objects()
@@ -309,7 +311,31 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
double l, t, r, b;
if (y1 == y2)
return; /*Nothing to do*/
{
video_blit_complete();
return; /*Nothing to do*/
}
if (hr == D3D_OK && !(y1 == 0 && y2 == 0))
{
RECT lock_rect;
lock_rect.top = y1;
lock_rect.left = 0;
lock_rect.bottom = y2;
lock_rect.right = 2047;
if (FAILED(d3dTexture->LockRect(0, &dr, &lock_rect, 0)))
fatal("LockRect failed\n");
for (yy = y1; yy < y2; yy++)
memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
video_blit_complete();
d3dTexture->UnlockRect(0);
}
else
video_blit_complete();
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;
@@ -339,24 +365,6 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
if (hr == D3D_OK)
hr = v_buffer->Unlock();
if (hr == D3D_OK && !(y1 == 0 && y2 == 0))
{
RECT lock_rect;
lock_rect.top = y1;
lock_rect.left = 0;
lock_rect.bottom = y2;
lock_rect.right = 2079;
if (FAILED(d3dTexture->LockRect(0, &dr, &lock_rect, 0)))
fatal("LockRect failed\n");
for (yy = y1; yy < y2; yy++)
memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
d3dTexture->UnlockRect(0);
}
if (hr == D3D_OK)
hr = d3ddev->BeginScene();
@@ -402,7 +410,39 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h)
double l, t, r, b;
if (!h)
return; /*Nothing to do*/
{
video_blit_complete();
return; /*Nothing to do*/
}
if (hr == D3D_OK)
{
RECT lock_rect;
lock_rect.top = 0;
lock_rect.left = 0;
lock_rect.bottom = 2047;
lock_rect.right = 2047;
if (FAILED(d3dTexture->LockRect(0, &dr, &lock_rect, 0)))
fatal("LockRect failed\n");
for (yy = 0; yy < h; yy++)
{
uint32_t *p = (uint32_t *)(dr.pBits + (yy * dr.Pitch));
if ((y + yy) >= 0 && (y + yy) < buffer->h)
{
for (xx = 0; xx < w; xx++)
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
}
}
video_blit_complete();
d3dTexture->UnlockRect(0);
}
else
video_blit_complete();
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;
@@ -432,31 +472,6 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h)
if (hr == D3D_OK)
hr = v_buffer->Unlock();
if (hr == D3D_OK)
{
RECT lock_rect;
lock_rect.top = 0;
lock_rect.left = 0;
lock_rect.bottom = 2079;
lock_rect.right = 2079;
if (FAILED(d3dTexture->LockRect(0, &dr, &lock_rect, 0)))
fatal("LockRect failed\n");
for (yy = 0; yy < h; yy++)
{
uint32_t *p = (uint32_t *)(dr.pBits + (yy * dr.Pitch));
if ((y + yy) >= 0 && (y + yy) < buffer->h)
{
for (xx = 0; xx < w; xx++)
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
}
}
d3dTexture->UnlockRect(0);
}
if (hr == D3D_OK)
hr = d3ddev->BeginScene();

View File

@@ -11,6 +11,7 @@ extern "C" void fatal(const char *format, ...);
extern "C" void pclog(const char *format, ...);
extern "C" void device_force_redraw();
extern "C" void video_blit_complete();
void d3d_init_objects();
void d3d_close_objects();
@@ -99,8 +100,8 @@ void d3d_init(HWND h)
d3d_init_objects();
video_blit_memtoscreen = d3d_blit_memtoscreen;
video_blit_memtoscreen_8 = d3d_blit_memtoscreen_8;
video_blit_memtoscreen_func = d3d_blit_memtoscreen;
video_blit_memtoscreen_8_func = d3d_blit_memtoscreen_8;
}
void d3d_close_objects()
@@ -234,8 +235,30 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
uint32_t *p, *src;
int yy;
if (y1 == y2)
if (y1 == y2)
{
video_blit_complete();
return; /*Nothing to do*/
}
r.top = y1;
r.left = 0;
r.bottom = y2;
r.right = 2047;
if (hr == D3D_OK)
{
if (FAILED(d3dTexture->LockRect(0, &dr, &r, 0)))
fatal("LockRect failed\n");
for (yy = y1; yy < y2; yy++)
memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
video_blit_complete();
d3dTexture->UnlockRect(0);
}
else
video_blit_complete();
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2048.0;
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;//0.5 / 2048.0;
@@ -255,22 +278,6 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
if (hr == D3D_OK)
hr = v_buffer->Unlock(); // unlock the vertex buffer
r.top = y1;
r.left = 0;
r.bottom = y2;
r.right = 2079;
if (hr == D3D_OK)
{
if (FAILED(d3dTexture->LockRect(0, &dr, &r, 0)))
fatal("LockRect failed\n");
for (yy = y1; yy < y2; yy++)
memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
d3dTexture->UnlockRect(0);
}
if (hr == D3D_OK)
hr = d3ddev->BeginScene();
@@ -312,25 +319,10 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
HRESULT hr = D3D_OK;
if (h == 0)
{
video_blit_complete();
return; /*Nothing to do*/
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2080.0;
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;//0.5 / 2080.0;
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2080.0;
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2080.0;
GetClientRect(d3d_hwnd, &r);
d3d_verts[0].x = d3d_verts[2].x = d3d_verts[3].x = -0.5;
d3d_verts[0].y = d3d_verts[3].y = d3d_verts[4].y = -0.5;
d3d_verts[1].x = d3d_verts[4].x = d3d_verts[5].x = (r.right - r.left) - 0.5;
d3d_verts[1].y = d3d_verts[2].y = d3d_verts[5].y = (r.bottom - r.top) - 0.5;
if (hr == D3D_OK)
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0); // lock the vertex buffer
if (hr == D3D_OK)
memcpy(pVoid, d3d_verts, sizeof(d3d_verts)); // copy the vertices to the locked buffer
if (hr == D3D_OK)
hr = v_buffer->Unlock(); // unlock the vertex buffer
}
r.top = 0;
r.left = 0;
@@ -351,9 +343,12 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
}
}
video_blit_complete();
d3dTexture->UnlockRect(0);
}
else
video_blit_complete();
if (hr == D3D_OK)
hr = d3ddev->BeginScene();
@@ -378,8 +373,28 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
if (hr == D3D_OK)
hr = d3ddev->EndScene();
}
else
video_blit_complete();
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2048.0;
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;//0.5 / 2048.0;
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2048.0;
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2048.0;
GetClientRect(d3d_hwnd, &r);
d3d_verts[0].x = d3d_verts[2].x = d3d_verts[3].x = -0.5;
d3d_verts[0].y = d3d_verts[3].y = d3d_verts[4].y = -0.5;
d3d_verts[1].x = d3d_verts[4].x = d3d_verts[5].x = (r.right - r.left) - 0.5;
d3d_verts[1].y = d3d_verts[2].y = d3d_verts[5].y = (r.bottom - r.top) - 0.5;
if (hr == D3D_OK)
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0); // lock the vertex buffer
if (hr == D3D_OK)
memcpy(pVoid, d3d_verts, sizeof(d3d_verts)); // copy the vertices to the locked buffer
if (hr == D3D_OK)
hr = v_buffer->Unlock(); // unlock the vertex buffer
if (hr == D3D_OK)
hr = d3ddev->Present(NULL, NULL, d3d_hwnd, NULL);
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)

View File

@@ -14,6 +14,8 @@ extern "C" void device_force_redraw();
extern "C" void ddraw_fs_init(HWND h);
extern "C" void ddraw_fs_close();
extern "C" void video_blit_complete();
static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h);
@@ -106,8 +108,8 @@ void ddraw_fs_init(HWND h)
pclog("DDRAW_INIT complete\n");
ddraw_hwnd = h;
video_blit_memtoscreen = ddraw_fs_blit_memtoscreen;
video_blit_memtoscreen_8 = ddraw_fs_blit_memtoscreen_8;
video_blit_memtoscreen_func = ddraw_fs_blit_memtoscreen;
video_blit_memtoscreen_8_func = ddraw_fs_blit_memtoscreen_8;
}
void ddraw_fs_close()
@@ -208,11 +210,16 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = y1; yy < y2; yy++)
{
if ((y + yy) >= 0) memcpy((unsigned char*)ddsd.lpSurface + (yy * ddsd.lPitch), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
}
video_blit_complete();
lpdds_back->Unlock(NULL);
window_rect.left = 0;
@@ -277,7 +284,11 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = 0; yy < h; yy++)
{
if ((y + yy) >= 0 && (y + yy) < buffer->h)
@@ -289,6 +300,7 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
}
}
}
video_blit_complete();
lpdds_back->Unlock(NULL);
window_rect.left = 0;

View File

@@ -15,6 +15,8 @@ extern "C" void device_force_redraw();
extern "C" void ddraw_init(HWND h);
extern "C" void ddraw_close();
extern "C" void video_blit_complete();
static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h);
@@ -111,8 +113,8 @@ void ddraw_init(HWND h)
pclog("DDRAW_INIT complete\n");
ddraw_hwnd = h;
video_blit_memtoscreen = ddraw_blit_memtoscreen;
video_blit_memtoscreen_8 = ddraw_blit_memtoscreen_8;
video_blit_memtoscreen_func = ddraw_blit_memtoscreen;
video_blit_memtoscreen_8_func = ddraw_blit_memtoscreen_8;
}
void ddraw_close()
@@ -152,7 +154,6 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
POINT po;
uint32_t *p;
HRESULT hr;
// pclog("Blit memtoscreen %i,%i %i %i %i,%i\n", x, y, y1, y2, w, h);
memset(&ddsd, 0, sizeof(ddsd));
@@ -165,12 +166,17 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = y1; yy < y2; yy++)
{
if ((y + yy) >= 0 && (y + yy) < buffer->h)
memcpy(ddsd.lpSurface + (yy * ddsd.lPitch), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
}
video_blit_complete();
lpdds_back->Unlock(NULL);
po.x = po.y = 0;
@@ -243,7 +249,11 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = 0; yy < h; yy++)
{
if ((y + yy) >= 0 && (y + yy) < buffer->h)
@@ -257,8 +267,9 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h)
}
p = (uint32_t *)(ddsd.lpSurface + (4 * ddsd.lPitch));
lpdds_back->Unlock(NULL);
video_blit_complete();
po.x = po.y = 0;
po.x = po.y = 0;
ClientToScreen(ddraw_hwnd, &po);
GetClientRect(ddraw_hwnd, &r_dest);

View File

@@ -225,6 +225,7 @@ void mainthread(LPVOID param)
if (!video_fullscreen && win_doresize)
{
RECT r;
video_wait_for_blit();
GetWindowRect(ghwnd, &r);
MoveWindow(ghwnd, r.left, r.top,
winsizex + (GetSystemMetrics(SM_CXFIXEDFRAME) * 2),
@@ -1039,6 +1040,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_VID_DDRAW: case IDM_VID_D3D:
startblit();
video_wait_for_blit();
CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_UNCHECKED);
vid_apis[0][vid_api].close();
vid_api = LOWORD(wParam) - IDM_VID_DDRAW;
@@ -1056,6 +1058,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
MessageBox(hwnd, "Use CTRL + ALT + PAGE DOWN to return to windowed mode", "PCem", MB_OK);
}
startblit();
video_wait_for_blit();
mouse_close();
vid_apis[0][vid_api].close();
video_fullscreen = 1;
@@ -1383,6 +1386,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (vid_apis[video_fullscreen][vid_api].resize)
{
startblit();
video_wait_for_blit();
vid_apis[video_fullscreen][vid_api].resize(winsizex, winsizey);
endblit();
}