From 212401bed6745bc8041bbbd6e043334d1cf1a8d1 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sun, 22 Jun 2025 21:29:46 -0500 Subject: [PATCH] Ensure the S3 ViRGE type is correctly assigned including when using an onboard ViRGE --- src/video/vid_s3_virge.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 9422f69bf..774b0d4b7 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -211,6 +211,7 @@ typedef struct virge_t { uint8_t pci_regs[256]; uint8_t pci_slot; + uint8_t type; int chip; int bilinear_enabled; @@ -5140,9 +5141,11 @@ s3_virge_init(const device_t *info) virge_t *virge = (virge_t *) calloc(1, sizeof(virge_t)); reset_state = calloc(1, sizeof(virge_t)); + virge->type = (info->local & 0xff); + virge->bilinear_enabled = device_get_config_int("bilinear"); virge->dithering_enabled = device_get_config_int("dithering"); - if (info->local >= S3_VIRGE_GX2) + if (virge->type >= S3_VIRGE_GX2) virge->memory_size = 4; else virge->memory_size = device_get_config_int("memory"); @@ -5150,7 +5153,7 @@ s3_virge_init(const device_t *info) virge->onboard = !!(info->local & 0x100); if (!virge->onboard) - switch (info->local) { + switch (virge->type) { case S3_VIRGE_325: bios_fn = ROM_VIRGE_325; break; @@ -5197,7 +5200,7 @@ s3_virge_init(const device_t *info) virge->svga.hwcursor.cur_ysize = 64; if (bios_fn != NULL) { - if (info->local == S3_VIRGE_GX2) + if (virge->type == S3_VIRGE_GX2) rom_init(&virge->bios_rom, bios_fn, 0xc0000, 0x10000, 0xffff, 0, MEM_MAPPING_EXTERNAL); else rom_init(&virge->bios_rom, bios_fn, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); @@ -5251,7 +5254,7 @@ s3_virge_init(const device_t *info) virge->virge_id = 0xe1; virge->is_agp = !!(info->flags & DEVICE_AGP); - switch (info->local) { + switch (virge->type) { case S3_VIRGE_325: case S3_DIAMOND_STEALTH3D_2000: case S3_MIROCRYSTAL_3D: @@ -5356,7 +5359,7 @@ s3_virge_init(const device_t *info) default: break; } - if (info->local == S3_VIRGE_GX) + if (virge->type == S3_VIRGE_GX) virge->svga.crtc[0x36] |= (1 << 2); }