Merge branch '86Box:master' into lang-ptbr-upd

This commit is contained in:
Nelson Kerber Hennemann Filho
2025-07-24 08:21:03 -03:00
committed by GitHub
66 changed files with 1260 additions and 486 deletions

View File

@@ -96,3 +96,4 @@ AppDir:
AppImage:
arch: !ENV '${arch_appimage}'
file_name: !ENV '${appimage_path}'
comp: gzip

View File

@@ -603,7 +603,7 @@ else
grep -q " bullseye " /etc/apt/sources.list || echo [!] WARNING: System not running the expected Debian version
# Establish general dependencies.
pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream qttranslations5-l10n"
pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream qttranslations5-l10n python3-pip python3-venv squashfs-tools"
if [ "$(dpkg --print-architecture)" = "$arch_deb" ]
then
pkgs="$pkgs build-essential"
@@ -1141,55 +1141,32 @@ EOF
# Copy line.
echo "$line" >> AppImageBuilder-generated.yml
# Workaround for appimage-builder issues 272 and 283 (i686 and armhf are also missing)
if [ "$arch_appimage" != "x86_64" -a "$line" = " files:" ]
then
# Some mild arbitrary code execution with a dummy package...
[ ! -d /runtime ] && sudo apt-get -y -o 'DPkg::Post-Invoke::=mkdir -p /runtime; chmod 777 /runtime' install libsixel1 > /dev/null 2>&1
echo " include:" >> AppImageBuilder-generated.yml
for loader in "/lib/$libdir/ld-linux"*.so.*
do
for loader_copy in "$loader" "/lib/$(basename "$loader")"
do
if [ ! -e "/runtime/compat$loader_copy" ]
then
mkdir -p "/runtime/compat$(dirname "$loader_copy")"
ln -s "$loader" "/runtime/compat$loader_copy"
fi
echo " - /runtime/compat$loader_copy" >> AppImageBuilder-generated.yml
done
done
fi
done < .ci/AppImageBuilder.yml
# Download appimage-builder if necessary.
appimage_builder_url="https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-$(uname -m).AppImage"
appimage_builder_binary="$cache_dir/$(basename "$appimage_builder_url")"
if [ ! -e "$appimage_builder_binary" ]
appimage_builder_commit=22fefa298f9cee922a651a6f65a46fe0ccbfa34e # from issue 376
appimage_builder_dir="$cache_dir/appimage-builder-$appimage_builder_commit"
if [ ! -x "$appimage_builder_dir/bin/appimage-builder" ]
then
rm -rf "$cache_dir/"*".AppImage" # remove old versions
wget -qO "$appimage_builder_binary" "$appimage_builder_url"
rm -rf "$cache_dir/appimage-builder-"* # remove old versions
python3 -m venv "$appimage_builder_dir" # venv to solve some Debian setuptools headaches
"$appimage_builder_dir/bin/pip" install -U "git+https://github.com/AppImageCrafters/appimage-builder.git@$appimage_builder_commit"
fi
# Symlink appimage-builder binary and global cache directory.
# Symlink appimage-builder global cache directory.
rm -rf appimage-builder.AppImage appimage-builder-cache "$project-"*".AppImage" # also remove any dangling AppImages which may interfere with the renaming process
ln -s "$appimage_builder_binary" appimage-builder.AppImage
chmod u+x appimage-builder.AppImage
mkdir -p "$cache_dir/appimage-builder-cache"
ln -s "$cache_dir/appimage-builder-cache" appimage-builder-cache
# Run appimage-builder in extract-and-run mode for Docker compatibility.
# Run appimage-builder from the virtual environment created above.
# --appdir is a workaround for appimage-builder issue 270 reported by us.
for retry in 1 2 3 4 5
do
project="$project" project_id="$project_id" project_version="$project_version" project_icon="$project_icon" arch_deb="$arch_deb" \
arch_appimage="$arch_appimage" appimage_path="$cwd/$package_name.AppImage" APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage \
arch_appimage="$arch_appimage" appimage_path="$cwd/$package_name.AppImage" "$appimage_builder_dir/bin/appimage-builder" \
--recipe AppImageBuilder-generated.yml --appdir "$(grep -oP '^\s+path: \K(.+)' AppImageBuilder-generated.yml)"
status=$?
[ $status -eq 0 ] && break
[ $status -eq 127 ] && rm -rf /tmp/appimage_extracted_*
done
# Remove appimage-builder binary on failure, just in case it's corrupted.

View File

