diff --git a/.ci/build.sh b/.ci/build.sh index 432599bd7..e425cc65a 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -156,7 +156,18 @@ do -p) shift - dep_report=1 + + # Check for lddtree and install it if required. + which lddtree > /dev/null || DEBIAN_FRONTEND=noninteractive sudo apt-get -y install pax-utils + + # Default to main binary. + binary="$1" + [ -z "$binary" ] && binary="archive_tmp/usr/local/bin/$project" + + # Run lddtree with AppImage lib directories included in the search path. + LD_LIBRARY_PATH=$(find "$(pwd)/archive_tmp" -type d -name lib -o -name lib64 | while read dir; do find "$dir" -type d; done | tr '\n' ':') \ + lddtree "$binary" + exit $? ;; -s) @@ -198,6 +209,7 @@ if [ -z "$package_name" -a -z "$tarball_name" ] || [ -n "$package_name" -a -z "$ then echo '[!] Usage: build.sh -b {package_name} {architecture} [-t] [cmake_flags...]' echo ' build.sh -s {source_tarball_name}' + echo 'Dep. tree: build.sh -p [archive_tmp/path/to/binary]' exit 100 fi @@ -316,7 +328,7 @@ then pacman -S --needed --noconfirm "$pkg" done fi - + # Clean pacman cache when running under Jenkins to save disk space. [ "$CI" = "true" ] && rm -rf /var/cache/pacman/pkg @@ -560,16 +572,15 @@ else # Establish general dependencies. pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream" - [ $dep_report -ne 0 ] && pkgs="$pkgs pax-utils" if [ "$(dpkg --print-architecture)" = "$arch_deb" ] then pkgs="$pkgs build-essential" else # Add foreign architecture if required. - if ! dpkg --print-foreign-architectures | grep -qE '^'"$arch_deb"'$' + if ! dpkg --print-foreign-architectures | grep -Fx "$arch_deb" then sudo dpkg --add-architecture "$arch_deb" - + # Force an apt-get update. save_buildtag aptupdate "arch_$arch_deb" fi @@ -874,6 +885,11 @@ else cwd_root="$(pwd)" check_buildtag "libs.$arch_deb" + cp cmake/flags-gcc.cmake cmake/flags-gcc.cmake.old + sed -i -e 's/ -Werror=.*\([" ]\)/\1/g' cmake/flags-gcc.cmake # temporary hack for -Werror=old-style-definition non-compliance on FluidSynth and SDL2 + sed -i -e 's/ C;CXX/ IGNORED/' cmake/flags-gcc.cmake # workaround for dynamic c(xx)flags system overwriting library flags and breaking (at least) openal-soft + sed -i -e 's/_INIT / /g' cmake/flags-gcc.cmake # still append our own flags + if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt then # Build openal-soft 1.23.1 manually to fix audio issues. This is a temporary @@ -890,7 +906,7 @@ else sed -i -e 's/PW_KEY_CONFIG_NAME/"config.name"/g' "$prefix/alc/backends/pipewire.cpp" prefix_build="$prefix/build-$arch_deb" - cmake -G Ninja -D ALSOFT_UTILS=OFF -D ALSOFT_EXAMPLES=OFF -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99 + cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99 cmake --build "$prefix_build" -j$(nproc) || exit 99 cmake --install "$prefix_build" || exit 99 @@ -939,8 +955,6 @@ else rm -rf "$cache_dir/fluidsynth-"* # remove old versions wget -qO - https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v2.3.0.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix" fi - cp cmake/flags-gcc.cmake cmake/flags-gcc.cmake.old - sed -i -e 's/ -Werror=.*\([" ]\)/\1/g' cmake/flags-gcc.cmake # temporary hack for -Werror=old-style-definition non-compliance on FluidSynth and SDL2 prefix_build="$prefix/build-$arch_deb" cmake -G Ninja -D enable-dbus=OFF -D enable-jack=OFF -D enable-oss=OFF -D enable-sdl2=OFF -D enable-pulseaudio=OFF -D enable-pipewire=OFF -D enable-alsa=OFF \ -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \ @@ -978,6 +992,7 @@ else -S "$prefix" -B "$prefix_build" || exit 99 cmake --build "$prefix_build" -j$(nproc) || exit 99 cmake --install "$prefix_build" || exit 99 + mv cmake/flags-gcc.cmake.old cmake/flags-gcc.cmake # Archive Discord Game SDK library. @@ -1142,16 +1157,6 @@ EOF # Remove appimage-builder binary on failure, just in case it's corrupted. [ $status -ne 0 ] && rm -f "$appimage_builder_binary" - - # Generate library dependency report if requested. - if [ $dep_report -ne 0 ] - then - echo '[-] Library dependency report:' - - # Run lddtree with AppImage lib directories included in the search path. - LD_LIBRARY_PATH=$(find "$(pwd)/archive_tmp" -type d -name lib -o -name lib64 | while read dir; do find "$dir" -type d; done | tr '\n' ':') \ - lddtree "archive_tmp/usr/local/bin/$project" 2>&1 | tee depreport.txt - fi fi # Check if the archival succeeded. diff --git a/src/cdrom/cdrom_image_backend.c b/src/cdrom/cdrom_image_backend.c index 1d39e8c82..5d8294213 100644 --- a/src/cdrom/cdrom_image_backend.c +++ b/src/cdrom/cdrom_image_backend.c @@ -768,7 +768,7 @@ cdi_add_track(cd_img_t *cdi, track_t *cur, uint64_t *shift, uint64_t prestart, u } /* First track (track number must be 1). */ - if (cdi->tracks_num == 0) { + if ((prev == NULL) || (cdi->tracks_num == 0)) { /* I guess this makes sure the structure is not filled with invalid data. */ if (cur->number != 1) return 0; diff --git a/src/chipset/ali1429.c b/src/chipset/ali1429.c index 138c7db93..e245603a9 100644 --- a/src/chipset/ali1429.c +++ b/src/chipset/ali1429.c @@ -166,7 +166,7 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv) dev->cfg_locked = (val != 0xc5); if (!dev->cfg_locked) { - pclog("M1429: dev->regs[%02x] = %02x\n", dev->index, val); + ali1429_log("M1429: dev->regs[%02x] = %02x\n", dev->index, val); /* Common M1429 Registers */ switch (dev->index) { diff --git a/src/chipset/et6000.c b/src/chipset/et6000.c index eb42ac7cb..ca011e33c 100644 --- a/src/chipset/et6000.c +++ b/src/chipset/et6000.c @@ -35,7 +35,7 @@ typedef struct { - uint8_t index, regs[6]; + uint8_t index, regs[256]; } et6000_t; #ifdef ENABLE_ET6000_LOG diff --git a/src/codegen_new/codegen.h b/src/codegen_new/codegen.h index 607a2e4ee..547f867e3 100644 --- a/src/codegen_new/codegen.h +++ b/src/codegen_new/codegen.h @@ -140,12 +140,16 @@ codeblock_tree_add(codeblock_t *new_block) block = block->right ? &codeblock[block->right] : NULL; } - if (a < old_block_cmp) - old_block->left = get_block_nr(new_block); - else - old_block->right = get_block_nr(new_block); + if (old_block != NULL) { + if (a < old_block_cmp) + old_block->left = get_block_nr(new_block); + else + old_block->right = get_block_nr(new_block); + + new_block->parent = get_block_nr(old_block); + } else + new_block->parent = BLOCK_INVALID; - new_block->parent = get_block_nr(old_block); new_block->left = new_block->right = BLOCK_INVALID; } } diff --git a/src/config.c b/src/config.c index 4bcbaf7fa..3a66bc01d 100644 --- a/src/config.c +++ b/src/config.c @@ -866,6 +866,8 @@ load_network(void) ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2096, (wchar_t *) IDS_2130); } strcpy(net_cards_conf[c].host_dev_name, "none"); + } else { + strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); } } else { strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); diff --git a/src/device.c b/src/device.c index 8c8ede245..7d8f5e88e 100644 --- a/src/device.c +++ b/src/device.c @@ -150,8 +150,10 @@ device_add_common(const device_t *d, const device_t *cd, void *p, void *params, if (devices[c] == NULL) break; } - if (c >= DEVICE_MAX) + if ((c >= DEVICE_MAX) || (c >= 256)) { fatal("DEVICE: too many devices\n"); + return NULL; + } /* Do this so that a chained device_add will not identify the same ID its master device is already trying to assign. */ diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index 58183e1df..37dc6b4a0 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -214,13 +214,14 @@ sermouse_data_mmseries(mouse_t *dev, int x, int y, int b) dev->data[0] = 0x80; if (x >= 0) dev->data[0] |= 0x10; - if (y >= 0) + /* It appears we have inverted Y polarity. */ + if (y < 0) dev->data[0] |= 0x08; dev->data[0] |= (b & 0x01) ? 0x04 : 0x00; /* left button */ dev->data[0] |= (b & 0x04) ? 0x02 : 0x00; /* middle button */ dev->data[0] |= (b & 0x02) ? 0x01 : 0x00; /* right button */ - dev->data[1] = abs(x); - dev->data[2] = abs(y); + dev->data[1] = abs(x) & 0x7f; + dev->data[2] = abs(y) & 0x7f; return 3; } diff --git a/src/disk/hdd.c b/src/disk/hdd.c index c4daf0f83..6135c31d8 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -161,6 +161,10 @@ hdd_seek_get_time(hard_disk_t *hdd, uint32_t dst_addr, uint8_t operation, uint8_ return HDD_OVERHEAD_TIME; hdd_zone_t *zone = NULL; + if (hdd->num_zones <= 0) { + fatal("hdd_seek_get_time(): hdd->num_zones < 0)\n"); + return 0.0; + } for (int i = 0; i < hdd->num_zones; i++) { zone = &hdd->zones[i]; if (zone->end_sector >= dst_addr) diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index 7768202da..deaa540c4 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -1593,10 +1593,8 @@ machine_at_hot433_init(const machine_t *model) device_add(&umc_hb4_device); device_add(&umc_8886af_device); device_add(&um8669f_device); - // device_add(&intel_flash_bxt_device); - device_add(&sst_flash_29ee010_device); - // device_add(&keyboard_at_ami_device); - device_add(&keyboard_ps2_ami_device); + device_add(&winbond_flash_w29c010_device); + device_add(&keyboard_at_ami_device); return ret; } @@ -1790,17 +1788,13 @@ machine_at_tg486gp_init(const machine_t *model) int machine_at_tg486g_init(const machine_t *model) { - int ret; + int ret, i; ret = bios_load_linear("roms/machines/tg486g/tg486g.bin", 0x000c0000, 262144, 0); if (bios_only || !ret) return ret; - else { - mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000); - mem_mapping_set_exec(&bios_mapping, rom); - } machine_at_common_init(model); device_add(&sis_85c471_device); @@ -1808,5 +1802,12 @@ machine_at_tg486g_init(const machine_t *model) device_add(&fdc37c651_ide_device); device_add(&keyboard_ps2_tg_ami_pci_device); + if (gfxcard[0] != VID_INTERNAL) { + for (i = 0; i < 32768; i++) + rom[i] = mem_readb_phys(0x000c0000 + i); + } + mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000); + mem_mapping_set_exec(&bios_mapping, rom); + return ret; } diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index 17dd506fc..b1ea475ae 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -1208,6 +1208,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) uint32_t iRxDesc; int cbPacket; uint8_t buf1[60]; + RMD rmd = { 0 }; if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev) || !size) return 0; @@ -1254,7 +1255,6 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) iRxDesc = CSR_RCVRL(dev); while (iRxDesc-- > 0) { - RMD rmd; pcnetRmdLoad(dev, &rmd, PHYSADDR(dev, GCPhys), 0); GCPhys += cb; } diff --git a/src/qt/qt_mediahistorymanager.cpp b/src/qt/qt_mediahistorymanager.cpp index f71f74fbe..9d003f464 100644 --- a/src/qt/qt_mediahistorymanager.cpp +++ b/src/qt/qt_mediahistorymanager.cpp @@ -66,8 +66,8 @@ MediaHistoryManager::getHistoryListForDeviceIndex(int index, ui::MediaType type) if ((index >= 0) && (index < master_list[type].size())) { return master_list[type][index]; } else { - qWarning("Media device index %i for device type %s was requested but index %i is out of range (valid range: >= 0 && < %i)", - index, mediaTypeToString(type).toUtf8().constData(), index, master_list[type].size()); + qWarning("Media device index %i for device type %s was requested but index %i is out of range (valid range: >= 0 && < %lli)", + index, mediaTypeToString(type).toUtf8().constData(), index, static_cast(master_list[type].size())); } } // Failure gets an empty list @@ -88,8 +88,8 @@ MediaHistoryManager::getImageForSlot(int index, int slot, ui::MediaType type) if ((slot >= 0) && (slot < device_history.size())) { image_name = device_history[slot]; } else { - qWarning("Media history slot %i, index %i for device type %s was requested but slot %i is out of range (valid range: >= 0 && < %i, device_history.size() is %i)", - slot, index, mediaTypeToString(type).toUtf8().constData(), slot, maxDevicesSupported(type), device_history.size()); + qWarning("Media history slot %i, index %i for device type %s was requested but slot %i is out of range (valid range: >= 0 && < %i, device_history.size() is %lli)", + slot, index, mediaTypeToString(type).toUtf8().constData(), slot, maxDevicesSupported(type), static_cast(device_history.size())); } return image_name; } diff --git a/src/sio/sio_it8661f.c b/src/sio/sio_it8661f.c index c7d4110be..9b3baa188 100644 --- a/src/sio/sio_it8661f.c +++ b/src/sio/sio_it8661f.c @@ -196,7 +196,7 @@ it8661_ldn(uint16_t addr, uint8_t val, it8661f_t *dev) break; case 1: case 2: - it8661_serial(LDN & 2, addr, val, dev); + it8661_serial((LDN & 2) - 1, addr, val, dev); break; case 3: it8661_lpt(addr, val, dev); diff --git a/src/sound/snd_ac97_codec.c b/src/sound/snd_ac97_codec.c index 51bc6bd2b..464e86f77 100644 --- a/src/sound/snd_ac97_codec.c +++ b/src/sound/snd_ac97_codec.c @@ -587,6 +587,7 @@ ac97_codec_init(const device_t *info) /* Associate this codec to the current controller. */ if (!ac97_codec || (ac97_codec_count <= 0)) { pclog("AC97 Codec %d: No controller to associate codec\n", ac97_codec_id); + free(dev); return NULL; } *ac97_codec = dev; diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index 95d38f1c3..a5422fbc1 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -327,7 +327,7 @@ draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr) if ((attr & 0x77) == 0) cfg = ibg; /* 'blank' attribute */ - buffer32->line[dev->displine][x * cw + i] = dev->cols[attr][blink][cfg]; + buffer32->line[dev->displine][x * cw + i] = dev->cols[attr][!!blink][cfg]; val = val << 1; } } @@ -423,7 +423,7 @@ draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr) else cfg |= ibg; - buffer32->line[dev->displine][(x * cw) + i] = dev->cols[attr][blink][cfg]; + buffer32->line[dev->displine][(x * cw) + i] = dev->cols[attr][!!blink][cfg]; val = val << 1; } } diff --git a/src/video/vid_ics2494.c b/src/video/vid_ics2494.c index 8bb4b0cb8..99a877a75 100644 --- a/src/video/vid_ics2494.c +++ b/src/video/vid_ics2494.c @@ -53,8 +53,8 @@ ics2494_getclock(int clock, void *p) { ics2494_t *ics2494 = (ics2494_t *) p; - if (clock > 16) - clock = 16; + if (clock > 15) + clock = 15; return ics2494->freq[clock]; }