Commit f27872b
authored
feat: comprehensive libretro core improvements — bug fixes, new options, modern API, CUE/CCD detection (#1825)
* fix: libretro core improvements — save state bug, aspect ratio, controller types, input polling
- Fix double zfile_fclose in retro_unserialize (restore_state_file
already closes via savestate_restore_finish)
- Fix retro_serialize_size to sum all RAM boards (MAX_RAM_BOARDS)
with z3chipmem/mbresmem and increase overhead from 2MB to 8MB
- Add RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME for Workbench boot
- Use fixed 4:3 aspect ratio instead of raw pixel ratio
- Add CD32 Pad and Joystick controller subtypes
- Add RETRO_ENVIRONMENT_GET_PERF_INTERFACE for profiling
- Fix mouse polling to support both Amiga ports (was hardcoded to 1)
- Skip input polling for ports configured as RETRO_DEVICE_NONE
- Extract Makefile version from CMakeLists.txt instead of hardcoding
* fix: mask device subclass IDs for joyport auto-ordering
RETRO_DEVICE_SUBCLASS values (CD32 Pad, Joystick) encode the subclass
in the upper bits. The joyport auto-ordering logic compared the raw
device ID against RETRO_DEVICE_JOYPAD, causing subclass selections
to be treated as non-joypad devices. Apply RETRO_DEVICE_MASK before
comparison, matching how poll_input() already handles these values.
* fix: harden libretro core — defensive fixes and modern API adoption
- Guard environ_cb against NULL before first use in retro_set_environment
- Replace all bare strdup() calls in core_entry() with safe_strdup that
tracks allocation failures; skip amiberry_main if OOM occurs
- Declare serialization quirks (CORE_VARIABLE_SIZE, MUST_INITIALIZE) so
frontends handle variable save-state sizes and pre-init correctly
- Upgrade show_message() to SET_MESSAGE_EXT with severity, duration in
ms, and priority; falls back to legacy SET_MESSAGE automatically
- Warn on unreadable disk paths in replace_image_index (accept anyway
since the file may appear later, e.g. network mount)
- Truncate WHDLoad sanitized filenames to 200 chars to prevent
filesystem path-length overflows on extraction
* feat: add core options, audio API, superhires geometry, CUE/CCD parsing, disk mutex
Phase 3 — Core options expansion:
- amiberry_sound_filter: off/emulated/on (Amiga low-pass filter)
- amiberry_stereo_separation: 0-10 (Amiga hard-panned audio mixing)
- amiberry_floppy_speed: turbo/1x/2x/4x/8x
- amiberry_video_standard: auto/PAL/NTSC (core restart required)
Phase 4 — Audio API:
- Register SET_MINIMUM_AUDIO_LATENCY (64ms) to reduce crackling on
50Hz PAL content running on 60Hz displays
- Register SET_AUDIO_BUFFER_STATUS_CALLBACK to receive underrun alerts
Phase 5 — Video geometry:
- Increase MAX_GFX_WIDTH from 1280 to 1920 and MAX_GFX_HEIGHT from
1024 to 1280, matching the draw buffer dimensions so superhires
modes (1508px wide) are not clamped by initial geometry
Phase 6 — Disk improvements:
- Implement CUE sheet parser (detect_cd_content_from_cue): parses
FILE/TRACK directives, resolves binary path, reads sector 16
with correct offset for MODE1/2048 and MODE1/2352 sector sizes
- Implement CCD parser (detect_cd_content_from_ccd): finds companion
.img file with raw 2352-byte sectors and reads sector 16
- Replace TODO heuristic with actual CUE/CCD detection in
detect_cd_content()
- Add std::mutex protection to all disk control callbacks to prevent
race conditions from concurrent frontend/emulator access
* fix: address PR review — subclass masking, aspect ratio, CUE case-sensitivity
- Apply RETRO_DEVICE_MASK in apply_port_device() so CD32 Pad and
Joystick subclass IDs are correctly recognized as joypads
- Remove redundant amiga_aspect_ratio() helper; inline 4:3 constant
- Make CUE parser fully case-insensitive via lowercase copy matching1 parent 0138766 commit f27872b
2 files changed
+404
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | | - | |
106 | | - | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
0 commit comments