@@ -19,6 +19,7 @@
#define __STDC_FORMAT_MACROS
#include <ctype.h>
#include <inttypes.h>
// #define ENABLE_IMAGE_LOG 1
#ifdef ENABLE_IMAGE_LOG
#include <stdarg.h>
#endif
@@ -26,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <sys/stat.h>
#ifndef _WIN32
# include <libgen.h>
@@ -84,17 +86,146 @@ typedef struct track_t {
track_index_t idx[3];
} track_t;
/*
MDS for DVD has the disc structure table - 4 byte pointer to BCA,
followed by the copyright, DMI, and layer pages.
*/
#pragma pack(push, 1)
typedef struct
{
uint8_t f1[4];
uint8_t f4[2048];
uint8_t f0[2048];
} layer_t;
typedef struct
{
layer_t layers[2];
} mds_disc_struct_t;
#pragma pack(pop)
#define dstruct_t mds_disc_struct_t
typedef struct cd_image_t {
cdrom_t *dev;
void *log;
int is_dvd;
int has_audio;
int has_dstruct;
int32_t tracks_num;
uint32_t bad_sectors_num;
track_t *tracks;
uint32_t *bad_sectors;
dstruct_t dstruct;
} cd_image_t;
typedef enum
{
CD = 0x00, /* CD-ROM */
CD_R = 0x01, /* CD-R */
CD_RW = 0x02, /* CD-RW */
DVD = 0x10, /* DVD-ROM */
DVD_MINUS_R = 0x12 /* DVD-R */
} mds_medium_type_t;
typedef enum
{
UNKNOWN = 0x00,
AUDIO = 0xa9, /* sector size = 2352 */
MODE1 = 0xaa, /* sector size = 2048 */
MODE2 = 0xab, /* sector size = 2336 */
MODE2_FORM1 = 0xac, /* sector size = 2048 */
MODE2_FORM2 = 0xad /* sector size = 2324 (+4) */
} mds_trk_mode_t;
typedef enum
{
NONE = 0x00, /* no subchannel */
PW_INTERLEAVED = 0x08 /* 96-byte PW subchannel, interleaved */
} mds_subch_mode_t;
typedef struct
{
uint8_t file_sig[16];
uint8_t file_ver[2];
uint16_t medium_type;
uint16_t sess_num;
uint16_t pad[2];
uint16_t bca_data_len;
uint32_t pad0[2];
uint32_t bca_data_offs_offs;
uint32_t pad1[6];
uint32_t disc_struct_offs;
uint32_t pad2[3];
uint32_t sess_blocks_offs;
uint32_t dpm_blocks_offs;
} mds_hdr_t; /* 88 bytes */
typedef struct
{
int32_t sess_start;
int32_t sess_end;
uint16_t sess_id;
uint8_t all_blocks_num;
uint8_t non_track_blocks_num;
uint16_t first_trk;
uint16_t last_trk;
uint32_t pad;
uint32_t trk_blocks_offs;
} mds_sess_block_t; /* 24 bytes */
typedef struct
{
uint8_t trk_mode;
/* DiscImageCreator says this is the number of subchannels. */
uint8_t subch_mode;
uint8_t adr_ctl;
uint8_t track_id;
uint8_t point;
uint8_t m;
uint8_t s;
uint8_t f;
uint8_t zero;
uint8_t pm;
uint8_t ps;
uint8_t pf;
/* DiscImageCreator calls this the index offset. */
uint32_t ex_offs;
uint16_t sector_len;
/* DiscImageCreator says unknown1 followed by 17x zero. */
uint8_t pad0[18];
uint32_t start_sect;
uint64_t start_offs;
uint32_t files_num;
uint32_t footer_offs;
uint8_t pad1[24];
} mds_trk_block_t; /* 80 bytes */
/*
DiscImageCreator's interpretation here makes sense and essentially
matches libmirage's - Index 0 sectors followed by Index 1 sectors.
*/
typedef struct
{
uint32_t pregap;
uint32_t trk_sectors;
} mds_trk_ex_block_t; /* 8 bytes */
typedef struct
{
uint32_t fn_offs;
uint32_t fn_is_wide;
uint32_t pad;
uint32_t pad0;
} mds_footer_t; /* 16 bytes */
typedef struct
{
uint32_t type;
uint32_t pad[2];
uint32_t entries;
} mds_dpm_block_t;
#ifdef ENABLE_IMAGE_LOG
int image_do_log = ENABLE_IMAGE_LOG;
@@ -284,6 +415,9 @@ bin_close(void *priv)
memset(tf->fn, 0x00, sizeof(tf->fn));
log_close(tf->log);
tf->log = NULL;
free(priv);
}
@@ -298,6 +432,11 @@ bin_init(const uint8_t id, const char *filename, int *error)
return NULL;
}
char n[1024] = { 0 };
sprintf(n, "CD-ROM %i Bin ", id + 1);
tf->log = log_open(n);
memset(tf->fn, 0x00, sizeof(tf->fn));
strncpy(tf->fn, filename, sizeof(tf->fn) - 1);
tf->fp = plat_fopen64(tf->fn, "rb");
@@ -314,11 +453,6 @@ bin_init(const uint8_t id, const char *filename, int *error)
tf->read = bin_read;
tf->get_length = bin_get_length;
tf->close = bin_close;
char n[1024] = { 0 };
sprintf(n, "CD-ROM %i Bin ", id + 1);
tf->log = log_open(n);
} else {
/* From the check above, error may still be non-zero if opening a directory.
* The error is set for viso to try and open the directory following this function.
@@ -326,8 +460,12 @@ bin_init(const uint8_t id, const char *filename, int *error)
if ((tf->fp != NULL) && ((stats.st_mode & S_IFMT) == S_IFDIR)) {
/* tf is freed by bin_close */
bin_close(tf);
} else
} else {
log_close(tf->log);
tf->log = NULL;
free(tf);
}
tf = NULL;
}
@@ -1183,7 +1321,7 @@ image_process(cd_image_t *img)
ct->point, j,
cit[ci->type + 2], ci->file_start * ct->sector_size);
image_log(img->log, " TOC data: %02X %02X %02X "
"%%02X %02X %02X %02X 02X %02X %02X %02X\n",
"%02X %02X %02X %02X %02X %02X %02X %02X\n",
ct->session, ct->attr, ct->tno, ct->point,
ct->extra[0], ct->extra[1], ct->extra[2], ct->extra[3],
(uint32_t) ((ci->start / 75) / 60),
@@ -1446,9 +1584,9 @@ image_load_cue(cd_image_t *img, const char *cuefile)
if (last_t != -1) {
/*
Important: This has to be done like this because pointers
change due to realloc.
change due to realloc.
*/
ct = &(img->tracks[t]);
ct = &(img->tracks[img->tracks_num - 1]);
for (int i = 2; i >= 0; i--) {
if (ct->idx[i].file == NULL)
@@ -1662,6 +1800,321 @@ image_load_cue(cd_image_t *img, const char *cuefile)
return success;
}
static int
image_load_mds(cd_image_t *img, const char *mdsfile)
{
track_t *ct = NULL;
track_index_t *ci = NULL;
track_file_t *tf = NULL;
int is_viso = 0;
int last_t = -1;
int error;
char pathname[MAX_FILENAME_LENGTH];
mds_hdr_t mds_hdr = { 0 };
mds_sess_block_t mds_sess_block = { 0 };
mds_trk_block_t mds_trk_block = { 0 };
mds_trk_ex_block_t mds_trk_ex_block = { 0 };
mds_footer_t mds_footer = { 0 };
mds_dpm_block_t mds_dpm_block = { 0 };
uint32_t mds_dpm_blocks_num = 0x00000000;
uint32_t mds_dpm_block_offs = 0x00000000;
img->tracks = NULL;
img->tracks_num = 0;
/* Get a copy of the filename into pathname, we need it later. */
memset(pathname, 0, MAX_FILENAME_LENGTH * sizeof(char));
path_get_dirname(pathname, mdsfile);
/* Open the file. */
FILE *fp = plat_fopen(mdsfile, "rb");
if (fp == NULL)
return 0;
int success = 0;
/*
Pass 1 - loading the MDS sheet.
*/
image_log(img->log, "Pass 1 (loading the Media Descriptor Sheet)...\n");
img->tracks_num = 0;
success = 2;
fseek(fp, 0, SEEK_SET);
fread(&mds_hdr, 1, sizeof(mds_hdr_t), fp);
if (memcmp(mds_hdr.file_sig, "MEDIA DESCRIPTOR", 16)) {
image_log(img->log, " [MDS ] Not an actual MDF file \"%s\"\n", mdsfile);
fclose(fp);
return 0;
}
if (mds_hdr.file_ver[0] == 0x02) {
image_log(img->log, " [MDS ] Daemon tools encrypted MDS is not supported in file \"%s\"\n", mdsfile);
fclose(fp);
return 0;
}
img->is_dvd = (mds_hdr.medium_type >= 0x10);
if (img->is_dvd) {
if (mds_hdr.disc_struct_offs != 0x00) {
fseek(fp, mds_hdr.disc_struct_offs, SEEK_SET);
fread(&(img->dstruct.layers[0]), 1, sizeof(layer_t), fp);
img->has_dstruct = 1;
if (((img->dstruct.layers[0].f0[2] & 0x60) >> 4) == 0x01) {
fseek(fp, mds_hdr.disc_struct_offs, SEEK_SET);
fread(&(img->dstruct.layers[1]), 1, sizeof(layer_t), fp);
img->has_dstruct++;
}
}
for (int t = 0; t < 3; t++) {
ct = image_insert_track(img, 1, 0xa0 + t);
ct->attr = DATA_TRACK;
ct->mode = 0;
ct->form = 0;
ct->tno = 0;
ct->subch_type = 0;
memset(ct->extra, 0x00, 4);
for (int i = 0; i < 3; i++) {
ci = &(ct->idx[i]);
ci->type = INDEX_NONE;
ci->start = 0;
ci->length = 0;
ci->file_start = 0;
ci->file_length = 0;
ci->file = NULL;
}
ci = &(ct->idx[1]);
if (t < 2)
ci->start = (0x01 * 60 * 75) + (0 * 75) + 0;
}
}
if (mds_hdr.dpm_blocks_offs != 0x00) {
fseek(fp, mds_hdr.dpm_blocks_offs, SEEK_SET);
fread(&mds_dpm_blocks_num, 1, sizeof(uint32_t), fp);
if (mds_dpm_blocks_num > 0) for (int b = 0; b < mds_dpm_blocks_num; b++) {
fseek(fp, mds_hdr.dpm_blocks_offs + 4 + (b * 4), SEEK_SET);
fread(&mds_dpm_block_offs, 1, sizeof(uint32_t), fp);
fseek(fp, mds_dpm_block_offs, SEEK_SET);
fread(&mds_dpm_block, 1, 4 * sizeof(mds_dpm_block_t), fp);
/* We currently only support the bad sectors block and not (yet) actual DPM. */
if (mds_dpm_block.type == 0x00000002) {
/* Bad sectors. */
img->bad_sectors_num = mds_dpm_block.entries;
img->bad_sectors = (uint32_t *) malloc(img->bad_sectors_num * sizeof(uint32_t));
fseek(fp, mds_dpm_block_offs + sizeof(mds_dpm_block_t), SEEK_SET);
fread(img->bad_sectors, 1, img->bad_sectors_num * sizeof(uint32_t), fp);
break;
}
}
}
for (int s = 0; s < mds_hdr.sess_num; s++) {
fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_sess_block_t)), SEEK_SET);
fread(&mds_sess_block, 1, sizeof(mds_sess_block_t), fp);
for (int t = 0; t < mds_sess_block.all_blocks_num; t++) {
fseek(fp, mds_sess_block.trk_blocks_offs + (t * sizeof(mds_trk_block_t)), SEEK_SET);
fread(&mds_trk_block, 1, sizeof(mds_trk_block_t), fp);
if (last_t != -1) {
/*
Important: This has to be done like this because pointers
change due to realloc.
*/
ct = &(img->tracks[img->tracks_num - 1]);
for (int i = 2; i >= 0; i--) {
if (ct->idx[i].file == NULL)
ct->idx[i].file = tf;
else
break;
}
}
last_t = mds_trk_block.point;
ct = image_insert_track(img, mds_sess_block.sess_id, mds_trk_block.point);
tf = NULL;
if (img->is_dvd) {
/* DVD images have no extra block - the extra block offset is the track length. */
memset(&mds_trk_ex_block, 0x00, sizeof(mds_trk_ex_block_t));
mds_trk_ex_block.pregap = 0x00000000;
mds_trk_ex_block.trk_sectors = mds_trk_block.ex_offs;
} else if (mds_trk_block.ex_offs != 0ULL) {
fseek(fp, mds_trk_block.ex_offs, SEEK_SET);
fread(&mds_trk_ex_block, 1, sizeof(mds_trk_ex_block), fp);
}
uint32_t astart = mds_trk_block.start_sect - mds_trk_ex_block.pregap;
uint32_t aend = astart + mds_trk_ex_block.pregap;
uint32_t aend2 = aend + mds_trk_ex_block.trk_sectors;
uint32_t astart2 = mds_trk_block.start_sect + mds_trk_ex_block.trk_sectors;
if (mds_trk_block.footer_offs != 0ULL) for (uint32_t ff = 0; ff < mds_trk_block.files_num; ff++) {
fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_footer_t)), SEEK_SET);
fread(&mds_footer, 1, sizeof(mds_footer_t), fp);
wchar_t wfn[2048] = { 0 };
char fn[2048] = { 0 };
fseek(fp, mds_footer.fn_offs, SEEK_SET);
if (mds_footer.fn_is_wide) {
fgetws(wfn, 256, fp);
wcstombs(fn, wfn, 256);
} else
fgets(fn, 512, fp);
if (!stricmp(fn, "*.mdf")) {
strcpy(fn, mdsfile);
fn[strlen(mdsfile) - 3] = 'm';
fn[strlen(mdsfile) - 2] = 'd';
fn[strlen(mdsfile) - 1] = 'f';
}
char filename[2048] = { 0 };
if (!path_abs(fn))
path_append_filename(filename, pathname, fn);
else
strcpy(filename, fn);
tf = index_file_init(img->dev->id, filename, &error, &is_viso);
}
ct->sector_size = mds_trk_block.sector_len;
ct->form = 0;
ct->tno = mds_trk_block.track_id;
ct->subch_type = mds_trk_block.subch_mode;
ct->extra[0] = mds_trk_block.m;
ct->extra[1] = mds_trk_block.s;
ct->extra[2] = mds_trk_block.f;
ct->extra[3] = mds_trk_block.zero;
/*
Note from DiscImageCreator:
I hexedited the track mode field with various values and fed it to Alchohol;
it seemed that high part of byte had no effect at all; only the lower one
affected the mode, in the following manner:
00: Mode 2, 01: Audio, 02: Mode 1, 03: Mode 2, 04: Mode 2 Form 1,
05: Mode 2 Form 2, 06: UKNONOWN, 07: Mode 2
08: Mode 2, 09: Audio, 0A: Mode 1, 0B: Mode 2, 0C: Mode 2 Form 1,
0D: Mode 2 Form 2, 0E: UKNONOWN, 0F: Mode 2
*/
ct->attr = ((mds_trk_block.trk_mode & 0x07) == 0x01) ?
AUDIO_TRACK : DATA_TRACK;
ct->mode = 0;
ct->form = 0;
if (((mds_trk_block.trk_mode & 0x07) != 0x01) &&
((mds_trk_block.trk_mode & 0x07) != 0x06))
ct->mode = ((mds_trk_block.trk_mode & 0x07) != 0x02) + 1;
if ((mds_trk_block.trk_mode & 0x06) == 0x04)
ct->form = (mds_trk_block.trk_mode & 0x07) - 0x03;
if (ct->attr == AUDIO_TRACK)
success = 1;
if (((ct->sector_size == 2336) || (ct->sector_size == 2332)) && (ct->mode == 2) && (ct->form == 1))
ct->skip = 8;
ci = &(ct->idx[0]);
if (ct->point < 0xa0) {
ci->start = astart + 150;
ci->length = mds_trk_ex_block.pregap;
}
ci->type = (ci->length > 0) ? INDEX_ZERO : INDEX_NONE;
ci->file_start = 0;
ci->file_length = 0;
ci->file = NULL;
ci = &(ct->idx[1]);
if ((mds_trk_block.point >= 1) && (mds_trk_block.point <= 99)) {
ci->start = aend + 150;
ci->length = mds_trk_ex_block.trk_sectors;
ci->type = INDEX_NORMAL;
ci->file_start = mds_trk_block.start_offs / ct->sector_size;
ci->file_length = ci->length;
ci->file = tf;
} else {
ci->start = (mds_trk_block.pm * 60 * 75) + (mds_trk_block.ps * 75) + mds_trk_block.pf;
ci->type = INDEX_ZERO;
ci->file_start = 0;
ci->file_length = 0;
ci->file = NULL;
}
ci = &(ct->idx[2]);
if (ct->point < 0xa0) {
ci->start = aend2 + 150;
ci->length = astart2 - aend2;
}
ci->type = (ci->length > 0) ? INDEX_ZERO : INDEX_NONE;
ci->file_start = 0;
ci->file_length = 0;
ci->file = NULL;
if (img->is_dvd) {
ci = &(ct->idx[1]);
uint32_t total = ci->start + ci->length;
ci = &(img->tracks[2].idx[1]);
ci->start = total;
}
}
for (int i = 2; i >= 0; i--) {
if (ct->point >= 0xa0)
ci->type = INDEX_SPECIAL;
if (ct->idx[i].file == NULL)
ct->idx[i].file = tf;
else
break;
}
}
tf = NULL;
fclose(fp);
if (success) {
// image_process(img);
#ifdef ENABLE_IMAGE_LOG
image_log(img->log, "Final tracks list:\n");
for (int i = 0; i < img->tracks_num; i++) {
ct = &(img->tracks[i]);
for (int j = 0; j < 3; j++) {
ci = &(ct->idx[j]);
image_log(img->log, " [TRACK ] %02X INDEX %02X: [%8s, %016" PRIX64 "]\n",
ct->point, j,
cit[ci->type + 2], ci->file_start * ct->sector_size);
image_log(img->log, " TOC data: %02X %02X %02X "
"%02X %02X %02X %02X %02X %02X %02X %02X\n",
ct->session, ct->attr, ct->tno, ct->point,
ct->extra[0], ct->extra[1], ct->extra[2], ct->extra[3],
(uint32_t) ((ci->start / 75) / 60),
(uint32_t) ((ci->start / 75) % 60),
(uint32_t) (ci->start % 75));
}
}
#endif
} else {
image_log(img->log, " [MDS ] Unable to open MDS sheet \"%s\"\n", mdsfile);
return 0;
}
return success;
}
/* Root functions. */
static void
image_clear_tracks(cd_image_t *img)
@@ -1945,7 +2398,27 @@ static int
image_read_dvd_structure(const void *local, const uint8_t layer, const uint8_t format,
uint8_t *buffer, uint32_t *info)
{
return 0;
const cd_image_t *img = (const cd_image_t *) local;
int ret = 0;
if ((img->has_dstruct > 0) && ((layer + 1) > img->has_dstruct)) {
switch (format) {
case 0x00:
memcpy(buffer + 4, img->dstruct.layers[layer].f0, 2048);
ret = 2048 + 2;
break;
case 0x01:
memcpy(buffer + 4, img->dstruct.layers[layer].f1, 4);
ret = 4 + 2;
break;
case 0x04:
memcpy(buffer + 4, img->dstruct.layers[layer].f4, 2048);
ret = 2048 + 2;
break;
}
}
return ret;
}
static int
@@ -1977,6 +2450,9 @@ image_close(void *local)
log_close(img->log);
img->log = NULL;
if (img->bad_sectors != NULL)
free(img->bad_sectors);
free(img);
}
}
@@ -2005,11 +2481,27 @@ image_open(cdrom_t *dev, const char *path)
if (img != NULL) {
int ret;
const int is_cue = ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE"));
const int is_cue = ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE"));
const int is_mds = ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "MDS"));
char n[1024] = { 0 };
sprintf(n, "CD-ROM %i Image", dev->id + 1);
img->log = log_open(n);
img->dev = dev;
if (is_cue) {
if (is_mds) {
ret = image_load_mds(img, path);
if (ret >= 2)
img->has_audio = 0;
else if (ret)
img->has_audio = 1;
else {
image_close(img);
img = NULL;
}
} else if (is_cue) {
ret = image_load_cue(img, path);
if (ret >= 2)
@@ -2030,15 +2522,12 @@ image_open(cdrom_t *dev, const char *path)
img->has_audio = 0;
}
if (ret) {
char n[1024] = { 0 };
sprintf(n, "CD-ROM %i Image", dev->id + 1);
img->log = log_open(n);
if (ret)
dev->ops = &image_ops;
} else
warning("Unable to load CD-ROM image: %s\n", path);
else {
log_warning(img->log, "Unable to load CD-ROM image: %s\n", path);
log_close(img->log);
}
}
return img;

View File

