Merge pull request #1662 from 86Box/master

Bring the branch up to par with master.
This commit is contained in:
Miran Grča
2021-09-05 20:31:53 +02:00
committed by GitHub
9 changed files with 2304 additions and 1654 deletions

View File

@@ -26,6 +26,13 @@
#include <string.h>
#include <time.h>
#include <wchar.h>
#ifdef __APPLE__
#include <string.h>
#include <dispatch/dispatch.h>
#ifdef __aarch64__
#include <pthread.h>
#endif
#endif
#define HAVE_STDARG_H
#include <86box/86box.h>
@@ -780,7 +787,13 @@ pc_init_modules(void)
mem_init();
#ifdef USE_DYNAREC
#if defined(__APPLE__) && defined(__aarch64__)
pthread_jit_write_protect_np(0);
#endif
codegen_init();
#if defined(__APPLE__) && defined(__aarch64__)
pthread_jit_write_protect_np(1);
#endif
#endif
keyboard_init();
@@ -1076,6 +1089,15 @@ pc_close(thread_t *ptr)
}
#ifdef __APPLE__
static void _ui_window_title(void *s)
{
ui_window_title((const wchar_t *) s);
free(s);
}
#endif
void
pc_run(void)
{
@@ -1104,7 +1126,12 @@ pc_run(void)
if (title_update) {
swprintf(temp, sizeof_w(temp), mouse_msg[!!mouse_capture], fps);
#ifdef __APPLE__
/* Needed due to modifying the UI on the non-main thread is a big no-no. */
dispatch_async_f(dispatch_get_main_queue(), wcsdup((const wchar_t *) temp), _ui_window_title);
#else
ui_window_title(temp);
#endif
title_update = 0;
}
}

View File

@@ -3,6 +3,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if defined(__APPLE__) && defined(__aarch64__)
#include <pthread.h>
#endif
#include <wchar.h>
#include <math.h>
#ifndef INFINITY
@@ -31,6 +34,9 @@
#endif
#include "386_common.h"
#if defined(__APPLE__) && defined(__aarch64__)
#include <pthread.h>
#endif
#define CPU_BLOCK_END() cpu_block_end = 1

View File

@@ -348,6 +348,8 @@ extern const device_t s3_phoenix_trio64_onboard_pci_device;
extern const device_t s3_phoenix_trio64_pci_device;
extern const device_t s3_phoenix_trio64vplus_pci_device;
extern const device_t s3_phoenix_trio64vplus_onboard_pci_device;
extern const device_t s3_mirocrystal_20sv_964_vlb_device;
extern const device_t s3_mirocrystal_20sv_964_pci_device;
extern const device_t s3_phoenix_vision864_pci_device;
extern const device_t s3_phoenix_vision864_vlb_device;
extern const device_t s3_phoenix_vision868_pci_device;
@@ -412,6 +414,7 @@ extern const device_t voodoo_3_2000_agp_device;
extern const device_t voodoo_3_2000_agp_onboard_8m_device;
extern const device_t voodoo_3_3000_device;
extern const device_t voodoo_3_3000_agp_device;
extern const device_t velocity_100_agp_device;
/* Wyse 700 */
extern const device_t wy700_device;

File diff suppressed because it is too large Load Diff

View File

