From c282d91e482dc0e8c5005e1044a569cf4b361a2c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 21 Jul 2025 21:45:07 -0300 Subject: [PATCH 01/16] Jenkins: Fix Linux AppImage build --- .ci/AppImageBuilder.yml | 1 + .ci/build.sh | 43 ++++++++++------------------------------- 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index 7f312baae..ddc6ea88f 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -96,3 +96,4 @@ AppDir: AppImage: arch: !ENV '${arch_appimage}' file_name: !ENV '${appimage_path}' + comp: zstd diff --git a/.ci/build.sh b/.ci/build.sh index 0af94132a..fccc055e6 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -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" 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 [ ! -d "$appimage_builder_dir" ] 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. From ec9d8965d317fa2c06c8abcc560e116d2e5de444 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 21 Jul 2025 21:56:04 -0300 Subject: [PATCH 02/16] Jenkins: Fix Linux build again --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index fccc055e6..cdda34fbc 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -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 python3-pip" + 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" if [ "$(dpkg --print-architecture)" = "$arch_deb" ] then pkgs="$pkgs build-essential" From e40889c5b7d513aa2ddfa28b1c71537d3f059efd Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 21 Jul 2025 22:09:07 -0300 Subject: [PATCH 03/16] Jenkins: Improve appimage-builder venv check --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index cdda34fbc..28db0441a 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -1146,7 +1146,7 @@ EOF # Download appimage-builder if necessary. appimage_builder_commit=22fefa298f9cee922a651a6f65a46fe0ccbfa34e # from issue 376 appimage_builder_dir="$cache_dir/appimage-builder-$appimage_builder_commit" - if [ ! -d "$appimage_builder_dir" ] + if [ ! -x "$appimage_builder_dir/bin/appimage-builder" ] then rm -rf "$cache_dir/appimage-builder-"* # remove old versions python3 -m venv "$appimage_builder_dir" # venv to solve some Debian setuptools headaches From dd873ae90903b6936771a50b39a77e4c102897e7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 21 Jul 2025 22:20:11 -0300 Subject: [PATCH 04/16] Jenkins: Add squashfs-tools as a Linux build dependency --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index 28db0441a..e26bbe8bf 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -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 python3-pip python3-venv" + 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" From 49b3bac9353104004ca58f10b06e25bcce0134e4 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 22 Jul 2025 14:21:06 +0500 Subject: [PATCH 05/16] AppImage: Use XZ compression instead of ZSTD --- .ci/AppImageBuilder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index ddc6ea88f..34e0b2c43 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -96,4 +96,4 @@ AppDir: AppImage: arch: !ENV '${arch_appimage}' file_name: !ENV '${appimage_path}' - comp: zstd + comp: xz From 5453aec74095806332dc93f84de0aaf572c752c6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 22 Jul 2025 13:29:31 +0200 Subject: [PATCH 06/16] Run icon: Fix stray gra pixel in the uppper right corner of the 24x24 icon. --- src/qt/icons/run.ico | Bin 9622 -> 9622 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/run.ico b/src/qt/icons/run.ico index 90a7f28866ea609d94cf0c3c6d62b174f2d7ee21..c088eb59dc462ab124fd36d94a6a2f7a8c2695a7 100644 GIT binary patch delta 25 hcmbQ{JEs delta 23 fcmbQ{J Date: Tue, 22 Jul 2025 20:45:54 +0200 Subject: [PATCH 07/16] XGA/SVGA mode changes of the day (July 22nd, 2025) 1. If the VGA mapping is for a 0xA0000 map for a length of 0x10000, then disable XGA mode (this is independent of the XGA extended mode aperture mode 1 which is XGA's own 0xA0000 mapping). 2. Remove text mode ctrl-alt-del hack. 3. Fixed cursor x coordinate in the Trio32 using 15bpp/16bpp modes. --- src/include/86box/vid_xga.h | 8 +- src/video/vid_ati_mach64.c | 4 + src/video/vid_ati_mach8.c | 6 ++ src/video/vid_cl54xx.c | 5 + src/video/vid_mga.c | 12 +++ src/video/vid_paradise.c | 8 +- src/video/vid_s3.c | 18 ++++ src/video/vid_s3_virge.c | 6 ++ src/video/vid_svga.c | 18 ++-- src/video/vid_tgui9440.c | 10 ++ src/video/vid_voodoo_banshee.c | 12 ++- src/video/vid_xga.c | 188 ++++++++++++++++++++++++--------- 12 files changed, 226 insertions(+), 69 deletions(-) diff --git a/src/include/86box/vid_xga.h b/src/include/86box/vid_xga.h index 8a4867a96..9aac43b9f 100644 --- a/src/include/86box/vid_xga.h +++ b/src/include/86box/vid_xga.h @@ -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; diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 2b89bddf4..324023db1 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -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); diff --git a/src/video/vid_ati_mach8.c b/src/video/vid_ati_mach8.c index 4bb678857..32b466740 100644 --- a/src/video/vid_ati_mach8.c +++ b/src/video/vid_ati_mach8.c @@ -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); diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index fff344f3a..0a43ab4ce 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -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); diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index 294e6ce75..eded49cf6 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -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); diff --git a/src/video/vid_paradise.c b/src/video/vid_paradise.c index e6d918e53..ff1013232 100644 --- a/src/video/vid_paradise.c +++ b/src/video/vid_paradise.c @@ -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 = ¶dise->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; } diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index d0495dca0..0cd1caea3 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -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); diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 774b0d4b7..87c2b4cd6 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -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); diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 512d5e11e..9d5841a94 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -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 { diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index 5cc3a8a78..6a0e1ca5e 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -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); diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index d80a39a15..86329ee8d 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -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]; } diff --git a/src/video/vid_xga.c b/src/video/vid_xga.c index 91a2ce500..a91a893df 100644 --- a/src/video/vid_xga.c +++ b/src/video/vid_xga.c @@ -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); From 828217bee9fd2109535d324b0441774a4d30d42d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 22 Jul 2025 21:04:56 -0300 Subject: [PATCH 08/16] Jenkins: Now trying zlib compression for the AppImage --- .ci/AppImageBuilder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index 34e0b2c43..b8914b9d3 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -96,4 +96,4 @@ AppDir: AppImage: arch: !ENV '${arch_appimage}' file_name: !ENV '${appimage_path}' - comp: xz + comp: zlib From 0b08235b00cd88ef62486b1a8870cfcca304a546 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 22 Jul 2025 21:17:11 -0300 Subject: [PATCH 09/16] Jenkins: ...or actually gzip --- .ci/AppImageBuilder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index b8914b9d3..08d7be1ae 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -96,4 +96,4 @@ AppDir: AppImage: arch: !ENV '${arch_appimage}' file_name: !ENV '${appimage_path}' - comp: zlib + comp: gzip From 67e7136ff99f8a8ebc1dd605ec2e962bfac38e79 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 11 Jul 2025 16:54:03 -0400 Subject: [PATCH 10/16] Some improvements to code readability --- src/game/gameport.c | 79 ++++++++++++++------------ src/game/joystick_ch_flightstick_pro.c | 6 +- src/game/joystick_standard.c | 28 ++++----- src/game/joystick_sw_pad.c | 4 +- src/game/joystick_tm_fcs.c | 6 +- src/include/86box/gameport.h | 58 +++++++++---------- src/qt/sdl_joystick.c | 8 +-- src/qt/win_joystick_rawinput.c | 22 +++---- src/unix/unix.c | 4 +- 9 files changed, 108 insertions(+), 107 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 3025ee5eb..366e35d01 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -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(); @@ -771,7 +778,7 @@ gameport_available(int port) /* UI */ const device_t * -gameports_getdevice(int port) +gameport_getdevice(int port) { return (gameports[port].device); } diff --git a/src/game/joystick_ch_flightstick_pro.c b/src/game/joystick_ch_flightstick_pro.c index 5b240f3f4..b3d4e0ef5 100644 --- a/src/game/joystick_ch_flightstick_pro.c +++ b/src/game/joystick_ch_flightstick_pro.c @@ -8,8 +8,6 @@ * * Implementation of the Flight Stick Pro. * - * - * * Authors: Miran Grca, * Sarah Walker, * @@ -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, diff --git a/src/game/joystick_standard.c b/src/game/joystick_standard.c index 8136935ea..fa83826da 100644 --- a/src/game/joystick_standard.c +++ b/src/game/joystick_standard.c @@ -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, diff --git a/src/game/joystick_sw_pad.c b/src/game/joystick_sw_pad.c index bfdc0e025..7c1d4910b 100644 --- a/src/game/joystick_sw_pad.c +++ b/src/game/joystick_sw_pad.c @@ -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, * Sarah Walker, * @@ -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, diff --git a/src/game/joystick_tm_fcs.c b/src/game/joystick_tm_fcs.c index 52d77d8fb..6c1176a42 100644 --- a/src/game/joystick_tm_fcs.c +++ b/src/game/joystick_tm_fcs.c @@ -8,8 +8,6 @@ * * Implementation of Thrust Master Flight Control System. * - * - * * Authors: Miran Grca, * Sarah Walker, * @@ -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, diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index 655eea942..88730dbd4 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -52,7 +52,7 @@ #define GAMEPORT_8ADDR 0x080000 #define GAMEPORT_SIO 0x1000000 -typedef struct joystick_if_t { +typedef struct joystick_t { const char *name; const char *internal_name; @@ -70,9 +70,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 +97,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 +108,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]; @@ -144,10 +144,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 +170,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 } diff --git a/src/qt/sdl_joystick.c b/src/qt/sdl_joystick.c index ea3720eea..75234bca3 100644 --- a/src/qt/sdl_joystick.c +++ b/src/qt/sdl_joystick.c @@ -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 diff --git a/src/qt/win_joystick_rawinput.c b/src/qt/win_joystick_rawinput.c index ecd885d3a..c775b4bb3 100644 --- a/src/qt/win_joystick_rawinput.c +++ b/src/qt/win_joystick_rawinput.c @@ -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); diff --git a/src/unix/unix.c b/src/unix/unix.c index 5a69424b4..cfd5d9244 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -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; From 6a43be5b0df6a87ca37131e7aa6b857db6493788 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 11 Jul 2025 11:33:39 -0400 Subject: [PATCH 11/16] Correct gameport device usage --- src/game/gameport.c | 10 +++++----- src/include/86box/gameport.h | 2 +- src/machine/m_amstrad.c | 2 +- src/machine/m_at.c | 2 +- src/machine/m_tandy.c | 2 +- src/machine/m_xt.c | 4 ++-- src/machine/m_xt_compaq.c | 4 ++-- src/machine/m_xt_laserxt.c | 2 +- src/machine/m_xt_olivetti.c | 4 ++-- src/machine/m_xt_philips.c | 2 +- src/machine/m_xt_xi8088.c | 2 +- src/sound/snd_sb.c | 20 ++++++++++---------- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 366e35d01..3d02167bc 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -489,9 +489,9 @@ gameport_close(void *priv) free(dev); } -const device_t gameport_device = { - .name = "Game port", - .internal_name = "gameport", +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, @@ -743,7 +743,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, @@ -758,7 +758,7 @@ const device_t gameport_sio_1io_device = { static const GAMEPORT gameports[] = { { &device_none }, { &device_internal }, - { &gameport_device }, + { &gameport_200_device }, { &gameport_208_device }, { &gameport_pnp_device }, { &gameport_tm_acm_device }, diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index 88730dbd4..ac0ea2d58 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -125,7 +125,7 @@ extern const char *gameport_get_internal_name(int port); 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; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index d42807b4d..fdad13df7 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -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 diff --git a/src/machine/m_at.c b/src/machine/m_at.c index d2c4b99a2..b30951140 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -81,7 +81,7 @@ machine_at_common_init_ex(const machine_t *model, int type) else if (type == 0) device_add(&at_nvr_device); - standalone_gameport_type = &gameport_device; + standalone_gameport_type = &gameport_200_device; } void diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 69200febe..d69694c44 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -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; } diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index c94549463..04cddbbd0 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -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); diff --git a/src/machine/m_xt_compaq.c b/src/machine/m_xt_compaq.c index f8c0b6a19..eaae251d1 100644 --- a/src/machine/m_xt_compaq.c +++ b/src/machine/m_xt_compaq.c @@ -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); diff --git a/src/machine/m_xt_laserxt.c b/src/machine/m_xt_laserxt.c index 7a6cab5e3..9a7dfc255 100644 --- a/src/machine/m_xt_laserxt.c +++ b/src/machine/m_xt_laserxt.c @@ -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); diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 8e37dce1f..b18aeedff 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -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(); diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c index eed54e07f..92a33391d 100644 --- a/src/machine/m_xt_philips.c +++ b/src/machine/m_xt_philips.c @@ -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); diff --git a/src/machine/m_xt_xi8088.c b/src/machine/m_xt_xi8088.c index 886c1be6e..2e155a833 100644 --- a/src/machine/m_xt_xi8088.c +++ b/src/machine/m_xt_xi8088.c @@ -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; diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 4c73abf21..f32ad0c59 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2874,7 +2874,7 @@ 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); } @@ -2959,7 +2959,7 @@ 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); } @@ -3047,7 +3047,7 @@ 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); } @@ -3107,7 +3107,7 @@ 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); } @@ -3146,7 +3146,7 @@ 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); } @@ -3241,7 +3241,7 @@ 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 +3279,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,7 +3645,7 @@ 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); } @@ -3911,7 +3911,7 @@ 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); } @@ -4060,7 +4060,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); From c419de503199bb3a17df7d9a34f3f5fd7a01e10d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 11 Jul 2025 18:46:04 -0400 Subject: [PATCH 12/16] Remove unneeded calls to gameport_remap --- src/sound/snd_sb.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index f32ad0c59..f041ebb8c 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2876,7 +2876,6 @@ sb_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { 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 */ @@ -2961,7 +2960,6 @@ sb_mcv_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } return sb; @@ -3049,7 +3047,6 @@ sb_pro_v1_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } return sb; @@ -3109,7 +3106,6 @@ sb_pro_v2_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } return sb; @@ -3148,7 +3144,6 @@ sb_pro_mcv_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } return sb; @@ -3243,7 +3238,6 @@ sb_16_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } } @@ -3647,7 +3641,6 @@ sb_awe32_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { sb->gameport = gameport_add(&gameport_200_device); sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); } return sb; @@ -3913,7 +3906,6 @@ ess_x688_init(UNUSED(const device_t *info)) if (device_get_config_int("gameport")) { ess->gameport = gameport_add(&gameport_200_device); ess->gameport_addr = 0x200; - gameport_remap(ess->gameport, ess->gameport_addr); } if (ide_base > 0x0000) { From dbd8d1d8f5c1e47dba55edf4b4a27c1c78889fe6 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 11 Jul 2025 12:59:55 -0400 Subject: [PATCH 13/16] 86Box Specific PNP Gameport --- src/game/gameport.c | 19 +++++++++++++++++-- src/include/86box/gameport.h | 2 ++ src/machine/m_at.c | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 3d02167bc..45f34f1e1 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -416,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; @@ -489,6 +489,20 @@ gameport_close(void *priv) free(dev); } +const device_t gameport_device = { + .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", @@ -759,6 +773,7 @@ static const GAMEPORT gameports[] = { { &device_none }, { &device_internal }, { &gameport_200_device }, + { &gameport_device }, { &gameport_208_device }, { &gameport_pnp_device }, { &gameport_tm_acm_device }, diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index ac0ea2d58..a990d018e 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -51,6 +51,7 @@ #define GAMEPORT_6ADDR 0x060000 #define GAMEPORT_8ADDR 0x080000 #define GAMEPORT_SIO 0x1000000 +#define GAMEPORT_PNPROM 0x2000000 typedef struct joystick_t { const char *name; @@ -125,6 +126,7 @@ extern const char *gameport_get_internal_name(int port); 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; diff --git a/src/machine/m_at.c b/src/machine/m_at.c index b30951140..d2c4b99a2 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -81,7 +81,7 @@ machine_at_common_init_ex(const machine_t *model, int type) else if (type == 0) device_add(&at_nvr_device); - standalone_gameport_type = &gameport_200_device; + standalone_gameport_type = &gameport_device; } void From 9063bbe68bc910f269cd2cfd799496d8a40893c1 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 23 Jul 2025 15:53:34 +0200 Subject: [PATCH 14/16] Second and last part of the icon indicator work. --- src/config.c | 251 +++++++++++----------------- src/device/cassette.c | 16 +- src/disk/mo.c | 13 +- src/disk/zip.c | 13 +- src/floppy/fdd.c | 12 +- src/include/86box/cassette.h | 2 +- src/qt/icons/browse.ico | Bin 0 -> 9622 bytes src/qt/icons/cartridge_image.ico | Bin 0 -> 9622 bytes src/qt/icons/cassette_image.ico | Bin 0 -> 9622 bytes src/qt/icons/cdrom_nomedia.ico | Bin 0 -> 9622 bytes src/qt/icons/eject.ico | Bin 0 -> 9622 bytes src/qt/icons/export.ico | Bin 0 -> 9622 bytes src/qt/icons/fast_forward.ico | Bin 0 -> 9622 bytes src/qt/icons/floppy_35_image.ico | Bin 0 -> 9622 bytes src/qt/icons/floppy_525_image.ico | Bin 0 -> 9622 bytes src/qt/icons/mo_image.ico | Bin 0 -> 9622 bytes src/qt/icons/new.ico | Bin 0 -> 9622 bytes src/qt/icons/record.ico | Bin 0 -> 9622 bytes src/qt/icons/rewind.ico | Bin 0 -> 9622 bytes src/qt/icons/superdisk.ico | Bin 0 -> 9622 bytes src/qt/icons/superdisk_disabled.ico | Bin 0 -> 9622 bytes src/qt/icons/superdisk_image.ico | Bin 0 -> 9622 bytes src/qt/icons/write_active.ico | Bin 9622 -> 6950 bytes src/qt/icons/write_protected.ico | Bin 9622 -> 9622 bytes src/qt/icons/zip_image.ico | Bin 0 -> 9622 bytes src/qt/qt_iconindicators.cpp | 18 +- src/qt/qt_iconindicators.hpp | 5 + src/qt/qt_machinestatus.cpp | 28 +++- src/qt/qt_mediahistorymanager.cpp | 46 +++-- src/qt/qt_mediamenu.cpp | 164 +++++++++++++----- src/qt_resources.qrc | 16 ++ 31 files changed, 362 insertions(+), 222 deletions(-) create mode 100644 src/qt/icons/browse.ico create mode 100644 src/qt/icons/cartridge_image.ico create mode 100644 src/qt/icons/cassette_image.ico create mode 100644 src/qt/icons/cdrom_nomedia.ico create mode 100644 src/qt/icons/eject.ico create mode 100644 src/qt/icons/export.ico create mode 100644 src/qt/icons/fast_forward.ico create mode 100644 src/qt/icons/floppy_35_image.ico create mode 100644 src/qt/icons/floppy_525_image.ico create mode 100644 src/qt/icons/mo_image.ico create mode 100644 src/qt/icons/new.ico create mode 100644 src/qt/icons/record.ico create mode 100644 src/qt/icons/rewind.ico create mode 100644 src/qt/icons/superdisk.ico create mode 100644 src/qt/icons/superdisk_disabled.ico create mode 100644 src/qt/icons/superdisk_image.ico create mode 100644 src/qt/icons/zip_image.ico diff --git a/src/config.c b/src/config.c index 95362bc06..9aa4a15e5 100644 --- a/src/config.c +++ b/src/config.c @@ -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]); } } diff --git a/src/device/cassette.c b/src/device/cassette.c index 5cde2fbd0..0577ae06f 100644 --- a/src/device/cassette.c +++ b/src/device/cassette.c @@ -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; } diff --git a/src/disk/mo.c b/src/disk/mo.c index 1a2db0443..c1f95c073 100644 --- a/src/disk/mo.c +++ b/src/disk/mo.c @@ -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 diff --git a/src/disk/zip.c b/src/disk/zip.c index 55cf901a4..7602f8096 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -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 diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index b5eb8c8fc..dd87c19c0 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -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; diff --git a/src/include/86box/cassette.h b/src/include/86box/cassette.h index 168d82099..dc85bfc26 100644 --- a/src/include/86box/cassette.h +++ b/src/include/86box/cassette.h @@ -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 diff --git a/src/qt/icons/browse.ico b/src/qt/icons/browse.ico new file mode 100644 index 0000000000000000000000000000000000000000..8a947ae9d375eb745363f03477518083ffe9a9a2 GIT binary patch literal 9622 zcmeHMy>1gh5MBfV0R<_7M3P^*ZtWEfEqPX*74|oo{Amc4z0#&RucW+|G`J+;`8fIrrE(x4WzN->y6N z70>S7)BE=~oqKlMx&3{;{{p>V7<(T&xCDYehj0&}*OyA?gxp7e3_TGrWK~t2Fk;=V z`l;^h;GnhbN#rx_P8)P5lNZDeJef@70OP6GMt3}Zq2m#w*(~@d#2Ak!(&Y0Pc9k?Y zj5BT1m+5Rqxsk@OLmduEr1{dIzi!{=Fr7{t?Gv2yw>ePKm01hlW5*bO&ZUoTjPt); z%TEOS9r%XG=^c@iJ&|f8QhJdcJiZU6d>5w-uj#wzdm?|8PA;&=!-=>BVv+q-zxs5x0QJ!ASX!Vu@^Z4AL9DE z$nV!Ut8i|WIJe3@kzMeuT7DRbya87p<7Az9ZlQ&C55RVAJw-2_nQXmeUo%B03*0+b zu$9A_%x1&K*qQNH{I0Qc`M(L<>)!31-c8uWQ0xMWlrazWU-M}(`M0qPJ=5X&g6C+x zZV+S{;5T5-)^oV#dEk9{w$A%t7eygt#<;2$wXE<=ZCPzEyr<1hR3Lxz`8;4!kv2>c z*L$_WIdlT92b_1|pS8OpiVZnY8|ue6MbVVczZYK*$$YfhVNSd6;k z|6TtXgH18AUJ}E?9^m+{bWx5C+x9?L+;}`~s2yg4wTy&1Q17pJ?2v1-!i%FJPMlAL{)My&=7MYS!xJie#Uwy@kFP6a#zr z)F|gbW>0q>+wa;}vQO|~e4pMvwY`k1lf|M6u{CM^6n(P3XUKcSy6xqAMo262$}!Au zD%r1F&)fICW8HqcUfX=hX`gWq>o`n&eZFQhm3`k^*5~duV_%5L`n>gdl}nxNv8cDf0ul$~yuTL4f=qjZ~&g%8 z_CHs$`k#I}X;AC`{kL;Ot-sg5mH+bRxKsK~%r*A3?b3{Wxm+gw88_u_J2p>^zqav> zgFp0VzmmSJ)c7xNeLJ>|k@b!I1st3QROj_#GU$6B?FVgz|Hog>5q>;{{`WCx_aW}- z{qxl|hLwdDFA)^lD1 zy+dx+#Pf?g9Pe=`8|d@_Av(#SM!HC zH1*r-9~r;KyvTOUu3O{sA7CdFyiZv$MY|br4J?3F5_}Jv12=%ahpqYHa+s3KO(pf! zJ>igYu{sAGJdmmLZ5fc6iW1iHE=lJaZNP-ly=v>Hx(yHaP8Sjfj-A&flat+Wz>)3 zqGzVh871S5J9pCe-~IG`!^aab>9ei&1I1rCOYD&IU!tpRpM!qiT$}zM@2iey_ZJ@> aI=C+q-kl?2PU8ML2ihj@;>~gWb33Z^REB(t#hB> zIk(w#{qOMmg=gQx2TdS!<1p?Dej}vCv%9ni*ECJL-ENEOu?PLzf)F?HS3g+tm!#+4 z;2kqM#-BWf**;>8^-p6R5faa*+IA71_2xXQRRBHC#SAL(YQ^?|*Nyk2ev|W;S<~EG=HRi8sJ4}pb_qPI zxyK~%-1saweHQK{c2bghu)ouB|V*B7O+MG5RcSXI#y=y4u3chQx@VkX0 zwEFnWp*CY!@yi){ru?WTS=%*&%#lQdGZw@V-ax0acti+w;qUuY=E-fwsYq|AIE|5c931$GCUW zQ=ZjQ;W=yry@Ki-*6#p-qT16mwoWZ@1Mq!_G|h19P3)pZvXT7B}XjcjK|a-!!IAz z&BxMl^D2H=&3E}Q1{=dWkdrDLJu_q#r+l7pr~KfdC?=~3JLn&OLuP2hkmt8ti*tw7d)3&$Q)+mA-0rP^ zWMOijSemyb+A!|I{c3&&f*AIq;U(9`nt_*@f%YDMXc(al{xE?z$>}l1PoNjj QOXxM!_G{XP{{WGZ{}B`&FaQ7m literal 0 HcmV?d00001 diff --git a/src/qt/icons/cdrom_nomedia.ico b/src/qt/icons/cdrom_nomedia.ico new file mode 100644 index 0000000000000000000000000000000000000000..ca3c58920b6ee508bf766e1c514d928a0d7c3a5e GIT binary patch literal 9622 zcmeHLJB}4G5cG-_2oXR)K(-qaasVVYLL7q#aSC{3gdBs2m~fA>CqNq#Acm@Tm#4?$ z@yzV5kU+1W{QT>#Dz`l!O-d)}G(CBeP@kvwrzyQoDLs9f``_=U^bKRrp5^}Mhbg^# zl+yWm?tewx5BNSu44Od5kYVKks@!$BO4u`0Pw1ladC z!f9)9?i|DaY>Ms12i??9vvsfyUW?@zOU}zw1LJ+(eA!q2!rWSX;c3MSXMw-OQVDZK ze-xUvRkz}~8pCI&xYaZ0iIR&@SHly1+uWl zVK{+w7WFkxU&b(&&n>({rxz%CZoS33^wIvQ4CqYP_3aj+Gdl2^&jpp4U1hgD|3DHh z>u7!z+qH*9XkF{;;q?lOxUrq*GP-fB+p1gsH^r~D+_nCIZ~5JVU$42fUikoDXQS-d$f3Qk+|#w}f#OGBY+GfRn_=UG z*pG3s5ZrCT(b6s&$1l2h`gDy73$^As#5S#P^zg|;jr8|l55Hg=17g;&3w}ngu}!CO zXWjKWHsOoIb7dT^ZwcRVsehmOeg=5Yo$Jr}*pFMQaGuHe;n+D=UX|Hn1doC`i{;!IsIJ?444NZQI?|A-~LIiP34SNHew zFKG~O#?u)a-<@k-^|$g1pK%QhHrB=({l!_=?YMB@(F~lH&)8?XkI~oAkIg#7S8G>3 z`WXK$Kd-UQ-fIuDk8)Vo{oF0)-?+6O%V)s2;bzu6M_c%*!gV+AE1VlO=scEnlbq+4 zCY<1}JoRhfH@Wqs(OyUkYw~$9ZvMfFhOKM&^-pq6oWO0`41MGjw`${-&zP_Ny5sC* zO=1VSp7Fv)EzY`@2EcNk_M2&Fa8rX@%{lAelv`?phI;K~eQ3;hId)s_prLSwwRidN ziaThqvy6O1o2)x?-rc&zUDw=`R;m4N(2r|twm%KSFMN;qiSH2C_~vkx9^l)=J$!pO YDJ8wcnf*`|j71;DFqRm^BIW?>Kkw2`!vFvP literal 0 HcmV?d00001 diff --git a/src/qt/icons/eject.ico b/src/qt/icons/eject.ico new file mode 100644 index 0000000000000000000000000000000000000000..1bfead4d6068671503da761fe5f717d590379a49 GIT binary patch literal 9622 zcmeHNy-ou$3^t+yAqE&2*yzZ}8?+P8!Gw5=p2Wh)V=yt(4JKX#iJhMbB#^@Qak3PJ zq`AwbP$XNj9Q%^b&ey9GDn!;~B)hu;JC?JN$gzm*?X~{RhR8Ky`}?hbu_bc4EixXr z{uS0eVeTQ;U7YHFmR6db`47FkMH3>LvzADgLd=XZ`iLWm*`Om(eFmg zCYB_^C@k7{v=^0pkBFJlL>ZZIY@Zs-EDavVdXyh4*{}8-<&2iG5-cs(#~g|kVh*WG zvDCJ;sb|(0Fa}nbfrfo~<{Yg*zJvb=eS`K9o?Ey=%Mn!1trOg(6QVtFkxeYkgxQDu z{+k*P>3z(R(@dFv{CE-X`mC(P954EODF1jlqn|VJhhXcji4*3ig&oUL8#~NVgA>IJ zZCiU7HQyL828;n?z+<49;M_XEoeP%Y`?oXa9uRwlen3lv_pmW^3e|g9!yhi=qGx3v z8%OFJ<(W~Uwazi-2EoxgMC#7io^#}CxM+UX&_`?SpF1eyfB4>42cge;P3^eQbyA%JYph};#BUNi&b=Hs_dap%bB0M3lIF^NiP0Z0lmSVLj{j4R&bfJ+l)t+uslChb^;v>>V70_4SU~*{<1e7}j_2 zd&9Gb@WCYz!aj_R;Fm!>0mE%<^lyq0eCYcKZHmF? zReuV#HZ51gh*j9KsT}l=`=D@R%lm;RK6AZm;j1skxV%omRs`gb5>FgCu*D%8pNH4E zMfh!CE7mr##Zhd@K*>PKz(2}>`!lAh8|W40tWEdN4X6dnHTS3YpJAH|=ddAk1l1fi z=8MbqOa8u8{|uTHx{6^o3s?*Nd3hcJKWC88XV;yF8GrjR@NDzSGi&~mZ6goFT%_Wx z+T1Y^FP=54e2dmO=TY&8C}!V_c)6F8Tfc!t`6o{`hBmkrL)9uTiea7Hj3wq@H+Rh6 z1$WHPJai>pa(8v+!do&>GEg#5GEg#5GVrf6fHw;l_><=tI)LKOpUJlS6J9`!@j?Q_ R%hYns{po!^hv(^+F5kkk$HV{t literal 0 HcmV?d00001 diff --git a/src/qt/icons/fast_forward.ico b/src/qt/icons/fast_forward.ico new file mode 100644 index 0000000000000000000000000000000000000000..6bc5eeaff16e0dca78ae41611c4f367135b3fcf0 GIT binary patch literal 9622 zcmb`LJ&qGW5QW?F3JVc#o1hJ+l0h#0a(1cV%c8z3VB!sb0j zrERsltE;+uS|i(2-}lNho}ZRO*o3QaeI4+63~#SOcojmpxmiDdeip(fY`eW(Kfiw- z!kZT%9FObgkMMqheF+C|k+5#ZOSp$uSYlyYx=F7;Jg{D8EOm`xtyPb)&d{~gzkDfY zh;ONvnAEq_b0+sK^^__3mbx6Xny=NR#&jC?;Ur+qJ}S+c+`Kk>}@foIQmJcGXBS@adpq(?lP9+wy%Pchsda2)pQ z%J>fV7 zS6&|Tr!A7-!&{s*zlU!*d43PCIi>s_zUI{Od-#&0<@fNp)5`DRQ^%6u!^<^g&G+!a z@+!0Bd-#;KZRLCT607BV_!?Ww_wX89%J=XsHqZC)7BOaHRGA#XP__Yjc z{~3NM!_$9;pJ#ac&+yZXp8hj@dFJ%?AMwTI^Qou*h@ZMW{YU)V_4Xg}ORlH?h+lK9 z{YQMwwe%nHTW+iWh;MPV{v*ECt@R)AJ#MN0i0^gt{v&>moAw{|c^~gtS@@pYSR+H04qaq0 Oib&V5LPA`G7Lphq)2C%l)Qmc@f=hPKQ90jzOySz9)pU3illK|01uJ}pr*)- z_&!;Cv(`x`oqdj(!8^0oolg6GtKF4!XJd}ci8((vXvgN&i80TOF&7uB`|C%>d_mvk zz zn?s1{W8TDw$s<4Q?T^=M!(;r68->qkOKI$Xz5xc5Ei`4XZCm#A!z;(d)RC$m;b#uf z-BO1Ke@JB}gFd_H&l_Saj9QP!SL(0A714EDsB z&E~ek{CUr3#PpY_lEk+oWD+?!C3(RT_xTi1GIE%zC0H*UY-ent6&J*tPaVh-C} zUlN`<@7j05XP&DQ&lPRKkKPwjfb_3aB6zL1Y>IdD0X5?_Tqm3OM=V$Cs9i1F_(weE zN9Sx?JgzM*L*V^){;3$2#LurWUAtzjUWn(l1ds8iaICDe7M?l>biQNP#M4;B)OhY1 z{&5~0SEAyVv@yIG4mp~21WwwqPjIB|!gCm~^>f+_9{r?`T4VENpB}?&nWJv+&B$u4 zac{CZ!I%n)b4w}DIG$U0g*MNia&EoAyYz+v{3cJO*Tqzfk=|o+*WQ<2__1{n>m&Cb z@P#wlGCrje`mbv*RiE49%X&`bZ3ukkBqc-ObAR5Y|KYi;=W_5L-!=bW{FxWO7sOh( z|8RY6TK_ultUbl&u=%6$Q#GV_#vyb=@Q z0Jsz1ae2S}SZCAaKgV&teeuP&Tr08M7GL}%p2S4zZV3M$0$*~{;Xj77g|Q1Y7k56_ zHf_{ZkFD|Xue3JDsF@Ny#kjK$9ogDU+^QljyXe5;1vt(;eh zCW-xnkl)?=`C~|I-9-D=&QRDB$J=+h(8XUeKgsVy@pDd6kK&)}W6o6F>}vi8{{6?F zIiMEgAH(v(T8XLPm$adMo^>_C{=uIP9a`g035+b!Q;a)`GI)!}j2*irU5b20r=ow68#^Waj82_9`XllkojU|j-@7}y zv`*4VcbC)!jsPKvA|H7qB{>mU$V$%71>;V>tVBMF$i+po{`p$u2V~oAv;O)<x8|MrRo|~iu08e0jGGvo6EkJ6HldNhTKQ4%SUfG9vn*IE zSM7YYbZ)fiXX$C0^h@Cu8wF-e=>f}32^{CIX*G_-uaySO=I;( zy$8p{Pg~-q;y6Wo#-zE`_*JHP(J>W2_d?7@^W`C#)#1J+SK*I;!y-%c*k7*9+{#7P z(Ay+=aki=df3SnY8?gQktN4%0X^7`xEDw%^HRbsq%5ChU{OA7e^7R<=?7w@TmK1~a zA4+rnJN>8qm_1IJe|tyf&ZqXDdf)V&u;c81+VjV{m(*a+|8)5;$-SP>f02Ls);A*8 zKlR$THZ<07Ip5!6sCy~#ukRG!9TU$1>m~fhd^3pW_Mh^d>z{WobO+Txlymx3%K3i1 z`(abZQBwcbM%{JB68{5Z*wo9KYU$%wLds%}w;7i%c PHEiy{dIyBZ590m+GThIg literal 0 HcmV?d00001 diff --git a/src/qt/icons/mo_image.ico b/src/qt/icons/mo_image.ico new file mode 100644 index 0000000000000000000000000000000000000000..c445ce385062a51c02c66aa3a9412d79645b6f8d GIT binary patch literal 9622 zcmeI2J(3hh5QU3?(1rqIF);9UO_{m@SUQI+g@8Nkv?&7!jv-5chq-rvbI6uKMC*N7 zl{MKt{X5+wIaEY${dDDfFSDxpXJS)&kRGKcPm=1}^!uZfen}}keVY59e@N*sjXiso z`+xkH(r=Gby1mW)Kjrtg=KdrfHHDDJRizj5TTxogowHH6rfJ&y`} zWA4Z5ypoKNYL(hZ?(*U1w`N!8I1@~OEk-vrUvaS@kSyzhXj6t-8vP2(v5vzm8TD*DF*)PnUGZPj5 zRDIx;wJ==8e0O)(9u5bq3B?L=lsq#QplZ`FneTI{wZ>qfkGg}GamKMA1`mA!a};l> zJ}`qF&=xFSqg?|Gjc@6ujn=52g7y3P+H=i00BL5=GqtICZs`>|{Ven6)~|Y(KC=kl zbg!uwQ?Zup(WO?jtisQmZvHPC{s(;L9IVOD($d#2z`Qxi`o+GtH{&C&oRxU4to`bh zoz+eHhwyoRU^>fN^s|X94{(qxzjsj=+k#)Q!2+LqExF=(z}SZmoAg(F&p-HJ2aa9z zJ3cje4;;JTgGqkMn)0}p_!xEvA8cY^U43t&Ut^9Fv1v2j!zNFiVp^FD{z#d^=b8X5 zX6g=j9>}Q7@fiFJC=RAf;d9;mGWImS-xC5p?>69%nPHc8%X0NM6cHZvgU?(H4jJzz zqwgni{)m34i~}CW4)r9y&zr+00`Q}r;yZ~S=g)C~KVS#t9wYzW9-7BkNPBIzjXwT^ zHR++|9j)I#Uc1t~>p{!!YS%3_?_syH7czejYxv=EpF&Jq?QA9Fob!LK744h&^WjBeR-TFV{=e-DXZRH*5BK*Ye@l(S~-Q(sRZBKsAyye{2fc*P=j&r*X;@7o3`71XZ z82s?SO|9=FGuoHrhmW}7C-+fy?h}6J zK*NNsiGPZ_!|(Y=gYS3W1H>Q3*6SdBseR5Y*PL`@m4tCnvfDZm%#DO5aowhdC`d)ec(?`Fze?-X` zLL^*&yZAW^Hpm<^X$WK>;NJCvcvD_RjC+i?Ak-NxH@@DWUV$F8MinB~nppNVz5RCh z4MB?MZZ@H}u1CHWp&pU@*i7sJ_EPrZ6ndNgY<-(JbMQmUMfTj*kKDH@$Mb`z$jy;QEPqQT!1{Lk#rgb1(XvOZ35BPl@qT1Y0SW zvTb$@0YktL_{Ru1cjDa7k#pZ8-DBzbTgn*6bIj{O*oRfh3uW%ZmN>W^j^ce8uZQp+ ze5Ji5^sarcW82f>eI2j4CMnoQi70G0?EU!aZ1xCP%N7f2=gUL-Z}5$HW7>(oGzO9X z*ymr@ek~<)VE$|G{-F8C*AwM{?^>LHjup>6zuZInk1PpmanM1JeNn;TpI@m}QX z2a(Oj)_-Z-Uv2wQWAsuH?0t1|r*WCZXuCG+3$J60`ZjyPY{7Bu@9&LiGlyB>co@b! zKDNiCaeRz1@nx~pWBURP=lGJbYvvErpe%4zKyV7q-@6aX9B<@36aYot8L0RgZ8Zv1N0W92PU4cf+vKm{a17!)j_g<1r^C z-p!k-^M`3Y4%2Dl5}6urxW=ZoP$TyC+;QN000|>X=)h_?2v=!oOt|L=W}?C z%zQsO4y(!b$H(F|pV!(MIKXqx#l9cPd^hGv&s#@5XC3sMwU?Eiy_S0JTD+K|u>XPg z+aLz9zyKC7fsJ$6M(s|G=ddllxEx;sEeaRc$1^k$JdQZmaXrw}L@K*e^EwXB(Ugzo z7Il}gR;}|n`?Zv>A*_`YZt4Acogo()W!OH{rzuavX}GDaTf=F&`!)Pe{&~35Ie5$b z^Y*Q@Lf=_zanzpLZ-iUmwyg9BXEpCXj| EAHYX{6aWAK literal 0 HcmV?d00001 diff --git a/src/qt/icons/rewind.ico b/src/qt/icons/rewind.ico new file mode 100644 index 0000000000000000000000000000000000000000..b18c1a66d39454710006ed5a4bc6aa6666085b29 GIT binary patch literal 9622 zcmb`LJ&x2s5JnpbArJ^}u)&5C5^hL<*o`;`5#ksQ$(Caf5wj7#!Ct{9U>!~{nxejG zwcNJ5tE;;0mNg#NdtZ4x9{-GUFWgIab>;Z=;J&|f?u&Eo`r5z$^UAs3yzb`4zyI;Z zxo>ZsI~@G`U+n#3_5(Y-$O(Quzqot$j1v`jsg7E0om}5bzEt)203^8TIEG@SnpN#BRh({P@_F(Bt@IL|D9@AD^{mo(hW$axxW$>j4i z+?Gk_X}C1A&C_ssW|^nsa6F{W!^n#Bv>d*BiH(mxEhlBhc@{3muJbHhicRHNxHX&0 zvv4shSvlXrr`deIh0n9;d=-iET>IOP?Jx!gX z@x7zroumG>3-=qBWvoLD3|KgDk#WgFCTHV5?7;Iq&*46-#~+vbPL}(uROc2y?3Yxo zW?hT#uQl4^cDpq#zISVmQ@)d?*7GLkC`?vTuciX?kx4X;!Z9c9en&%+&jOTFuY4vfn zsL2TZ_wZ{n;{JR1){J%kJ$y?>s{bCoHY3-64_}iZ_20uUWt95w;Y%5s{(Jbj3~m2C z{8Wae{~rE2!`gojKhCJ>zlR@Z)INV<+pYg2pl>|Ye*Tcr>LbTzghcx*`*h}U;&J3L y@fdjwJbE7d*Tb2|iN}%0#AD_vl#0dLYy}f?kuiw?QMQZ3-|Y7zqEl9vHN}4KRm>SG5Y?BbH{!fuNn~h z^z?MpBHpo9jc5K*k7wsN)d+qXPyMjOpayb#pH@6s=f+cm)Xd6ay)AuM=Q9`k#=d|461#?{SbQe7 zFwcdT)5hmKa#fvr4omtlpD^S5>p15jd*A2qFvt25BWIzJe$+VO*;0BhMP0|5a(I}7 zueK4$emsWT{Sa;}hqouT8^gIB-&^(x9o}2xd+VcpOINP3ezv}rJy2=BYxO6cC%@OY zzp&h6^q~_Ru$Wif8q?b+w&E!Ml+VaROe1by$v2)=#Zi3v!N!~-w13a&IFYCOfH=VD z!A}^q-aLGtLk*dAr*7Jsevhv;VLx#`*UtD-eN;oj$@TKsz4-LgGpBv($k|qXaxrt} z{uO+jzf!B!tEWEj(eDSGHyxMGK6qRB9-Hs8UXGW(QXWPJAQ}l4EW9(zrzOn;j($GeS%DEG_Re$)=7x(L&#@Lc=-T$SywdVixm*0Q68slE>ZMk?qH>dva)!#31ZrOC6 z{n~SfI(qp%xBt$E4)UsPY4{uXTe+harTkHgS`B*ge@Xrx?pFS_8np7qI$Jzf&wpR8 z@iVrx2Q_}I@jij|XI{s;|GX!Cd``n!{H#IL5o?6L>Yu~!wQH`uea{aqUc;2XxgP&N e2lLu`IlZ4^x(K}yEG#7XxQ zyuwh`wcmDk?Q~D?c|r0>i?^%XJ^J2!bP|Yn@tehhMzA(_&$X2@}=2-eHy|a zvi9ng*>67&;msEzY`12=m%M)@_G`(JOJT5efp8^xjbq;XTByGKj49(d#+((Dm^nL* zhn)NS`+{SZL&*)5-*SmFJ96w}LV%0h$H&LWA)c6T>+@`Jk$-<3+laBAqtqvkK1zLR zg9H7NgIujC9Q4Tr>7hi;u@eogh!}D~VnEixmOe2xgtMhz%VoW#Pfs8@U`rq0@4H>x zQ;=M6NuOMhT##J+dH<||%CCMoBC-yLuKP7?kX(>?Wd6YQsVJP`;d-8@ah`|EJ#O}> z>yxYx4ZNFYea^_^CO&WUd8NlYc}6vkVkQ#TveoC$1NDjh3J<@%9GCZoJzB=`z=hxT z1zzLydxh=MKcDbhf6AHe6Xr$l#PX~$q(1GqtjT6j)<+MX6YjFU5G;P4!Mr}WKsZXI zK3$Fdg~Vn3>L!;ybkq8B&-4qbR+=Amfwi7ZTXV~k_*Q+yctq13=w*_xr%lqn2d0+k5 zfq%#MmV82oZ{*~?^^<%{H;#DUi2o_5Ir&-0JasXJ*{XtG|uXJV%Z zezg*xX(YS;yMlWeef_0I&Y$$t`;k7Dx%2vMMrAy+xA`y&VnEi>sL#kWY|rV-xU~{J z;D8(S8pMIe_Yt+Hy@mr$kN9ht>Q+upxf%}|)%v~GskV*=ol|qy;^A%0e~n|!-%~$( zS;Lw}PyNL34%K?JUu-mM8m;<0H+HW^7GJ%8s1qay8+=OrEdHo|eB@$- ztb?_ESen1*zy_%wtZ8KNC)W=*2$!Fc`fEO7@z;HSu|vo?Zn1+UE3_34>>cYPu_2@WUVUHlH)iq4gse20zths*jAf5YNFCn{Hdsyh67 z9gj25cds`J`qOGbPsO?BKJYf{otSCz&diZ|(*3J7@H<5t?9>bvH!6+j+Zhe_4?dgA z(JXXsd#=+_IrVTF1z+;(9HPET9{RUFj`zg!Qk=I-?YxetQ}Fv5)@JRsmhGCR&ckY; zH?P0ce;FHs{|5B7?;pR@ihJSKs?Sm8vfQuVi(3E0r8#*0p8nTr@cl2xTMb^HKAAbl zI$X@OhW#}hW)XjHt^R!t)Uu5E9-yK3UViF2zM%Tm{bvr#TI{PwtHE;6N~r64XifBX zO8>Rlm+RKADV6^+3wk?$|7jj*m6)EZJ^fRs%`9>E+T_=;r+;#(w-?E)Av~@9ujQU= z{gnRCr3uf+)_?CkM;v|D@Ra_E<^LSIZ+hRz5s`JUw+79Jd#z5mi3gurLzXX3WPK*4 zXM?W=ZIE1$b&sCM+dchzPBg(<|Kxd1>@2_9KQVA&d&KW?ZLY2U(SQ@%<68f<8sL%q z|EzyBn7PMR|2`HjkG_9wpYLsWB>t#>eB@x)5Ka8pubT?FkIeD(=S{3`@=?X+^>sY<95%6;r2`UyTl}a Kml!?(@BRge4M<)9 literal 0 HcmV?d00001 diff --git a/src/qt/icons/superdisk_image.ico b/src/qt/icons/superdisk_image.ico new file mode 100644 index 0000000000000000000000000000000000000000..b8c854fd2346860c41e95d4d51b864ce76a4e774 GIT binary patch literal 9622 zcmeHLF>c&25M0AXj39+wxNvt@rpyoQDz%@GD#$OaGG(5TDs|l5Gwv0sQy5@&M9tlL zkEBRRcSZmcSg%BJXO_bisk6wLT*&pcs9(#s3z5$va&r^!f4>v?rG2-z@&5aJk*^;_ z*6VoxQ{(>V*pC{cmx>Vk)yciaHMF2($1DribzRtOHd!06i}4}TfV*%!@pc~h=bGhz zc#x2?miQ1N#?zDRC|lyek68HacH3J^JhWsy6G+7mn(s8i;(-(SBc2%OOT|MsG(1Br znvVw-EEjKMeLS$VPh(>|#(G1HZRBUp1O9-qpBu4lEUwXSV;Rr!@LXRVzMD63Qt`x~ zFU2zlj7=Fh$w5x*pU*8pt8I2)uo(7wCfUgmaU_Y3PXY<24%*7klyMHH^ zz~jEhy>D)Q$HZG=J#2opc+}kZgMFX4HTu<@BdvJgweKnF&ek*V(1&p~X0dSX@hp}; zR?NLwUW~(YVAy8yEY>iOK35&T+xv+*1&^5Y&|(Y^xq{2*=C!jqay(*vdzMwO*6F>B z+MSMhRMTvY;f%w%rJvC9NsZ^$7yXu=*c5-aPPNz7RM5iP*eT;O#GVP8XQaS*VpPpO=2G- zrl0w!!`HyaJU9nvw1ocDhMxFP=@|H&19)=y=x1FdJmgR6&pFVS@L2_@8^hOQFNL4O z9>d3b4J+mEu%XwBma0!`zyBsk@1NkMCcshPD*U*n$UEj<${(1_XAVAd^`13Qn|~^I zYJmA5N9x9XwVBr%sFDmn#Y({e8h0R#7uc=j;K>J547~}3;+NC literal 0 HcmV?d00001 diff --git a/src/qt/icons/write_active.ico b/src/qt/icons/write_active.ico index dcd758ee6c6a6a76b60aa2fd3163206979f59f7c..babf8c86c0f94585cf9e00cd60d17c682fcf7c34 100644 GIT binary patch literal 6950 zcmeI%zfTlF6u|L!7nE!Gl^~%YdZ7|*Os1kE6o!V9o@!#re*m>1#)9Vcm{?F>O=;2$>C=xYr$|F4WN}d_E&2RZ|NNQAOAe!n*J#jAl=WuWRI3J?Kyi23+;n;W-s7m$ z)vG!Kbp{@92AU&fGz-nfM8AyQP2}O!H~Qsj{I`7H(eGaG-;jYx=8HRsx#lin9&2MA z{dtV(aaihkY?zCBug*Z7fg3Y0a(gek;}?z0UopR3nH%ET`h0)dFWbM6pZ>I5w%6Mq z8^H1LtB)Uh2KIOm`Exvz+^fWMO1zS{F?de-`F>4R^{!oxtLLBL`*t~7uj&lc8F&O4 zxH5~zgGN;b)y;B`Xx`&E=FgGOkF`H&_&@EGpBMW-Gv2V}^^o_&+r@o0e(H>E|33TS zmiuh<6}bPEN#o7xLxXcj@|GIsf(5J6T=*SbhT~Ez)YW;zKewHzx}V3$nDd zB+JXova+%wDJ5B3Ta%5A4cXe-lI`tn+1c5VoU`oi?#llDz8oAJ$l>9ksHz+t9m()VwI~dZ z_;5l7A&9{d4JKqL2t^!`goF%*A@W6SSu$&d!4bh^C=8AWE+IoY*?==!jUThr-~XbGo1&3d79I^tCcID8o}z{9j5bQ~$bdvMQtf-Vom~ Ss)xNNFD~SFxL+`wzxD&9mw}%E literal 9622 zcmeI2J#ND=422mqC{T3CkRe+=cI*wBspsfa6v!cJpi9Rdqf_Ues#kCxO$ZSL(vg** zKfohEOQJ=|{wz{L5Rru}WwjENojfl^9zqbJ*La9F&*y@=QCHeSVlC>^s(Ys;4Kg?lkJc=!~Q%HaW zNPq-#0{uO5sACTNyVNI50^b|NsAgGY~UEF^CPq$0tt|QJ=hy#dvb1fXL*tvKE`? za#S*He!x<|JlTm`W%3jeoylq3#+xezL|HaZ;C{d|`4CV|yAlkq&IZD-Lva+iAj>UL$1A77Ud6k2bzwWe R{{Mdi^JE28smW%lG640NCT;)# diff --git a/src/qt/icons/zip_image.ico b/src/qt/icons/zip_image.ico new file mode 100644 index 0000000000000000000000000000000000000000..82fd868fdf5026584ecdf6a601ad377ddefa294a GIT binary patch literal 9622 zcmeHNJ8s-C6r^DzMv%fTT)6W#0aE4$c9nCa3UUjpOcmr9L5kEVbqF6|PY}4=Vi9JB z;v=58Bt=SE=K~X%rKIJX89x5xg^f8eXXf(Kpx&5|XU4oU##~(u_di}3^BvEwuZR0j zFOB)|%9zb&xc`c{pJ@9AF}MW7@En!7LtI0#Xgh^0UDtKC@B1t~cQM{(3VDwdFT9ri zb0wv3Uw^Y2E%7ey;n7-!+W4T!Sb9LAzoz&omK>>gpYxC-4qosMZR)b*^yPbUGnOTe z*KHh``VihBa`+7KpC1nLPn{S#me-?ra^!&iv3W5*ngfoT&%C!{Jlpy4_w7V4^eYul zKS9Uq$9DhPAlUjJqBA=Rq#Y<{FF<)|>=1dm+Ip3To%wKIu@yT3sHRk;iKF1+@BG(YESK;&P zk^P*@7rZGh=3^~Ba{Vv<{F;!p!Fs&!V&1X8wfWPzAs5SNJY-BN=dk>c6 z>i&M!oU#w8{ec=O$a_n*f9A$((OU`O9fj>{^P~7ve&w0V3;QSi&hVq%cn&S&Ctb3* zaVEEdc+J(iZIToZZHGVp6@Hmhy92gB@6n+q%n0YWzsQ2`Y`wX4?_nG0+yU|)*71kS zbxLu5K%(aR*-n^uuK&64{ub%${ix-do}cv(_tTca;P}ri&-tG<|76a(`ib%%H1&SU z>tpN3df_bcXVNkCowh#zvGi-SnTuoS7qt`bJ!`K2qBiDRe9o-h|ExaWIZ*zH zzS538tl9r$-+j(q=Y9XRhgyBM^Ji_Uc1KQ5U-VKQTJ&|i@)M4`oIb}q=b=@fTq$ju zDCy@swCI<#YxGkdTJ&@MmI0XRKlNh|E&5EcXr<~}eeHqzwMc2|XGwjYHC+EKQ0J37 zFA)o!V&CZ_s~_{V-v8_R(V6G|<}N*p^RuM?9CyX%$5F;JS&x1bVC;(eQ*)jE=ISTs zVATHw`lPQarL{Jt&+p^-Dp53YKRWP-haB(!CD?0`pL3-myz0Gdcassette.label = std::make_unique(); 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(); 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(); 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(); 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(); diff --git a/src/qt/qt_mediahistorymanager.cpp b/src/qt/qt_mediahistorymanager.cpp index 5892c55cd..74d596866 100644 --- a/src/qt/qt_mediahistorymanager.cpp +++ b/src/qt/qt_mediahistorymanager.cpp @@ -21,6 +21,9 @@ #include #include #include "qt_mediahistorymanager.hpp" +#ifdef Q_OS_WINDOWS +#include +#endif extern "C" { #include <86box/timer.h> @@ -205,6 +208,8 @@ MediaHistoryManager::initialDeduplication() break; } deduplicateList(device_history, QVector(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 = ""; } diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index c9d658fb2..cf14d7826 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -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::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,7 +591,7 @@ 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 { @@ -641,8 +663,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) menu = cassetteMenu; children = menu->children(); imageHistoryUpdatePos = dynamic_cast(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(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(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(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. */ diff --git a/src/qt_resources.qrc b/src/qt_resources.qrc index 9291892b5..f0ea8d945 100644 --- a/src/qt_resources.qrc +++ b/src/qt_resources.qrc @@ -1,6 +1,9 @@ + qt/icons/browse.ico qt/icons/cartridge.ico + qt/icons/cartridge_image.ico + qt/icons/cassette_image.ico qt/icons/cassette.ico qt/icons/cdrom.ico qt/icons/cdrom_disabled.ico @@ -10,22 +13,35 @@ qt/icons/cdrom_folder.ico qt/icons/cdrom_host.ico qt/icons/display.ico + qt/icons/eject.ico + qt/icons/export.ico + qt/icons/fast_forward.ico qt/icons/floppy_35.ico + qt/icons/floppy_35_image.ico qt/icons/floppy_525.ico + qt/icons/floppy_525_image.ico qt/icons/floppy_and_cdrom_drives.ico qt/icons/floppy_disabled.ico qt/icons/hard_disk.ico qt/icons/input_devices.ico qt/icons/machine.ico qt/icons/mo.ico + qt/icons/mo_image.ico qt/icons/mo_disabled.ico qt/icons/network.ico + qt/icons/new.ico qt/icons/other_peripherals.ico qt/icons/other_removable_devices.ico qt/icons/ports.ico + qt/icons/record.ico + qt/icons/rewind.ico qt/icons/sound.ico qt/icons/storage_controllers.ico + qt/icons/superdisk.ico + qt/icons/superdisk_image.ico + qt/icons/superdisk_disabled.ico qt/icons/zip.ico + qt/icons/zip_image.ico qt/icons/zip_disabled.ico qt/icons/active.ico qt/icons/write_protected.ico From 1923f3ec66723451d1cbdc8efa49768a29767bc9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 24 Jul 2025 12:08:58 +0200 Subject: [PATCH 15/16] Added MDS support. --- src/cdrom/cdrom_image.c | 529 ++++++++++++++++++++++++++++++++++++++-- src/qt/qt_mediamenu.cpp | 2 +- 2 files changed, 510 insertions(+), 21 deletions(-) diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index 6bc284fd3..6f1137b19 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -19,6 +19,7 @@ #define __STDC_FORMAT_MACROS #include #include +// #define ENABLE_IMAGE_LOG 1 #ifdef ENABLE_IMAGE_LOG #include #endif @@ -26,6 +27,7 @@ #include #include #include +#include #include #ifndef _WIN32 # include @@ -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; diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index cf14d7826..2a0b3bbfd 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -597,7 +597,7 @@ MediaMenu::cdromMount(int i, int dir, const QString &arg) 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()) From 362528de251ac5288fda8c596c36287587c79cd3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 24 Jul 2025 12:12:26 +0200 Subject: [PATCH 16/16] CMD646: Return the registers from the correct bus master instance. --- src/disk/hdc_ide_cmd646.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/disk/hdc_ide_cmd646.c b/src/disk/hdc_ide_cmd646.c index a60962ba8..a61b78ec3 100644 --- a/src/disk/hdc_ide_cmd646.c +++ b/src/disk/hdc_ide_cmd646.c @@ -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);