mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 20:35:32 -07:00
Conflict resolution.
This commit is contained in:
@@ -131,7 +131,6 @@ option(RTMIDI "RtMidi"
|
||||
option(FLUIDSYNTH "FluidSynth" ON)
|
||||
option(MUNT "MUNT" ON)
|
||||
option(VNC "VNC renderer" OFF)
|
||||
option(DINPUT "DirectInput" OFF)
|
||||
option(CPPTHREADS "C++11 threads" ON)
|
||||
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
|
||||
option(MINITRACE "Enable Chrome tracing using the modified minitrace library" OFF)
|
||||
|
||||
@@ -183,6 +183,7 @@ int gfxcard[2] = { 0, 0 }; /* (C) graphic
|
||||
int show_second_monitors = 1; /* (C) show non-primary monitors */
|
||||
int sound_is_float = 1; /* (C) sound uses FP values */
|
||||
int voodoo_enabled = 0; /* (C) video option */
|
||||
int lba_enhancer_enabled = 0; /* (C) enable Vision Systems LBA Enhancer */
|
||||
int ibm8514_standalone_enabled = 0; /* (C) video option */
|
||||
int xga_standalone_enabled = 0; /* (C) video option */
|
||||
uint32_t mem_size = 0; /* (C) memory size (Installed on
|
||||
@@ -1228,6 +1229,10 @@ pc_reset_hard_init(void)
|
||||
device_add(&postcard_device);
|
||||
if (unittester_enabled)
|
||||
device_add(&unittester_device);
|
||||
|
||||
if (lba_enhancer_enabled)
|
||||
device_add(&lba_enhancer_device);
|
||||
|
||||
if (novell_keycard_enabled)
|
||||
device_add(&novell_keycard_device);
|
||||
|
||||
|
||||
@@ -671,9 +671,10 @@ ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeb
|
||||
ropFLD##name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
static double fp_imm = v; \
|
||||
static uint64_t *fptr = (uint64_t *) &fp_imm; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
FP_LOAD_IMM_Q(*(uint64_t *) &fp_imm); \
|
||||
FP_LOAD_IMM_Q(*fptr); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
@@ -876,6 +876,8 @@ load_storage_controllers(void)
|
||||
path_normalize(cart_fns[c]);
|
||||
}
|
||||
}
|
||||
|
||||
lba_enhancer_enabled = !!ini_section_get_int(cat, "lba_enhancer_enabled", 0);
|
||||
}
|
||||
|
||||
/* Load "Hard Disks" section. */
|
||||
@@ -2342,6 +2344,11 @@ save_storage_controllers(void)
|
||||
else
|
||||
ini_section_set_string(cat, temp, cart_fns[c]);
|
||||
}
|
||||
|
||||
if (lba_enhancer_enabled == 0)
|
||||
ini_section_delete_var(cat, "lba_enhancer_enabled");
|
||||
else
|
||||
ini_section_set_int(cat, "lba_enhancer_enabled", 1);
|
||||
}
|
||||
|
||||
/* Save "Other Peripherals" section. */
|
||||
|
||||
@@ -433,7 +433,7 @@ is_lock_legal(uint32_t fetchdat)
|
||||
|
||||
legal = lock_legal[fetch_dat.b[0]];
|
||||
if (legal == 1)
|
||||
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
||||
legal = 1; // ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
||||
else if (legal == 2) {
|
||||
legal = lock_legal_0f[fetch_dat.b[1]];
|
||||
if (legal == 1)
|
||||
|
||||
@@ -738,9 +738,6 @@ opLOCK(uint32_t fetchdat)
|
||||
|
||||
legal = is_lock_legal(fetchdat);
|
||||
|
||||
if (legal == 4)
|
||||
pclog("PREFIX: F0 %08X\n", fetchdat);
|
||||
|
||||
ILLEGAL_ON(legal == 0);
|
||||
|
||||
CLOCK_CYCLES(4);
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
#define ISAMEM_RAMPAGEXT_CARD 11
|
||||
#define ISAMEM_ABOVEBOARD_CARD 12
|
||||
#define ISAMEM_BRAT_CARD 13
|
||||
#define ISAMEM_EV165A_CARD 14
|
||||
|
||||
#define ISAMEM_DEBUG 0
|
||||
|
||||
@@ -452,6 +453,16 @@ isamem_init(const device_t *info)
|
||||
dev->frame_addr = 0xE0000;
|
||||
break;
|
||||
|
||||
case ISAMEM_EV165A_CARD: /* Everex Maxi Magic EV-165A */
|
||||
dev->base_addr = device_get_config_hex16("base");
|
||||
dev->total_size = device_get_config_int("size");
|
||||
dev->start_addr = device_get_config_int("start");
|
||||
tot = device_get_config_int("length");
|
||||
if (!!device_get_config_int("ems"))
|
||||
dev->flags |= FLAG_EMS;
|
||||
dev->frame_addr = 0xE0000;
|
||||
break;
|
||||
|
||||
case ISAMEM_RAMPAGEXT_CARD: /* AST RAMpage/XT */
|
||||
case ISAMEM_ABOVEBOARD_CARD: /* Intel AboveBoard */
|
||||
case ISAMEM_BRAT_CARD: /* BocaRAM/AT */
|
||||
@@ -1238,6 +1249,101 @@ static const device_t ev159_device = {
|
||||
.config = ev159_config
|
||||
};
|
||||
|
||||
static const device_config_t ev165a_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "size",
|
||||
.description = "Memory Size",
|
||||
.type = CONFIG_SPINNER,
|
||||
.default_string = "",
|
||||
.default_int = 512,
|
||||
.file_filter = "",
|
||||
.spinner = {
|
||||
.min = 0,
|
||||
.max = 2048,
|
||||
.step = 512
|
||||
},
|
||||
.selection = { { 0 } }
|
||||
},
|
||||
{
|
||||
.name = "start",
|
||||
.description = "Start Address",
|
||||
.type = CONFIG_SPINNER,
|
||||
.default_string = "",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = {
|
||||
.min = 0,
|
||||
.max = 896,
|
||||
.step = 128
|
||||
},
|
||||
.selection = { { 0 } }
|
||||
},
|
||||
{
|
||||
.name = "length",
|
||||
.description = "Contiguous Size",
|
||||
.type = CONFIG_SPINNER,
|
||||
.default_string = "",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = {
|
||||
.min = 0,
|
||||
.max = 16384,
|
||||
.step = 128
|
||||
},
|
||||
.selection = { { 0 } }
|
||||
},
|
||||
{
|
||||
.name = "ems",
|
||||
.description = "EMS mode",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "Disabled", .value = 0 },
|
||||
{ .description = "Enabled", .value = 1 },
|
||||
{ .description = "" }
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "base",
|
||||
.description = "Address",
|
||||
.type = CONFIG_HEX16,
|
||||
.default_string = "",
|
||||
.default_int = 0x0258,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "208H", .value = 0x0208 },
|
||||
{ .description = "218H", .value = 0x0218 },
|
||||
{ .description = "258H", .value = 0x0258 },
|
||||
{ .description = "268H", .value = 0x0268 },
|
||||
{ .description = "2A8H", .value = 0x02A8 },
|
||||
{ .description = "2B8H", .value = 0x02B8 },
|
||||
{ .description = "2E8H", .value = 0x02E8 },
|
||||
{ .description = "" }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static const device_t ev165a_device = {
|
||||
.name = "Everex Magi Magic EV-165A",
|
||||
.internal_name = "ev165a",
|
||||
.flags = DEVICE_ISA,
|
||||
.local = ISAMEM_EV165A_CARD,
|
||||
.init = isamem_init,
|
||||
.close = isamem_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = ev165a_config
|
||||
};
|
||||
|
||||
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_BRAT)
|
||||
static const device_config_t brat_config[] = {
|
||||
// clang-format off
|
||||
@@ -1560,6 +1666,7 @@ static const struct {
|
||||
{ &a6pak_device },
|
||||
{ &ems5150_device },
|
||||
{ &ev159_device },
|
||||
{ &ev165a_device },
|
||||
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_BRAT)
|
||||
{ &brat_device },
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
add_library(hdd OBJECT hdd.c hdd_image.c hdd_table.c hdc.c hdc_st506_xt.c
|
||||
hdc_st506_at.c hdc_xta.c hdc_esdi_at.c hdc_esdi_mca.c hdc_xtide.c
|
||||
hdc_ide.c hdc_ide_ali5213.c hdc_ide_opti611.c hdc_ide_cmd640.c hdc_ide_cmd646.c
|
||||
hdc_ide_sff8038i.c hdc_ide_um8673f.c hdc_ide_w83769f.c)
|
||||
hdc_ide_sff8038i.c hdc_ide_um8673f.c hdc_ide_w83769f.c lba_enhancer.c)
|
||||
|
||||
add_library(zip OBJECT zip.c)
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ hdd_image_load(int id)
|
||||
hdd_images[id].type = HDD_IMAGE_HDX;
|
||||
} else if (is_vhd[0]) {
|
||||
fclose(hdd_images[id].file);
|
||||
MVHDGeom geometry;
|
||||
MVHDGeom geometry = { 0 };
|
||||
geometry.cyl = hdd[id].tracks;
|
||||
geometry.heads = hdd[id].hpc;
|
||||
geometry.spt = hdd[id].spt;
|
||||
@@ -335,7 +335,7 @@ hdd_image_load(int id)
|
||||
hdd_images[id].last_sector = (full_size >> 9LL) - 1;
|
||||
|
||||
if (hdd[id].vhd_blocksize || hdd[id].vhd_parent[0]) {
|
||||
MVHDCreationOptions options;
|
||||
MVHDCreationOptions options = { 0 };
|
||||
retry_vhd:
|
||||
options.block_size_in_sectors = hdd[id].vhd_blocksize;
|
||||
options.path = fn;
|
||||
|
||||
99
src/disk/lba_enhancer.c
Normal file
99
src/disk/lba_enhancer.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Vision Systems LBA Enhancer emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Cacodemon345
|
||||
*
|
||||
* Copyright 2024 Cacodemon345
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct lba_enhancer_t
|
||||
{
|
||||
rom_t rom;
|
||||
} lba_enhancer_t;
|
||||
|
||||
#define BIOS_LBA_ENHANCER "roms/hdd/misc/lbaenhancer.bin"
|
||||
|
||||
void
|
||||
lba_enhancer_close(void* priv)
|
||||
{
|
||||
free(priv);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void *
|
||||
lba_enhancer_init(const device_t *info)
|
||||
{
|
||||
lba_enhancer_t *dev = (lba_enhancer_t *) calloc(1, sizeof(lba_enhancer_t));
|
||||
|
||||
rom_init(&dev->rom, BIOS_LBA_ENHANCER,
|
||||
device_get_config_hex20("bios_addr"), 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
static int
|
||||
lba_enhancer_available(void)
|
||||
{
|
||||
return rom_present(BIOS_LBA_ENHANCER);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static const device_config_t lba_enhancer_config[] = {
|
||||
{
|
||||
.name = "bios_addr",
|
||||
.description = "BIOS Address",
|
||||
.type = CONFIG_HEX20,
|
||||
.default_string = "",
|
||||
.default_int = 0xc8000,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "C800H", .value = 0xc8000 },
|
||||
{ .description = "CC00H", .value = 0xcc000 },
|
||||
{ .description = "D000H", .value = 0xd0000 },
|
||||
{ .description = "D400H", .value = 0xd4000 },
|
||||
{ .description = "D800H", .value = 0xd8000 },
|
||||
{ .description = "DC00H", .value = 0xdc000 },
|
||||
{ .description = "" }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const device_t lba_enhancer_device = {
|
||||
.name = "Vision Systems LBA Enhancer",
|
||||
.internal_name = "lba_enhancer",
|
||||
.flags = DEVICE_AT,
|
||||
.local = 0,
|
||||
.init = lba_enhancer_init,
|
||||
.close = lba_enhancer_close,
|
||||
.reset = NULL,
|
||||
{ .available = lba_enhancer_available },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = lba_enhancer_config
|
||||
};
|
||||
@@ -315,7 +315,7 @@ create_sparse_diff(const char* path, const char* par_path, uint64_t size_in_byte
|
||||
{
|
||||
uint8_t footer_buff[MVHD_FOOTER_SIZE] = {0};
|
||||
uint8_t sparse_buff[MVHD_SPARSE_SIZE] = {0};
|
||||
uint8_t bat_sect[MVHD_SECTOR_SIZE];
|
||||
uint8_t bat_sect[MVHD_SECTOR_SIZE] = {0};
|
||||
MVHDGeom par_geom = {0};
|
||||
memset(bat_sect, 0xffffffff, sizeof bat_sect);
|
||||
MVHDMeta* vhdm = NULL;
|
||||
|
||||
@@ -92,7 +92,7 @@ read_footer(MVHDMeta* vhdm)
|
||||
static void
|
||||
read_sparse_header(MVHDMeta* vhdm)
|
||||
{
|
||||
uint8_t buffer[MVHD_SPARSE_SIZE];
|
||||
uint8_t buffer[MVHD_SPARSE_SIZE] = { 0 };
|
||||
|
||||
mvhd_fseeko64(vhdm->f, vhdm->footer.data_offset, SEEK_SET);
|
||||
(void) !fread(buffer, sizeof buffer, 1, vhdm->f);
|
||||
@@ -438,17 +438,15 @@ mvhd_version_id(void)
|
||||
MVHDAPI int
|
||||
mvhd_file_is_vhd(FILE* f)
|
||||
{
|
||||
uint8_t con_str[8];
|
||||
uint8_t con_str[8] = { 0 };
|
||||
|
||||
if (f == NULL) {
|
||||
if (f == NULL)
|
||||
return 0;
|
||||
}
|
||||
|
||||
mvhd_fseeko64(f, -MVHD_FOOTER_SIZE, SEEK_END);
|
||||
(void) !fread(con_str, sizeof con_str, 1, f);
|
||||
if (mvhd_is_conectix_str(con_str)) {
|
||||
if (mvhd_is_conectix_str(con_str))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -457,13 +455,12 @@ mvhd_file_is_vhd(FILE* f)
|
||||
MVHDAPI MVHDGeom
|
||||
mvhd_calculate_geometry(uint64_t size)
|
||||
{
|
||||
MVHDGeom chs;
|
||||
MVHDGeom chs = { 0 };
|
||||
uint32_t ts = (uint32_t)(size / MVHD_SECTOR_SIZE);
|
||||
uint32_t spt, heads, cyl, cth;
|
||||
|
||||
if (ts > 65535 * 16 * 255) {
|
||||
if (ts > 65535 * 16 * 255)
|
||||
ts = 65535 * 16 * 255;
|
||||
}
|
||||
|
||||
if (ts >= 65535 * 16 * 63) {
|
||||
spt = 255;
|
||||
@@ -473,9 +470,8 @@ mvhd_calculate_geometry(uint64_t size)
|
||||
spt = 17;
|
||||
cth = ts / spt;
|
||||
heads = (cth + 1023) / 1024;
|
||||
if (heads < 4) {
|
||||
if (heads < 4)
|
||||
heads = 4;
|
||||
}
|
||||
if (cth >= (heads * 1024) || heads > 16) {
|
||||
spt = 31;
|
||||
heads = 16;
|
||||
@@ -500,7 +496,7 @@ mvhd_calculate_geometry(uint64_t size)
|
||||
MVHDAPI MVHDMeta*
|
||||
mvhd_open(const char* path, int readonly, int* err)
|
||||
{
|
||||
MVHDError open_err;
|
||||
MVHDError open_err = { 0 };
|
||||
|
||||
MVHDMeta *vhdm = calloc(sizeof *vhdm, 1);
|
||||
if (vhdm == NULL) {
|
||||
@@ -516,11 +512,10 @@ mvhd_open(const char* path, int readonly, int* err)
|
||||
//This is safe, as we've just checked for potential overflow above
|
||||
strcpy(vhdm->filename, path);
|
||||
|
||||
if (readonly) {
|
||||
if (readonly)
|
||||
vhdm->f = mvhd_fopen((const char*)vhdm->filename, "rb", err);
|
||||
} else {
|
||||
else
|
||||
vhdm->f = mvhd_fopen((const char*)vhdm->filename, "rb+", err);
|
||||
}
|
||||
if (vhdm->f == NULL) {
|
||||
/* note, mvhd_fopen sets err for us */
|
||||
goto cleanup_vhdm;
|
||||
@@ -567,14 +562,12 @@ mvhd_open(const char* path, int readonly, int* err)
|
||||
vhdm->format_buffer.sector_count = 64;
|
||||
if (vhdm->footer.disk_type == MVHD_TYPE_DIFF) {
|
||||
char* par_path = get_diff_parent_path(vhdm, err);
|
||||
if (par_path == NULL) {
|
||||
if (par_path == NULL)
|
||||
goto cleanup_format_buff;
|
||||
}
|
||||
|
||||
uint32_t par_mod_ts = mvhd_file_mod_timestamp(par_path, err);
|
||||
if (*err != 0) {
|
||||
if (*err != 0)
|
||||
goto cleanup_format_buff;
|
||||
}
|
||||
|
||||
if (vhdm->sparse.par_timestamp != par_mod_ts) {
|
||||
/* The last-modified timestamp is to fragile to make this a fatal error.
|
||||
@@ -582,9 +575,8 @@ mvhd_open(const char* path, int readonly, int* err)
|
||||
*err = MVHD_ERR_TIMESTAMP;
|
||||
}
|
||||
vhdm->parent = mvhd_open(par_path, true, err);
|
||||
if (vhdm->parent == NULL) {
|
||||
if (vhdm->parent == NULL)
|
||||
goto cleanup_format_buff;
|
||||
}
|
||||
|
||||
if (memcmp(vhdm->sparse.par_uuid, vhdm->parent->footer.uuid, sizeof vhdm->sparse.par_uuid) != 0) {
|
||||
*err = MVHD_ERR_INVALID_PAR_UUID;
|
||||
@@ -629,9 +621,8 @@ mvhd_close(MVHDMeta* vhdm)
|
||||
if (vhdm == NULL)
|
||||
return;
|
||||
|
||||
if (vhdm->parent != NULL) {
|
||||
if (vhdm->parent != NULL)
|
||||
mvhd_close(vhdm->parent);
|
||||
}
|
||||
|
||||
fclose(vhdm->f);
|
||||
|
||||
@@ -655,7 +646,7 @@ mvhd_close(MVHDMeta* vhdm)
|
||||
MVHDAPI int
|
||||
mvhd_diff_update_par_timestamp(MVHDMeta* vhdm, int* err)
|
||||
{
|
||||
uint8_t sparse_buff[1024];
|
||||
uint8_t sparse_buff[1024] = { 0 };
|
||||
|
||||
if (vhdm == NULL || err == NULL) {
|
||||
*err = MVHD_ERR_INVALID_PARAMS;
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "minivhd.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
/*
|
||||
* The following bit array macros adapted from:
|
||||
*
|
||||
@@ -56,7 +55,6 @@
|
||||
#define VHD_CLEARBIT(A,k) ( A[(k>>3)] &= ~(0x80 >> (k&7)) )
|
||||
#define VHD_TESTBIT(A,k) ( A[(k>>3)] & (0x80 >> (k&7)) )
|
||||
|
||||
|
||||
/**
|
||||
* \brief Check that we will not be overflowing buffers
|
||||
*
|
||||
@@ -68,29 +66,26 @@
|
||||
* \param [out] trunc_sectors The number of sectors truncated if transfer_sectors < num_sectors
|
||||
*/
|
||||
static inline void
|
||||
check_sectors(uint32_t offset, int num_sectors, uint32_t total_sectors, int* transfer_sect, int* trunc_sect)
|
||||
check_sectors(uint32_t offset, int num_sectors, uint32_t total_sectors, int *transfer_sect, int *trunc_sect)
|
||||
{
|
||||
*transfer_sect = num_sectors;
|
||||
*trunc_sect = 0;
|
||||
|
||||
if ((total_sectors - offset) < (uint32_t)*transfer_sect) {
|
||||
if ((total_sectors - offset) < ((uint32_t) *transfer_sect)) {
|
||||
*transfer_sect = total_sectors - offset;
|
||||
*trunc_sect = num_sectors - *transfer_sect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mvhd_write_empty_sectors(FILE* f, int sector_count)
|
||||
mvhd_write_empty_sectors(FILE *f, int sector_count)
|
||||
{
|
||||
uint8_t zero_bytes[MVHD_SECTOR_SIZE] = {0};
|
||||
|
||||
for (int i = 0; i < sector_count; i++) {
|
||||
for (int i = 0; i < sector_count; i++)
|
||||
fwrite(zero_bytes, sizeof zero_bytes, 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Read the sector bitmap for a block.
|
||||
*
|
||||
@@ -101,19 +96,17 @@ mvhd_write_empty_sectors(FILE* f, int sector_count)
|
||||
* \param [in] blk The block for which to read the sector bitmap from
|
||||
*/
|
||||
static void
|
||||
read_sect_bitmap(MVHDMeta* vhdm, int blk)
|
||||
read_sect_bitmap(MVHDMeta *vhdm, int blk)
|
||||
{
|
||||
if (vhdm->block_offset[blk] != MVHD_SPARSE_BLK) {
|
||||
mvhd_fseeko64(vhdm->f, (uint64_t)vhdm->block_offset[blk] * MVHD_SECTOR_SIZE, SEEK_SET);
|
||||
(void) !fread(vhdm->bitmap.curr_bitmap, vhdm->bitmap.sector_count * MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
} else {
|
||||
} else
|
||||
memset(vhdm->bitmap.curr_bitmap, 0, vhdm->bitmap.sector_count * MVHD_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
vhdm->bitmap.curr_block = blk;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Write the current sector bitmap in memory to file
|
||||
*
|
||||
@@ -129,7 +122,6 @@ write_curr_sect_bitmap(MVHDMeta* vhdm)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Write block offset from memory into file
|
||||
*
|
||||
@@ -137,7 +129,7 @@ write_curr_sect_bitmap(MVHDMeta* vhdm)
|
||||
* \param [in] blk The block for which to write the offset for
|
||||
*/
|
||||
static void
|
||||
write_bat_entry(MVHDMeta* vhdm, int blk)
|
||||
write_bat_entry(MVHDMeta *vhdm, int blk)
|
||||
{
|
||||
uint64_t table_offset = vhdm->sparse.bat_offset + ((uint64_t)blk * sizeof *vhdm->block_offset);
|
||||
uint32_t offset = mvhd_to_be32(vhdm->block_offset[blk]);
|
||||
@@ -146,7 +138,6 @@ write_bat_entry(MVHDMeta* vhdm, int blk)
|
||||
fwrite(&offset, sizeof offset, 1, vhdm->f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create an empty block in a sparse or differencing VHD image
|
||||
*
|
||||
@@ -162,9 +153,9 @@ write_bat_entry(MVHDMeta* vhdm, int blk)
|
||||
* \param [in] blk The block number to create
|
||||
*/
|
||||
static void
|
||||
create_block(MVHDMeta* vhdm, int blk)
|
||||
create_block(MVHDMeta *vhdm, int blk)
|
||||
{
|
||||
uint8_t footer[MVHD_FOOTER_SIZE];
|
||||
uint8_t footer[MVHD_FOOTER_SIZE] = { 0 };
|
||||
|
||||
/* Seek to where the footer SHOULD be */
|
||||
mvhd_fseeko64(vhdm->f, -MVHD_FOOTER_SIZE, SEEK_END);
|
||||
@@ -179,13 +170,12 @@ create_block(MVHDMeta* vhdm, int blk)
|
||||
}
|
||||
|
||||
int64_t abs_offset = mvhd_ftello64(vhdm->f);
|
||||
if (abs_offset % MVHD_SECTOR_SIZE != 0) {
|
||||
if ((abs_offset % MVHD_SECTOR_SIZE) != 0) {
|
||||
/* Yikes! We're supposed to be on a sector boundary. Add some padding */
|
||||
int64_t padding_amount = (int64_t)MVHD_SECTOR_SIZE - (abs_offset % MVHD_SECTOR_SIZE);
|
||||
int64_t padding_amount = ((int64_t) MVHD_SECTOR_SIZE) - (abs_offset % MVHD_SECTOR_SIZE);
|
||||
uint8_t zero_byte = 0;
|
||||
for (int i = 0; i < padding_amount; i++) {
|
||||
for (int i = 0; i < padding_amount; i++)
|
||||
fwrite(&zero_byte, sizeof zero_byte, 1, vhdm->f);
|
||||
}
|
||||
abs_offset += padding_amount;
|
||||
}
|
||||
|
||||
@@ -204,37 +194,39 @@ create_block(MVHDMeta* vhdm, int blk)
|
||||
write_bat_entry(vhdm, blk);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_fixed_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buff) {
|
||||
int64_t addr;
|
||||
int transfer_sectors, truncated_sectors;
|
||||
mvhd_fixed_read(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *out_buff) {
|
||||
int64_t addr = 0ULL;
|
||||
int transfer_sectors = 0;
|
||||
int truncated_sectors = 0;
|
||||
uint32_t total_sectors = (uint32_t)(vhdm->footer.curr_sz / MVHD_SECTOR_SIZE);
|
||||
|
||||
check_sectors(offset, num_sectors, total_sectors, &transfer_sectors, &truncated_sectors);
|
||||
|
||||
addr = (int64_t)offset * MVHD_SECTOR_SIZE;
|
||||
addr = ((int64_t) offset) * MVHD_SECTOR_SIZE;
|
||||
mvhd_fseeko64(vhdm->f, addr, SEEK_SET);
|
||||
(void) !fread(out_buff, transfer_sectors*MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
(void) !fread(out_buff, transfer_sectors * MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
|
||||
return truncated_sectors;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_sparse_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buff)
|
||||
mvhd_sparse_read(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *out_buff)
|
||||
{
|
||||
int transfer_sectors, truncated_sectors;
|
||||
int transfer_sectors = 0;
|
||||
int truncated_sectors;
|
||||
uint32_t total_sectors = (uint32_t)(vhdm->footer.curr_sz / MVHD_SECTOR_SIZE);
|
||||
|
||||
check_sectors(offset, num_sectors, total_sectors, &transfer_sectors, &truncated_sectors);
|
||||
|
||||
uint8_t* buff = (uint8_t*)out_buff;
|
||||
int64_t addr;
|
||||
uint32_t s, ls;
|
||||
int blk, prev_blk, sib;
|
||||
int64_t addr = 0ULL;
|
||||
uint32_t s = 0;
|
||||
uint32_t ls = 0;
|
||||
int blk = 0;
|
||||
int prev_blk = -1;
|
||||
int sib = 0;
|
||||
ls = offset + transfer_sectors;
|
||||
prev_blk = -1;
|
||||
|
||||
for (s = offset; s < ls; s++) {
|
||||
blk = s / vhdm->sect_per_block;
|
||||
@@ -245,14 +237,15 @@ mvhd_sparse_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buf
|
||||
read_sect_bitmap(vhdm, blk);
|
||||
mvhd_fseeko64(vhdm->f, (uint64_t)sib * MVHD_SECTOR_SIZE, SEEK_CUR);
|
||||
} else {
|
||||
addr = ((int64_t)vhdm->block_offset[blk] + vhdm->bitmap.sector_count + sib) * MVHD_SECTOR_SIZE;
|
||||
addr = (((int64_t) vhdm->block_offset[blk]) + vhdm->bitmap.sector_count + sib) *
|
||||
MVHD_SECTOR_SIZE;
|
||||
mvhd_fseeko64(vhdm->f, addr, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
if (VHD_TESTBIT(vhdm->bitmap.curr_bitmap, sib)) {
|
||||
if (VHD_TESTBIT(vhdm->bitmap.curr_bitmap, sib))
|
||||
(void) !fread(buff, MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
} else {
|
||||
else {
|
||||
memset(buff, 0, MVHD_SECTOR_SIZE);
|
||||
mvhd_fseeko64(vhdm->f, MVHD_SECTOR_SIZE, SEEK_CUR);
|
||||
}
|
||||
@@ -262,19 +255,21 @@ mvhd_sparse_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buf
|
||||
return truncated_sectors;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_diff_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buff)
|
||||
mvhd_diff_read(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *out_buff)
|
||||
{
|
||||
int transfer_sectors, truncated_sectors;
|
||||
int transfer_sectors = 0;
|
||||
int truncated_sectors = 0;
|
||||
uint32_t total_sectors = (uint32_t)(vhdm->footer.curr_sz / MVHD_SECTOR_SIZE);
|
||||
|
||||
check_sectors(offset, num_sectors, total_sectors, &transfer_sectors, &truncated_sectors);
|
||||
|
||||
uint8_t* buff = (uint8_t*)out_buff;
|
||||
MVHDMeta* curr_vhdm = vhdm;
|
||||
uint32_t s, ls;
|
||||
int blk, sib;
|
||||
uint8_t *buff = (uint8_t*)out_buff;
|
||||
MVHDMeta *curr_vhdm = vhdm;
|
||||
uint32_t s = 0;
|
||||
uint32_t ls = 0;
|
||||
int blk = 0;
|
||||
int sib = 0;
|
||||
ls = offset + transfer_sectors;
|
||||
|
||||
for (s = offset; s < ls; s++) {
|
||||
@@ -291,11 +286,11 @@ mvhd_diff_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buff)
|
||||
|
||||
/* We handle actual sector reading using the fixed or sparse functions,
|
||||
as a differencing VHD is also a sparse VHD */
|
||||
if (curr_vhdm->footer.disk_type == MVHD_TYPE_DIFF || curr_vhdm->footer.disk_type == MVHD_TYPE_DYNAMIC) {
|
||||
if ((curr_vhdm->footer.disk_type == MVHD_TYPE_DIFF) ||
|
||||
(curr_vhdm->footer.disk_type == MVHD_TYPE_DYNAMIC))
|
||||
mvhd_sparse_read(curr_vhdm, s, 1, buff);
|
||||
} else {
|
||||
else
|
||||
mvhd_fixed_read(curr_vhdm, s, 1, buff);
|
||||
}
|
||||
|
||||
curr_vhdm = vhdm;
|
||||
buff += MVHD_SECTOR_SIZE;
|
||||
@@ -304,38 +299,40 @@ mvhd_diff_read(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* out_buff)
|
||||
return truncated_sectors;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_fixed_write(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* in_buff)
|
||||
mvhd_fixed_write(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *in_buff)
|
||||
{
|
||||
int64_t addr;
|
||||
int transfer_sectors, truncated_sectors;
|
||||
int64_t addr = 0ULL;
|
||||
int transfer_sectors = 0;
|
||||
int truncated_sectors = 0;
|
||||
uint32_t total_sectors = (uint32_t)(vhdm->footer.curr_sz / MVHD_SECTOR_SIZE);
|
||||
|
||||
check_sectors(offset, num_sectors, total_sectors, &transfer_sectors, &truncated_sectors);
|
||||
|
||||
addr = (int64_t)offset * MVHD_SECTOR_SIZE;
|
||||
mvhd_fseeko64(vhdm->f, addr, SEEK_SET);
|
||||
fwrite(in_buff, transfer_sectors*MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
fwrite(in_buff, transfer_sectors * MVHD_SECTOR_SIZE, 1, vhdm->f);
|
||||
|
||||
return truncated_sectors;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_sparse_diff_write(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* in_buff)
|
||||
mvhd_sparse_diff_write(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *in_buff)
|
||||
{
|
||||
int transfer_sectors, truncated_sectors;
|
||||
int transfer_sectors = 0;
|
||||
int truncated_sectors = 0;
|
||||
uint32_t total_sectors = (uint32_t)(vhdm->footer.curr_sz / MVHD_SECTOR_SIZE);
|
||||
|
||||
check_sectors(offset, num_sectors, total_sectors, &transfer_sectors, &truncated_sectors);
|
||||
|
||||
uint8_t* buff = (uint8_t*)in_buff;
|
||||
int64_t addr;
|
||||
uint32_t s, ls;
|
||||
int blk, prev_blk, sib;
|
||||
uint8_t* buff = (uint8_t *) in_buff;
|
||||
int64_t addr = 0ULL;
|
||||
uint32_t s = 0;
|
||||
uint32_t ls = 0;
|
||||
int blk = 0;
|
||||
int prev_blk = -1;
|
||||
int sib = 0;
|
||||
ls = offset + transfer_sectors;
|
||||
prev_blk = -1;
|
||||
|
||||
for (s = offset; s < ls; s++) {
|
||||
blk = s / vhdm->sect_per_block;
|
||||
@@ -357,7 +354,8 @@ mvhd_sparse_diff_write(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* i
|
||||
read_sect_bitmap(vhdm, blk);
|
||||
mvhd_fseeko64(vhdm->f, (uint64_t)sib * MVHD_SECTOR_SIZE, SEEK_CUR);
|
||||
} else {
|
||||
addr = ((int64_t)vhdm->block_offset[blk] + vhdm->bitmap.sector_count + sib) * MVHD_SECTOR_SIZE;
|
||||
addr = (((int64_t) vhdm->block_offset[blk]) + vhdm->bitmap.sector_count + sib) *
|
||||
MVHD_SECTOR_SIZE;
|
||||
mvhd_fseeko64(vhdm->f, addr, SEEK_SET);
|
||||
}
|
||||
prev_blk = blk;
|
||||
@@ -374,14 +372,13 @@ mvhd_sparse_diff_write(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* i
|
||||
return truncated_sectors;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mvhd_noop_write(MVHDMeta* vhdm, uint32_t offset, int num_sectors, void* in_buff)
|
||||
mvhd_noop_write(MVHDMeta *vhdm, uint32_t offset, int num_sectors, void *in_buff)
|
||||
{
|
||||
(void)vhdm;
|
||||
(void)offset;
|
||||
(void)num_sectors;
|
||||
(void)in_buff;
|
||||
(void) vhdm;
|
||||
(void) offset;
|
||||
(void) num_sectors;
|
||||
(void) in_buff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ mvhd_file_mod_timestamp(const char* path, int *err)
|
||||
{
|
||||
*err = 0;
|
||||
#ifdef _WIN32
|
||||
struct _stat file_stat;
|
||||
struct _stat file_stat = { 0 };
|
||||
size_t path_len = strlen(path);
|
||||
mvhd_utf16 new_path[260] = {0};
|
||||
int new_path_len = (sizeof new_path) - 2;
|
||||
@@ -485,7 +485,7 @@ mvhd_file_mod_timestamp(const char* path, int *err)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
struct stat file_stat;
|
||||
struct stat file_stat = { 0 };
|
||||
int stat_res = stat(path, &file_stat);
|
||||
|
||||
if (stat_res != 0) {
|
||||
|
||||
@@ -79,7 +79,6 @@ int floppyrate[4];
|
||||
|
||||
int fdc_type = 0;
|
||||
|
||||
// #define ENABLE_FDC_LOG 1
|
||||
#ifdef ENABLE_FDC_LOG
|
||||
int fdc_do_log = ENABLE_FDC_LOG;
|
||||
|
||||
@@ -781,12 +780,27 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
return;
|
||||
case 4:
|
||||
if (val & 0x80) {
|
||||
if (!(val & 0x80)) {
|
||||
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
||||
fdc->interrupt = -1;
|
||||
fdc->perp &= 0xfc;
|
||||
fdc_ctrl_reset(fdc);
|
||||
fdc->interrupt = -6;
|
||||
}
|
||||
if (fdc->power_down || ((val & 0x80) && !(fdc->dsr & 0x80))) {
|
||||
if (fdc->power_down) {
|
||||
timer_set_delay_u64(&fdc->timer, 1000 * TIMER_USEC);
|
||||
fdc->interrupt = -5;
|
||||
} else {
|
||||
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
||||
fdc->interrupt = -1;
|
||||
|
||||
fdc->perp &= 0xfc;
|
||||
|
||||
for (i = 0; i < FDD_NUM; i++)
|
||||
ui_sb_update_icon(SB_FLOPPY | i, 0);
|
||||
|
||||
fdc_ctrl_reset(fdc);
|
||||
}
|
||||
}
|
||||
fdc->dsr = val;
|
||||
return;
|
||||
case 5: /*Command register*/
|
||||
if ((fdc->stat & 0xf0) == 0xb0) {
|
||||
@@ -1532,6 +1546,9 @@ fdc_callback(void *priv)
|
||||
memset(fdc->pcn, 0x00, 4 * sizeof(uint16_t));
|
||||
fdc->reset_stat = 4;
|
||||
return;
|
||||
case -6: /*DSR Reset clear*/
|
||||
fdc->dsr |= 0x80;
|
||||
return;
|
||||
case 0x01: /* Mode */
|
||||
fdc->stat = 0x80;
|
||||
fdc->densel_force = (fdc->params[2] & 0xC0) >> 6;
|
||||
|
||||
@@ -141,6 +141,7 @@ extern int fpu_type; /* (C) fpu type */
|
||||
extern int fpu_softfloat; /* (C) fpu uses softfloat */
|
||||
extern int time_sync; /* (C) enable time sync */
|
||||
extern int hdd_format_type; /* (C) hard disk file format */
|
||||
extern int lba_enhancer_enabled; /* (C) enable Vision Systems LBA Enhancer */
|
||||
extern int confirm_reset; /* (C) enable reset confirmation */
|
||||
extern int confirm_exit; /* (C) enable exit confirmation */
|
||||
extern int confirm_save; /* (C) enable save confirmation */
|
||||
|
||||
@@ -115,12 +115,13 @@ typedef struct fdc_t {
|
||||
uint8_t rw_drive;
|
||||
|
||||
uint8_t lock;
|
||||
uint8_t dsr;
|
||||
|
||||
uint8_t params[15];
|
||||
uint8_t specify[2];
|
||||
uint8_t res[11];
|
||||
uint8_t eot[4];
|
||||
uint8_t rwc[4];
|
||||
uint8_t params[8];
|
||||
|
||||
uint16_t pcn[4];
|
||||
|
||||
|
||||
@@ -103,6 +103,9 @@ extern const device_t xtide_at_device; /* xtide_at */
|
||||
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
|
||||
extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */
|
||||
|
||||
/* Miscellaneous */
|
||||
extern const device_t lba_enhancer_device;
|
||||
|
||||
extern void hdc_init(void);
|
||||
extern void hdc_reset(void);
|
||||
|
||||
|
||||
@@ -795,7 +795,6 @@ machine_at_compaq_init(const machine_t *model, int type)
|
||||
break;
|
||||
|
||||
case COMPAQ_PORTABLEIII:
|
||||
case COMPAQ_PORTABLEIII386:
|
||||
if (hdc_current == 1)
|
||||
device_add(&ide_isa_device);
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
@@ -803,6 +802,16 @@ machine_at_compaq_init(const machine_t *model, int type)
|
||||
machine_at_init(model);
|
||||
break;
|
||||
|
||||
case COMPAQ_PORTABLEIII386:
|
||||
if (hdc_current == 1)
|
||||
device_add(&ide_isa_device);
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(&compaq_plasma_device);
|
||||
device_add(&compaq_386_device);
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_at_compaq_device);
|
||||
break;
|
||||
|
||||
case COMPAQ_DESKPRO386:
|
||||
case COMPAQ_DESKPRO386_05_1988:
|
||||
device_add(&compaq_386_device);
|
||||
|
||||
@@ -807,7 +807,7 @@ const machine_t machines[] = {
|
||||
.package = CPU_PKG_8088,
|
||||
.block = CPU_BLOCK_NONE,
|
||||
.min_bus = 4772728,
|
||||
.max_bus = 7159092,
|
||||
.max_bus = 8000000,
|
||||
.min_voltage = 0,
|
||||
.max_voltage = 0,
|
||||
.min_multi = 0,
|
||||
|
||||
@@ -191,13 +191,6 @@ if(WIN32)
|
||||
enable_language(RC)
|
||||
target_sources(86Box PUBLIC ../win/86Box-qt.rc)
|
||||
target_sources(plat PRIVATE win_dynld.c)
|
||||
if(DINPUT)
|
||||
target_sources(plat PRIVATE win_joystick.cpp)
|
||||
target_link_libraries(86Box dinput8)
|
||||
else()
|
||||
target_sources(plat PRIVATE win_joystick_rawinput.c)
|
||||
endif()
|
||||
target_link_libraries(86Box hid)
|
||||
|
||||
# CMake 3.22 messed this up for clang/clang++
|
||||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/22611
|
||||
@@ -212,8 +205,15 @@ if(WIN32)
|
||||
if (MINGW)
|
||||
add_compile_definitions(NTDDI_VERSION=0x06010000)
|
||||
endif()
|
||||
|
||||
option(SDL_JOYSTICK "Use SDL2 joystick backend instead of raw input" OFF)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT SDL_JOYSTICK)
|
||||
target_sources(plat PRIVATE win_joystick_rawinput.c)
|
||||
target_link_libraries(86Box hid)
|
||||
else()
|
||||
target_sources(plat PRIVATE sdl_joystick.cpp)
|
||||
target_sources(plat PRIVATE sdl_joystick.c)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
|
||||
@@ -62,6 +62,7 @@ SettingsStorageControllers::save()
|
||||
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
|
||||
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
|
||||
cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0;
|
||||
lba_enhancer_enabled = ui->checkBoxLbaEnhancer->isChecked() ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -204,6 +205,9 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
ui->checkBoxCassette->setChecked(false);
|
||||
ui->checkBoxCassette->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->checkBoxLbaEnhancer->setChecked(lba_enhancer_enabled > 0 && device_available(&lba_enhancer_device));
|
||||
ui->pushButtonConfigureLbaEnhancer->setEnabled(ui->checkBoxLbaEnhancer->isChecked());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -333,3 +337,15 @@ SettingsStorageControllers::on_pushButtonSCSI4_clicked()
|
||||
{
|
||||
DeviceConfig::ConfigureDevice(scsi_card_getdevice(ui->comboBoxSCSI4->currentData().toInt()), 4, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void SettingsStorageControllers::on_checkBoxLbaEnhancer_stateChanged(int arg1)
|
||||
{
|
||||
ui->pushButtonConfigureLbaEnhancer->setEnabled(arg1 != 0);
|
||||
}
|
||||
|
||||
|
||||
void SettingsStorageControllers::on_pushButtonConfigureLbaEnhancer_clicked()
|
||||
{
|
||||
DeviceConfig::ConfigureDevice(&lba_enhancer_device);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ private slots:
|
||||
void on_comboBoxHD_currentIndexChanged(int index);
|
||||
void on_comboBoxCDInterface_currentIndexChanged(int index);
|
||||
|
||||
void on_checkBoxLbaEnhancer_stateChanged(int arg1);
|
||||
|
||||
void on_pushButtonConfigureLbaEnhancer_clicked();
|
||||
|
||||
private:
|
||||
Ui::SettingsStorageControllers *ui;
|
||||
int machineId = 0;
|
||||
|
||||
@@ -51,45 +51,45 @@
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>CD-ROM Controller:</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CD-ROM Controller:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxCDInterface">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButtonCDInterface">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxHD">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
@@ -171,15 +171,15 @@
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboBoxSCSI1">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
@@ -191,41 +191,41 @@
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboBoxSCSI2">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="comboBoxSCSI3">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="comboBoxSCSI4">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -266,6 +266,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxLbaEnhancer">
|
||||
<property name="text">
|
||||
<string>Vision Systems LBA Enhancer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonConfigureLbaEnhancer">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -1,28 +1,53 @@
|
||||
// Lifted from wx-sdl2-joystick.c in PCem
|
||||
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* SDL2 joystick interface.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Joakim L. Gilje <jgilje@jgilje.net>
|
||||
*
|
||||
* Copyright 2017-2021 Sarah Walker
|
||||
* Copyright 2021 Joakim L. Gilje
|
||||
*/
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
extern "C" {
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
/* This #undef is needed because a SDL include header redefines HAVE_STDARG_H. */
|
||||
#undef HAVE_STDARG_H
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
int joysticks_present;
|
||||
joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
void
|
||||
joystick_init()
|
||||
joystick_init(void)
|
||||
{
|
||||
/* This is needed for SDL's Windows raw input backend to work properly without SDL video. */
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1");
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0) {
|
||||
return;
|
||||
}
|
||||
@@ -36,9 +61,9 @@ joystick_init()
|
||||
int d;
|
||||
|
||||
strncpy(plat_joystick_state[c].name, SDL_JoystickNameForIndex(c), 64);
|
||||
plat_joystick_state[c].nr_axes = std::min(SDL_JoystickNumAxes(sdl_joy[c]), MAX_JOY_AXES);
|
||||
plat_joystick_state[c].nr_buttons = std::min(SDL_JoystickNumButtons(sdl_joy[c]), MAX_JOY_BUTTONS);
|
||||
plat_joystick_state[c].nr_povs = std::min(SDL_JoystickNumHats(sdl_joy[c]), MAX_JOY_POVS);
|
||||
plat_joystick_state[c].nr_axes = MIN(SDL_JoystickNumAxes(sdl_joy[c]), MAX_JOY_AXES);
|
||||
plat_joystick_state[c].nr_buttons = MIN(SDL_JoystickNumButtons(sdl_joy[c]), MAX_JOY_BUTTONS);
|
||||
plat_joystick_state[c].nr_povs = MIN(SDL_JoystickNumHats(sdl_joy[c]), MAX_JOY_POVS);
|
||||
|
||||
for (d = 0; d < plat_joystick_state[c].nr_axes; d++) {
|
||||
snprintf(plat_joystick_state[c].axis[d].name, sizeof(plat_joystick_state[c].axis[d].name), "Axis %i", d);
|
||||
@@ -57,7 +82,7 @@ joystick_init()
|
||||
}
|
||||
|
||||
void
|
||||
joystick_close()
|
||||
joystick_close(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -103,8 +128,9 @@ joystick_get_axis(int joystick_nr, int mapping)
|
||||
} else
|
||||
return plat_joystick_state[joystick_nr].a[plat_joystick_state[joystick_nr].axis[mapping].id];
|
||||
}
|
||||
|
||||
void
|
||||
joystick_process()
|
||||
joystick_process(void)
|
||||
{
|
||||
int c;
|
||||
int d;
|
||||
@@ -160,3 +186,11 @@ joystick_process()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
win_joystick_handle(UNUSED(void *raw))
|
||||
{
|
||||
/* Nothing to be done here, atleast currently */
|
||||
}
|
||||
#endif
|
||||
@@ -70,6 +70,11 @@ uint16_t aha_ports[] = {
|
||||
|
||||
static uint8_t *aha1542cp_pnp_rom = NULL;
|
||||
|
||||
// static char *aha1542cp_rev = "F001";
|
||||
static char aha1542cp_rev[16] = { 0 };
|
||||
|
||||
static uint16_t fw_chksum = 0x0000;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct aha_setup_t {
|
||||
uint8_t CustomerSignature[20];
|
||||
@@ -466,8 +471,10 @@ aha_setup_data(void *priv)
|
||||
ReplyISI->fParityCheckingEnabled = dev->parity & 1;
|
||||
|
||||
U32_TO_ADDR(aha_setup->BIOSMailboxAddress, dev->BIOSMailboxOutAddr);
|
||||
aha_setup->uChecksum = 0xA3;
|
||||
aha_setup->uUnknown = 0xC2;
|
||||
// aha_setup->uChecksum = 0xA3;
|
||||
// aha_setup->uUnknown = 0xC2;
|
||||
aha_setup->uChecksum = fw_chksum >> 8;
|
||||
aha_setup->uUnknown = fw_chksum & 0xff;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -822,6 +829,7 @@ aha_setmcode(x54x_t *dev)
|
||||
{
|
||||
uint32_t temp;
|
||||
FILE *fp;
|
||||
uint16_t tempb = 0x00;
|
||||
|
||||
/* Only if this device has a BIOS ROM. */
|
||||
if (dev->mcode_path == NULL)
|
||||
@@ -851,6 +859,9 @@ aha_setmcode(x54x_t *dev)
|
||||
return;
|
||||
}
|
||||
|
||||
fseek(fp, 0x3136, SEEK_SET);
|
||||
(void) !fread(dev->fw_rev, 4, 1, fp);
|
||||
|
||||
/* Allocate the buffer and then read the real PnP ROM into it. */
|
||||
if (aha1542cp_pnp_rom != NULL) {
|
||||
free(aha1542cp_pnp_rom);
|
||||
@@ -874,6 +885,14 @@ aha_setmcode(x54x_t *dev)
|
||||
fseek(fp, dev->cmd_33_offset, SEEK_SET);
|
||||
(void) !fread(dev->cmd_33_buf, dev->cmd_33_len, 1, fp);
|
||||
|
||||
fw_chksum = 0x0000;
|
||||
|
||||
for (uint16_t i = 0; i < 32768; i++) {
|
||||
(void) fseek(fp, i, SEEK_SET);
|
||||
(void) !fread(&tempb, 1, 1, fp);
|
||||
fw_chksum += tempb;
|
||||
}
|
||||
|
||||
(void) fclose(fp);
|
||||
}
|
||||
|
||||
@@ -892,7 +911,7 @@ aha_initnvr(x54x_t *dev)
|
||||
EE2_EXT1G | EE2_RMVOK); /* Imm return on seek */
|
||||
dev->nvr[3] = SPEED_50; /* speed 5.0 MB/s */
|
||||
dev->nvr[6] = (EE6_TERM | /* host term enable */
|
||||
EE6_RSTBUS); /* reset SCSI bus on boot*/
|
||||
EE6_RSTBUS); /* reset SCSI bus on boot */
|
||||
}
|
||||
|
||||
/* Initialize the board's EEPROM (NVR.) */
|
||||
@@ -942,6 +961,7 @@ static void *
|
||||
aha_init(const device_t *info)
|
||||
{
|
||||
x54x_t *dev;
|
||||
const char *bios_rev = NULL;
|
||||
|
||||
/* Call common initializer. */
|
||||
dev = x54x_init(info);
|
||||
@@ -981,13 +1001,16 @@ aha_init(const device_t *info)
|
||||
|
||||
strcpy(dev->vendor, "Adaptec");
|
||||
|
||||
fw_chksum = 0xa3c2;
|
||||
|
||||
/* Perform per-board initialization. */
|
||||
switch (dev->type) {
|
||||
case AHA_154xA:
|
||||
strcpy(dev->name, "AHA-154xA");
|
||||
dev->fw_rev = "A003"; /* The 3.07 microcode says A006. */
|
||||
dev->bios_path = "roms/scsi/adaptec/aha1540a307.bin"; /*Only for port 0x330*/
|
||||
/* This is configurable from the configuration for the 154xB, the rest of the controllers read it from the EEPROM. */
|
||||
/* This is configurable from the configuration for the 154xB, the rest of the controllers read
|
||||
it from the EEPROM. */
|
||||
dev->HostID = device_get_config_int("hostid");
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
@@ -1009,7 +1032,8 @@ aha_init(const device_t *info)
|
||||
break;
|
||||
}
|
||||
dev->fw_rev = "A005"; /* The 3.2 microcode says A012. */
|
||||
/* This is configurable from the configuration for the 154xB, the rest of the controllers read it from the EEPROM. */
|
||||
/* This is configurable from the configuration for the 154xB, the rest of the controllers read
|
||||
it from the EEPROM. */
|
||||
dev->HostID = device_get_config_int("hostid");
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
@@ -1053,10 +1077,11 @@ aha_init(const device_t *info)
|
||||
|
||||
case AHA_154xCP:
|
||||
strcpy(dev->name, "AHA-154xCP");
|
||||
dev->bios_path = "roms/scsi/adaptec/aha1542cp102.bin";
|
||||
dev->mcode_path = "roms/scsi/adaptec/908301-00_f_mcode_17c9.u12";
|
||||
bios_rev = (char *) device_get_config_bios("bios_rev");
|
||||
dev->bios_path = (char *) device_get_bios_file(info, bios_rev, 0);
|
||||
dev->mcode_path = (char *) device_get_bios_file(info, bios_rev, 1);
|
||||
dev->nvr_path = "aha1542cp.nvr";
|
||||
dev->fw_rev = "F001";
|
||||
dev->fw_rev = aha1542cp_rev;
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
dev->rom_ioaddr = 0x3F7E; /* [2:0] idx into addr table */
|
||||
@@ -1069,11 +1094,14 @@ aha_init(const device_t *info)
|
||||
dev->ven_get_dma = aha_get_dma; /* function to return DMA channel from EEPROM */
|
||||
dev->ha_bps = 10000000.0; /* fast SCSI */
|
||||
dev->pnp_len = 0x00be; /* length of the PnP ROM */
|
||||
dev->pnp_offset = 0x533d; /* offset of the PnP ROM in the microcode ROM */
|
||||
dev->cmd_33_len = 0x06dc; /* length of the SCSISelect code expansion routine returned by
|
||||
SCSI controller command 0x33 */
|
||||
dev->cmd_33_offset = 0x7000; /* offset of the SCSISelect code expansion routine in the
|
||||
microcode ROM */
|
||||
if (!strcmp(bios_rev, "v1_02_en"))
|
||||
dev->pnp_offset = 0x533d; /* offset of the PnP ROM in the microcode ROM */
|
||||
else
|
||||
dev->pnp_offset = 0x5345; /* offset of the PnP ROM in the microcode ROM */
|
||||
dev->cmd_33_len = 0x06dc; /* length of the SCSISelect code expansion routine
|
||||
returned by SCSI controller command 0x33 */
|
||||
dev->cmd_33_offset = 0x7000; /* offset of the SCSISelect code expansion routine
|
||||
in the microcode ROM */
|
||||
aha_setmcode(dev);
|
||||
if (aha1542cp_pnp_rom)
|
||||
isapnp_add_card(aha1542cp_pnp_rom, dev->pnp_len + 7, aha_pnp_config_changed, NULL, NULL, NULL, dev);
|
||||
@@ -1384,6 +1412,31 @@ static const device_config_t aha_154xcf_config[] = {
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
};
|
||||
|
||||
static const device_config_t aha_154xcp_config[] = {
|
||||
{
|
||||
.name = "bios_rev",
|
||||
.description = "BIOS Revision",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "v1_02_en",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 }, /*W1*/
|
||||
.bios = {
|
||||
{ .name = "Version 1.02 (English)", .internal_name = "v1_02_en", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 2, .local = 0, .size = 32768, .files = { "roms/scsi/adaptec/aha1542cp102.bin",
|
||||
"roms/scsi/adaptec/908301-00_f_mcode_17c9.u12", "" } },
|
||||
{ .name = "Version 1.02 (German)", .internal_name = "v1_02_de", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 2, .local = 0, .size = 32768, .files = { "roms/scsi/adaptec/buff_1-0_bios.bin",
|
||||
"roms/scsi/adaptec/buff_1-0_mcode.bin", "" } },
|
||||
{ .name = "Version 1.03 (English)", .internal_name = "v1_03_en", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 2, .local = 0, .size = 32768, .files = { "roms/scsi/adaptec/aha1542cp103.bin",
|
||||
"roms/scsi/adaptec/908301-00_g_mcode_144c.u12.bin", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const device_t aha154xa_device = {
|
||||
@@ -1453,7 +1506,7 @@ const device_t aha154xcp_device = {
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
.config = aha_154xcp_config
|
||||
};
|
||||
|
||||
const device_t aha1640_device = {
|
||||
|
||||
@@ -11093,7 +11093,7 @@ const device_t s3_stb_powergraph_64_video_vlb_device = {
|
||||
{ .available = s3_stb_powergraph_64_video_available },
|
||||
.speed_changed = s3_speed_changed,
|
||||
.force_redraw = s3_force_redraw,
|
||||
.config = s3_standard_config
|
||||
.config = s3_phoenix_trio32_config
|
||||
};
|
||||
|
||||
const device_t s3_phoenix_trio64vplus_onboard_pci_device = {
|
||||
|
||||
@@ -51,6 +51,7 @@ if(NOT MINGW)
|
||||
target_sources(plat PRIVATE win_opendir.c)
|
||||
endif()
|
||||
|
||||
option(DINPUT "Use DirectInput joystick backend instead of raw input" OFF)
|
||||
if(DINPUT)
|
||||
target_sources(plat PRIVATE win_joystick.cpp)
|
||||
target_link_libraries(86Box dinput8)
|
||||
|
||||
Reference in New Issue
Block a user