Remove __LIBRETRO__: this core only ever builds for libretro

Every one of the 46 __LIBRETRO__ conditionals in the tree guarded a
choice between "the libretro build" and "a build that cannot exist":
this repository has no other frontend, no configure script, and no way
to compile without the define. Keep the libretro side of each one,
delete the other, and stop defining the symbol in Makefile.libretro,
the 22 build/Makefile.* platform files, etc/mkmake.lua and
build/jni/Android.mk.

Everything was stripped mechanically with unifdef -D__LIBRETRO__; the
only hand edits are in fuse/peripherals/joystick.c, where the comment
above the now-unconditional joy_kempston enable described the deleted
condition, and libspectrum/snap_accessors.txt, where the %ifdef around
the TurboSound fields is gone so accessor.pl regenerates exactly the
stripped snap_accessors.c (verified: the regenerated file is
byte-identical).

What falls out:

  - machine.h/spectrum.h/periph.c/unittests.c: one
    spectrum_unattached_port signature (taking the port, for floating
    bus emulation) instead of two.
  - ay.c/ay.h/machine.h/szx.c/snap_accessors.*/z80.c: the TurboSound
    second AY and its AY2 snapshot chunk are simply part of the core.
  - joystick.c/settings.c/widget.c: the libretro joystick-mapping
    behaviour (frontend port wiring is authoritative, joy_kempston
    always enabled on snapshot load, no joystick_N_output defaults) is
    now the only behaviour, unconditionally.
  - snapshot.c/snapshot.h: the peripheral-override hook from ad7e52f
    is unconditional.
  - szx.c: the fixed-size savestate padding (0xFF tail and fake
    0xFFFFFFFF chunk) and AY2 chunk read/write are unconditional.

No functional change. The built core contains no __LIBRETRO__ string,
and the full verification matrix from issues #176 and #177 - Kempston
Mouse hotplug and Fuller joystick wiring with and without fastload,
option flips mid-autoload, all five border modes measured from the
framebuffer, machine boots, and a savestate round trip - produces
identical reset counts, port reads, framebuffer hashes and audio
sample counts to the build before this change.
This commit is contained in:
libretroadmin authored and libretroadmin committed 2026-08-11 06:57:45 +02:00
1 parent 2b5c8ce8ac
commit 5e3762d4e1
43 files changed
+30 -159

No files matched your search