@@ -759,7 +759,7 @@ void monitor_thread(void* param)
{
exit_event = 1;
}
else if (strncasecmp(xargv[0], "fullscreen", 1) == 0)
else if (strncasecmp(xargv[0], "fullscreen", 10) == 0)
{
video_fullscreen = 1;
fullscreen_pending = 1;

View File

@@ -203,11 +203,12 @@ hercules_in(uint16_t addr, void *priv)
case 0x03b3:
case 0x03b5:
case 0x03b7:
ret = dev->crtc[dev->crtcreg];
if (dev->crtcreg == 12)
if (dev->crtcreg == 0x0c)
ret = (dev->ma >> 8) & 0x3f;
else
else if (dev->crtcreg == 0x0d)
ret = dev->ma & 0xff;
else
ret = dev->crtc[dev->crtcreg];
break;
case 0x03ba:
@@ -274,6 +275,38 @@ hercules_read(uint32_t addr, void *priv)
}
static void
hercules_render_overscan_left(hercules_t *dev)
{
int i;
if ((dev->displine + 14) < 0)
return;
if ((((uint32_t) dev->crtc[1]) * 9) == 0)
return;
for (i = 0; i < 8; i++)
buffer32->line[dev->displine + 14][i] = 0x00000000;
}
static void
hercules_render_overscan_right(hercules_t *dev)
{
int i;
if ((dev->displine + 14) < 0)
return;
if ((((uint32_t) dev->crtc[1]) * 9) == 0)
return;
for (i = 0; i < 8; i++)
buffer32->line[dev->displine + 14][8 + (((uint32_t) dev->crtc[1]) * 9) + i] = 0x00000000;
}
static void
hercules_poll(void *priv)
{
@@ -282,8 +315,9 @@ hercules_poll(void *priv)
uint16_t ca, dat;
uint16_t pa;
int oldsc, blink;
int x, c, oldvc;
int x, xx, y, yy, c, oldvc;
int drawcursor;
uint32_t *p;
ca = (dev->crtc[15] | (dev->crtc[14] << 8)) & 0x3fff;
@@ -303,6 +337,8 @@ hercules_poll(void *priv)
}
dev->lastline = dev->displine;
hercules_render_overscan_left(dev);
if (dev->ctrl & 0x02) {
ca = (dev->sc & 3) * 0x2000;
if (dev->ctrl & 0x80)
@@ -315,9 +351,9 @@ hercules_poll(void *priv)
dat = 0;
dev->ma++;
for (c = 0; c < 16; c++)
buffer32->line[dev->displine][(x << 4) + c] = (dat & (32768 >> c)) ? 7 : 0;
buffer32->line[dev->displine + 14][(x << 4) + c + 8] = (dat & (32768 >> c)) ? 7 : 0;
for (c = 0; c < 16; c += 8)
video_blend((x << 4) + c, dev->displine);
video_blend((x << 4) + c + 8, dev->displine + 14);
}
} else {
for (x = 0; x < dev->crtc[1]; x++) {
@@ -333,15 +369,15 @@ hercules_poll(void *priv)
if (dev->sc == 12 && ((attr & 7) == 1)) {
for (c = 0; c < 9; c++)
buffer32->line[dev->displine][(x * 9) + c] = dev->cols[attr][blink][1];
buffer32->line[dev->displine + 14][(x * 9) + c + 8] = dev->cols[attr][blink][1];
} else {
for (c = 0; c < 8; c++)
buffer32->line[dev->displine][(x * 9) + c] = dev->cols[attr][blink][(fontdatm[chr][dev->sc] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[dev->displine + 14][(x * 9) + c + 8] = dev->cols[attr][blink][(fontdatm[chr][dev->sc] & (1 << (c ^ 7))) ? 1 : 0];
if ((chr & ~0x1f) == 0xc0)
buffer32->line[dev->displine][(x * 9) + 8] = dev->cols[attr][blink][fontdatm[chr][dev->sc] & 1];
buffer32->line[dev->displine + 14][(x * 9) + 8 + 8] = dev->cols[attr][blink][fontdatm[chr][dev->sc] & 1];
else
buffer32->line[dev->displine][(x * 9) + 8] = dev->cols[attr][blink][0];
buffer32->line[dev->displine + 14][(x * 9) + 8 + 8] = dev->cols[attr][blink][0];
}
if (dev->ctrl2 & 0x01)
dev->ma = (dev->ma + 1) & 0x3fff;
@@ -350,10 +386,12 @@ hercules_poll(void *priv)
if (drawcursor) {
for (c = 0; c < 9; c++)
buffer32->line[dev->displine][(x * 9) + c] ^= dev->cols[attr][0][1];
buffer32->line[dev->displine + 14][(x * 9) + c + 8] ^= dev->cols[attr][0][1];
}
}
}
hercules_render_overscan_right(dev);
}
dev->sc = oldsc;
@@ -435,19 +473,41 @@ hercules_poll(void *priv)
x = dev->crtc[1] * 9;
dev->lastline++;
if ((dev->ctrl & 8) && x && (dev->lastline - dev->firstline) &&
((x != xsize) || ((dev->lastline - dev->firstline) != ysize) || video_force_resize_get())) {
y = (dev->lastline - dev->firstline);
if ((dev->ctrl & 8) && x && y && ((x != xsize) || (y != ysize) || video_force_resize_get())) {
xsize = x;
ysize = dev->lastline - dev->firstline;
if (xsize < 64) xsize = 656;
ysize = y;
if (xsize < 64) xsize = enable_overscan ? 640 : 656;
if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize);
set_screen_size(xsize + (enable_overscan ? 16 : 0), ysize + (enable_overscan ? 28 : 0));
if (video_force_resize_get())
video_force_resize_set(0);
}
video_blit_memtoscreen_8(0, dev->firstline, 0, ysize, xsize, ysize);
if ((x >= 160) && ((y + 1) >= 120)) {
/* Draw (overscan_size) lines of overscan on top and bottom. */
for (yy = 0; yy < 14; yy++) {
p = &(buffer32->line[(dev->firstline + yy) & 0x7ff][0]);
for (xx = 0; xx < (x + 16); xx++)
p[xx] = 0x00000000;
}
for (yy = 0; yy < 14; yy++) {
p = &(buffer32->line[(dev->firstline + 14 + y + yy) & 0x7ff][0]);
for (xx = 0; xx < (x + 16); xx++)
p[xx] = 0x00000000;
}
}
if (enable_overscan)
video_blit_memtoscreen_8(0, dev->firstline, 0, ysize + 28, xsize + 16, ysize + 28);
else
video_blit_memtoscreen_8(8, dev->firstline + 14, 0, ysize + 14, xsize, ysize);
frames++;
// if ((dev->ctrl & 2) && (dev->ctrl2 & 1)) {
if (dev->ctrl & 0x02) {
@@ -492,6 +552,9 @@ hercules_init(const device_t *info)
dev = (hercules_t *)malloc(sizeof(hercules_t));
memset(dev, 0x00, sizeof(hercules_t));
overscan_x = 16;
overscan_y = 28;
dev->vram = (uint8_t *)malloc(0x10000);
timer_add(&dev->timer, hercules_poll, dev, 1);

File diff suppressed because it is too large Load Diff

View File

@@ -138,6 +138,7 @@ video_cards[] = {
{ "stealth32_pci", &et4000w32p_pci_device },
{ "stealth64v_pci", &s3_diamond_stealth64_964_pci_device },
{ "elsawin2kprox_964_pci", &s3_elsa_winner2000_pro_x_964_pci_device },
{ "mirocrystal20sv_pci", &s3_mirocrystal_20sv_964_pci_device },
{ "bahamas64_pci", &s3_bahamas64_pci_device },
{ "px_vision864_pci", &s3_phoenix_vision864_pci_device },
{ "stealthse_pci", &s3_diamond_stealth_se_pci_device },
@@ -187,7 +188,9 @@ video_cards[] = {
{ "metheus928_vlb", &s3_metheus_86c928_vlb_device },
{ "mirocrystal10sd_vlb", &s3_mirocrystal_10sd_805_vlb_device },
{ "px_86c805_vlb", &s3_phoenix_86c805_vlb_device },
{ "px_s3_v7_805_vlb", &s3_spea_mirage_86c805_vlb_device },
{ "stealth64v_vlb", &s3_diamond_stealth64_964_vlb_device },
{ "mirocrystal20sv_vlb", &s3_mirocrystal_20sv_964_vlb_device },
{ "bahamas64_vlb", &s3_bahamas64_vlb_device },
{ "px_vision864_vlb", &s3_phoenix_vision864_vlb_device },
{ "stealthse_vlb", &s3_diamond_stealth_se_vlb_device },
@@ -203,6 +206,7 @@ video_cards[] = {
{ "virge375_vbe20_vlb", &s3_virge_375_4_vlb_device },
{ "tgui9400cxi_vlb", &tgui9400cxi_device },
{ "tgui9440_vlb", &tgui9440_vlb_device },
{ "velocity100_agp", &velocity_100_agp_device },
{ "voodoo3_2k_agp", &voodoo_3_2000_agp_device },
{ "voodoo3_3k_agp", &voodoo_3_3000_agp_device },
{ "", NULL }

View File

@@ -62,7 +62,8 @@ enum
{
TYPE_BANSHEE = 0,
TYPE_V3_2000,
TYPE_V3_3000
TYPE_V3_3000,
TYPE_VELOCITY100
};
typedef struct banshee_t
@@ -2406,7 +2407,7 @@ static uint8_t banshee_pci_read(int func, int addr, void *p)
case 0x00: ret = 0x1a; break; /*3DFX*/
case 0x01: ret = 0x12; break;
case 0x02: ret = (banshee->type == TYPE_BANSHEE) ? 0x03 : 0x05; break;
case 0x02: ret = (banshee->type == TYPE_BANSHEE) ? 0x03 : ((banshee->type == TYPE_VELOCITY100) ? 0x04 : 0x05); break;
case 0x03: ret = 0x00; break;
case 0x04: ret = banshee->pci_regs[0x04] & 0x27; break;
@@ -2750,9 +2751,12 @@ static void *banshee_init_common(const device_t *info, char *fn, int has_sgram,
if (!banshee->has_bios)
mem_size = info->local; /* fixed size for on-board chips */
else if (has_sgram)
mem_size = device_get_config_int("memory");
else
else if (has_sgram) {
if (banshee->type == TYPE_VELOCITY100)
mem_size = 8; /* Velocity 100 only supports 8 MB */
else
mem_size = device_get_config_int("memory");
} else
mem_size = 16; /* SDRAM Banshee only supports 16 MB */
svga_init(info, &banshee->svga, banshee, mem_size << 20,
@@ -2889,6 +2893,10 @@ static void *v3_3000_agp_init(const device_t *info)
{
return banshee_init_common(info, "roms/video/voodoo/3k12sd.rom", 0, TYPE_V3_3000, VOODOO_3, 1);
}
static void *velocity_100_agp_init(const device_t *info)
{
return banshee_init_common(info, "roms/video/voodoo/Velocity100.VBI", 1, TYPE_VELOCITY100, VOODOO_3, 1);
}
static int banshee_available(void)
{
@@ -2908,6 +2916,10 @@ static int v3_3000_available(void)
return rom_present("roms/video/voodoo/3k12sd.rom");
}
#define v3_3000_agp_available v3_3000_available
static int velocity_100_available(void)
{
return rom_present("roms/video/voodoo/Velocity100.VBI");
}
static void banshee_close(void *p)
{
@@ -3034,3 +3046,17 @@ const device_t voodoo_3_3000_agp_device =
banshee_force_redraw,
banshee_sdram_config
};
const device_t velocity_100_agp_device =
{
"3dfx Velocity 100",
DEVICE_AGP,
0,
velocity_100_agp_init,
banshee_close,
NULL,
{ velocity_100_available },
banshee_speed_changed,
banshee_force_redraw,
banshee_sdram_config
};