diff --git a/Makefile.libretro b/Makefile.libretro index 350b50c..8dab032 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -501,7 +501,7 @@ ifeq ($(LOG_PERFORMANCE), 1) endif -DEFINES := -D__LIBRETRO__ $(PLATFORM_DEFINES) +DEFINES := $(PLATFORM_DEFINES) DEFINES += -DHAVE_CONFIG_H CFLAGS += $(fpic) $(DEFINES) diff --git a/build/Makefile.android_arm64-v8a b/build/Makefile.android_arm64-v8a index a36ca55..411fb89 100644 --- a/build/Makefile.android_arm64-v8a +++ b/build/Makefile.android_arm64-v8a @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-arm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_armeabi b/build/Makefile.android_armeabi index 59b0a99..acb9d91 100644 --- a/build/Makefile.android_armeabi +++ b/build/Makefile.android_armeabi @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-arm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_armeabi-v7a b/build/Makefile.android_armeabi-v7a index cf22982..8bcdb95 100644 --- a/build/Makefile.android_armeabi-v7a +++ b/build/Makefile.android_armeabi-v7a @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-19/arch-arm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_mips b/build/Makefile.android_mips index 495f5c3..14c1a13 100644 --- a/build/Makefile.android_mips +++ b/build/Makefile.android_mips @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-mips ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_mips64 b/build/Makefile.android_mips64 index 735618b..f43aa0b 100644 --- a/build/Makefile.android_mips64 +++ b/build/Makefile.android_mips64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-mip ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_x86 b/build/Makefile.android_x86 index 59df307..a54582f 100644 --- a/build/Makefile.android_x86 +++ b/build/Makefile.android_x86 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-x86 ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.android_x86_64 b/build/Makefile.android_x86_64 index 842792a..27150c0 100644 --- a/build/Makefile.android_x86_64 +++ b/build/Makefile.android_x86_64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-x86 ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.linux-portable_x86 b/build/Makefile.linux-portable_x86 index 61c0690..5981136 100644 --- a/build/Makefile.linux-portable_x86 +++ b/build/Makefile.linux-portable_x86 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -m32 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.linux-portable_x86_64 b/build/Makefile.linux-portable_x86_64 index ecfbcf5..8763dbb 100644 --- a/build/Makefile.linux-portable_x86_64 +++ b/build/Makefile.linux-portable_x86_64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.linux_x86 b/build/Makefile.linux_x86 index 68b5fa8..15299de 100644 --- a/build/Makefile.linux_x86 +++ b/build/Makefile.linux_x86 @@ -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 = diff --git a/build/Makefile.linux_x86_64 b/build/Makefile.linux_x86_64 index 7a304bd..2a28948 100644 --- a/build/Makefile.linux_x86_64 +++ b/build/Makefile.linux_x86_64 @@ -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 = diff --git a/build/Makefile.mingw_x86 b/build/Makefile.mingw_x86 index 3c286f6..bfc5bbc 100644 --- a/build/Makefile.mingw_x86 +++ b/build/Makefile.mingw_x86 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -m32 -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.mingw_x86_64 b/build/Makefile.mingw_x86_64 index 45dbdfd..2603411 100644 --- a/build/Makefile.mingw_x86_64 +++ b/build/Makefile.mingw_x86_64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -m64 -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.osx_x86 b/build/Makefile.osx_x86 index 602031a..62cebcc 100644 --- a/build/Makefile.osx_x86 +++ b/build/Makefile.osx_x86 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.osx_x86_64 b/build/Makefile.osx_x86_64 index 1329aa0..f4c3e21 100644 --- a/build/Makefile.osx_x86_64 +++ b/build/Makefile.osx_x86_64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.ps3_ppc b/build/Makefile.ps3_ppc index 03ba573..d4bd9ac 100644 --- a/build/Makefile.ps3_ppc +++ b/build/Makefile.ps3_ppc @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.vita_arm b/build/Makefile.vita_arm index 557ef95..b71872c 100644 --- a/build/Makefile.vita_arm +++ b/build/Makefile.vita_arm @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm -mthumb -mcpu=cortex-a9 -mfloat-abi=hard ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.wii_ppc b/build/Makefile.wii_ppc index 89bd5d1..8fedfa7 100644 --- a/build/Makefile.wii_ppc +++ b/build/Makefile.wii_ppc @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.windows_x86 b/build/Makefile.windows_x86 index 4894030..6f28e06 100644 --- a/build/Makefile.windows_x86 +++ b/build/Makefile.windows_x86 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/Makefile.windows_x86_64 b/build/Makefile.windows_x86_64 index 4d61da7..bcd863a 100644 --- a/build/Makefile.windows_x86_64 +++ b/build/Makefile.windows_x86_64 @@ -50,7 +50,7 @@ PLATLDXFLAGS = -shared -lm ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/build/jni/Android.mk b/build/jni/Android.mk index 7605d31..b10cf5c 100644 --- a/build/jni/Android.mk +++ b/build/jni/Android.mk @@ -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) diff --git a/etc/mkmake.lua b/etc/mkmake.lua index fd57cd1..24ad838 100644 --- a/etc/mkmake.lua +++ b/etc/mkmake.lua @@ -61,7 +61,7 @@ PLATLDXFLAGS = ${PLAT_LDXFLAGS} ################ # libretro setup -RETRODEFS = -D__LIBRETRO__ +RETRODEFS = RETROCFLAGS = RETROCXXFLAGS = RETROLDFLAGS = diff --git a/fuse/machine.h b/fuse/machine.h index fd54b62..356e732 100644 --- a/fuse/machine.h +++ b/fuse/machine.h @@ -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 */ diff --git a/fuse/machines/pentagon.c b/fuse/machines/pentagon.c index 4bcf34d..9480aed 100644 --- a/fuse/machines/pentagon.c +++ b/fuse/machines/pentagon.c @@ -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; } diff --git a/fuse/machines/specplus2a.c b/fuse/machines/specplus2a.c index 4019162..80b99ac 100644 --- a/fuse/machines/specplus2a.c +++ b/fuse/machines/specplus2a.c @@ -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; diff --git a/fuse/machines/specplus3.c b/fuse/machines/specplus3.c index db834a8..cbe2510 100644 --- a/fuse/machines/specplus3.c +++ b/fuse/machines/specplus3.c @@ -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(); diff --git a/fuse/machines/specplus3e.c b/fuse/machines/specplus3e.c index feddca6..c51f660 100644 --- a/fuse/machines/specplus3e.c +++ b/fuse/machines/specplus3e.c @@ -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; diff --git a/fuse/periph.c b/fuse/periph.c index 7ed7135..e076156 100644 --- a/fuse/periph.c +++ b/fuse/periph.c @@ -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 ); diff --git a/fuse/peripherals/ay.c b/fuse/peripherals/ay.c index 9502e0a..58c2e9a 100644 --- a/fuse/peripherals/ay.c +++ b/fuse/peripherals/ay.c @@ -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 diff --git a/fuse/peripherals/ay.h b/fuse/peripherals/ay.h index d24f101..6332b4e 100644 --- a/fuse/peripherals/ay.h +++ b/fuse/peripherals/ay.h @@ -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 */ diff --git a/fuse/peripherals/joystick.c b/fuse/peripherals/joystick.c index 0df80b4..277c395 100644 --- a/fuse/peripherals/joystick.c +++ b/fuse/peripherals/joystick.c @@ -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; } } diff --git a/fuse/snapshot.c b/fuse/snapshot.c index 894e5e2..e2c1b1c 100644 --- a/fuse/snapshot.c +++ b/fuse/snapshot.c @@ -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 ) { diff --git a/fuse/snapshot.h b/fuse/snapshot.h index f933c53..63fcc9d 100644 --- a/fuse/snapshot.h +++ b/fuse/snapshot.h @@ -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 ); diff --git a/fuse/spectrum.c b/fuse/spectrum.c index d615a93..6eeb582 100644 --- a/fuse/spectrum.c +++ b/fuse/spectrum.c @@ -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 diff --git a/fuse/spectrum.h b/fuse/spectrum.h index f96ac9e..09a7113 100644 --- a/fuse/spectrum.h +++ b/fuse/spectrum.h @@ -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 */ diff --git a/fuse/ui/widget/widget.c b/fuse/ui/widget/widget.c index 163d10a..f052ceb 100644 --- a/fuse/ui/widget/widget.c +++ b/fuse/ui/widget/widget.c @@ -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; diff --git a/fuse/unittests/unittests.c b/fuse/unittests/unittests.c index c9f2682..692d41c 100644 --- a/fuse/unittests/unittests.c +++ b/fuse/unittests/unittests.c @@ -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: diff --git a/libspectrum/snap_accessors.c b/libspectrum/snap_accessors.c index 5158636..695c18e 100644 --- a/libspectrum/snap_accessors.c +++ b/libspectrum/snap_accessors.c @@ -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 ) diff --git a/libspectrum/snap_accessors.txt b/libspectrum/snap_accessors.txt index cdbb816..71e355b 100644 --- a/libspectrum/snap_accessors.txt +++ b/libspectrum/snap_accessors.txt @@ -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 diff --git a/libspectrum/szx.c b/libspectrum/szx.c index a541300..83bc53b 100644 --- a/libspectrum/szx.c +++ b/libspectrum/szx.c @@ -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, diff --git a/libspectrum/z80.c b/libspectrum/z80.c index 11d2cc1..132a1fb 100644 --- a/libspectrum/z80.c +++ b/libspectrum/z80.c @@ -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; diff --git a/src/fuse/settings.c b/src/fuse/settings.c index 24e1ce5..8f6e9bb 100644 --- a/src/fuse/settings.c +++ b/src/fuse/settings.c @@ -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;