+1 -1
View File
@@ -501,7 +501,7 @@ ifeq ($(LOG_PERFORMANCE), 1)
endif
DEFINES := -D__LIBRETRO__ $(PLATFORM_DEFINES)
DEFINES := $(PLATFORM_DEFINES)
DEFINES += -DHAVE_CONFIG_H
CFLAGS += $(fpic) $(DEFINES)
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-arm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-arm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-19/arch-arm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-mips
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-mip
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-x86
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-x86
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m32 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m32 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T -Wl,-n
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T -Wl,-n
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m32 -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -m64 -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm -mthumb -mcpu=cortex-a9 -mfloat-abi=hard
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
+1 -1
View File
@@ -22,6 +22,6 @@ $(shell cp $(CORE_DIR)/src/config_libspectrum.h $(CORE_DIR)/libspectrum/config.h
include $(CLEAR_VARS)
LOCAL_MODULE := retro
LOCAL_SRC_FILES := $(SOURCES_C)
LOCAL_CFLAGS := $(COREFLAGS) -D__LIBRETRO__
LOCAL_CFLAGS := $(COREFLAGS)
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/build/link.T
include $(BUILD_SHARED_LIBRARY)
+1 -1
View File
@@ -61,7 +61,7 @@ PLATLDXFLAGS = ${PLAT_LDXFLAGS}
################
# libretro setup
RETRODEFS = -D__LIBRETRO__
RETRODEFS =
RETROCFLAGS =
RETROCXXFLAGS =
RETROLDFLAGS =
-6
View File
@@ -34,11 +34,7 @@
#include "peripherals/specdrum.h"
#include "spectrum.h"
#ifdef __LIBRETRO__
typedef libspectrum_byte (*spectrum_unattached_port_fn)( libspectrum_word port );
#else
typedef libspectrum_byte (*spectrum_unattached_port_fn)( void );
#endif
/* How long do things take to happen; fields are pulled from libspectrum
via the libspectrum_timings_* functions */
@@ -81,9 +77,7 @@ typedef struct fuse_machine_info {
attached to anything */
ayinfo ay; /* The AY-3-8912 chip */
#ifdef __LIBRETRO__
ayinfo ay2; /* Second AY-3-8912 chip (TurboSound) */
#endif
specdrum_info specdrum; /* SpecDrum settings */
-4
View File
@@ -86,11 +86,7 @@ pentagon_select_ff_read( libspectrum_word port, libspectrum_byte *attached )
data = beta_sp_read( port, &tmpattached );
if( !tmpattached )
#ifdef __LIBRETRO__
data = spectrum_unattached_port(port);
#else
data = spectrum_unattached_port();
#endif
*attached = 0xff; /* TODO: check this */
return data;
}
-4
View File
@@ -50,11 +50,7 @@ specplus2a_init( fuse_machine_info *machine )
machine->ram.contend_delay_no_mreq = spectrum_contend_delay_none;
machine->ram.valid_pages = 8;
#ifdef __LIBRETRO__
machine->unattached_port = spectrum_unattached_port_amstrad;
#else
machine->unattached_port = spectrum_unattached_port_none;
#endif
machine->shutdown = NULL;
machine->memory_map = specplus3_memory_map;
-4
View File
@@ -121,11 +121,7 @@ int specplus3_init( fuse_machine_info *machine )
machine->ram.contend_delay_no_mreq = spectrum_contend_delay_none;
machine->ram.valid_pages = 8;
#ifdef __LIBRETRO__
machine->unattached_port = spectrum_unattached_port_amstrad;
#else
machine->unattached_port = spectrum_unattached_port_none;
#endif
specplus3_765_init();
specplus3_menu_items();
-4
View File
@@ -49,11 +49,7 @@ specplus3e_init( fuse_machine_info *machine )
machine->ram.contend_delay_no_mreq = spectrum_contend_delay_none;
machine->ram.valid_pages = 8;
#ifdef __LIBRETRO__
machine->unattached_port = spectrum_unattached_port_amstrad;
#else
machine->unattached_port = spectrum_unattached_port_none;
#endif
machine->shutdown = specplus3_shutdown;
-4
View File
@@ -352,11 +352,7 @@ readport_internal( libspectrum_word port )
if( callback_info.attached != 0xff )
callback_info.value =
periph_merge_floating_bus( callback_info.value, callback_info.attached,
#ifdef __LIBRETRO__
machine_current->unattached_port(port) );
#else
machine_current->unattached_port() );
#endif
/* If we're RZX recording, store this byte */
if( rzx_recording ) rzx_store_byte( callback_info.value );
-28
View File
@@ -51,7 +51,6 @@ static void ay_to_snapshot( libspectrum_snap *snap );
static libspectrum_dword get_current_register( void );
static void set_current_register( libspectrum_dword value );
#ifdef __LIBRETRO__
/* TurboSound: a second AY-3-8912 chip, selected via the classic NedoPC
protocol - writing a value with its top 5 bits all set (0xF8-0xFF, never
a valid register index since a single AY only has registers 0-15) to the
@@ -73,13 +72,6 @@ current_ay( void )
{
return current_ay_chip() ? &machine_current->ay2 : &machine_current->ay;
}
#else
static ayinfo *
current_ay( void )
{
return &machine_current->ay;
}
#endif
static module_info_t ay_module_info = {
@@ -182,12 +174,10 @@ ay_reset( int hard_reset GCC_UNUSED )
ay->current_register = 0;
memset( ay->registers, 0, sizeof( ay->registers ) );
#ifdef __LIBRETRO__
machine_current->ay2.current_register = 0;
memset( machine_current->ay2.registers, 0,
sizeof( machine_current->ay2.registers ) );
ay_turbosound_active_chip = 0;
#endif
}
/* What happens when the AY register port (traditionally 0xfffd on the 128K
@@ -228,12 +218,10 @@ ay_registerport_read( libspectrum_word port GCC_UNUSED, libspectrum_byte *attach
void
ay_registerport_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
{
#ifdef __LIBRETRO__
if( ay_turbosound_enabled && ( b & 0xf8 ) == 0xf8 ) {
ay_turbosound_active_chip = b & 1;
return;
}
#endif
set_current_register( b );
}
@@ -249,7 +237,6 @@ ay_dataport_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
current = ay->current_register;
ay->registers[ current ] = b & mask[ current ];
#ifdef __LIBRETRO__
sound_ay_write( current_ay_chip(), current, b, tstates );
/* The .psg recording format and the serial-out port only cover a single
chip; only chip A's I/O port pins are wired to anything on real
@@ -258,11 +245,6 @@ ay_dataport_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
if( psg_recording ) psg_write_register( current, b );
if( current == 14 ) printer_serial_write( b );
}
#else
sound_ay_write( current, b, tstates );
if( psg_recording ) psg_write_register( current, b );
if( current == 14 ) printer_serial_write( b );
#endif
}
void
@@ -276,15 +258,10 @@ ay_state_from_snapshot( libspectrum_snap *snap )
for( i = 0; i < AY_REGISTERS; i++ ) {
machine_current->ay.registers[i] =
libspectrum_snap_ay_registers( snap, i );
#ifdef __LIBRETRO__
sound_ay_write( 0, i, machine_current->ay.registers[i], 0 );
#else
sound_ay_write( i, machine_current->ay.registers[i], 0 );
#endif
}
}
#ifdef __LIBRETRO__
void
ay2_state_from_snapshot( libspectrum_snap *snap )
{
@@ -306,21 +283,18 @@ ay2_state_from_snapshot( libspectrum_snap *snap )
sound_ay_write( 1, i, machine_current->ay2.registers[i], 0 );
}
}
#endif
static void
ay_from_snapshot( libspectrum_snap *snap )
{
if( machine_current->capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_AY ) {
ay_state_from_snapshot( snap );
#ifdef __LIBRETRO__
/* Restored unconditionally, like chip A above, regardless of whether
TurboSound is currently enabled: harmless if disabled (chip B's
registers just sit unused - see current_ay_chip()), and safe for
snapshots that predate this chunk (its accessors default to zero,
same as any other absent chunk's fields). */
ay2_state_from_snapshot( snap );
#endif
}
}
@@ -337,7 +311,6 @@ ay_to_snapshot( libspectrum_snap *snap )
libspectrum_snap_set_ay_registers( snap, i,
machine_current->ay.registers[i] );
#ifdef __LIBRETRO__
/* Written unconditionally, like chip A above - see the write side of
the AY2 chunk in libspectrum/szx.c for why this must not depend on
the (live-toggleable) ay_turbosound_enabled option. */
@@ -351,7 +324,6 @@ ay_to_snapshot( libspectrum_snap *snap )
for( i = 0; i < AY_REGISTERS; i++ )
libspectrum_snap_set_ay2_registers( snap, i,
machine_current->ay2.registers[i] );
#endif
}
static libspectrum_dword
-2
View File
@@ -43,12 +43,10 @@ void ay_dataport_write( libspectrum_word port, libspectrum_byte b );
void ay_state_from_snapshot( libspectrum_snap *snap );
#ifdef __LIBRETRO__
/* TurboSound: a second AY-3-8912 chip, selected via the classic NedoPC
protocol (see ay.c). Controlled by a core option; off by default. */
extern int ay_turbosound_enabled;
void ay2_state_from_snapshot( libspectrum_snap *snap );
#endif
#endif /* #ifndef FUSE_AY_H */
+7 -11
View File
@@ -296,10 +296,6 @@ joystick_enabled_snapshot( libspectrum_snap *snap )
}
if( settings_current.joystick_keyboard_output != fuse_type &&
#ifndef __LIBRETRO__
settings_current.joystick_1_output != fuse_type &&
settings_current.joystick_2_output != fuse_type &&
#endif
!rzx_playback ) {
switch( ui_confirm_joystick( libspectrum_snap_joystick_list(snap,i),
libspectrum_snap_joystick_inputs(snap,i)) ) {
@@ -317,13 +313,13 @@ joystick_enabled_snapshot( libspectrum_snap *snap )
}
}
/* If the snap was configured for a Kempston joystick, enable
our Kempston emulation in case the snap was reading from
the joystick to prevent things going haywire */
#ifndef __LIBRETRO__
if( fuse_type == JOYSTICK_TYPE_KEMPSTON )
#endif
settings_current.joy_kempston = 1;
/* Enable our Kempston emulation whatever joystick the snap was
configured for, in case the snap was reading from the joystick, to
prevent things going haywire. (Upstream Fuse only does this when the
snap's joystick really is a Kempston; this core has always done it
unconditionally, since the frontend's port wiring, not the snapshot,
decides what the user is actually holding.) */
settings_current.joy_kempston = 1;
}
}
-4
View File
@@ -87,7 +87,6 @@ snapshot_copy_from( libspectrum_snap *snap )
periph_disable_optional();
module_snapshot_enabled( snap );
#ifdef __LIBRETRO__
/* Which optional peripherals are plugged in is frontend configuration
here, not emulated machine state, so the core options outrank whatever
module_snapshot_enabled() just read out of the file. Do it now rather
@@ -97,7 +96,6 @@ snapshot_copy_from( libspectrum_snap *snap )
a second reset, which for a peripheral declaring hard_reset throws
away the snapshot that was just loaded. */
libretro_snapshot_periph_override();
#endif
machine = libspectrum_snap_machine( snap );
@@ -123,7 +121,6 @@ snapshot_copy_from( libspectrum_snap *snap )
return 0;
}
#ifdef __LIBRETRO__
/* Bytes allocated in snapshot_buffer. Kept apart from snapshot_size, which
is the length of the snapshot currently held in it: an SZX shrinks as
well as grows, and conflating the two made snapshot_size a high water
@@ -176,7 +173,6 @@ int snapshot_update(void)
libspectrum_free(buffer);
return 0;
}
#endif
int snapshot_write( const char *filename )
{
-2
View File
@@ -34,10 +34,8 @@ int snapshot_read_buffer( const unsigned char *buffer, size_t length,
int snapshot_copy_from( libspectrum_snap *snap );
#ifdef __LIBRETRO__
int snapshot_update( void );
void libretro_snapshot_periph_override( void );
#endif
int snapshot_write( const char *filename );
int snapshot_copy_to( libspectrum_snap *snap );
-14
View File
@@ -72,9 +72,7 @@ static const char * const frame_count_name = "frames";
/* Count of frames since last reset */
static libspectrum_dword frames_since_reset;
#ifdef __LIBRETRO__
static libspectrum_word last_floating_bus_amstrad_value = 0xff;
#endif
static void
spectrum_reset( int hard_reset )
@@ -231,11 +229,7 @@ spectrum_contend_delay_76543210( libspectrum_dword time )
/* What happens if we read from an unattached port? */
libspectrum_byte
#ifdef __LIBRETRO__
spectrum_unattached_port(libspectrum_word port)
#else
spectrum_unattached_port( void )
#endif
{
int line, tstates_through_line, column;
@@ -303,21 +297,14 @@ spectrum_unattached_port( void )
}
libspectrum_byte
#ifdef __LIBRETRO__
spectrum_unattached_port_none( libspectrum_word port )
#else
spectrum_unattached_port_none( void )
#endif
{
#ifdef __LIBRETRO__
/* Make compiler happy */
(void) port;
#endif
return 0xff;
}
#ifdef __LIBRETRO__
/**
* References:
* http://sky.relative-path.com/zx/floating_bus.html
@@ -426,5 +413,4 @@ spectrum_unattached_port_amstrad( libspectrum_word port )
return (game) ? 0xff : last_floating_bus_amstrad_value;
}
#endif
-5
View File
@@ -72,14 +72,9 @@ libspectrum_byte spectrum_contend_delay_none( libspectrum_dword time );
libspectrum_byte spectrum_contend_delay_65432100( libspectrum_dword time );
libspectrum_byte spectrum_contend_delay_76543210( libspectrum_dword time );
#ifdef __LIBRETRO__
libspectrum_byte spectrum_unattached_port( libspectrum_word port );
libspectrum_byte spectrum_unattached_port_none( libspectrum_word port );
libspectrum_byte spectrum_unattached_port_amstrad( libspectrum_word port );
#else
libspectrum_byte spectrum_unattached_port( void );
libspectrum_byte spectrum_unattached_port_none( void );
#endif
/* Miscellaneous stuff */
-2
View File
@@ -756,10 +756,8 @@ ui_confirm_joystick( libspectrum_joystick libspectrum_type, int inputs )
int error;
char title[80];
#ifdef __LIBRETRO__
if(( !settings_current.joy_prompt ) && (inputs & LIBSPECTRUM_JOYSTICK_INPUT_JOYSTICK_1))
return UI_CONFIRM_JOYSTICK_JOYSTICK_1;
#endif
if( !settings_current.joy_prompt ) return UI_CONFIRM_JOYSTICK_NONE;
-4
View File
@@ -155,11 +155,7 @@ floating_bus_test( void )
RAM[ memory_current_screen ][ offset ] = offset % 0x100;
for( tstates = 0; tstates < ULA_CONTENTION_SIZE; tstates++ )
#ifdef __LIBRETRO__
checksum += machine_current->unattached_port((libspectrum_word) 0xff) * ( tstates + 1 );
#else
checksum += machine_current->unattached_port() * ( tstates + 1 );
#endif
if( settings_current.late_timings ) {
switch( machine_current->machine ) {
case LIBSPECTRUM_MACHINE_16:
-8
View File
@@ -79,14 +79,12 @@ struct libspectrum_snap {
libspectrum_byte out_plus3_memoryport; /* Used for both the +3's and the Scorpion's 0x1ffd port */
libspectrum_byte out_ay_registerport;
libspectrum_byte ay_registers[ 16 ];
#ifdef __LIBRETRO__
/* TurboSound: second AY-3-8912 chip (fuse-libretro only) */
int turbosound_active;
libspectrum_byte out_ay2_registerport;
libspectrum_byte ay2_registers[ 16 ];
libspectrum_byte out_ay2_active_chip;
#endif
/* Timex-specific bits */
libspectrum_byte out_scld_hsr;
@@ -379,7 +377,6 @@ libspectrum_snap_alloc( void )
libspectrum_snap_set_out_ay_registerport( snap, 0x0e );
for( i = 0; i < 16; i++ )
libspectrum_snap_set_ay_registers( snap, i, 0 );
#ifdef __LIBRETRO__
/* TurboSound: second AY-3-8912 chip (fuse-libretro only) */
libspectrum_snap_set_turbosound_active( snap, 0 );
@@ -387,7 +384,6 @@ libspectrum_snap_alloc( void )
for( i = 0; i < 16; i++ )
libspectrum_snap_set_ay2_registers( snap, i, 0 );
libspectrum_snap_set_out_ay2_active_chip( snap, 0 );
#endif
/* Timex-specific bits */
libspectrum_snap_set_out_scld_hsr( snap, 0 );
@@ -642,8 +638,6 @@ libspectrum_snap_free( libspectrum_snap *snap )
for( i = 0; i < SNAPSHOT_SLT_PAGES; i++ )
libspectrum_free( libspectrum_snap_slt( snap, i ) );
libspectrum_free( libspectrum_snap_slt_screen( snap ) );
#ifdef __LIBRETRO__
#endif
libspectrum_free( libspectrum_snap_interface1_rom( snap, 0 ) );
@@ -1165,7 +1159,6 @@ libspectrum_snap_set_ay_registers( libspectrum_snap *snap, int idx, libspectrum_
{
snap->ay_registers[idx] = ay_registers;
}
#ifdef __LIBRETRO__
int
libspectrum_snap_turbosound_active( libspectrum_snap *snap )
@@ -1214,7 +1207,6 @@ libspectrum_snap_set_out_ay2_active_chip( libspectrum_snap *snap, libspectrum_by
{
snap->out_ay2_active_chip = out_ay2_active_chip;
}
#endif
libspectrum_byte
libspectrum_snap_out_scld_hsr( libspectrum_snap *snap )
-2
View File
@@ -80,13 +80,11 @@ libspectrum_byte out_plus3_memoryport 0 0x08 /* Used for both the +3's and the S
libspectrum_byte out_ay_registerport 0 0x0e
libspectrum_byte ay_registers 16
%ifdef __LIBRETRO__
/* TurboSound: second AY-3-8912 chip (fuse-libretro only) */
int turbosound_active
libspectrum_byte out_ay2_registerport
libspectrum_byte ay2_registers 16
libspectrum_byte out_ay2_active_chip
%endif
/* Timex-specific bits */
libspectrum_byte out_scld_hsr
-22
View File
@@ -87,12 +87,10 @@ static const libspectrum_word ZXSTRF_COMPRESSED = 1;
static const libspectrum_byte ZXSTAYF_FULLERBOX = 1;
static const libspectrum_byte ZXSTAYF_128AY = 2;
#ifdef __LIBRETRO__
/* Non-standard chunk: second AY-3-8912 chip (TurboSound). Not part of the
real SZX spec - only ever written/read by this core, for round-tripping
save states/rewind. Standard SZX readers safely skip unknown chunks. */
#define ZXSTBID_AY2 "AY2\0"
#endif
#define ZXSTBID_MULTIFACE "MFCE"
static const libspectrum_byte ZXSTMF_PAGEDIN = 1;
@@ -294,11 +292,9 @@ write_rom_chunk( libspectrum_buffer *buffer, libspectrum_buffer *block_data,
static void
write_ay_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
libspectrum_snap *snap );
#ifdef __LIBRETRO__
static void
write_ay2_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
libspectrum_snap *snap );
#endif
static void
write_scld_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
libspectrum_snap *snap );
@@ -512,7 +508,6 @@ read_ay_chunk( libspectrum_snap *snap, libspectrum_word version GCC_UNUSED,
return LIBSPECTRUM_ERROR_NONE;
}
#ifdef __LIBRETRO__
static libspectrum_error
read_ay2_chunk( libspectrum_snap *snap, libspectrum_word version GCC_UNUSED,
const libspectrum_byte **buffer,
@@ -541,7 +536,6 @@ read_ay2_chunk( libspectrum_snap *snap, libspectrum_word version GCC_UNUSED,
return LIBSPECTRUM_ERROR_NONE;
}
#endif /* #ifdef __LIBRETRO__ */
static libspectrum_error
read_b128_chunk( libspectrum_snap *snap, libspectrum_word version GCC_UNUSED,
@@ -2571,9 +2565,7 @@ struct read_chunk_t {
static struct read_chunk_t read_chunks[] = {
{ ZXSTBID_AY, read_ay_chunk },
#ifdef __LIBRETRO__
{ ZXSTBID_AY2, read_ay2_chunk },
#endif
{ ZXSTBID_BETA128, read_b128_chunk },
{ ZXSTBID_BETADISK, skip_chunk },
{ ZXSTBID_COVOX, read_covx_chunk },
@@ -2654,14 +2646,12 @@ read_chunk( libspectrum_snap *snap, libspectrum_word version,
error = read_chunk_header( id, &data_length, buffer, end );
if( error ) return error;
#ifdef __LIBRETRO__
/* Hack to keep all snapshots with the same size*/
if (memcmp(id, "\xFF\xFF\xFF\xFF", 4) == 0)
{
*buffer = end;
return LIBSPECTRUM_ERROR_NONE;
}
#endif
if( end - *buffer < data_length ) {
libspectrum_print_error(
@@ -2823,7 +2813,6 @@ libspectrum_szx_read( libspectrum_snap *snap, const libspectrum_byte *buffer,
ctx->swap_af = 0;
while( buffer < end ) {
#ifdef __LIBRETRO__
/* This core pads fixed-size savestates (and auto-size states that have
shrunk below the frontend's frozen buffer size) with 0xFF - see
retro_serialize(). A pad tail of 8+ bytes is caught as the fake
@@ -2836,7 +2825,6 @@ libspectrum_szx_read( libspectrum_snap *snap, const libspectrum_byte *buffer,
while( pad < end && *pad == 0xFF ) pad++;
if( pad == end ) break;
}
#endif
error = read_chunk( snap, version, &buffer, end, ctx );
if( error ) {
libspectrum_free( ctx );
@@ -2910,7 +2898,6 @@ libspectrum_szx_write( libspectrum_buffer *buffer, int *out_flags,
capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_AY ) {
write_ay_chunk( buffer, block_data, snap );
#ifdef __LIBRETRO__
/* Written under the same condition as the primary AY chip above (not
ay_turbosound_enabled, which can change mid-session via the
fuse_turbosound core option without a content reload): frontends
@@ -2921,7 +2908,6 @@ libspectrum_szx_write( libspectrum_buffer *buffer, int *out_flags,
same, session-constant condition as chip A keeps the size stable
regardless of whether TurboSound is actually turned on. */
write_ay2_chunk( buffer, block_data, snap );
#endif
}
if( capabilities & ( LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_MEMORY |
@@ -3003,7 +2989,6 @@ libspectrum_szx_write( libspectrum_buffer *buffer, int *out_flags,
}
}
#ifdef __LIBRETRO__
/* Written unconditionally (like write_joy_chunk() below), not gated on
kempston_mouse_active: this core's Kempston Mouse peripheral can be
connected/disconnected mid-session via retro_set_controller_port_device(),
@@ -3014,11 +2999,6 @@ libspectrum_szx_write( libspectrum_buffer *buffer, int *out_flags,
from that point on. write_amxm_chunk() already encodes "no mouse" as
ZXSTM_NONE, so writing it unconditionally is lossless. */
write_amxm_chunk( buffer, block_data, snap );
#else
if( libspectrum_snap_kempston_mouse_active( snap ) ) {
write_amxm_chunk( buffer, block_data, snap );
}
#endif
if( libspectrum_snap_simpleide_active( snap ) ) {
write_side_chunk( buffer, block_data, snap );
@@ -3584,7 +3564,6 @@ write_ay_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
write_chunk( buffer, ZXSTBID_AY, data );
}
#ifdef __LIBRETRO__
static void
write_ay2_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
libspectrum_snap *snap )
@@ -3604,7 +3583,6 @@ write_ay2_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
write_chunk( buffer, ZXSTBID_AY2, data );
}
#endif /* #ifdef __LIBRETRO__ */
static void
write_scld_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data,
-2
View File
@@ -444,11 +444,9 @@ read_header( const libspectrum_byte *buffer, size_t buffer_length,
*version = 1;
libspectrum_snap_set_joystick_active_count( snap, 1 );
#ifdef __LIBRETRO__
libspectrum_snap_set_joystick_inputs( snap, 0,
LIBSPECTRUM_JOYSTICK_INPUT_KEYBOARD |
LIBSPECTRUM_JOYSTICK_INPUT_JOYSTICK_1 );
#endif
error = get_joystick_type_v1( snap, ( header[29] & 0xc0 ) >> 6 );
if( error ) return error;
-4
View File
@@ -29,10 +29,6 @@ int settings_init(int *first_arg, int argc, char **argv)
Forcing it on here left the Fuller Box AY permanently decoded at ports
0x3f/0x5f on every machine, so plain 48K titles that poke those ports
(Vixen, Andy Capp, ...) got AY music no real 48K would have produced. */
#ifndef __LIBRETRO__
settings_current.joystick_1_output = 1;
settings_current.joystick_2_output = 2;
#endif
update_variables(1);
return res;