Reverted Direct3D to 2048x2048 buffer and suppressed the EGA/(S)VGA overscan, if enabled, in 2048x modes, fixes Direct3D freezes;

Improved the BusLogic incoming mailbox code;
The BusLogic callback is now three-phases and outgoing mailbox interrupts are emulated correctly;
Fixed the CD-ROM command READ DISC INFORMATION (0x51), fixes NetBSD crashing 86Box with segmentation fault when using the AHA-154x;
Added the CD-ROM command PAUSE/RESUME ALT (0xC2).
This commit is contained in:
OBattler
2017-01-24 01:03:23 +01:00
parent bd28cc5e57
commit bc5ac4a699
21 changed files with 308 additions and 278 deletions

View File

@@ -63,12 +63,12 @@ static uint32_t pal_lookup[256];
static CUSTOMVERTEX d3d_verts[] =
{
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f},
{2080.0f, 2080.0f, 1.0f, 1.0f, 1.0f, 1.0f},
{ 0.0f, 2080.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{2048.0f, 2048.0f, 1.0f, 1.0f, 1.0f, 1.0f},
{ 0.0f, 2048.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f},
{2080.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f},
{2080.0f, 2080.0f, 1.0f, 1.0f, 1.0f, 1.0f},
{2048.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f},
{2048.0f, 2048.0f, 1.0f, 1.0f, 1.0f, 1.0f},
};
void d3d_init(HWND h)
@@ -135,19 +135,18 @@ void d3d_init_objects()
&v_buffer,
NULL);
d3ddev->CreateTexture(2080, 2080, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL);
d3ddev->CreateTexture(2048, 2048, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL);
r.top = r.left = 0;
r.bottom = 2079;
r.right = 2079;
r.bottom = r.right = 2047;
if (FAILED(d3dTexture->LockRect(0, &dr, &r, 0)))
fatal("LockRect failed\n");
for (y = 0; y < 2056; y++)
for (y = 0; y < 2048; y++)
{
uint32_t *p = (uint32_t *)(dr.pBits + (y * dr.Pitch));
memset(p, 0, 2064 * 4);
memset(p, 0, 2048 * 4);
}
d3dTexture->UnlockRect(0);
@@ -242,7 +241,7 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
{
video_blit_complete();
return; /*Nothing to do*/
}
}
r.top = y1;
r.left = 0;
@@ -263,10 +262,10 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
else
video_blit_complete();
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2048.0;
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 / 2080.0;
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2080.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;
@@ -321,7 +320,7 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
int yy, xx;
HRESULT hr = D3D_OK;
if (h == 0)
if (h == 0)
{
video_blit_complete();
return; /*Nothing to do*/
@@ -330,7 +329,7 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
r.top = 0;
r.left = 0;
r.bottom = h;
r.right = 2079;
r.right = 2047;
if (hr == D3D_OK)
{
@@ -353,6 +352,24 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
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->BeginScene();
@@ -376,28 +393,8 @@ 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)