@@ -795,6 +795,33 @@ load_ports(void)
#endif
}
static int
load_image_file(char *dest, char *p, uint8_t *ui_wp)
{
char *prefix = "";
int ret = 0;
if (strstr(p, "wp://") == p) {
p += 5;
prefix = "wp://";
if (ui_wp != NULL)
*ui_wp = 1;
} else if ((ui_wp != NULL) && *ui_wp)
prefix = "wp://";
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
ret = 1;
else
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s", prefix, p);
} else
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, usr_path, path_get_slash(usr_path), p);
path_normalize(dest);
return ret;
}
/* Load "Storage Controllers" section. */
static void
load_storage_controllers(void)
@@ -888,20 +915,17 @@ load_storage_controllers(void)
else
cassette_enable = 0;
cassette_ui_writeprot = !!ini_section_get_int(cat, "cassette_writeprot", 0);
ini_section_delete_var(cat, "cassette_writeprot");
p = ini_section_get_string(cat, "cassette_file", "");
if (!strcmp(p, usr_path))
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of cassette_file is more than 511\n");
else
strncpy(cassette_fname, p, 511);
} else
path_append_filename(cassette_fname, usr_path, p);
path_normalize(cassette_fname);
if (load_image_file(cassette_fname, p, (uint8_t *) &cassette_ui_writeprot))
fatal("Configuration: Length of cassette_file is more than 511\n");
}
p = ini_section_get_string(cat, "cassette_mode", "load");
@@ -915,16 +939,9 @@ load_storage_controllers(void)
sprintf(temp, "cassette_image_history_%02i", i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of cassette_image_history_%02i is more "
"than %i\n", i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cassette_image_history[i]);
if (load_image_file(cassette_image_history[i], p, NULL))
fatal("Configuration: Length of cassette_image_history_%02i is more "
"than %i\n", i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
cassette_pos = ini_section_get_int(cat, "cassette_position", 0);
@@ -939,9 +956,6 @@ load_storage_controllers(void)
cassette_pcm = ini_section_get_int(cat, "cassette_pcm", 0);
if (!cassette_pcm)
ini_section_delete_var(cat, "cassette_pcm");
cassette_ui_writeprot = !!ini_section_get_int(cat, "cassette_writeprot", 0);
if (!cassette_ui_writeprot)
ini_section_delete_var(cat, "cassette_writeprot");
if (!cassette_enable) {
ini_section_delete_var(cat, "cassette_file");
@@ -1227,6 +1241,11 @@ load_floppy_and_cdrom_drives(void)
if (fdd_get_type(c) > 13)
fdd_set_type(c, 13);
sprintf(temp, "fdd_%02i_writeprot", c + 1);
ui_writeprot[c] = !!ini_section_get_int(cat, temp, 0);
if (ui_writeprot[c] == 0)
ini_section_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_fn", c + 1);
p = ini_section_get_string(cat, temp, "");
@@ -1234,22 +1253,14 @@ load_floppy_and_cdrom_drives(void)
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of fdd_%02i_fn is more than 511\n", c + 1);
else
strncpy(floppyfns[c], p, 511);
} else
path_append_filename(floppyfns[c], usr_path, p);
path_normalize(floppyfns[c]);
if (load_image_file(floppyfns[c], p, (uint8_t *) &(ui_writeprot[c])))
fatal("Configuration: Length of fdd_%02i_fn is more than 511\n", c + 1);
}
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
if (*p != '\0')
config_log("Floppy%d: %ls\n", c, floppyfns[c]);
#endif
sprintf(temp, "fdd_%02i_writeprot", c + 1);
ui_writeprot[c] = !!ini_section_get_int(cat, temp, 0);
sprintf(temp, "fdd_%02i_turbo", c + 1);
fdd_set_turbo(c, !!ini_section_get_int(cat, temp, 0));
sprintf(temp, "fdd_%02i_check_bpb", c + 1);
@@ -1265,10 +1276,6 @@ load_floppy_and_cdrom_drives(void)
sprintf(temp, "fdd_%02i_fn", c + 1);
ini_section_delete_var(cat, temp);
}
if (ui_writeprot[c] == 0) {
sprintf(temp, "fdd_%02i_writeprot", c + 1);
ini_section_delete_var(cat, temp);
}
if (fdd_get_turbo(c) == 0) {
sprintf(temp, "fdd_%02i_turbo", c + 1);
ini_section_delete_var(cat, temp);
@@ -1282,16 +1289,9 @@ load_floppy_and_cdrom_drives(void)
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of fdd_%02i_image_history_%02i is more "
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(fdd_image_history[c][i]);
if (load_image_file(fdd_image_history[c][i], p, NULL))
fatal("Configuration: Length of fdd_%02i_image_history_%02i is more "
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
}
@@ -1520,19 +1520,14 @@ load_other_removable_devices(void)
sprintf(temp, "zip_%02i_writeprot", c + 1);
zip_drives[c].read_only = ini_section_get_int(cat, temp, 0);
ini_section_delete_var(cat, temp);
if (!strcmp(p, usr_path))
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of zip_%02i_image_path is more than 511\n", c + 1);
else
strncpy(zip_drives[c].image_path, p, 511);
} else
path_append_filename(zip_drives[c].image_path, usr_path, p);
path_normalize(zip_drives[c].image_path);
if (load_image_file(zip_drives[c].image_path, p, &(zip_drives[c].read_only)))
fatal("Configuration: Length of zip_%02i_image_path is more than 511\n", c + 1);
}
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
@@ -1540,16 +1535,9 @@ load_other_removable_devices(void)
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of zip_%02i_image_history_%02i is more than %i\n",
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(zip_drives[c].image_history[i]);
if (load_image_file(zip_drives[c].image_history[i], p, NULL))
fatal("Configuration: Length of zip_%02i_image_history_%02i is more than %i\n",
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
@@ -1635,19 +1623,14 @@ load_other_removable_devices(void)
sprintf(temp, "mo_%02i_writeprot", c + 1);
mo_drives[c].read_only = ini_section_get_int(cat, temp, 0);
ini_section_delete_var(cat, temp);
if (!strcmp(p, usr_path))
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of mo_%02i_image_path is more than 511\n", c + 1);
else
strncpy(mo_drives[c].image_path, p, 511);
} else
path_append_filename(mo_drives[c].image_path, usr_path, p);
path_normalize(mo_drives[c].image_path);
if (load_image_file(mo_drives[c].image_path, p, &(mo_drives[c].read_only)))
fatal("Configuration: Length of mo_%02i_image_path is more than 511\n", c + 1);
}
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
@@ -1655,16 +1638,9 @@ load_other_removable_devices(void)
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of mo_%02i_image_history_%02i is more than %i\n",
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(mo_drives[c].image_history[i]);
if (load_image_file(mo_drives[c].image_history[i], p, NULL))
fatal("Configuration: Length of mo_%02i_image_history_%02i is more than %i\n",
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
@@ -2579,6 +2555,27 @@ save_keybinds(void)
ini_delete_section_if_empty(config, cat);
}
static void
save_image_file(char *cat, char *var, char *src)
{
char temp[2048] = { 0 };
char *prefix = "";
path_normalize(src);
if (strstr(src, "wp://") == src) {
src += 5;
prefix = "wp://";
}
if (!strnicmp(src, usr_path, strlen(usr_path)))
sprintf(temp, "%s%s", prefix, &src[strlen(usr_path)]);
else
sprintf(temp, "%s%s", prefix, src);
ini_section_set_string(cat, var, temp);
}
/* Save "Storage Controllers" section. */
static void
save_storage_controllers(void)
@@ -2640,13 +2637,8 @@ save_storage_controllers(void)
if (strlen(cassette_fname) == 0)
ini_section_delete_var(cat, "cassette_file");
else {
path_normalize(cassette_fname);
if (!strnicmp(cassette_fname, usr_path, strlen(usr_path)))
ini_section_set_string(cat, "cassette_file", &cassette_fname[strlen(usr_path)]);
else
ini_section_set_string(cat, "cassette_file", cassette_fname);
}
else
save_image_file(cat, "cassette_file", cassette_fname);
if (!strcmp(cassette_mode, "load"))
ini_section_delete_var(cat, "cassette_mode");
@@ -2657,13 +2649,8 @@ save_storage_controllers(void)
sprintf(temp, "cassette_image_history_%02i", i + 1);
if ((cassette_image_history[i] == 0) || strlen(cassette_image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(cassette_image_history[i]);
if (!strnicmp(cassette_image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &cassette_image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, cassette_image_history[i]);
}
else
save_image_file(cat, temp, cassette_image_history[i]);
}
if (cassette_pos == 0)
@@ -2686,10 +2673,7 @@ save_storage_controllers(void)
else
ini_section_set_int(cat, "cassette_pcm", cassette_pcm);
if (cassette_ui_writeprot == 0)
ini_section_delete_var(cat, "cassette_writeprot");
else
ini_section_set_int(cat, "cassette_writeprot", cassette_ui_writeprot);
ini_section_delete_var(cat, "cassette_writeprot");
for (c = 0; c < 2; c++) {
sprintf(temp, "cartridge_%02i_fn", c + 1);
@@ -2944,19 +2928,11 @@ save_floppy_and_cdrom_drives(void)
sprintf(temp, "fdd_%02i_writeprot", c + 1);
ini_section_delete_var(cat, temp);
} else {
path_normalize(floppyfns[c]);
if (!strnicmp(floppyfns[c], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &floppyfns[c][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, floppyfns[c]);
}
} else
save_image_file(cat, temp, floppyfns[c]);
sprintf(temp, "fdd_%02i_writeprot", c + 1);
if (ui_writeprot[c] == 0)
ini_section_delete_var(cat, temp);
else
ini_section_set_int(cat, temp, ui_writeprot[c]);
ini_section_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_turbo", c + 1);
if (fdd_get_turbo(c) == 0)
@@ -2974,13 +2950,8 @@ save_floppy_and_cdrom_drives(void)
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
if ((fdd_image_history[c][i] == 0) || strlen(fdd_image_history[c][i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(fdd_image_history[c][i]);
if (!strnicmp(fdd_image_history[c][i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &fdd_image_history[c][i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, fdd_image_history[c][i]);
}
else
save_image_file(cat, temp, fdd_image_history[c][i]);
}
}
@@ -3097,10 +3068,7 @@ save_other_removable_devices(void)
ini_section_delete_var(cat, temp);
sprintf(temp, "zip_%02i_writeprot", c + 1);
if (zip_drives[c].read_only)
ini_section_set_int(cat, temp, zip_drives[c].read_only);
else
ini_section_delete_var(cat, temp);
ini_section_delete_var(cat, temp);
sprintf(temp, "zip_%02i_scsi_location", c + 1);
if (zip_drives[c].bus_type != ZIP_BUS_SCSI)
@@ -3114,25 +3082,15 @@ save_other_removable_devices(void)
sprintf(temp, "zip_%02i_image_path", c + 1);
if ((zip_drives[c].bus_type == 0) || (strlen(zip_drives[c].image_path) == 0))
ini_section_delete_var(cat, temp);
else {
path_normalize(zip_drives[c].image_path);
if (!strnicmp(zip_drives[c].image_path, usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &zip_drives[c].image_path[strlen(usr_path)]);
else
ini_section_set_string(cat, temp, zip_drives[c].image_path);
}
else
save_image_file(cat, temp, zip_drives[c].image_path);
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
if ((zip_drives[c].image_history[i] == 0) || strlen(zip_drives[c].image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(zip_drives[c].image_history[i]);
if (!strnicmp(zip_drives[c].image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &zip_drives[c].image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, zip_drives[c].image_history[i]);
}
else
save_image_file(cat, temp, zip_drives[c].image_history[i]);
}
}
@@ -3159,10 +3117,7 @@ save_other_removable_devices(void)
ini_section_delete_var(cat, temp);
sprintf(temp, "mo_%02i_writeprot", c + 1);
if (mo_drives[c].read_only)
ini_section_set_int(cat, temp, mo_drives[c].read_only);
else
ini_section_delete_var(cat, temp);
ini_section_delete_var(cat, temp);
sprintf(temp, "mo_%02i_scsi_location", c + 1);
if (mo_drives[c].bus_type != MO_BUS_SCSI)
@@ -3176,25 +3131,15 @@ save_other_removable_devices(void)
sprintf(temp, "mo_%02i_image_path", c + 1);
if ((mo_drives[c].bus_type == 0) || (strlen(mo_drives[c].image_path) == 0))
ini_section_delete_var(cat, temp);
else {
path_normalize(mo_drives[c].image_path);
if (!strnicmp(mo_drives[c].image_path, usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &mo_drives[c].image_path[strlen(usr_path)]);
else
ini_section_set_string(cat, temp, mo_drives[c].image_path);
}
else
save_image_file(cat, temp, mo_drives[c].image_path);
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
if ((mo_drives[c].image_history[i] == 0) || strlen(mo_drives[c].image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(mo_drives[c].image_history[i]);
if (!strnicmp(mo_drives[c].image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &mo_drives[c].image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, mo_drives[c].image_history[i]);
}
else
save_image_file(cat, temp, mo_drives[c].image_history[i]);
}
}

View File

@@ -152,10 +152,11 @@ pc_cas_del(pc_cassette_t *cas)
}
int
pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
pc_cas_set_fname(pc_cassette_t *cas, char *fname)
{
unsigned n;
const char *ext;
int offs = 0;
if (cas->close)
fclose(cas->fp);
@@ -176,6 +177,13 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
return 0;
}
if (strstr(fname, "wp://") == fname) {
offs = 5;
cassette_ui_writeprot = 1;
}
fname += offs;
cas->fp = plat_fopen(fname, "r+b");
if (cas->fp == NULL)
@@ -197,10 +205,10 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
n = strlen(fname);
cas->fname = malloc((n + 1) * sizeof(char));
cas->fname = malloc((n + offs + 1) * sizeof(char));
if (cas->fname != NULL)
memcpy(cas->fname, fname, (n + 1) * sizeof(char));
memcpy(cas->fname, fname - offs, (n + offs + 1) * sizeof(char));
if (n > 4) {
ext = fname + (n - 4);
@@ -216,6 +224,8 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
pc_cas_set_pcm(cas, 0);
}
ui_sb_update_icon_wp(SB_CASSETTE, cassette_ui_writeprot);
return 0;
}

View File

@@ -302,7 +302,7 @@ cmd646_pci_read(int func, int addr, void *priv)
else if ((addr >= 0x70) && (addr <= 0x77))
ret = sff_bus_master_read(addr & 0x0f, dev->bm[0]);
else if ((addr >= 0x78) && (addr <= 0x7f))
ret = sff_bus_master_read(addr & 0x0f, dev->bm[0]);
ret = sff_bus_master_read(addr & 0x0f, dev->bm[1]);
}
cmd646_log("[%04X:%08X] (%08X) cmd646_pci_read(%i, %02X, %02X)\n", CS, cpu_state.pc, ESI, func, addr, ret);

View File

@@ -152,6 +152,14 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
{
const int was_empty = mo_is_empty(dev->id);
int ret = 0;
int offs = 0;
if (strstr(fn, "wp://") == fn) {
offs = 5;
dev->drv->read_only = 1;
}
fn += offs;
if (dev->drv == NULL)
mo_eject(dev->id);
@@ -202,7 +210,7 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
log_fatal(dev->log, "mo_load(): Error seeking to the beginning of "
"the file\n");
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
strncpy(dev->drv->image_path, fn - offs, sizeof(dev->drv->image_path) - 1);
ret = 1;
} else
@@ -218,6 +226,9 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
if (was_empty)
mo_insert((mo_t *) dev);
}
if (ret)
ui_sb_update_icon_wp(SB_MO | dev->id, dev->drv->read_only);
}
void

View File

@@ -194,6 +194,14 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
{
const int was_empty = zip_is_empty(dev->id);
int ret = 0;
int offs = 0;
if (strstr(fn, "wp://") == fn) {
offs = 5;
dev->drv->read_only = 1;
}
fn += offs;
if (dev->drv == NULL)
zip_eject(dev->id);
@@ -247,7 +255,7 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
log_fatal(dev->log, "zip_load(): Error seeking to the beginning of "
"the file\n");
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
strncpy(dev->drv->image_path, fn - offs, sizeof(dev->drv->image_path) - 1);
/*
After using strncpy, dev->drv->image_path needs to be explicitly null
terminated to make gcc happy.
@@ -270,6 +278,9 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
if (was_empty)
zip_insert((zip_t *) dev);
}
if (ret)
ui_sb_update_icon_wp(SB_ZIP | dev->id, dev->drv->read_only);
}
void

View File

@@ -459,11 +459,17 @@ fdd_load(int drive, char *fn)
int size;
const char *p;
FILE *fp;
int offs = 0;
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);
if (!fn)
return;
if (strstr(fn, "wp://") == fn) {
offs = 5;
ui_writeprot[drive] = 1;
}
fn += offs;
p = path_get_extension(fn);
if (!p)
return;
@@ -476,10 +482,10 @@ fdd_load(int drive, char *fn)
while (loaders[c].ext) {
if (!strcasecmp(p, (char *) loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1)) {
driveloaders[drive] = c;
if (floppyfns[drive] != fn)
strcpy(floppyfns[drive], fn);
if (floppyfns[drive] != (fn - offs))
strcpy(floppyfns[drive], fn - offs);
d86f_setup(drive);
loaders[c].load(drive, floppyfns[drive]);
loaders[c].load(drive, floppyfns[drive] + offs);
drive_empty[drive] = 0;
fdd_forced_seek(drive, 0);
fdd_changed[drive] = 1;

View File

@@ -61,13 +61,13 @@ typedef struct _joystick_instance_ {
uint8_t state;
g_axis_t axis[4];
const joystick_if_t *intf;
void *dat;
const joystick_t *intf;
void *dat;
} joystick_instance_t;
int joystick_type = JS_TYPE_NONE;
static const joystick_if_t joystick_none = {
static const joystick_t joystick_none = {
.name = "None",
.internal_name = "none",
.init = NULL,
@@ -86,7 +86,7 @@ static const joystick_if_t joystick_none = {
};
static const struct {
const joystick_if_t *joystick;
const joystick_t *joystick;
} joysticks[] = {
{ &joystick_none },
{ &joystick_2axis_2button },
@@ -100,7 +100,7 @@ static const struct {
{ &joystick_3axis_2button },
{ &joystick_2button_yoke_throttle },
{ &joystick_3axis_4button },
{ &joystick_win95_steering_wheel }, // Temp
{ &joystick_win95_steering_wheel },
{ &joystick_4button_yoke_throttle },
{ &joystick_4axis_4button },
{ &joystick_ch_flightstick_pro },
@@ -114,24 +114,39 @@ static const struct {
static joystick_instance_t *joystick_instance[GAMEPORT_MAX] = { NULL, NULL };
static uint8_t gameport_pnp_rom[] = {
0x09, 0xf8, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* BOX0002, dummy checksum (filled in by isapnp_add_card) */
0x0a, 0x10, 0x10, /* PnP version 1.0, vendor version 1.0 */
0x82, 0x09, 0x00, 'G', 'a', 'm', 'e', ' ', 'P', 'o', 'r', 't', /* ANSI identifier */
/* BOX0002, serial 0, dummy checksum (filled in by isapnp_add_card) */
0x09, 0xf8, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
/* PnP version 1.0, vendor version 1.0 */
0x0a, 0x10, 0x10,
/* ANSI identifier */
0x82, 0x09, 0x00, 'G', 'a', 'm', 'e', ' ', 'P', 'o', 'r', 't',
0x15, 0x09, 0xf8, 0x00, 0x02, 0x01, /* logical device BOX0002, can participate in boot */
0x1c, 0x41, 0xd0, 0xb0, 0x2f, /* compatible device PNPB02F */
0x31, 0x00, /* start dependent functions, preferred */
0x47, 0x01, 0x00, 0x02, 0x00, 0x02, 0x08, 0x08, /* I/O 0x200, decodes 16-bit, 8-byte alignment, 8 addresses */
0x30, /* start dependent functions, acceptable */
0x47, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x08, /* I/O 0x208, decodes 16-bit, 8-byte alignment, 8 addresses */
0x31, 0x02, /* start dependent functions, sub-optimal */
0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08, /* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */
0x38, /* end dependent functions */
/* Logical device BOX0002, can participate in boot */
0x15, 0x09, 0xf8, 0x00, 0x02, 0x01,
/* Compatible device PNPB02F */
0x1c, 0x41, 0xd0, 0xb0, 0x2f,
/* Start dependent functions, preferred */
0x31, 0x00,
/* I/O 0x200, decodes 16-bit, 8-byte alignment, 8 addresses */
0x47, 0x01, 0x00, 0x02, 0x00, 0x02, 0x08, 0x08,
/* Start dependent functions, acceptable */
0x30,
/* I/O 0x208, decodes 16-bit, 8-byte alignment, 8 addresses */
0x47, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x08,
/* Start dependent functions, sub-optimal */
0x31, 0x02,
/* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */
0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08,
/* End dependent functions */
0x38,
0x79, 0x00 /* end tag, dummy checksum (filled in by isapnp_add_card) */
/* End tag, dummy checksum (filled in by isapnp_add_card) */
0x79, 0x00
};
static const isapnp_device_config_t gameport_pnp_defaults[] = {
{.activate = 1,
{
.activate = 1,
.io = {
{ .base = 0x200 },
}
@@ -244,10 +259,8 @@ gameport_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), void *priv)
/* Read all axes. */
joystick->state |= 0x0f;
gameport_time(joystick, 0, joystick->intf->read_axis(joystick->dat, 0));
gameport_time(joystick, 1, joystick->intf->read_axis(joystick->dat, 1));
gameport_time(joystick, 2, joystick->intf->read_axis(joystick->dat, 2));
gameport_time(joystick, 3, joystick->intf->read_axis(joystick->dat, 3));
for (uint8_t i = 0; i < 4; i++)
gameport_time(joystick, i, joystick->intf->read_axis(joystick->dat, i));
/* Notify the interface. */
joystick->intf->write(joystick->dat);
@@ -384,20 +397,14 @@ gameport_init(const device_t *info)
if (!joystick_instance[0] && joystick_type) {
joystick_instance[0] = calloc(1, sizeof(joystick_instance_t));
joystick_instance[0]->axis[0].joystick = joystick_instance[0];
joystick_instance[0]->axis[1].joystick = joystick_instance[0];
joystick_instance[0]->axis[2].joystick = joystick_instance[0];
joystick_instance[0]->axis[3].joystick = joystick_instance[0];
// For each analog joystick axis
for (uint8_t i = 0; i < 4; i++) {
joystick_instance[0]->axis[i].joystick = joystick_instance[0];
joystick_instance[0]->axis[0].axis_nr = 0;
joystick_instance[0]->axis[1].axis_nr = 1;
joystick_instance[0]->axis[2].axis_nr = 2;
joystick_instance[0]->axis[3].axis_nr = 3;
joystick_instance[0]->axis[i].axis_nr = i;
timer_add(&joystick_instance[0]->axis[0].timer, timer_over, &joystick_instance[0]->axis[0], 0);
timer_add(&joystick_instance[0]->axis[1].timer, timer_over, &joystick_instance[0]->axis[1], 0);
timer_add(&joystick_instance[0]->axis[2].timer, timer_over, &joystick_instance[0]->axis[2], 0);
timer_add(&joystick_instance[0]->axis[3].timer, timer_over, &joystick_instance[0]->axis[3], 0);
timer_add(&joystick_instance[0]->axis[i].timer, timer_over, &joystick_instance[0]->axis[i], 0);
}
joystick_instance[0]->intf = joysticks[joystick_type].joystick;
joystick_instance[0]->dat = joystick_instance[0]->intf->init();
@@ -409,8 +416,8 @@ gameport_init(const device_t *info)
dev->len = (info->local >> 16) & 0xff;
gameport_remap(dev, info->local & 0xffff);
/* Register ISAPnP if this is a standard game port card. */
if ((info->local & 0xffff) == 0x200)
/* Register ISAPnP if this is a PNP game port card. */
if (info->local & GAMEPORT_PNPROM)
isapnp_set_device_defaults(isapnp_add_card(gameport_pnp_rom, sizeof(gameport_pnp_rom), gameport_pnp_config_changed, NULL, NULL, NULL, dev), 0, gameport_pnp_defaults);
return dev;
@@ -483,9 +490,23 @@ gameport_close(void *priv)
}
const device_t gameport_device = {
.name = "Game port",
.name = "86Box PNP Game port",
.internal_name = "gameport",
.flags = 0,
.local = GAMEPORT_PNPROM | GAMEPORT_8ADDR | 0x0200,
.init = gameport_init,
.close = gameport_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t gameport_200_device = {
.name = "Game port (Port 200h-207h)",
.internal_name = "gameport_200",
.flags = 0,
.local = GAMEPORT_8ADDR | 0x0200,
.init = gameport_init,
.close = gameport_close,
@@ -736,7 +757,7 @@ const device_t gameport_sio_device = {
const device_t gameport_sio_1io_device = {
.name = "Game port (Super I/O, 1 I/O port)",
.internal_name = "gameport_sio",
.internal_name = "gameport_sio_1io",
.flags = 0,
.local = GAMEPORT_SIO | GAMEPORT_1ADDR,
.init = gameport_init,
@@ -751,6 +772,7 @@ const device_t gameport_sio_1io_device = {
static const GAMEPORT gameports[] = {
{ &device_none },
{ &device_internal },
{ &gameport_200_device },
{ &gameport_device },
{ &gameport_208_device },
{ &gameport_pnp_device },
@@ -771,7 +793,7 @@ gameport_available(int port)
/* UI */
const device_t *
gameports_getdevice(int port)
gameport_getdevice(int port)
{
return (gameports[port].device);
}

View File

@@ -8,8 +8,6 @@
*
* Implementation of the Flight Stick Pro.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
@@ -138,7 +136,7 @@ ch_flightstick_pro_a0_over(UNUSED(void *priv))
//
}
const joystick_if_t joystick_ch_flightstick_pro = {
const joystick_t joystick_ch_flightstick_pro = {
.name = "CH Flightstick Pro",
.internal_name = "ch_flightstick_pro",
.init = ch_flightstick_pro_init,
@@ -156,7 +154,7 @@ const joystick_if_t joystick_ch_flightstick_pro = {
.pov_names = { "POV" }
};
const joystick_if_t joystick_ch_flightstick_pro_ch_pedals = {
const joystick_t joystick_ch_flightstick_pro_ch_pedals = {
.name = "CH Flightstick Pro + CH Pedals",
.internal_name = "ch_flightstick_pro_ch_pedals",
.init = ch_flightstick_pro_init,

View File

@@ -274,7 +274,7 @@ joystick_standard_a0_over(UNUSED(void *priv))
//
}
const joystick_if_t joystick_2axis_2button = {
const joystick_t joystick_2axis_2button = {
.name = "2-axis, 2-button joystick(s)",
.internal_name = "2axis_2button",
.init = joystick_standard_init,
@@ -292,7 +292,7 @@ const joystick_if_t joystick_2axis_2button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2button_gamepad = {
const joystick_t joystick_2button_gamepad = {
.name = "2-button gamepad(s)",
.internal_name = "2button_gamepad",
.init = joystick_standard_init,
@@ -310,7 +310,7 @@ const joystick_if_t joystick_2button_gamepad = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2button_flight_yoke = {
const joystick_t joystick_2button_flight_yoke = {
.name = "2-button flight yoke",
.internal_name = "2button_flight_yoke",
.init = joystick_standard_init,
@@ -328,7 +328,7 @@ const joystick_if_t joystick_2button_flight_yoke = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2axis_4button = {
const joystick_t joystick_2axis_4button = {
.name = "2-axis, 4-button joystick",
.internal_name = "2axis_4button",
.init = joystick_standard_init,
@@ -346,7 +346,7 @@ const joystick_if_t joystick_2axis_4button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_4button_gamepad = {
const joystick_t joystick_4button_gamepad = {
.name = "4-button gamepad",
.internal_name = "4button_gamepad",
.init = joystick_standard_init,
@@ -364,7 +364,7 @@ const joystick_if_t joystick_4button_gamepad = {
.pov_names = { NULL }
};
const joystick_if_t joystick_4button_flight_yoke = {
const joystick_t joystick_4button_flight_yoke = {
.name = "4-button flight yoke",
.internal_name = "4button_flight_yoke",
.init = joystick_standard_init,
@@ -382,7 +382,7 @@ const joystick_if_t joystick_4button_flight_yoke = {
.pov_names = { NULL }
};
const joystick_if_t joystick_3axis_2button = {
const joystick_t joystick_3axis_2button = {
.name = "3-axis, 2-button joystick",
.internal_name = "3axis_2button",
.init = joystick_standard_init,
@@ -400,7 +400,7 @@ const joystick_if_t joystick_3axis_2button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2button_yoke_throttle = {
const joystick_t joystick_2button_yoke_throttle = {
.name = "2-button flight yoke with throttle",
.internal_name = "2button_yoke_throttle",
.init = joystick_standard_init,
@@ -418,7 +418,7 @@ const joystick_if_t joystick_2button_yoke_throttle = {
.pov_names = { NULL }
};
const joystick_if_t joystick_3axis_4button = {
const joystick_t joystick_3axis_4button = {
.name = "3-axis, 4-button joystick",
.internal_name = "3axis_4button",
.init = joystick_standard_init,
@@ -436,7 +436,7 @@ const joystick_if_t joystick_3axis_4button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_4button_yoke_throttle = {
const joystick_t joystick_4button_yoke_throttle = {
.name = "4-button flight yoke with throttle",
.internal_name = "4button_yoke_throttle",
.init = joystick_standard_init,
@@ -454,7 +454,7 @@ const joystick_if_t joystick_4button_yoke_throttle = {
.pov_names = { NULL }
};
const joystick_if_t joystick_win95_steering_wheel = {
const joystick_t joystick_win95_steering_wheel = {
.name = "Win95 Steering Wheel (3-axis, 4-button)",
.internal_name = "win95_steering_wheel",
.init = joystick_standard_init,
@@ -472,7 +472,7 @@ const joystick_if_t joystick_win95_steering_wheel = {
.pov_names = { NULL }
};
const joystick_if_t joystick_4axis_4button = {
const joystick_t joystick_4axis_4button = {
.name = "4-axis, 4-button joystick",
.internal_name = "4axis_4button",
.init = joystick_standard_init,
@@ -490,7 +490,7 @@ const joystick_if_t joystick_4axis_4button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2axis_6button = {
const joystick_t joystick_2axis_6button = {
.name = "2-axis, 6-button joystick",
.internal_name = "2axis_6button",
.init = joystick_standard_init,
@@ -508,7 +508,7 @@ const joystick_if_t joystick_2axis_6button = {
.pov_names = { NULL }
};
const joystick_if_t joystick_2axis_8button = {
const joystick_t joystick_2axis_8button = {
.name = "2-axis, 8-button joystick",
.internal_name = "2axis_8button",
.init = joystick_standard_init,

View File

@@ -29,8 +29,6 @@
* - Some DOS stuff will write to 0x201 while a packet is
* being transferred. This seems to be ignored.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
@@ -244,7 +242,7 @@ sw_a0_over(void *priv)
timer_set_delay_u64(&sw->trigger_timer, TIMER_USEC * 10000);
}
const joystick_if_t joystick_sw_pad = {
const joystick_t joystick_sw_pad = {
.name = "Microsoft SideWinder Pad",
.internal_name = "sidewinder_pad",
.init = sw_init,

View File

@@ -8,8 +8,6 @@
*
* Implementation of Thrust Master Flight Control System.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
@@ -148,7 +146,7 @@ tm_fcs_a0_over(UNUSED(void *priv))
//
}
const joystick_if_t joystick_tm_fcs = {
const joystick_t joystick_tm_fcs = {
.name = "Thrustmaster Flight Control System",
.internal_name = "thrustmaster_fcs",
.init = tm_fcs_init,
@@ -166,7 +164,7 @@ const joystick_if_t joystick_tm_fcs = {
.pov_names = { "POV" }
};
const joystick_if_t joystick_tm_fcs_rcs = {
const joystick_t joystick_tm_fcs_rcs = {
.name = "Thrustmaster FCS + Rudder Control System",
.internal_name = "thrustmaster_fcs_rcs",
.init = tm_fcs_init,

View File

@@ -75,7 +75,7 @@ void pc_cas_del(pc_cassette_t *cas);
* @short Set the cassette file
* @return True on error, false otherwise
*****************************************************************************/
int pc_cas_set_fname(pc_cassette_t *cas, const char *fname);
int pc_cas_set_fname(pc_cassette_t *cas, char *fname);
/*!***************************************************************************
* @short Get the cassette mode

View File

@@ -51,8 +51,9 @@
#define GAMEPORT_6ADDR 0x060000
#define GAMEPORT_8ADDR 0x080000
#define GAMEPORT_SIO 0x1000000
#define GAMEPORT_PNPROM 0x2000000
typedef struct joystick_if_t {
typedef struct joystick_t {
const char *name;
const char *internal_name;
@@ -70,9 +71,9 @@ typedef struct joystick_if_t {
const char *axis_names[MAX_JOY_AXES];
const char *button_names[MAX_JOY_BUTTONS];
const char *pov_names[MAX_JOY_POVS];
} joystick_if_t;
} joystick_t;
typedef struct plat_joystick_t {
typedef struct plat_joystick_state_t {
char name[260];
int a[MAX_JOY_AXES];
@@ -97,9 +98,9 @@ typedef struct plat_joystick_t {
int nr_axes;
int nr_buttons;
int nr_povs;
} plat_joystick_t;
} plat_joystick_state_t;
typedef struct joystick_t {
typedef struct joystick_state_t {
int axis[MAX_JOY_AXES];
int button[MAX_JOY_BUTTONS];
int pov[MAX_JOY_POVS];
@@ -108,7 +109,7 @@ typedef struct joystick_t {
int axis_mapping[MAX_JOY_AXES];
int button_mapping[MAX_JOY_BUTTONS];
int pov_mapping[MAX_JOY_POVS][2];
} joystick_t;
} joystick_state_t;
extern device_t game_ports[GAMEPORT_MAX];
@@ -126,6 +127,7 @@ extern int gameport_get_from_internal_name(const char *str);
#ifdef EMU_DEVICE_H
extern const device_t gameport_device;
extern const device_t gameport_200_device;
extern const device_t gameport_201_device;
extern const device_t gameport_203_device;
extern const device_t gameport_205_device;
@@ -144,10 +146,10 @@ extern const device_t gameport_sio_1io_device;
extern const device_t *standalone_gameport_type;
#endif
extern int gameport_instance_id;
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
extern int joysticks_present;
extern int gameport_instance_id;
extern plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
extern int joysticks_present;
extern int joystick_type;
@@ -170,28 +172,28 @@ extern void gameport_update_joystick_type(void);
extern void gameport_remap(void *priv, uint16_t address);
extern void *gameport_add(const device_t *gameport_type);
extern const joystick_if_t joystick_2axis_2button;
extern const joystick_if_t joystick_2button_gamepad;
extern const joystick_if_t joystick_2button_flight_yoke;
extern const joystick_if_t joystick_2axis_4button;
extern const joystick_if_t joystick_4button_gamepad;
extern const joystick_if_t joystick_4button_flight_yoke;
extern const joystick_if_t joystick_3axis_2button;
extern const joystick_if_t joystick_2button_yoke_throttle;
extern const joystick_if_t joystick_3axis_4button;
extern const joystick_if_t joystick_4button_yoke_throttle;
extern const joystick_if_t joystick_win95_steering_wheel;
extern const joystick_if_t joystick_4axis_4button;
extern const joystick_if_t joystick_2axis_6button;
extern const joystick_if_t joystick_2axis_8button;
extern const joystick_t joystick_2axis_2button;
extern const joystick_t joystick_2button_gamepad;
extern const joystick_t joystick_2button_flight_yoke;
extern const joystick_t joystick_2axis_4button;
extern const joystick_t joystick_4button_gamepad;
extern const joystick_t joystick_4button_flight_yoke;
extern const joystick_t joystick_3axis_2button;
extern const joystick_t joystick_2button_yoke_throttle;
extern const joystick_t joystick_3axis_4button;
extern const joystick_t joystick_4button_yoke_throttle;
extern const joystick_t joystick_win95_steering_wheel;
extern const joystick_t joystick_4axis_4button;
extern const joystick_t joystick_2axis_6button;
extern const joystick_t joystick_2axis_8button;
extern const joystick_if_t joystick_ch_flightstick_pro;
extern const joystick_if_t joystick_ch_flightstick_pro_ch_pedals;
extern const joystick_t joystick_ch_flightstick_pro;
extern const joystick_t joystick_ch_flightstick_pro_ch_pedals;
extern const joystick_if_t joystick_sw_pad;
extern const joystick_t joystick_sw_pad;
extern const joystick_if_t joystick_tm_fcs;
extern const joystick_if_t joystick_tm_fcs_rcs;
extern const joystick_t joystick_tm_fcs;
extern const joystick_t joystick_tm_fcs_rcs;
#ifdef __cplusplus
}

View File

@@ -19,8 +19,8 @@
#include <86box/rom.h>
#define INT_START_BLKNK_ENAB (1 << 0)
#define INT_MASK 0xf
#define XGA_INT_START_BLKNK_ENAB (1 << 0)
#define XGA_INT_MASK 0xf
typedef struct xga_hwcursor_t {
int ena;
@@ -152,10 +152,9 @@ typedef struct xga_t {
int cursor_data_on;
int pal_test;
int a5_test;
int test_stage;
int type;
int bus;
int src_reverse_order;
int dst_reverse_order;
uint32_t linear_base;
uint32_t linear_size;
@@ -175,6 +174,7 @@ typedef struct xga_t {
uint32_t px_map_base;
uint32_t pallook[512];
uint32_t bios_diag;
uint32_t mapping_base;
PALETTE xgapal;

View File

@@ -2997,7 +2997,7 @@ machine_amstrad_init(const machine_t *model, int type)
mouse_set_poll(ms_poll, ams);
}
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
}
int

View File

@@ -995,7 +995,7 @@ machine_tandy1k_init(const machine_t *model, int type)
break;
}
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
eep_data_out = 0x0000;
}

View File

@@ -57,7 +57,7 @@ machine_xt_common_init(const machine_t *model, int fixed_floppy)
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
nmi_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
}
static const device_config_t ibmpc_config[] = {
@@ -690,7 +690,7 @@ machine_xt_tuliptc8_init(const machine_t *model)
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
nmi_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
device_add(&amstrad_megapc_nvr_device);

View File

@@ -56,7 +56,7 @@ machine_xt_compaq_deskpro_init(const machine_t *model)
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_xt_device);
nmi_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
lpt1_remove();
lpt1_setup(LPT_MDA_ADDR);
@@ -84,7 +84,7 @@ machine_xt_compaq_portable_init(const machine_t *model)
device_add(&fdc_xt_device);
nmi_init();
if (joystick_type)
device_add(&gameport_device);
device_add(&gameport_200_device);
lpt1_remove();
lpt1_setup(LPT_MDA_ADDR);

View File

@@ -464,7 +464,7 @@ machine_xt_laserxt_common_init(const machine_t *model,int is_lxt3)
device_add(&fdc_xt_device);
nmi_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
device_add(is_lxt3 ? &lxt3_device : &laserxt_device);

View File

@@ -2325,7 +2325,7 @@ machine_xt_m24_init(const machine_t *model)
/* Address 66-67 = mainboard dip-switch settings */
io_sethandler(0x0065, 3, m24_read, NULL, NULL, NULL, NULL, NULL, NULL);
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
nmi_init();
@@ -2397,7 +2397,7 @@ machine_xt_m240_init(const machine_t *model)
device_add(&fdc_at_device); /* io.c logs clearly show it using port 3F7 */
if (joystick_type)
device_add(&gameport_device);
device_add(&gameport_200_device);
nmi_init();

View File

@@ -158,7 +158,7 @@ machine_xt_philips_common_init(const machine_t *model)
nmi_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
device_add(&keyboard_pc_device);

View File

@@ -209,7 +209,7 @@ machine_xt_xi8088_init(const machine_t *model)
nmi_init();
device_add(&ibmat_nvr_device);
pic2_init();
standalone_gameport_type = &gameport_device;
standalone_gameport_type = &gameport_200_device;
device_add(&sst_flash_39sf010_device);
return ret;

BIN
src/qt/icons/browse.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/eject.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/export.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/mo_image.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/new.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/record.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/rewind.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/superdisk.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/qt/icons/zip_image.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -14,6 +14,14 @@ getIndicatorIcon(IconIndicator indicator)
return QIcon(":/settings/qt/icons/disabled.ico");
case WriteProtected:
return QIcon(":/settings/qt/icons/write_protected.ico");
case New:
return QIcon(":/settings/qt/icons/new.ico");
case Browse:
return QIcon(":/settings/qt/icons/browse.ico");
case Eject:
return QIcon(":/settings/qt/icons/eject.ico");
case Export:
return QIcon(":/settings/qt/icons/eject.ico");
default:
return QIcon();
}
@@ -30,12 +38,18 @@ getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode,
auto painter = QPainter(&iconPixmap);
auto indicatorPixmap = getIndicatorIcon((indicator == ReadWriteActive || indicator == WriteProtectedActive) ? Active : indicator).pixmap(size);
if (indicator == WriteProtectedBrowse)
indicatorPixmap = getIndicatorIcon(WriteProtected).pixmap(size);
painter.drawPixmap(0, 0, indicatorPixmap);
if (indicator == ReadWriteActive || indicator == WriteProtectedActive) {
if ((indicator == ReadWriteActive) || (indicator == WriteProtectedActive)) {
auto writeIndicatorPixmap = getIndicatorIcon(indicator == WriteProtectedActive ? WriteProtected : WriteActive).pixmap(size);
painter.drawPixmap(0, 0, writeIndicatorPixmap);
} else if (indicator == WriteProtectedBrowse) {
auto browseIndicatorPixmap = getIndicatorIcon(Browse).pixmap(size);
painter.drawPixmap(0, 0, browseIndicatorPixmap);
}
painter.end();
return iconPixmap;
}
}

View File

@@ -12,6 +12,11 @@ enum IconIndicator {
Disabled,
WriteProtected,
WriteProtectedActive,
New,
Browse,
WriteProtectedBrowse,
Export,
Eject
};
QPixmap getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode, IconIndicator indicator);

View File

@@ -617,7 +617,12 @@ MachineStatus::refresh(QStatusBar *sbar)
if (cassette_enable) {
d->cassette.label = std::make_unique<ClickableLabel>();
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
d->cassette.setWriteProtected(cassette_ui_writeprot);
if (QString(cassette_fname).isEmpty())
d->cassette.setWriteProtected(false);
else if (QString(cassette_fname).left(5) == "wp://")
d->cassette.setWriteProtected(true);
else
d->cassette.setWriteProtected(cassette_ui_writeprot);
d->cassette.refresh();
connect((ClickableLabel *) d->cassette.label.get(), &ClickableLabel::clicked, [](QPoint pos) {
MediaMenu::ptr->cassetteMenu->popup(pos - QPoint(0, MediaMenu::ptr->cassetteMenu->sizeHint().height()));
@@ -658,7 +663,12 @@ MachineStatus::refresh(QStatusBar *sbar)
}
d->fdd[i].label = std::make_unique<ClickableLabel>();
d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty());
d->fdd[i].setWriteProtected(ui_writeprot[i]);
if (QString(floppyfns[i]).isEmpty())
d->fdd[i].setWriteProtected(false);
else if (QString(floppyfns[i]).left(5) == "wp://")
d->fdd[i].setWriteProtected(true);
else
d->fdd[i].setWriteProtected(ui_writeprot[i]);
d->fdd[i].setActive(false);
d->fdd[i].setWriteActive(false);
d->fdd[i].refresh();
@@ -693,7 +703,12 @@ MachineStatus::refresh(QStatusBar *sbar)
iterateZIP([this, sbar](int i) {
d->zip[i].label = std::make_unique<ClickableLabel>();
d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty());
d->zip[i].setWriteProtected(zip_drives[i].read_only);
if (QString(zip_drives[i].image_path).isEmpty())
d->zip[i].setWriteProtected(false);
else if (QString(zip_drives[i].image_path).left(5) == "wp://")
d->zip[i].setWriteProtected(true);
else
d->zip[i].setWriteProtected(zip_drives[i].read_only);
d->zip[i].setActive(false);
d->zip[i].setWriteActive(false);
d->zip[i].refresh();
@@ -711,7 +726,12 @@ MachineStatus::refresh(QStatusBar *sbar)
iterateMO([this, sbar](int i) {
d->mo[i].label = std::make_unique<ClickableLabel>();
d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty());
d->mo[i].setWriteProtected(mo_drives[i].read_only);
if (QString(zip_drives[i].image_path).isEmpty())
d->mo[i].setWriteProtected(false);
else if (QString(zip_drives[i].image_path).left(5) == "wp://")
d->mo[i].setWriteProtected(true);
else
d->mo[i].setWriteProtected(zip_drives[i].read_only);
d->mo[i].setActive(false);
d->mo[i].setWriteActive(false);
d->mo[i].refresh();

View File

@@ -21,6 +21,9 @@
#include <QStringBuilder>
#include <utility>
#include "qt_mediahistorymanager.hpp"
#ifdef Q_OS_WINDOWS
#include <windows.h>
#endif
extern "C" {
#include <86box/timer.h>
@@ -205,6 +208,8 @@ MediaHistoryManager::initialDeduplication()
break;
}
deduplicateList(device_history, QVector<QString>(1, current_image));
device_history = removeMissingImages(device_history);
device_history = pathAdjustFull(device_history);
// Fill in missing, if any
int missing = MAX_PREV_IMAGES - device_history.size();
if (missing) {
@@ -213,6 +218,7 @@ MediaHistoryManager::initialDeduplication()
}
}
setHistoryListForDeviceIndex(device_index, device_type, device_history);
serializeImageHistoryType(device_type);
}
}
}
@@ -343,24 +349,42 @@ MediaHistoryManager::removeMissingImages(device_index_list_t &device_history)
char temp[MAX_IMAGE_PATH_LEN * 2] = { 0 };
if (path_abs(checked_path.toUtf8().data())) {
if (checked_path.length() > (MAX_IMAGE_PATH_LEN - 1))
fatal("removeMissingImages(): checked_path.length() > %i\n", MAX_IMAGE_PATH_LEN - 1);
else
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s", checked_path.toUtf8().constData());
if (checked_path.left(8) == "ioctl://") {
strncpy(temp, checked_path.toUtf8().data(), sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
} else {
if ((strlen(usr_path) + strlen(path_get_slash(usr_path)) + checked_path.length()) > (MAX_IMAGE_PATH_LEN - 1))
fatal("removeMissingImages(): Combined absolute path length > %i\n", MAX_IMAGE_PATH_LEN - 1);
QString path_only;
if (checked_path.left(5) == "wp://")
path_only = checked_path.right(checked_path.length() - 5);
else
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), checked_path.toUtf8().constData());
path_only = checked_path;
if (path_abs(path_only.toUtf8().data())) {
if (path_only.length() > (MAX_IMAGE_PATH_LEN - 1))
fatal("removeMissingImages(): path_only.length() > %i\n", MAX_IMAGE_PATH_LEN - 1);
else
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s", path_only.toUtf8().constData());
} else {
if ((strlen(usr_path) + strlen(path_get_slash(usr_path)) + path_only.length()) > (MAX_IMAGE_PATH_LEN - 1))
fatal("removeMissingImages(): Combined absolute path length > %i\n", MAX_IMAGE_PATH_LEN - 1);
else
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), path_only.toUtf8().constData());
}
path_normalize(temp);
}
path_normalize(temp);
QString qstr = QString::fromUtf8(temp);
QFileInfo new_fi(qstr);
if ((new_fi.filePath().left(8) != "ioctl://") && !new_fi.exists()) {
bool file_exists = new_fi.exists();
#ifdef Q_OS_WINDOWS
if (new_fi.filePath().left(8) == "ioctl://")
file_exists = (GetDriveType(new_fi.filePath().right(2).toUtf8().data()) == DRIVE_CDROM);
#endif
if (!file_exists) {
qWarning("Image file %s does not exist - removing from history", qPrintable(new_fi.filePath()));
checked_path = "";
}

View File

@@ -69,9 +69,12 @@ extern "C" {
#include "qt_deviceconfig.hpp"
#include "qt_mediahistorymanager.hpp"
#include "qt_mediamenu.hpp"
#include "qt_iconindicators.hpp"
std::shared_ptr<MediaMenu> MediaMenu::ptr;
static QSize pixmap_size(16, 16);
MediaMenu::MediaMenu(QWidget *parent)
: QObject(parent)
{
@@ -86,27 +89,28 @@ MediaMenu::refresh(QMenu *parentMenu)
if (MachineStatus::hasCassette()) {
cassetteMenu = parentMenu->addMenu("");
cassetteMenu->addAction(tr("&New image..."), [this]() { cassetteNewImage(); });
QIcon img_icon = QIcon(":/settings/qt/icons/cassette_image.ico");
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this]() { cassetteNewImage(); });
cassetteMenu->addSeparator();
cassetteMenu->addAction(tr("&Existing image..."), [this]() { cassetteSelectImage(false); });
cassetteMenu->addAction(tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this]() { cassetteSelectImage(false); });
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
cassetteMenu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
cassetteImageHistoryPos[slot] = cassetteMenu->children().count();
cassetteMenu->addAction(tr("Image %1").arg(slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
cassetteMenu->addAction(img_icon, tr("Image %1").arg(slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
}
cassetteMenu->addSeparator();
cassetteRecordPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("&Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
cassetteMenu->addAction(QIcon(":/settings/qt/icons/record.ico"), tr("&Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
cassettePlayPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("&Play"), [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
cassetteMenu->addAction(QIcon(":/menuicons/qt/icons/run.ico"), tr("&Play"), [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
cassetteRewindPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("&Rewind to the beginning"), [] { pc_cas_rewind(cassette); });
cassetteMenu->addAction(QIcon(":/settings/qt/icons/rewind.ico"), tr("&Rewind to the beginning"), [] { pc_cas_rewind(cassette); });
cassetteFastFwdPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("&Fast forward to the end"), [] { pc_cas_append(cassette); });
cassetteMenu->addAction(QIcon(":/settings/qt/icons/fast_forward.ico"), tr("&Fast forward to the end"), [] { pc_cas_append(cassette); });
cassetteMenu->addSeparator();
cassetteEjectPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("E&ject"), [this]() { cassetteEject(); });
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this]() { cassetteEject(); });
cassetteUpdateMenu();
}
@@ -114,15 +118,16 @@ MediaMenu::refresh(QMenu *parentMenu)
if (machine_has_cartridge(machine)) {
for (int i = 0; i < 2; i++) {
auto *menu = parentMenu->addMenu("");
menu->addAction(tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
QIcon img_icon = QIcon(":/settings/qt/icons/cartridge_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
menu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
cartridgeImageHistoryPos[slot] = menu->children().count();
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
}
menu->addSeparator();
cartridgeEjectPos = menu->children().count();
menu->addAction(tr("E&ject"), [this, i]() { cartridgeEject(i); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { cartridgeEject(i); });
cartridgeMenus[i] = menu;
cartridgeUpdateMenu(i);
}
@@ -131,21 +136,23 @@ MediaMenu::refresh(QMenu *parentMenu)
floppyMenus.clear();
MachineStatus::iterateFDD([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
menu->addAction(tr("&New image..."), [this, i]() { floppyNewImage(i); });
QIcon img_icon = fdd_is_525(i) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
QIcon(":/settings/qt/icons/floppy_35_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { floppyNewImage(i); });
menu->addSeparator();
menu->addAction(tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); });
menu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
floppyImageHistoryPos[slot] = menu->children().count();
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
}
menu->addSeparator();
floppyExportPos = menu->children().count();
menu->addAction(tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Export), tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); });
menu->addSeparator();
floppyEjectPos = menu->children().count();
menu->addAction(tr("E&ject"), [this, i]() { floppyEject(i); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { floppyEject(i); });
floppyMenus[i] = menu;
floppyUpdateMenu(i);
});
@@ -156,8 +163,8 @@ MediaMenu::refresh(QMenu *parentMenu)
cdromMutePos = menu->children().count();
menu->addAction(QIcon(":/settings/qt/icons/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
menu->addSeparator();
menu->addAction(QIcon(":/settings/qt/icons/cdrom_image.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
menu->addAction(QIcon(":/settings/qt/icons/cdrom_folder.ico"), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_image.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_folder.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
menu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
cdromImageHistoryPos[slot] = menu->children().count();
@@ -183,18 +190,19 @@ MediaMenu::refresh(QMenu *parentMenu)
zipMenus.clear();
MachineStatus::iterateZIP([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
menu->addAction(tr("&New image..."), [this, i]() { zipNewImage(i); });
QIcon img_icon = QIcon(":/settings/qt/icons/zip_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { zipNewImage(i); });
menu->addSeparator();
menu->addAction(tr("&Existing image..."), [this, i]() { zipSelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { zipSelectImage(i, true); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { zipSelectImage(i, false); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { zipSelectImage(i, true); });
menu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
zipImageHistoryPos[slot] = menu->children().count();
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
}
menu->addSeparator();
zipEjectPos = menu->children().count();
menu->addAction(tr("E&ject"), [this, i]() { zipEject(i); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { zipEject(i); });
zipMenus[i] = menu;
zipUpdateMenu(i);
});
@@ -202,18 +210,19 @@ MediaMenu::refresh(QMenu *parentMenu)
moMenus.clear();
MachineStatus::iterateMO([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
menu->addAction(tr("&New image..."), [this, i]() { moNewImage(i); });
QIcon img_icon = QIcon(":/settings/qt/icons/mo_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { moNewImage(i); });
menu->addSeparator();
menu->addAction(tr("&Existing image..."), [this, i]() { moSelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { moSelectImage(i, false); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); });
menu->addSeparator();
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
moImageHistoryPos[slot] = menu->children().count();
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
}
menu->addSeparator();
moEjectPos = menu->children().count();
menu->addAction(tr("E&ject"), [this, i]() { moEject(i); });
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { moEject(i); });
moMenus[i] = menu;
moUpdateMenu(i);
});
@@ -277,6 +286,12 @@ MediaMenu::cassetteMount(const QString &filename, bool wp)
if (!filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
if (filename.left(5) == "wp://")
cassette_ui_writeprot = 1;
else if (cassette_ui_writeprot)
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
strncpy(cassette_fname, filenameBytes.data(), sizeof(cassette_fname) - 1);
pc_cas_set_fname(cassette, cassette_fname);
}
@@ -444,11 +459,18 @@ MediaMenu::floppyMount(int i, const QString &filename, bool wp)
ui_writeprot[i] = wp ? 1 : 0;
if (!filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
if (filename.left(5) == "wp://")
ui_writeprot[i] = 1;
else if (ui_writeprot[i])
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
fdd_load(i, filenameBytes.data());
}
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), QString(filenameBytes));
} else
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), filename);
ui_sb_update_icon_state(SB_FLOPPY | i, filename.isEmpty() ? 1 : 0);
ui_sb_update_icon_wp(SB_FLOPPY | i, ui_writeprot[i]);
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), filename);
floppyUpdateMenu(i);
ui_sb_update_tip(SB_FLOPPY | i);
config_save();
@@ -569,13 +591,13 @@ MediaMenu::cdromMount(int i, int dir, const QString &arg)
QFileInfo fi(cdrom[i].image_path);
if (dir > 1)
filename = QString::asprintf(R"(ioctl://%s)", arg.toStdString().c_str());
filename = QString::asprintf(R"(ioctl://%s)", arg.toUtf8().data());
else if (dir == 1)
filename = QFileDialog::getExistingDirectory(parentWidget);
else {
filename = QFileDialog::getOpenFileName(parentWidget, QString(),
QString(),
tr("CD-ROM images") % util::DlgFilter({ "iso", "cue" }) % tr("All files") % util::DlgFilter({ "*" }, true));
tr("CD-ROM images") % util::DlgFilter({ "iso", "cue", "mds" }) % tr("All files") % util::DlgFilter({ "*" }, true));
}
if (filename.isEmpty())
@@ -641,8 +663,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
menu = cassetteMenu;
children = menu->children();
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cassetteImageHistoryPos[slot]]);
fi.setFile(fn);
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
menu_icon = QIcon(":/settings/qt/icons/cassette_image.ico");
if (fn.left(5) == "wp://")
fi.setFile(fn.right(fn.length() - 5));
else
fi.setFile(fn);
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
} else {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
imageHistoryUpdatePos->setIcon(menu_icon);
}
break;
case ui::MediaType::Cartridge:
if (!machine_has_cartridge(machine))
@@ -659,8 +691,19 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
menu = floppyMenus[index];
children = menu->children();
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[floppyImageHistoryPos[slot]]);
fi.setFile(fn);
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
menu_icon = fdd_is_525(index) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
QIcon(":/settings/qt/icons/floppy_35_image.ico");
if (fn.left(5) == "wp://")
fi.setFile(fn.right(fn.length() - 5));
else
fi.setFile(fn);
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
} else {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
imageHistoryUpdatePos->setIcon(menu_icon);
}
break;
case ui::MediaType::Optical:
if (!cdromMenus.contains(index))
@@ -688,8 +731,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
menu = zipMenus[index];
children = menu->children();
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[zipImageHistoryPos[slot]]);
fi.setFile(fn);
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
menu_icon = QIcon(":/settings/qt/icons/mo_image.ico");
if (fn.left(5) == "wp://")
fi.setFile(fn.right(fn.length() - 5));
else
fi.setFile(fn);
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
} else {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
imageHistoryUpdatePos->setIcon(menu_icon);
}
break;
case ui::MediaType::Mo:
if (!moMenus.contains(index))
@@ -697,8 +750,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
menu = moMenus[index];
children = menu->children();
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[moImageHistoryPos[slot]]);
fi.setFile(fn);
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
menu_icon = QIcon(":/settings/qt/icons/mo_image.ico");
if (fn.left(5) == "wp://")
fi.setFile(fn.right(fn.length() - 5));
else
fi.setFile(fn);
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
} else {
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
imageHistoryUpdatePos->setIcon(menu_icon);
}
break;
}
@@ -749,9 +812,12 @@ MediaMenu::cdromUpdateMenu(int i)
menu_item_name = name.isEmpty() ? QString() : fi.fileName();
name2 = name;
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
if (name.isEmpty())
menu_icon = QIcon(":/settings/qt/icons/cdrom.ico");
else
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
}
ejectMenu->setIcon(menu_icon);
ejectMenu->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, Eject));
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(menu_item_name));
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
@@ -812,6 +878,12 @@ MediaMenu::zipMount(int i, const QString &filename, bool wp)
zip_drives[i].read_only = wp;
if (!filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
if (filename.left(5) == "wp://")
zip_drives[i].read_only = 1;
else if (zip_drives[i].read_only)
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
zip_load(dev, filenameBytes.data(), 1);
/* Signal media change to the emulated machine. */
@@ -951,6 +1023,12 @@ MediaMenu::moMount(int i, const QString &filename, bool wp)
mo_drives[i].read_only = wp;
if (!filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
if (filename.left(5) == "wp://")
mo_drives[i].read_only = 1;
else if (mo_drives[i].read_only)
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
mo_load(dev, filenameBytes.data(), 1);
/* Signal media change to the emulated machine. */

View File

@@ -33,10 +33,10 @@
#include <86box/gameport.h>
#include <86box/plat_unused.h>
int joysticks_present = 0;
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
int joysticks_present = 0;
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
#ifndef M_PI
# define M_PI 3.14159265358979323846

View File

@@ -96,15 +96,15 @@ typedef struct {
} pov[MAX_JOY_POVS];
} raw_joystick_t;
int joysticks_present = 0;
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
int joysticks_present = 0;
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
raw_joystick_t raw_joystick_state[MAX_PLAT_JOYSTICKS];
/* We only use the first 32 buttons reported, from Usage ID 1-128 */
void
joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, USAGE usage)
{
if (joy->nr_buttons >= MAX_JOY_BUTTONS)
return;
@@ -117,7 +117,7 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
}
void
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PHIDP_VALUE_CAPS prop)
{
if (joy->nr_axes >= MAX_JOY_AXES)
return;
@@ -202,7 +202,7 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
}
void
joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PHIDP_VALUE_CAPS prop)
{
if (joy->nr_povs >= MAX_JOY_POVS)
return;
@@ -217,7 +217,7 @@ joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
}
void
joystick_get_capabilities(raw_joystick_t *rawjoy, plat_joystick_t *joy)
joystick_get_capabilities(raw_joystick_t *rawjoy, plat_joystick_state_t *joy)
{
UINT size = 0;
PHIDP_BUTTON_CAPS btn_caps = NULL;
@@ -276,7 +276,7 @@ end:
}
void
joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_t *joy, PRID_DEVICE_INFO info)
joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PRID_DEVICE_INFO info)
{
UINT size = 0;
WCHAR *device_name = NULL;
@@ -340,9 +340,9 @@ joystick_init(void)
if (info->hid.usUsage != HID_USAGE_GENERIC_JOYSTICK && info->hid.usUsage != HID_USAGE_GENERIC_GAMEPAD)
goto end_loop;
plat_joystick_t *joy = &plat_joystick_state[joysticks_present];
raw_joystick_t *rawjoy = &raw_joystick_state[joysticks_present];
rawjoy->hdevice = deviceList[i].hDevice;
plat_joystick_state_t *joy = &plat_joystick_state[joysticks_present];
raw_joystick_t *rawjoy = &raw_joystick_state[joysticks_present];
rawjoy->hdevice = deviceList[i].hDevice;
joystick_get_capabilities(rawjoy, joy);
joystick_get_device_name(rawjoy, joy, info);

View File

@@ -1,6 +1,9 @@
<RCC>
<qresource prefix="/settings">
<file>qt/icons/browse.ico</file>
<file>qt/icons/cartridge.ico</file>
<file>qt/icons/cartridge_image.ico</file>
<file>qt/icons/cassette_image.ico</file>
<file>qt/icons/cassette.ico</file>
<file>qt/icons/cdrom.ico</file>
<file>qt/icons/cdrom_disabled.ico</file>
@@ -10,22 +13,35 @@
<file>qt/icons/cdrom_folder.ico</file>
<file>qt/icons/cdrom_host.ico</file>
<file>qt/icons/display.ico</file>
<file>qt/icons/eject.ico</file>
<file>qt/icons/export.ico</file>
<file>qt/icons/fast_forward.ico</file>
<file>qt/icons/floppy_35.ico</file>
<file>qt/icons/floppy_35_image.ico</file>
<file>qt/icons/floppy_525.ico</file>
<file>qt/icons/floppy_525_image.ico</file>
<file>qt/icons/floppy_and_cdrom_drives.ico</file>
<file>qt/icons/floppy_disabled.ico</file>
<file>qt/icons/hard_disk.ico</file>
<file>qt/icons/input_devices.ico</file>
<file>qt/icons/machine.ico</file>
<file>qt/icons/mo.ico</file>
<file>qt/icons/mo_image.ico</file>
<file>qt/icons/mo_disabled.ico</file>
<file>qt/icons/network.ico</file>
<file>qt/icons/new.ico</file>
<file>qt/icons/other_peripherals.ico</file>
<file>qt/icons/other_removable_devices.ico</file>
<file>qt/icons/ports.ico</file>
<file>qt/icons/record.ico</file>
<file>qt/icons/rewind.ico</file>
<file>qt/icons/sound.ico</file>
<file>qt/icons/storage_controllers.ico</file>
<file>qt/icons/superdisk.ico</file>
<file>qt/icons/superdisk_image.ico</file>
<file>qt/icons/superdisk_disabled.ico</file>
<file>qt/icons/zip.ico</file>
<file>qt/icons/zip_image.ico</file>
<file>qt/icons/zip_disabled.ico</file>
<file>qt/icons/active.ico</file>
<file>qt/icons/write_protected.ico</file>

View File

@@ -2874,9 +2874,8 @@ sb_init(UNUSED(const device_t *info))
sb_ct1335_mixer_reset(sb);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
/* DSP I/O handler is activated in sb_dsp_setaddr */
@@ -2959,9 +2958,8 @@ sb_mcv_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
return sb;
@@ -3047,9 +3045,8 @@ sb_pro_v1_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
return sb;
@@ -3107,9 +3104,8 @@ sb_pro_v2_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
return sb;
@@ -3146,9 +3142,8 @@ sb_pro_mcv_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
return sb;
@@ -3241,9 +3236,8 @@ sb_16_init(UNUSED(const device_t *info))
gameport_remap(sb->gameport, sb->gameport_addr);
} else {
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
}
@@ -3279,7 +3273,7 @@ sb_16_reply_mca_init(UNUSED(const device_t *info))
if (device_get_config_int("receive_input"))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
/* I/O handlers activated in sb_pro_mcv_write */
mca_add(sb_16_reply_mca_read, sb_16_reply_mca_write, sb_mcv_feedb, NULL, sb);
@@ -3645,9 +3639,8 @@ sb_awe32_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
if (device_get_config_int("gameport")) {
sb->gameport = gameport_add(&gameport_device);
sb->gameport = gameport_add(&gameport_200_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
}
return sb;
@@ -3911,9 +3904,8 @@ ess_x688_init(UNUSED(const device_t *info))
}
if (device_get_config_int("gameport")) {
ess->gameport = gameport_add(&gameport_device);
ess->gameport = gameport_add(&gameport_200_device);
ess->gameport_addr = 0x200;
gameport_remap(ess->gameport, ess->gameport_addr);
}
if (ide_base > 0x0000) {
@@ -4060,7 +4052,7 @@ ess_x688_mca_init(UNUSED(const device_t *info))
sb_dsp_set_mpu(&ess->dsp, ess->mpu);
}
ess->gameport = gameport_add(&gameport_device);
ess->gameport = gameport_add(&gameport_200_device);
mpu401_change_addr(ess->mpu, 0);

View File

@@ -64,8 +64,8 @@ int fixed_size_x = 640;
int fixed_size_y = 480;
extern int title_set;
extern wchar_t sdl_win_title[512];
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
int joysticks_present;
SDL_mutex *blitmtx;
SDL_threadID eventthread;

View File

@@ -37,6 +37,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
#include <86box/vid_ati_eeprom.h>
@@ -586,6 +587,7 @@ void
mach64_updatemapping(mach64_t *mach64)
{
svga_t *svga = &mach64->svga;
xga_t *xga = (xga_t *) svga->xga;
if (mach64->pci && !(mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) {
mach64_log("Update mapping - PCI disabled\n");
@@ -611,6 +613,8 @@ mach64_updatemapping(mach64_t *mach64)
mem_mapping_set_p(&svga->mapping, mach64);
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL))
xga->on = 0;
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_handler(&svga->mapping, svga_read, svga_readw, svga_readl, svga_write, svga_writew, svga_writel);

View File

@@ -6218,6 +6218,7 @@ static void
mach32_updatemapping(mach_t *mach, svga_t *svga)
{
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
xga_t *xga = (xga_t *) svga->xga;
if (mach->pci_bus && (!(mach->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM))) {
mach_log("No Mapping.\n");
@@ -6238,6 +6239,11 @@ mach32_updatemapping(mach_t *mach, svga_t *svga)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga_read, svga_readw, svga_readl, svga_write, svga_writew, svga_writel);
mem_mapping_set_p(&svga->mapping, svga);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);

View File

@@ -1703,6 +1703,7 @@ static void
gd543x_recalc_mapping(gd54xx_t *gd54xx)
{
svga_t *svga = &gd54xx->svga;
xga_t *xga = (xga_t *) svga->xga;
uint32_t base;
uint32_t size;
@@ -1729,6 +1730,10 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);

View File

@@ -35,6 +35,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
@@ -1042,6 +1043,9 @@ mystique_recalctimings(svga_t *svga)
}
} else {
switch (svga->bpp) {
case 4:
svga->render = svga_render_4bpp_highres;
break;
case 8:
svga->render = svga_render_8bpp_highres;
break;
@@ -1061,6 +1065,9 @@ mystique_recalctimings(svga_t *svga)
}
} else {
switch (svga->bpp) {
case 4:
svga->render = svga_render_4bpp_highres;
break;
case 8:
svga->render = svga_render_8bpp_highres;
break;
@@ -1104,6 +1111,7 @@ static void
mystique_recalc_mapping(mystique_t *mystique)
{
svga_t *svga = &mystique->svga;
xga_t *xga = (xga_t *) svga->xga;
io_removehandler(0x03c0, 0x0020, mystique_in, NULL, NULL, mystique_out, NULL, NULL, mystique);
if ((mystique->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) && (mystique->pci_regs[0x41] & 1))
@@ -1141,6 +1149,10 @@ mystique_recalc_mapping(mystique_t *mystique)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);

View File

@@ -30,6 +30,7 @@
#include <86box/rom.h>
#include <86box/device.h>
#include <86box/video.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
@@ -143,6 +144,7 @@ paradise_out(uint16_t addr, uint8_t val, void *priv)
{
paradise_t *paradise = (paradise_t *) priv;
svga_t *svga = &paradise->svga;
xga_t *xga = (xga_t *) svga->xga;
uint8_t old;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
@@ -188,6 +190,10 @@ paradise_out(uint16_t addr, uint8_t val, void *priv)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
@@ -586,7 +592,7 @@ paradise_decode_addr(paradise_t *paradise, uint32_t addr, int write)
addr = (addr & 0x7fff) + paradise->write_bank[(addr >> 15) & 3];
else
addr = (addr & 0x7fff) + paradise->read_bank[(addr >> 15) & 3];
return addr;
}

View File

@@ -37,6 +37,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
#include "cpu.h"
@@ -3069,6 +3070,8 @@ s3_out(uint16_t addr, uint8_t val, void *priv)
svga->hwcursor.x /= 3;
else if ((s3->chip <= S3_86C805) && s3->color_16bit)
svga->hwcursor.x >>= 1;
else if ((s3->chip == S3_TRIO32) && ((svga->bpp == 15) || (svga->bpp == 16)))
svga->hwcursor.x >>= 1;
break;
case 0x4a:
@@ -4488,6 +4491,7 @@ static void
s3_updatemapping(s3_t *s3)
{
svga_t *svga = &s3->svga;
xga_t *xga = (xga_t *) svga->xga;
if (s3->pci && !(s3->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) {
mem_mapping_disable(&svga->mapping);
@@ -4504,6 +4508,10 @@ s3_updatemapping(s3_t *s3)
/* Enhanced mode forces 64kb at 0xa0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
} else
switch (svga->gdcreg[6] & 0xc) { /*VGA mapping*/
case 0x0: /*128k at A0000*/
@@ -4513,6 +4521,10 @@ s3_updatemapping(s3_t *s3)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
@@ -10143,6 +10155,12 @@ s3_init(const device_t *info)
NULL);
}
}
svga->read = s3_read;
svga->readw = s3_readw;
svga->readl = s3_readl;
svga->write = s3_write;
svga->writew = s3_writew;
svga->writel = s3_writel;
mem_mapping_set_handler(&svga->mapping, s3_read, s3_readw, s3_readl, s3_write, s3_writew, s3_writel);
mem_mapping_set_p(&svga->mapping, s3);

View File

@@ -37,6 +37,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
@@ -1036,6 +1037,7 @@ static void
s3_virge_updatemapping(virge_t *virge)
{
svga_t *svga = &virge->svga;
xga_t *xga = (xga_t *) svga->xga;
if (!(virge->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) {
mem_mapping_disable(&svga->mapping);
@@ -1053,6 +1055,10 @@ s3_virge_updatemapping(virge_t *virge)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);

View File

@@ -404,6 +404,10 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
@@ -789,13 +793,6 @@ svga_recalctimings(svga_t *svga)
else
svga->render = svga_render_text_80;
if (xga_active && (svga->xga != NULL)) {
if (xga->on) {
svga_log("XGA on=%d, base=%05x, ap=%x.\n", xga->on, svga->mapping.base, xga->aperture_cntl);
if ((svga->mapping.base == 0xb8000) && (xga->aperture_cntl >= 1)) /*Some operating systems reset themselves with ctrl-alt-del by going into text mode.*/
xga->on = 0;
}
}
svga->hdisp_old = svga->hdisp;
} else {
svga->hdisp_old = svga->hdisp;
@@ -809,14 +806,15 @@ svga_recalctimings(svga_t *svga)
} else if ((svga->gdcreg[5] & 0x60) == 0x20) {
if (svga->seqregs[1] & 8) { /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
svga_log("2 bpp low res\n");
svga_log("2 bpp low res.\n");
} else
svga->render = svga_render_2bpp_highres;
} else {
svga->map8 = svga->pallook;
if (svga->lowres) /*Low res (320)*/
if (svga->lowres) { /*Low res (320)*/
svga->render = svga_render_8bpp_lowres;
else
svga_log("8 bpp low res.\n");
} else
svga->render = svga_render_8bpp_highres;
}
} else {

View File

@@ -72,6 +72,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
@@ -911,6 +912,7 @@ static void
tgui_recalcmapping(tgui_t *tgui)
{
svga_t *svga = &tgui->svga;
xga_t *xga = (xga_t *) svga->xga;
if (tgui->type == TGUI_9400CXI) {
if (svga->gdcreg[0x10] & EXT_CTRL_LATCH_COPY) {
@@ -964,6 +966,10 @@ tgui_recalcmapping(tgui_t *tgui)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
@@ -988,6 +994,10 @@ tgui_recalcmapping(tgui_t *tgui)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);

View File

@@ -41,6 +41,7 @@
#include <86box/video.h>
#include <86box/i2c.h>
#include <86box/vid_ddc.h>
#include <86box/vid_xga.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
#include <86box/vid_voodoo_common.h>
@@ -452,6 +453,7 @@ static void
banshee_updatemapping(banshee_t *banshee)
{
svga_t *svga = &banshee->svga;
xga_t *xga = (xga_t *) svga->xga;
if (!(banshee->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) {
#if 0
@@ -473,6 +475,10 @@ banshee_updatemapping(banshee_t *banshee)
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
if (xga_active && (svga->xga != NULL)) {
xga->on = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
}
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
@@ -956,7 +962,7 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *priv)
case Video_vidChromaKeyMin:
banshee->vidChromaKeyMin = val;
break;
case Video_vidChromaKeyMax:
banshee->vidChromaKeyMax = val;
break;
@@ -2760,7 +2766,7 @@ banshee_overlay_draw(svga_t *svga, int displine)
voodoo->overlay.src_y += (1 << 20);
return;
}
chroma_test_passed = banshee_chroma_key(banshee, svga->overlay_latch.x, displine - svga->y_add);
if ((voodoo->overlay.src_y >> 20) < 2048)
@@ -2880,7 +2886,7 @@ banshee_overlay_draw(svga_t *svga, int displine)
fil[x * 3 + 1] = vb_filter_v1_g[fil[x * 3 + 1]][fil3[(x + 1) * 3 + 1]];
fil[x * 3 + 2] = vb_filter_v1_rb[fil[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
chroma_test_passed = banshee_chroma_key(banshee, svga->overlay_latch.x + x, displine - svga->y_add);
if (chroma_test_passed)
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
}

View File

@@ -163,24 +163,76 @@ xga_updatemapping(svga_t *svga)
case 0:
xga_log("XGA: VGA mode address decode disabled.\n");
mem_mapping_disable(&xga->linear_mapping);
xga->test_stage = 0;
xga->mapping_base = svga->mapping.base;
break;
case 1:
xga_log("XGA: VGA mode address decode enabled.\n");
mem_mapping_disable(&xga->linear_mapping);
xga->test_stage = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
switch (svga->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x20000);
svga->banked_mask = 0xffff;
break;
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
svga->banked_mask = 0x7fff;
break;
case 0xC: /*32k at B8000*/
mem_mapping_set_addr(&svga->mapping, 0xb8000, 0x08000);
svga->banked_mask = 0x7fff;
break;
default:
break;
}
xga->mapping_base = svga->mapping.base;
break;
case 2:
xga_log("XGA: 132-Column mode address decode disabled.\n");
mem_mapping_disable(&xga->linear_mapping);
xga->test_stage = 0;
xga->mapping_base = svga->mapping.base;
break;
case 3:
xga_log("XGA: 132-Column mode address decode enabled.\n");
mem_mapping_disable(&xga->linear_mapping);
xga->test_stage = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
switch (svga->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x20000);
svga->banked_mask = 0xffff;
break;
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
svga->banked_mask = 0xffff;
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x08000);
svga->banked_mask = 0x7fff;
break;
case 0xC: /*32k at B8000*/
mem_mapping_set_addr(&svga->mapping, 0xb8000, 0x08000);
svga->banked_mask = 0x7fff;
break;
default:
break;
}
xga->mapping_base = svga->mapping.base;
break;
default:
xga_log("XGA: Extended Graphics mode, ap=%d.\n", xga->aperture_cntl);
xga_log("XGA: Extended Graphics mode, ap=%d, mapbits=%x.\n", xga->aperture_cntl, svga->gdcreg[6] & 0xc);
switch (xga->aperture_cntl) {
case 0:
xga_log("XGA: No 64KB aperture: 1MB=%x, 4MB=%x, SVGA Mapping Base=%x.\n", xga->base_addr_1mb, xga->linear_base, svga->mapping.base);
xga_log("XGA: No 64KB aperture: 1MB=%x, 4MB=%x, SVGA Mapping Base=%x, mapbits=%x.\n", xga->base_addr_1mb, xga->linear_base, svga->mapping.base, svga->gdcreg[6] & 0xc);
if (xga->base_addr_1mb) {
mem_mapping_set_addr(&xga->linear_mapping, xga->base_addr_1mb, 0x100000);
mem_mapping_enable(&xga->linear_mapping);
@@ -190,6 +242,7 @@ xga_updatemapping(svga_t *svga)
} else
mem_mapping_disable(&xga->linear_mapping);
xga->test_stage = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
switch (svga->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
@@ -212,10 +265,13 @@ xga_updatemapping(svga_t *svga)
default:
break;
}
xga->mapping_base = svga->mapping.base;
break;
case 1:
mem_mapping_disable(&xga->linear_mapping);
xga_log("XGA: 64KB aperture at A0000.\n");
xga_log("XGA: 64KB aperture at A0000, on=%d.\n", xga->on);
xga->test_stage = 0;
xga->mapping_base = 0xa0000;
mem_mapping_set_handler(&svga->mapping, xga_read, xga_readw, xga_readl, xga_write, xga_writew, xga_writel);
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
xga->banked_mask = 0xffff;
@@ -223,6 +279,8 @@ xga_updatemapping(svga_t *svga)
case 2:
mem_mapping_disable(&xga->linear_mapping);
xga_log("XGA: 64KB aperture at B0000.\n");
xga->test_stage = 0;
xga->mapping_base = 0xb0000;
mem_mapping_set_handler(&svga->mapping, xga_read, xga_readw, xga_readl, xga_write, xga_writew, xga_writel);
mem_mapping_set_addr(&svga->mapping, 0xb0000, 0x10000);
xga->banked_mask = 0xffff;
@@ -258,6 +316,8 @@ void
xga_recalctimings(svga_t *svga)
{
xga_t *xga = (xga_t *) svga->xga;
xga_log("DispCntl2=%d, lowres=%x.\n", xga->disp_cntl_2 & 7, svga->lowres);
if (xga->on) {
xga->h_total = xga->htotal + 1;
xga->v_total = xga->vtotal + 1;
@@ -305,6 +365,7 @@ xga_recalctimings(svga_t *svga)
break;
}
svga->render_xga = xga_render_blank;
switch (xga->disp_cntl_2 & 7) {
case 2:
svga->render_xga = xga_render_4bpp;
@@ -317,7 +378,6 @@ xga_recalctimings(svga_t *svga)
break;
default:
svga->render_xga = xga_render_blank;
break;
}
@@ -602,6 +662,12 @@ xga_ext_outb(uint16_t addr, uint8_t val, void *priv)
xga_log("[%04X:%08X]: EXT OUTB = %02x, val = %02x\n", CS, cpu_state.pc, addr, val);
xga->int_stat = val;
break;
case 6:
xga_log("[%04X:%08X]: EXT OUTB = %02x, val = %02x\n", CS, cpu_state.pc, addr, val);
break;
case 7:
xga_log("[%04X:%08X]: EXT OUTB = %02x, val = %02x\n", CS, cpu_state.pc, addr, val);
break;
case 8:
xga->ap_idx = val;
xga_log("Aperture CNTL = %d, val = %02x, up to bit6 = %02x\n", xga->aperture_cntl,
@@ -2379,8 +2445,6 @@ exec_command:
xga->accel.px_map_format[xga->accel.src_map] & 0x0f,
xga->accel.plane_mask);
xga->src_reverse_order = 0;
xga->dst_reverse_order = 0;
switch ((xga->accel.command >> 24) & 0x0f) {
case 2: /*Short Stroke Vectors Read */
xga_log("Short Stroke Vectors Read.\n");
@@ -2837,31 +2901,39 @@ xga_render_16bpp(svga_t *svga)
void
xga_write_test(uint32_t addr, uint8_t val, void *priv)
{
svga_t *svga = (svga_t *) priv;
xga_t *xga = (xga_t *) svga->xga;
svga_t *svga = (svga_t *) priv;
xga_t *xga = (xga_t *) svga->xga;
if (xga_active && xga) {
if (((xga->op_mode & 7) >= 1) && xga->aperture_cntl && (svga->mapping.base == 0xb8000)) {
xga_log("WriteAddr=%05x.\n", addr);
if (val == 0xa5) { /*Memory size test of XGA*/
xga->test = val;
if (addr == 0xa0001)
xga->a5_test = 1;
else if (addr == 0xafffe)
xga->a5_test = 2;
if ((xga->op_mode & 7) == 4) {
if (xga->aperture_cntl && !xga->test_stage) {
if (val == 0xa5) { /*Memory size test of XGA*/
xga->test = val;
if (addr == (xga->mapping_base + 0x0001))
xga->a5_test = 1;
else if (addr == (xga->mapping_base + xga->banked_mask - 0x0001))
xga->a5_test = 2;
xga->test_stage = 1;
xga->on = 0;
xga_log("XGA test1 addr=%05x, test=%02x.\n", addr, xga->a5_test);
} else if (val == 0x5a) {
xga->test = val;
xga->test_stage = 1;
xga->on = 0;
xga_log("XGA test2 addr = %05x.\n", addr);
} else if ((addr == xga->mapping_base) || (addr == (xga->mapping_base + 0x0010))) {
addr += xga->write_bank;
xga->vram[addr & xga->vram_mask] = val;
xga_log("XGA Linear endian reverse write, val = %02x, addr = %05x, banked mask = %04x, a5test=%d.\n", val, addr, svga->banked_mask, xga->a5_test);
}
} else {
xga->test_stage = 0;
xga->on = 0;
xga_log("XGA test1 addr=%05x, test=%02x.\n", addr, xga->a5_test);
} else if (val == 0x5a) {
xga->test = val;
xga->on = 0;
xga_log("XGA test2 addr = %05x.\n", addr);
} else if ((addr == 0xa0000) || (addr == 0xa0010)) {
addr += xga->write_bank;
xga->vram[addr & xga->vram_mask] = val;
xga_log("XGA Linear endian reverse write, val = %02x, addr = %05x, banked mask = %04x, a5test=%d.\n", val, addr, svga->banked_mask, xga->a5_test);
xga_log("Write: AP=%x, teststage=%x, on=%d.\n", xga->aperture_cntl, xga->test_stage, xga->on);
}
} else if (xga->aperture_cntl || (!xga->aperture_cntl && (svga->mapping.base == 0xa0000))) {
} else {
xga->test_stage = 0;
xga->on = 0;
xga_log("OFF XGA write.\n");
}
@@ -2899,7 +2971,7 @@ xga_write(uint32_t addr, uint8_t val, void *priv)
addr &= xga->banked_mask;
addr += xga->write_bank;
xga_log("WriteBankedB addr=%08x, val=%02x, addrshift1=%08x.\n", addr, val, addr >> 1);
xga_log("WriteBankedB addr=%08x, val=%02x, ison=%d, mapbits=%x.\n", addr, val, xga->on, svga->gdcreg[6] & 0x0c);
if (addr >= xga->vram_size)
return;
@@ -2917,7 +2989,7 @@ xga_writew(uint32_t addr, uint16_t val, void *priv)
addr &= xga->banked_mask;
addr += xga->write_bank;
xga_log("WriteBankedW addr=%08x, val=%04x, addrshift1=%08x.\n", addr, val, addr >> 1);
xga_log("WriteBankedW addr=%08x, val=%04x, ison=%d.\n", addr, val, xga->on);
if (addr >= xga->vram_size)
return;
@@ -2935,7 +3007,7 @@ xga_writel(uint32_t addr, uint32_t val, void *priv)
addr &= xga->banked_mask;
addr += xga->write_bank;
xga_log("WriteBankedL addr=%08x, val=%08x, addrshift1=%08x.\n", addr, val, addr >> 1);
xga_log("WriteBankedL addr=%08x, val=%08x.\n", addr, val);
if (addr >= xga->vram_size)
return;
@@ -2953,31 +3025,41 @@ xga_read_test(uint32_t addr, void *priv)
uint8_t ret = 0x00;
if (xga_active && xga) {
if (((xga->op_mode & 7) >= 1) && xga->aperture_cntl && (svga->mapping.base == 0xb8000)) {
if (xga->test == 0xa5) { /*Memory size test of XGA*/
if (addr == 0xa0001) {
xga_log("Read: OPMODE=%x, APCNTL=%x, base=%05x, test=%x.\n", xga->op_mode & 7, xga->aperture_cntl, svga->mapping.base, xga->test);
if ((xga->op_mode & 7) == 4) {
if (xga->aperture_cntl && (xga->test_stage == 1)) {
if (xga->test == 0xa5) { /*Memory size test of XGA*/
if (addr == (xga->mapping_base + 0x0001)) {
xga_log("A5 test bank = %x, svgabase=%05x.\n", addr, svga->mapping.base);
ret = xga->test;
} else if ((addr == xga->mapping_base) && (xga->a5_test == 1)) { /*This is required by XGAKIT to pass the memory test*/
xga_log("A5 test bank = %x.\n", addr);
addr += xga->read_bank;
ret = xga->vram[addr & xga->vram_mask];
} else
ret = xga->test;
xga->test_stage = 0;
xga->on = 1;
xga_log("A5 read: XGA ON = %d, addr = %05x, ret = %02x, test1 = %x.\n", xga->on, addr, ret, xga->a5_test);
return ret;
} else if (xga->test == 0x5a) {
xga->test_stage = 0;
ret = xga->test;
xga->on = 1;
} else if ((addr == 0xa0000) && (xga->a5_test == 1)) { /*This is required by XGAKIT to pass the memory test*/
xga_log("A5 test bank = %x.\n", addr);
xga_log("5A read: XGA ON = %d.\n", xga->on);
return ret;
} else if ((addr == xga->mapping_base) || (addr == (xga->mapping_base + 0x0010))) {
addr += xga->read_bank;
ret = xga->vram[addr & xga->vram_mask];
} else {
ret = xga->test;
xga->on = 1;
return xga->vram[addr & xga->vram_mask];
}
xga_log("A5 read: XGA ON = %d, addr = %05x, ret = %02x, test1 = %x.\n", xga->on, addr, ret, xga->a5_test);
return ret;
} else if (xga->test == 0x5a) {
ret = xga->test;
xga->on = 1;
xga_log("5A read: XGA ON = %d.\n", xga->on);
return ret;
} else if ((addr == 0xa0000) || (addr == 0xa0010)) {
addr += xga->read_bank;
return xga->vram[addr & xga->vram_mask];
} else {
xga->test_stage = 0;
xga->on = 0;
xga_log("Read: AP=%x, teststage=%x, on=%d.\n", xga->aperture_cntl, xga->test_stage, xga->on);
}
} else if (xga->aperture_cntl || (!xga->aperture_cntl && (svga->mapping.base == 0xa0000))) {
} else {
xga->test_stage = 0;
xga->on = 0;
xga_log("OFF XGA read.\n");
}
@@ -3029,6 +3111,7 @@ xga_read(uint32_t addr, void *priv)
cycles -= svga->monitor->mon_video_timing_read_b;
ret = xga_read_banked(addr, svga);
xga_log("ReadBankedB addr=%08x, ret=%02x, ison=%d.\n", addr, ret, xga->on);
return ret;
}
@@ -3050,6 +3133,7 @@ xga_readw(uint32_t addr, void *priv)
cycles -= svga->monitor->mon_video_timing_read_w;
ret = xga_readw_banked(addr, svga);
xga_log("ReadBankedW addr=%08x, ret=%04x, ison=%d.\n", addr, ret, xga->on);
return ret;
}
@@ -3398,6 +3482,7 @@ xga_mca_write(int port, uint8_t val, void *priv)
mem_mapping_disable(&xga->memio_mapping);
xga->on = 0;
xga->a5_test = 0;
xga->test_stage = 0;
/* Save the MCA register value. */
xga->pos_regs[port & 7] = val;
@@ -3450,11 +3535,11 @@ xga_reset(void *priv)
xga_t *xga = (xga_t *) svga->xga;
xga_log("Normal Reset.\n");
if (xga_standalone_enabled)
mem_mapping_disable(&xga->memio_mapping);
mem_mapping_disable(&xga->memio_mapping);
xga->on = 0;
xga->a5_test = 0;
xga->test_stage = 0;
mem_mapping_set_handler(&svga->mapping, svga->read, svga->readw, svga->readl, svga->write, svga->writew, svga->writel);
svga_set_poll(svga);
}
@@ -3651,6 +3736,7 @@ xga_init(const device_t *info)
xga->hwcursor.cur_xsize = 64;
xga->hwcursor.cur_ysize = 64;
xga->a5_test = 0;
xga->test_stage = 0;
if (info->flags & DEVICE_MCA) {
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_xga_mca);