Stefan Reinauer [Wed, 27 May 2026 16:06:10 +0000 (09:06 -0700)]
slirp: harden backend reinitialization
Ariadne can close and reopen the selected Ethernet backend while
guest software probes or retries card configuration. The SLIRP
backend destroyed callback state before the receive thread was known
to be stopped, and ignored initialization or thread start failures.
Join the receive thread before teardown, keep callback state alive
until shutdown completes, report SLIRP startup failures, and reset or
reuse BOOTP leases across backend restarts.
Stefan Reinauer [Thu, 4 Jun 2026 02:07:22 +0000 (19:07 -0700)]
sndboard: keep addrbank tables file-local
The sound-board addrbank tables are static, but earlier forward
declarations used external linkage. That breaks C++ builds when the
Unix port enables the shared sound-board sources.
Declare the memory callbacks first and move the static bank tables
before the accessors that reference them. This keeps the symbols
file-local without conflicting declarations.
Stefan Reinauer [Thu, 28 May 2026 15:08:36 +0000 (08:08 -0700)]
slirp: avoid Unix thread sentinel in shared code
Track whether the builtin slirp helper thread was started. Do not
write BAD_THREAD into uae_thread_id from common code because Windows
uses HANDLE thread IDs and does not define that Unix sentinel.
Stefan Reinauer [Thu, 28 May 2026 00:38:28 +0000 (17:38 -0700)]
slirp: check TCP connect completion with SO_ERROR
The nonblocking connect path treated a writable socket as connected
and then used a zero-length send as the failure probe. That is not a
reliable completion check and can mis-handle failed or pending guest
TCP connects.
Use getsockopt(SO_ERROR) when select reports the socket writable. Keep
pending connects pending, and only clear SS_ISFCONNECTING after the
host socket has no pending error.
Stefan Reinauer [Thu, 28 May 2026 00:21:35 +0000 (17:21 -0700)]
slirp: forward ICMP through datagram sockets
Enable datagram ICMP forwarding, keep the host sockets nonblocking,
and strip host IP headers before delivering ICMP replies back to the
emulated Ethernet device.
Stefan Reinauer [Sun, 31 May 2026 04:25:47 +0000 (21:25 -0700)]
pcem: hide unused CPU catalog declarations
The embedded bridgeboard glue provides its own file-local CPU tables
and model_init() helper. The public PCem header declarations are not
used by the UAE integration, and some of the names collide with those
local definitions when compiled as C++.
Disable the unused declarations in the imported headers instead of
removing individual entries. This avoids mixed-linkage conflicts while
leaving the original declarations visible in the source for reference.
The PCI bridge code maps the config, I/O, memory, and bridge banks
before their definitions later in pci.cpp. Clang requires declarations
before those uses.
Keep the declarations and definitions in an anonymous namespace. The
objects remain private to pci.cpp even though the forward declarations
use extern syntax.
Stefan Reinauer [Sun, 31 May 2026 04:15:01 +0000 (21:15 -0700)]
pcem: pass MIDI parser a byte buffer
Midi_Parse() takes a BYTE pointer. Store the uint8_t input in a local
BYTE before passing it on so the call does not depend on uint8_t and
BYTE being the same typedef on every host.
Stefan Reinauer [Mon, 1 Jun 2026 21:17:14 +0000 (14:17 -0700)]
pcem: select Voodoo codegen by host capability
The imported Voodoo code only enabled its x86 code generators through
Windows-oriented preprocessor checks. That left Unix x86 builds with
the recompiler disabled even when the matching generator was compiled.
Derive explicit PCEM_VOODOO_CODEGEN macros from the host CPU and use
those macros for init, close, rendering, and the default recompiler
configuration.
Stefan Reinauer [Mon, 1 Jun 2026 21:15:51 +0000 (14:15 -0700)]
pcem: avoid dynamic offsetof in Voodoo codegen
The Voodoo x86 code generators compute offsets into array members
with offsetof(type, field[index]). Some compilers reject that
expression form.
Add helpers that derive the offset from field[0] plus an element
stride. That preserves the generated offsets without relying on a
runtime-indexed offsetof expression. This matches the same cleanup
merged upstream in 86Box.
Stefan Reinauer [Sun, 31 May 2026 02:58:12 +0000 (19:58 -0700)]
pcem: fit bridgeboard glue into UAE builds
The embedded PCem sources are compiled as part of UAE's bridgeboard
integration, not as a standalone PCem binary.
Keep the standalone dynarec entry points behind the non-UAE build
guard, leave the shared block-end flag visible to the interpreter
code, and provide default device configuration values used by the
bridgeboard devices.
Stefan Reinauer [Mon, 1 Jun 2026 20:39:20 +0000 (13:39 -0700)]
pcem: fit graphics sources into C++ builds
WinUAE builds the imported PCem graphics sources as C++ files.
The MGA source includes C atomics directly, and the BT482 RAMDAC
source uses C allocation declarations through C++ headers.
Use C++ atomics when compiling MGA as C++, and include the C++
cstdlib wrapper where the BT482 RAMDAC needs those declarations.
Stefan Reinauer [Mon, 1 Jun 2026 20:38:59 +0000 (13:38 -0700)]
pcem: make MGA high-bit masks unsigned
MGA defines several bit-31 masks from a signed int literal.
Shifting a signed 1 into the sign bit is undefined behavior in C.
Use UINT32_C(1) so the masks are built in unsigned arithmetic.
This matches the same cleanup merged upstream in 86Box, with the
extra OPTION_POWERPC mask that exists in this imported copy.
Stefan Reinauer [Tue, 26 May 2026 07:19:35 +0000 (00:19 -0700)]
pcem: fix helper thread handles
The PCem compatibility layer returned a raw uae_thread_id as a
thread_t pointer and then waited on that value through the semaphore
API. That was pointer-shaped on some targets, but it was not a valid
wrapper around UAE's thread API.
Store the uae_thread_id in an explicit PCem handle object, join it
with uae_wait_thread(), and free the wrapper after wait or close. Reset
and signal PCem events through the existing semaphore object instead of
passing the address of a local pointer copy.
Stefan Reinauer [Sun, 31 May 2026 02:59:04 +0000 (19:59 -0700)]
cd32_fmv: include libmpeg2 headers as C
The external libmpeg2 headers declare a C API. Wrap them in
extern "C" when they are included from C++ so the CD32 FMV decoder
links against the library's C symbols.
Stefan Reinauer [Sun, 31 May 2026 02:57:32 +0000 (19:57 -0700)]
prowizard: use C linkage for ripper hooks
The ripper entry points are consumed from C++ code. Wrap the public
declarations and the compiled search entry point in C linkage so names
match across C and C++ builds.
Stefan Reinauer [Sat, 23 May 2026 04:26:23 +0000 (21:26 -0700)]
archive: support official LZMA SDK 16.04 APIs
The bundled 7z reader used older SDK field names directly. Keep the
existing Windows SDK layout as the default path, and add an opt-in
UAE_7Z_SDK_1604 path for the public 16.04 headers.
Select the matching XZ finish constant by SDK family so the shared
archive code can build with either header set.
Stefan Reinauer [Thu, 21 May 2026 23:11:14 +0000 (16:11 -0700)]
chd: make LZMA and inline helpers portable
Use the public LZMA property writer to build decoder properties
instead of the MAME-only allocator helper. This keeps the CHD LZMA
path compatible with the stock SDK interface.
Make ATTR_FORCE_INLINE produce inline definitions on GCC and Clang so
header-defined helpers can be included safely by multiple translation
units. Define PTR64 from CPU_64_BIT when the build has not already
provided it.
Stefan Reinauer [Sun, 31 May 2026 02:56:31 +0000 (19:56 -0700)]
jit: use ucontext_t for gregset access
The generic Unix exception path works with ucontext_t directly. Use that
typedef instead of struct ucontext so platforms that expose only
ucontext_t still build.
Stefan Reinauer [Tue, 26 May 2026 01:14:33 +0000 (18:14 -0700)]
gfxboard: rewind Picasso IV flash before autoconfig
Picasso IV autoconfig is read from the flash image, but the
initializer can run more than once while the expansion list is
scanned and sorted. loadp4rom() leaves the flash zfile positioned
later in the image, so a later dry scan read all-0xff data and the
board looked like it had no autoconfig block.
Seek back to the beginning before reading the Picasso IV
autoconfig bytes so repeated scans see the same board data.
Stefan Reinauer [Thu, 21 May 2026 19:52:04 +0000 (12:52 -0700)]
dms: include target configuration header
crc_csum.cpp uses UAE target types through the DMS headers. Include
sysconfig.h first so those target type definitions are available
before the archive declarations are parsed.
Stefan Reinauer [Thu, 21 May 2026 00:37:36 +0000 (17:37 -0700)]
isofs: avoid undefined timezone sign extension
make_date() sign-extends the ISO9660 timezone byte when the high
bit is set. (-1 << 8) shifts a negative signed value, which is
undefined behavior in C++.
Use ~0xff to build the same extension mask without relying on
that undefined shift.
Stefan Reinauer [Sun, 31 May 2026 02:55:32 +0000 (19:55 -0700)]
native2amiga: pass signal state as pipe pointer
write_comm_pipe_pvoid stores a pointer-sized value. Cast the
processed-state token through void * at the call site so the helper
receives the type it expects.
Stefan Reinauer [Sun, 31 May 2026 07:32:59 +0000 (00:32 -0700)]
softfloat: drop stale float_raise declaration
float_raise() is provided as a static inline helper by
softfloat-specialize.h. Remove the separate external prototype from
softfloat.h so the header does not advertise a non-existent external
definition.
Stefan Reinauer [Sun, 31 May 2026 07:32:30 +0000 (00:32 -0700)]
softfloat: copy mod/rem quotient through uint64_t
floatx80_mod() and floatx80_rem() take a uint64_t quotient pointer,
while the FPU wrapper stores the quotient in uae_u64. Copy through a
temporary so the call does not depend on those typedefs being the same
type on every host.
Stefan Reinauer [Sun, 31 May 2026 07:28:39 +0000 (00:28 -0700)]
softfloat: use lowercase macro header name
The source already includes the macro helper as softfloat-macros.h.
Rename the tracked file to match that spelling so case-sensitive file
systems do not depend on the old all-caps name.
Stefan Reinauer [Sun, 31 May 2026 04:14:51 +0000 (21:14 -0700)]
a2410: drop unused TMS bank declaration
The A2410 emulation does not reference tms_bank from this file. Drop
the stale extern declaration while keeping the bank definition local to
the TMS34010 code that owns it.
Stefan Reinauer [Sun, 31 May 2026 07:20:57 +0000 (00:20 -0700)]
cfgfile: map legacy toccata_mixer setting
The old toccata_mixer option enabled the board but did not carry the
current per-board mixer setting. Map the legacy key onto the Toccata
ROM config bit so older configurations preserve the same mixer state.
Stefan Reinauer [Sun, 31 May 2026 07:19:10 +0000 (00:19 -0700)]
sndboard: disable recording if capture setup fails
codec_start() allocated the record buffer even when host capture setup
failed. Treat that as recording unavailable, clear the record bit, free
the buffer, and leave playback running.
Stefan Reinauer [Sun, 31 May 2026 07:18:38 +0000 (00:18 -0700)]
sound: track QEMU output voices separately
Keep every QEMU output voice on a small linked list instead of
replacing a single global pointer. Pass the voice through the audio
callback so each active stream reads its own buffer.
Update all active QEMU voice volumes, only run QEMU board audio when a
voice is active, clamp writes to the sample buffer, and return no input
data until the capture path has a real backend.
Stefan Reinauer [Sun, 31 May 2026 02:58:07 +0000 (19:58 -0700)]
dsp3210: fix portable host declarations
Declare the onboard ROM as external from the emulation file and use the
common byte-swap helpers in the host glue. This avoids Windows-only
byteswap names in shared code.
jit/x86-64: fix FPU FLDCW codegen crashes on 64-bit hosts
The x86-64 JIT could crash when compiling FPU rounding-mode changes
(FLDCW with an indexed operand) via two defects in codegen_x86.cpp:
1. x86_64_rex() dereferenced its 'b' (REX.B) pointer unconditionally and
ignored 'r'/'x'. raw_fldcw_m_indexed() passes its index register in the
'x' (REX.X) slot with b == NULL, so the function read through a NULL
pointer; an index register in r8-r15 would also have been mis-encoded.
x86_64_rex() now null-guards each pointer and emits REX.R/X/B (and W).
2. raw_fldcw_m_indexed() loaded the 64-bit base of the x87 control-word
table into RAX. RAX is allocatable (not in always_used[]) and may hold a
live m68k value mid-block, and a LOWFUNC cannot declare a register
clobber, so the allocator's view of RAX was silently corrupted; a later
access through that register (e.g. MOVEM.L ...,-(An)) then dereferenced
the table pointer as an m68k address and faulted. The base is now
materialized in a push/pop-preserved scratch register chosen to differ
from the index register.
Only x86-64 is affected; the 32-bit path uses a direct FLDCW [reg] encoding
and ARM64 uses different codegen.