IDE hard disks and ATAPI CD-ROMS with DMA support now report as supporting UDMA modes, for the sake of future-proofing things;

Changed the CD-ROM capabilities MODE SENSE page a bit;
Applied the S3 Trio and SVGA changes from PCem;
Fixed saving of the video renderer settings;
Fixed DirectDraw full screen;
Fixed crashes on soft reset in full screen.
This commit is contained in:
OBattler
2017-10-25 02:17:27 +02:00
parent 1efbf0463a
commit 45204350b4
22 changed files with 269 additions and 191 deletions

View File

@@ -392,7 +392,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef USE_RDP
case IDM_VID_RDP:
#endif
CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_UNCHECKED);
plat_setvid(LOWORD(wParam) - IDM_VID_DDRAW);
CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_CHECKED);
config_save();
break;
@@ -1048,6 +1050,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil)
device_force_redraw();
}
#endif
if (start_in_fullscreen) {
plat_setfullscreen(1);
}
/* Set up the current window size. */
plat_resize(scrnsz_x, scrnsz_y);
@@ -1140,6 +1145,9 @@ ui_window_title(wchar_t *s)
s = wTitle;
SetWindowText(hwndMain, s);
} else {
if (s == NULL)
s = wTitle;
}
return(s);
@@ -1344,8 +1352,8 @@ plat_delay_ms(uint32_t count)
void
plat_pause(int p)
{
static wchar_t oldtitle[128];
wchar_t title[128];
static wchar_t oldtitle[512];
wchar_t title[512];
/* If un-pausing, as the renderer if that's OK. */
if (p == 0)

View File

@@ -240,7 +240,7 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
RECT r;
int yy;
if (y1 == y2)
if ((y1 == y2) || (h <= 0))
{
video_blit_complete();
return; /*Nothing to do*/

View File

@@ -312,7 +312,7 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
int yy;
double l = 0, t = 0, r = 0, b = 0;
if (y1 == y2)
if ((y1 == y2) || (h <= 0))
{
video_blit_complete();
return; /*Nothing to do*/

View File

@@ -182,7 +182,7 @@ blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
return; /*Nothing to do*/
}
if (h <= 0) {
if ((y1 == y2) || (h <= 0)) {
video_blit_complete();
return;
}

View File

@@ -58,8 +58,8 @@ int ddraw_fs_init(HWND h)
if (FAILED(lpdd7->SetDisplayMode(ddraw_w, ddraw_h, 32, 0 ,0)))
return 0;
// memset(&ddsd, 0, sizeof(ddsd));
// ddsd.dwSize = sizeof(ddsd);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.dwBackBufferCount = 1;
@@ -190,6 +190,11 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
return; /*Nothing to do*/
}
if ((y1 == y2) || (h <= 0)) {
video_blit_complete();
return;
}
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@@ -205,10 +210,8 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
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);
}
for (yy = y1; yy < y2; yy++)
memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
video_blit_complete();
lpdds_back->Unlock(NULL);

View File

@@ -104,7 +104,7 @@ plat_vidapi(char *name)
{
int i;
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(0);
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(1);
for (i=0; i<4; i++) {
if (vid_apis[0][i].name &&
@@ -112,7 +112,28 @@ plat_vidapi(char *name)
}
/* Default value. */
return(0);
return(1);
}
char *
plat_vidapi_name(void)
{
switch(vid_api) {
case 0:
return("ddraw");
case 1:
default:
return("default"); /* Direct3D is default. */
#ifdef USE_VNC
case 2:
return("vnc");
#endif
#ifdef USE_RDP
case 3:
return("rdp");
#endif
}
}
@@ -162,6 +183,7 @@ void
plat_setfullscreen(int on)
{
static int flag = 0;
HWND *hw;
/* Want off and already off? */
if (!on && !video_fullscreen) return;
@@ -190,10 +212,12 @@ plat_setfullscreen(int on)
/* Close the current mode, and open the new one. */
vid_apis[video_fullscreen][vid_api].close();
video_fullscreen = on;
vid_apis[video_fullscreen][vid_api].init(NULL);
hw = (video_fullscreen) ? &hwndMain : &hwndRender;
vid_apis[video_fullscreen][vid_api].init((void *) *hw);
flag = 0;
mouse_init();
leave_fullscreen_flag = 0;
/* Release video and make it redraw the screen. */
endblit();