Direct3D in full-screen mode now transfers control of input to the full screen window, fixes #429;

Unified screenshot code and moved it to video.c, it is now independent of both renderer and platform;
The EGA/(S)VGA overscan now also works for CGA, PCjr, Tandy, and CGA-using Amstrads;
Fixed EGA/(S)VGA overscan operation so it works correctly with scrolling and panning;
Fixed 320x200x32K and 320x200x64K modes on the ET4000/W32p;
Fixed the Video 7 1024i chip ID and video memory options, fixes #431;
Fixed a banking bug in the S3 cards, fixes Windows 9x and NeoPaint.
This commit is contained in:
OBattler
2019-10-20 15:09:38 +02:00
parent 93e6b9bc70
commit a495faec59
36 changed files with 3302 additions and 3751 deletions

View File

@@ -12,7 +12,7 @@
* we will not use that, but, instead, use a new window which
* coverrs the entire desktop.
*
* Version: @(#)win_sdl.c 1.0.6 2019/03/09
* Version: @(#)win_sdl.c 1.0.7 2019/10/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Michael Dr<44>ing, <michael@drueing.de>
@@ -55,9 +55,6 @@
#include <windows.h>
#include <SDL2/SDL.h>
#define PNG_DEBUG 0
#include <png.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
@@ -90,9 +87,6 @@ static int cur_w, cur_h;
static volatile int sdl_enabled = 0;
static SDL_mutex* sdl_mutex = NULL;
static png_structp png_ptr;
static png_infop info_ptr;
/* Pointers to the real functions. */
static void (*sdl_GetVersion)(SDL_version *ver);
@@ -522,94 +516,6 @@ sdl_init_fs(HWND h)
}
void
sdl_take_screenshot(const wchar_t *fn)
{
int i, res, x, y, width = 0, height = 0;
unsigned char* rgba = NULL;
png_bytep *b_rgb = NULL;
FILE *fp = NULL;
sdl_GetWindowSize(sdl_win, &width, &height);
/* create file */
fp = plat_fopen((wchar_t *) fn, (wchar_t *) L"wb");
if (!fp) {
sdl_log("[sdl_take_screenshot] File %ls could not be opened for writing", fn);
return;
}
/* initialize stuff */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
sdl_log("[sdl_take_screenshot] png_create_write_struct failed");
fclose(fp);
return;
}
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
sdl_log("[sdl_take_screenshot] png_create_info_struct failed");
fclose(fp);
return;
}
png_init_io(png_ptr, fp);
png_set_IHDR(png_ptr, info_ptr, width, height,
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
rgba = (unsigned char *) malloc(width * height * 4);
if (rgba == NULL) {
sdl_log("[sdl_take_screenshot] Unable to Allocate RGBA Bitmap Memory");
fclose(fp);
return;
}
res = sdl_RenderReadPixels(sdl_render, NULL, SDL_PIXELFORMAT_ABGR8888, rgba, width * 4);
if (res) {
sdl_log("[sdl_take_screenshot] Error reading render pixels\n");
fclose(fp);
return;
}
b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * height);
if (b_rgb == NULL) {
sdl_log("[sdl_take_screenshot] Unable to Allocate RGB Bitmap Memory");
free(rgba);
fclose(fp);
return;
}
for (y = 0; y < height; ++y) {
b_rgb[y] = (png_byte *) malloc(png_get_rowbytes(png_ptr, info_ptr));
for (x = 0; x < width; ++x) {
b_rgb[y][(x) * 3 + 0] = rgba[(y * width + x) * 4 + 0];
b_rgb[y][(x) * 3 + 1] = rgba[(y * width + x) * 4 + 1];
b_rgb[y][(x) * 3 + 2] = rgba[(y * width + x) * 4 + 2];
}
}
png_write_info(png_ptr, info_ptr);
png_write_image(png_ptr, b_rgb);
png_write_end(png_ptr, NULL);
/* cleanup heap allocation */
for (i = 0; i < height; i++)
if (b_rgb[i]) free(b_rgb[i]);
if (b_rgb) free(b_rgb);
if (rgba) free(rgba);
if (fp) fclose(fp);
}
int
sdl_pause(void)
{