Update atari800 core from 3.1.0 to 5.2.0#123
Update atari800 core from 3.1.0 to 5.2.0#123WizzardSK wants to merge 7 commits intolibretro:masterfrom
Conversation
Replace atari800/src with standalone atari800 5.2.0 source and re-apply all libretro-specific patches: - State save/load via memory stream (Retro_SaveAtariState/ReadAtariState) - Per-subsystem Retro_*_StateSave/StateRead functions - ROM directory search (retro_system_directory) - Config file handling (legacy_configuration_file) - co_switch in Atari800_Sync for libretro coroutine model - Analog joystick (Atari_POT) and digital 5200 sensitivity - Stereo sound defaults and POKEYSND_stereo_enabled - UI menu cleanup (remove screenshot/monitor/exit items) - CRC-based cart hash detection in AFILE_DetectFileType - path_mkdir for libretro directory creation Build system changes: - Add cartridge_info.c, file_export.c, altirra_5200_charset.c - Remove emuos.c (replaced by EMUOS_ALTIRRA define), sndsave.c Config changes: - PACKAGE_VERSION: 3.1.0 → 5.2.0 - Add EMUOS_ALTIRRA=1 for built-in AltirraOS ROMs Bug fix: - Guard POKEYSND_Init in Atari800_SetTVMode against Sound_out.freq==0 to prevent crash when TV mode changes before sound is initialized
|
https://git.libretro.com/libretro/libretro-atari800/-/pipelines/64699 Looks like most failures are related to termios.h |
termios.h is missing on Windows and transitively broken on devkitPro platforms (PSP, Vita, 3DS, GC/Wii, Wii U, Switch) where it pulls in a nonexistent sys/termios.h. monitor.c includes it only when HAVE_TERMIOS_H is defined, so skip the define on those targets.
|
Thanks for the pointer! Fixed in 1d7a65f — |
|
I don't think .a52 files for the Atari 5200 system work. They don't boot. At least on Win 11. |
|
Only one remaining build failure for WiiU missing nanosleep https://git.libretro.com/libretro/libretro-atari800/-/jobs/1295954 |
devkitPPC's libc declares nanosleep() in <time.h> but doesn't provide the symbol at link time, causing the WiiU build to fail. Fall back to usleep() like VITA/PSP/PS3 do.
|
Pushed 69e3f38 — |
|
@WizzardSK Have you tested the Atari 5200 ROMs? |
|
Yes, I have tested Atari 5200 games yesterday on Linux and I also having black screen. edit: I think I found the bug. Tomorrow I will try to do the fix. |
The 3.1.0 -> 5.2.0 core update dropped the libretro-specific patch in atari800/src/cartridge.c (commit 1ac0cbc, 2017) that CRC-autodetected 5200 cart types. Without it, raw .a52/.bin images of common sizes (16K, 32K, 64K, 128K, 256K, 512K) match multiple entries in CARTRIDGES[] and fall into CARTRIDGE_UNKNOWN, which triggers UI_SelectCartType() during boot -> black screen. Re-implement the autodetect in the libretro layer (no change to atari800/src/): - carts_hash: new get_5200_cart_atari800_type(crc, size) resolving the internal a5200_* category (plus size-based fallback for unlisted .a52 files) to CARTRIDGE_5200_* enums. - libretro-core: compute CRC for .a52 too, store the resolved type in autorun5200CartType. - cmdline: for A5200_CART, invoke atari800 with '-5200 -cart-type <N> -cart <file>' so CARTRIDGE_Initialise() preserves the commandline-specified type when auto-detect returns UNKNOWN.
|
Fix for Atari 5200 black screen regression introduced by this PR (commit bc35963). BugReplacing Fix (no change to
|
Upstream atari800 5.2.0 knows only CARTRIDGE_5200_40 (fixed 8K at image offset 0x8000). The TOSEC dump of Bounty Bob Strikes Back (5200) CRC32 0x7873c6dd has the fixed 8K at image offset 0 and the two banked 16K regions shifted by +0x2000. Running it through CARTRIDGE_5200_40 produced garbage at the reset vector -> CIM at $0007 and the Atari800 crash monitor. This was already handled in the 3.1.0 libretro fork via PR libretro#106 (CARTRIDGE_5200_40_ALT, slot 73), but was lost when the core was replaced wholesale with upstream 5.2.0 in PR libretro#123. Re-add it at slot 104 (first unused slot in upstream 5.2.0 enum): - atari800/src/cartridge_info.h: add CARTRIDGE_5200_40_ALT = 104. - atari800/src/cartridge_info.c: add CARTRIDGES[104] entry (40 KB). - atari800/src/cartridge.c: add ALT case to CartIsFor5200(), cold mapping in MapActiveCart(), and runtime bank-switch offsets in access_BountyBob1()/access_BountyBob2(). - libretro/carts_hash.c: map a5200_40_ALT -> CARTRIDGE_5200_40_ALT.
|
Follow-up fix: Bounty Bob Strikes Back! (5200) was crashing with CIM at $0007 (commit 3a6b4c5). The TOSEC dump CRC32 `0x7873c6dd` has an alternative ROM layout: the fixed 8K block is at image offset 0 (mapped to $8000–$BFFF), with the two banked 16K regions shifted by +0x2000. Running it through the standard `CARTRIDGE_5200_40` (which expects the fixed 8K at image offset 0x8000) produces garbage at the reset vector → CIM → Atari800 crash monitor. This was already handled in the 3.1.0 fork by PR #106 via a dedicated `CARTRIDGE_5200_40_ALT` cart type (slot 73 back then) with its own `MapActiveCart()` case and shifted offsets in the Bounty Bob bank-switch handlers. That custom cart type was lost when the core was replaced wholesale with upstream 5.2.0 in this PR. Re-added at slot 104 (first unused slot in upstream 5.2.0's enum):
Verified: `Bounty Bob Strikes Back! (USA).a52` boots to the title screen (Big Five Software copyright 1985) in RetroArch. Before: black screen on boot, then Atari computer crash monitor. |
|
@WizzardSK Unfortunately, all versions of this game still don't work properly: This is a problem that also occurred in 3.1. But in the standalone 5.2 version, the games work fine. |
|
After some research, I found information that the game uses some form of protection. This likely applies to the Atari 800 and Atari 5200 cartridge versions. I don't think the tape version has protection. The sound issue is likely caused by something else. I don't know if this will be useful (information from the Atariage forum): " bounty bob uses custom banking scheme, developed for protecting atari 2600 games https://forums.atariage.com/topic/314050-bounty-bob-strikes-back-problem/#comments |
Fixes the menu-freeze regression on Bounty Bob Strikes Back! reported by @KamiLordus. The 3.1.0 fork's cartridge.c had an explicit POKEYSND_stereo_enabled = FALSE for Bounty Bob ("game locks") that was lost when the core was replaced with upstream 5.2.0 in 32cc3b2. POKEY masks register addresses with 0x0F in mono and 0x1F in stereo (pokey.c:188). Bounty Bob writes to mirrored POKEY addresses (e.g. \$E810 on 5200, \$D210 on 800) expecting them to alias to \$E800/\$D200 on a single-POKEY system. With stereo enabled, bit 4 is decoded as chip-select and those writes vanish into a nonexistent second chip, leaving the game stuck in the title screen. Real Atari 5200 has only one POKEY, so stereo is non-authentic for any 5200 cart -- force mono whenever the machine is set to MACHINE_5200. For Atari 800 .car images, peek at the 4-byte big-endian type field in the 16-byte CART header; if it's CARTRIDGE_BBSB_40 (18), force mono before Sound_Initialise() runs. Verified with Bounty Bob Strikes Back! (USA).a52 (CRC 0x7873c6dd): attract-mode demo runs after the fix; previously the title screen was static even after 2000 frames. Not covered: .cas tape dumps of BBSB (no header to identify the game).
Stock Atari 800/XL/XE has a single POKEY chip. Stereo POKEY is the Atari Stereo Sound Mod hardware addon (second POKEY at $D210-$D21F). Defaulting to mono is more authentic and avoids breaking titles that rely on POKEY register mirroring (Bounty Bob Strikes Back, Road Race) -- those games write to addresses like $D210 expecting them to alias to $D200, but with stereo enabled bit 4 is decoded as chip-select and the writes vanish into a nonexistent second chip. Adds atari800_pokey_stereo (disabled by default) to the core options. The option is processed at the top of update_variables(), so the existing 5200 (always mono) and BBSB .car (always mono) overrides still apply on top of it. To use stereo POKEY mod games, user toggles the option to enabled and restarts. Matches standalone atari800 behavior where stereo is a user-controllable setting (-stereo / -nostereo cmdline, STEREO_POKEY config, or UI toggle) rather than a forced default.
|
@KamiLordus Identified the root cause and pushed two follow-up commits. Root causeThe 3.1.0 fork's POKEY masks register addresses with Fixes (commits 01d80d3, d66c6a2)
Verified
Not addressed:
|
|
First of all, thanks a lot for your work on this. With these settings, the tapes work (no crashes) in version 3a6b4c5 – except there's no sound. Although I don't rule out that the Linux version might be different. For testing purposes, I'll include my versions of the tapes. If you can, please test them and then remove them. If that doesn't help, let's leave it as is. |
|
@KamiLordus Did some more digging on the Both Title screen comparison:
So the cart has proper title music and the European budget tape conversions don't — they reuse the simple typewriter "tick" SFX during the intro instead of a melodic theme. That's a property of those specific tape dumps (the conversions stripped the music to fit cassette memory layout), not a regression in this PR. I also cross-checked one of the tapes against standalone If you're getting genuine silence in-game on Win11 (not just the missing title music), that's almost certainly a RetroArch audio driver / buffer issue rather than a core problem — the POKEY mono fix in d66c6a2 already addresses the underlying mirror-write issue that was breaking BBSB gameplay sound. Worth trying a different audio driver in RetroArch settings (WASAPI ↔ XAudio ↔ DirectSound) once a Win build with this PR's changes is available. |
|
@WizzardSK Very interesting. I usually use sio acceleration off, which often causes crashes for various games on tapes, but I always use the RA fast forward option. I wonder if that's the problem with the lack of sound. Thanks a lot for checking the tapes and providing the information. |
|
Tested and hurray, all versions work without any problem. Great work WizzardSK!!! |
Summary
atari800/src/with standalone atari800 5.2.0 source (from 3.1.0)POKEYSND_InitagainstSound_out.freq==0)Changes
cartridge_info.c/h,file_export.c/h,altirra_5200_charset.c,codecs/,libatari800/,pokeyrec.c/hemuos.c/h(replaced byEMUOS_ALTIRRA),sndsave.c/hPACKAGE_VERSION3.1.0 → 5.2.0, addedEMUOS_ALTIRRA=1