Hello community, here is the log from the commit of package libretro-cap32 for openSUSE:Factory checked in at 2020-06-07 21:37:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libretro-cap32 (Old) and /work/SRC/openSUSE:Factory/.libretro-cap32.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libretro-cap32" Sun Jun 7 21:37:03 2020 rev:2 rq:812100 version:0~git20200508 Changes: -------- --- /work/SRC/openSUSE:Factory/libretro-cap32/libretro-cap32.changes 2020-02-11 22:23:05.935491757 +0100 +++ /work/SRC/openSUSE:Factory/.libretro-cap32.new.3606/libretro-cap32.changes 2020-06-07 21:37:41.485330862 +0200 @@ -1,0 +2,16 @@ +Sat May 30 18:27:45 UTC 2020 - i...@guoyunhe.me + +- Update to version 0~git20200508: + * Cleanup wiiu flags + * Fix incorrect dereferencing + * Fix video glitch on big-endian + * Replace ad-hoc MSB_FIRST with retro_endianness.h + * Fix Core_PollEvent declaration + * Fix declaration of ev_events + * Fix crash on blackberry + * Apply c++ flags also on debug version + * QNX fixes + * Fix psl1ght support + * Remove unused GetTicks + +------------------------------------------------------------------- Old: ---- libretro-cap32-0~git20190907.tar.xz New: ---- libretro-cap32-0~git20200508.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libretro-cap32.spec ++++++ --- /var/tmp/diff_new_pack.CbxRbu/_old 2020-06-07 21:37:42.417333817 +0200 +++ /var/tmp/diff_new_pack.CbxRbu/_new 2020-06-07 21:37:42.417333817 +0200 @@ -1,7 +1,7 @@ # # spec file for package libretro-cap32 # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,10 +17,10 @@ Name: libretro-cap32 -Version: 0~git20190907 +Version: 0~git20200508 Release: 0 Summary: Caprice32 libretro core for Amstrad CPC emulation -License: GPL-2.0 +License: GPL-2.0-only URL: http://www.retroarch.com Source: %{name}-%{version}.tar.xz ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.CbxRbu/_old 2020-06-07 21:37:42.457333943 +0200 +++ /var/tmp/diff_new_pack.CbxRbu/_new 2020-06-07 21:37:42.461333956 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/libretro/libretro-cap32.git</param> - <param name="changesrevision">8681fbdc5623830078b38d713935caf4682e5295</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">49a3c6522e980a3136aeadc8830e1cb357781de2</param></service></servicedata> \ No newline at end of file ++++++ libretro-cap32-0~git20190907.tar.xz -> libretro-cap32-0~git20200508.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/Makefile new/libretro-cap32-0~git20200508/Makefile --- old/libretro-cap32-0~git20190907/Makefile 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/Makefile 2020-05-08 15:51:31.000000000 +0200 @@ -128,7 +128,8 @@ CC_AS = qcc -Vgcc_ntoarmv7le CXX = QCC -Vgcc_ntoarmv7le_cpp AR = QCC -Vgcc_ntoarmv7le - PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp + PLATFORM_DEFINES := -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp + CFLAGS += -std=c99 -D_POSIX_C_SOURCE # PS3 else ifeq ($(platform), ps3) @@ -140,7 +141,6 @@ PLATFORM_DEFINES := -D__CELLOS_LV2__ -Iutils/zlib STATIC_LINKING = 1 HAVE_COMPAT = 1 - MSB_FIRST = 1 # sncps3 else ifeq ($(platform), sncps3) @@ -152,7 +152,6 @@ PLATFORM_DEFINES := -D__CELLOS_LV2__ STATIC_LINKING = 1 HAVE_COMPAT = 1 - MSB_FIRST = 1 # Lightweight PS3 Homebrew SDK else ifeq ($(platform), psl1ght) @@ -161,10 +160,9 @@ CC_AS = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT) AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) - PLATFORM_DEFINES := -D__CELLOS_LV2__ + PLATFORM_DEFINES := -D__CELLOS_LV2__ -D__PSL1GHT__ STATIC_LINKING = 1 HAVE_COMPAT = 1 - MSB_FIRST = 1 # PSP else ifeq ($(platform), psp1) @@ -179,7 +177,6 @@ STATIC_LINKING = 1 HAVE_COMPAT = 1 EXTRA_INCLUDES := -I$(shell psp-config --pspsdk-path)/include - MSB_FIRST = 1 # Vita else ifeq ($(platform), vita) @@ -223,7 +220,6 @@ PLATFORM_DEFINES += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float STATIC_LINKING = 1 HAVE_COMPAT = 1 - MSB_FIRST = 1 # Nintendo Wii U else ifeq ($(platform), wiiu) @@ -231,12 +227,10 @@ CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) - COMMONFLAGS += -DGEKKO -DWIIU -DHW_RVL -mcpu=750 -meabi -mhard-float -D__POWERPC__ -D__ppc__ -DWORDS_BIGENDIAN=1 - COMMONFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int + COMMONFLAGS += -DGEKKO -DWIIU -DHW_RVL -mcpu=750 -meabi -mhard-float STATIC_LINKING = 1 PLATFORM_DEFINES += $(COMMONFLAGS) -Iutils/zlib HAVE_COMPAT = 1 - MSB_FIRST = 1 # Nintendo Wii else ifeq ($(platform), wii) @@ -248,7 +242,6 @@ PLATFORM_DEFINES += -DGEKKO -DHW_RVL -DLOWRES -mrvl -mcpu=750 -meabi -mhard-float STATIC_LINKING = 1 HAVE_COMPAT = 1 - MSB_FIRST = 1 # Nintendo Switch (libnx) else ifeq ($(platform), libnx) @@ -318,21 +311,19 @@ PLATFORM_DEFINES += -DHAVE_COMPAT endif -ifeq ($(MSB_FIRST), 1) - PLATFORM_DEFINES += -DMSB_FIRST -endif - ifeq ($(DEBUG), 1) CFLAGS += -O0 -g CXXFLAGS += -O0 -g else ifeq ($(platform), emscripten) CFLAGS += -O2 - CXXFLAGS += -O2 -fno-exceptions -fno-rtti -DHAVE_STDINT_H + CXXFLAGS += -O2 else CFLAGS += -O3 - CXXFLAGS += -O3 -fno-exceptions -fno-rtti -DHAVE_STDINT_H + CXXFLAGS += -O3 endif +CXXFLAGS += -fno-exceptions -fno-rtti -DHAVE_STDINT_H + ifeq ($(LOG_PERFORMANCE), 1) CFLAGS += -DLOG_PERFORMANCE CXXFLAGS += -DLOG_PERFORMANCE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/cap32.c new/libretro-cap32-0~git20200508/cap32/cap32.c --- old/libretro-cap32-0~git20190907/cap32/cap32.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/cap32/cap32.c 2020-05-08 15:51:31.000000000 +0200 @@ -164,7 +164,7 @@ #include <zlib.h> -#ifdef __CELLOS_LV2__ +#if defined (__CELLOS_LV2__) && !defined(__PSL1GHT__) #define tmpnam(a) #endif @@ -177,7 +177,6 @@ int capmain (int argc, char **argv); void retro_audio_mix(); void mixsnd (void); -long GetTicks(void); int HandleExtension(char *path,char *ext); #include "libretro-core.h" @@ -241,7 +240,7 @@ //video_plugin* vid_plugin; uint32_t dwSndMinSafeDist=0, dwSndMaxSafeDist=2*2*882; -uint32_t dwTicks, dwTicksOffset, dwTicksTarget, dwTicksTargetFPS; +uint32_t dwTicks, dwTicksOffset; uint32_t dwXScale, dwYScale; uint32_t dwBreakPoint, dwTrace, dwMF2ExitAddr; @@ -2327,9 +2326,6 @@ memset(&driveB, 0, sizeof(t_drive)); // clear disk drive B data structure dwTicksOffset = (int)(FRAME_PERIOD_MS / (double)(CPC.speed/CPC_BASE_FREQUENCY_MHZ)); - dwTicksTarget = GetTicks(); - dwTicksTargetFPS = dwTicksTarget; - dwTicksTarget += dwTicksOffset; iExitCondition = EC_FRAME_COMPLETE; bolDone = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/cap32.h new/libretro-cap32-0~git20200508/cap32/cap32.h --- old/libretro-cap32-0~git20190907/cap32/cap32.h 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/cap32/cap32.h 2020-05-08 15:51:31.000000000 +0200 @@ -27,6 +27,8 @@ #include <sys/types.h> #include <unistd.h> #include <stdbool.h> +#include <retro_endianness.h> + //RETRO HACK //TODO ENDIANNESS //#define DEBUG 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/crtc.c new/libretro-cap32-0~git20200508/cap32/crtc.c --- old/libretro-cap32-0~git20190907/cap32/crtc.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/cap32/crtc.c 2020-05-08 15:51:31.000000000 +0200 @@ -37,6 +37,7 @@ */ #include <math.h> +#include <retro_endianness.h> #include "cap32.h" #include "crtc.h" @@ -516,19 +517,6 @@ CRTC.hstart++; } -#ifdef MSB_FIRST -static INLINE unsigned Swap32(unsigned x) -{ - unsigned result = ((x << 24)|((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00)| (x >> 24)); - return result; -} -#else -static INLINE unsigned Swap32(unsigned x) -{ - return x; -} -#endif - static INLINE void change_mode(void) { if (CRTC.flag_hadhsync) { // have we had an HSYNC on this scan line? @@ -797,11 +785,7 @@ void prerender_border(void) { - register uint32_t dwVal = 0x10101010; - *RendPos = dwVal; - *(RendPos + 1) = dwVal; - *(RendPos + 2) = dwVal; - *(RendPos + 3) = dwVal; + memset(RendPos, 0x10, sizeof(*RendPos) * 4); RendPos += 4; } @@ -809,9 +793,7 @@ void prerender_border_half(void) { - register uint32_t dwVal = 0x10101010; - *RendPos = dwVal; - *(RendPos + 1) = dwVal; + memset(RendPos, 0x10, sizeof(*RendPos) * 2); RendPos += 2; } @@ -884,6 +866,7 @@ * uses PrData as temp buffer * * TODO: need a BIG ENDIAN version + * TODO: need alignment-safe version * * b(0x01000000, 0x00000001, 0x00010100, shift:0)=[0x00010100] * b(0x01000000, 0x00000001, 0x00010100, shift:1)=[0x01010000] @@ -945,6 +928,20 @@ uint8_t c2 = get_sprite_asic(offset++); uint8_t c3 = get_sprite_asic(offset++); uint8_t c4 = get_sprite_asic(offset++); +#if RETRO_IS_BIG_ENDIAN + if (c1) { + *RendPos = ((*RendPos) & 0x00FFFFFF) | (c1 << 24); + } + if (c2) { + *RendPos = ((*RendPos) & 0xFF00FFFF) | (c2 << 16); + } + if (c3) { + *RendPos = ((*RendPos) & 0xFFFF00FF) | (c3 << 8); + } + if (c4) { + *RendPos = ((*RendPos) & 0xFFFFFF00) | c4; + } +#else if (c4) { *RendPos = ((*RendPos) & 0x00FFFFFF) | (c4 << 24); } @@ -957,6 +954,7 @@ if (c1) { *RendPos = ((*RendPos) & 0xFFFFFF00) | c1; } +#endif RendPos++; } } @@ -985,15 +983,11 @@ PrData[4] = PrData[2] = *(ModeMap + *bVidMem ); PrData[5] = *(ModeMap + *(bVidMem + 1) ); *(RendPos) = shift_scroll_pixel(2, byteShift); - *(RendPos) = Swap32(shift_scroll_pixel(2, byteShift)); *(RendPos + 1) = shift_scroll_pixel(5, byteShift); - *(RendPos + 1) = Swap32(shift_scroll_pixel(5, byteShift)); } else { *RendPos = *(ModeMap + (*bVidMem)); - *RendPos = Swap32(*RendPos); *(RendPos + 1) = *(ModeMap + (*(bVidMem + 1)) ); - *(RendPos + 1) = Swap32(*(RendPos + 1)); } uint16_t i, offset = 0; @@ -1002,6 +996,20 @@ uint8_t c2 = get_sprite_asic(offset++); uint8_t c3 = get_sprite_asic(offset++); uint8_t c4 = get_sprite_asic(offset++); +#if RETRO_IS_BIG_ENDIAN + if (c1) { + *RendPos = ((*RendPos) & 0x00FFFFFF) | (c1 << 24); + } + if (c2) { + *RendPos = ((*RendPos) & 0xFF00FFFF) | (c2 << 16); + } + if (c3) { + *RendPos = ((*RendPos) & 0xFFFF00FF) | (c3 << 8); + } + if (c4) { + *RendPos = ((*RendPos) & 0xFFFFFF00) | c4; + } +#else if (c4) { *RendPos = ((*RendPos) & 0x00FFFFFF) | (c4 << 24); } @@ -1014,6 +1022,7 @@ if (c1) { *RendPos = ((*RendPos) & 0xFFFFFF00) | c1; } +#endif RendPos++; } } @@ -1022,10 +1031,8 @@ { uint8_t bVidMem = *(pbRAM + CRTC.next_address); *RendPos = *(ModeMap + bVidMem); - *RendPos = Swap32(*RendPos); bVidMem = *(pbRAM + CRTC.next_address+1); *(RendPos + 1) = *(ModeMap + bVidMem); - *(RendPos + 1) = Swap32(*(RendPos + 1)); RendPos += 2; } @@ -1374,6 +1381,26 @@ { unsigned l; +#if RETRO_IS_BIG_ENDIAN + static int byte_swapped = 0; + if (!byte_swapped) { + int j; + byte_swapped = 1; + for (j = 0; j < 0x200; j++) { + M0Map[j] = retro_cpu_to_le32(M0Map[j]); + M1Map[j] = retro_cpu_to_le32(M1Map[j]); + M2Map[j] = retro_cpu_to_le32(M2Map[j]); + M3Map[j] = retro_cpu_to_le32(M3Map[j]); + } + for (j = 0; j < 0x100; j++) { + M0hMap[j] = retro_cpu_to_le32(M0hMap[j]); + M1hMap[j] = retro_cpu_to_le32(M1hMap[j]); + M2hMap[j] = retro_cpu_to_le32(M2hMap[j]); + M3hMap[j] = retro_cpu_to_le32(M3hMap[j]); + } + } +#endif + if (dwXScale == 1) { ModeMaps[0] = M0hMap; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/psg.c new/libretro-cap32-0~git20200508/cap32/psg.c --- old/libretro-cap32-0~git20190907/cap32/psg.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/cap32/psg.c 2020-05-08 15:51:31.000000000 +0200 @@ -43,6 +43,7 @@ */ #include <math.h> +#include <retro_endianness.h> #include "cap32.h" #include "z80.h" @@ -601,7 +602,8 @@ if (Ton_EnA) { - if ((!Envelope_EnA) || (*(uint16_t *)&PSG.RegisterAY.TonALo > 4)) + if ((!Envelope_EnA) || (PSG.RegisterAY.TonALo > 4 || + PSG.RegisterAY.TonAHi > 0)) k = Ton_A; else k = 1; @@ -622,7 +624,8 @@ if (Ton_EnB) { - if ((!Envelope_EnB) || (*(uint16_t *)&PSG.RegisterAY.TonBLo > 4)) + if ((!Envelope_EnB) || (PSG.RegisterAY.TonBLo > 4 || + PSG.RegisterAY.TonBHi > 0)) k = Ton_B; else k = 1; @@ -643,7 +646,8 @@ if (Ton_EnC) { - if ((!Envelope_EnC) || (*(uint16_t *)&PSG.RegisterAY.TonCLo > 4)) + if ((!Envelope_EnC) || (PSG.RegisterAY.TonCLo > 4 || + PSG.RegisterAY.TonCHi > 0)) k = Ton_C; else k = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/retro_endianness.h new/libretro-cap32-0~git20200508/cap32/retro_endianness.h --- old/libretro-cap32-0~git20190907/cap32/retro_endianness.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libretro-cap32-0~git20200508/cap32/retro_endianness.h 2020-05-08 15:51:31.000000000 +0200 @@ -0,0 +1,582 @@ +/* Copyright (C) 2010-2020 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_endianness.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_ENDIANNESS_H +#define __LIBRETRO_SDK_ENDIANNESS_H + +#include <retro_inline.h> +#include <stdint.h> +#include <stdlib.h> + +#if defined(_MSC_VER) && _MSC_VER > 1200 +#define SWAP16 _byteswap_ushort +#define SWAP32 _byteswap_ulong +#else +static INLINE uint16_t SWAP16(uint16_t x) +{ + return ((x & 0x00ff) << 8) | + ((x & 0xff00) >> 8); +} + +static INLINE uint32_t SWAP32(uint32_t x) +{ + return ((x & 0x000000ff) << 24) | + ((x & 0x0000ff00) << 8) | + ((x & 0x00ff0000) >> 8) | + ((x & 0xff000000) >> 24); +} + +#endif + +#if defined(_MSC_VER) && _MSC_VER <= 1200 +static INLINE uint64_t SWAP64(uint64_t val) +{ + return + ((val & 0x00000000000000ff) << 56) + | ((val & 0x000000000000ff00) << 40) + | ((val & 0x0000000000ff0000) << 24) + | ((val & 0x00000000ff000000) << 8) + | ((val & 0x000000ff00000000) >> 8) + | ((val & 0x0000ff0000000000) >> 24) + | ((val & 0x00ff000000000000) >> 40) + | ((val & 0xff00000000000000) >> 56); +} +#else +static INLINE uint64_t SWAP64(uint64_t val) +{ + return ((val & 0x00000000000000ffULL) << 56) + | ((val & 0x000000000000ff00ULL) << 40) + | ((val & 0x0000000000ff0000ULL) << 24) + | ((val & 0x00000000ff000000ULL) << 8) + | ((val & 0x000000ff00000000ULL) >> 8) + | ((val & 0x0000ff0000000000ULL) >> 24) + | ((val & 0x00ff000000000000ULL) >> 40) + | ((val & 0xff00000000000000ULL) >> 56); +} +#endif + + +#if defined (LSB_FIRST) || defined (MSB_FIRST) +# warning Defining MSB_FIRST and LSB_FIRST in compile options is deprecated +# undef LSB_FIRST +# undef MSB_FIRST +#endif + +#ifdef _MSC_VER +#include <winsock2.h> +#endif + +#ifdef _MSC_VER +#if _M_IX86 || _M_AMD64 || _M_ARM || _M_ARM64 +#define LSB_FIRST 1 +#elif _M_PPC +#define MSB_FIRST 1 +#else +/* MSVC can run on _M_ALPHA and _M_IA64 too, but they're both bi-endian; need to find what mode MSVC runs them at */ +#error "unknown platform, can't determine endianness" +#endif +#else +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define MSB_FIRST 1 +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define LSB_FIRST 1 +#else +#error "Invalid endianness macros" +#endif +#endif + +#if defined(MSB_FIRST) && defined(LSB_FIRST) +# error "Bug in LSB_FIRST/MSB_FIRST definition" +#endif + +#if !defined(MSB_FIRST) && !defined(LSB_FIRST) +# error "Bug in LSB_FIRST/MSB_FIRST definition" +#endif + +#ifdef MSB_FIRST +# define RETRO_IS_BIG_ENDIAN 1 +# define RETRO_IS_LITTLE_ENDIAN 0 +/* For compatibility */ +# define WORDS_BIGENDIAN 1 +#else +# define RETRO_IS_BIG_ENDIAN 0 +# define RETRO_IS_LITTLE_ENDIAN 1 +/* For compatibility */ +# undef WORDS_BIGENDIAN +#endif + + +/** + * is_little_endian: + * + * Checks if the system is little endian or big-endian. + * + * Returns: greater than 0 if little-endian, + * otherwise big-endian. + **/ +#define is_little_endian() RETRO_IS_LITTLE_ENDIAN + +/** + * swap_if_big64: + * @val : unsigned 64-bit value + * + * Byteswap unsigned 64-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_big64(val) (SWAP64(val)) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_big64(val) (val) +#endif + +/** + * swap_if_big32: + * @val : unsigned 32-bit value + * + * Byteswap unsigned 32-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_big32(val) (SWAP32(val)) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_big32(val) (val) +#endif + +/** + * swap_if_little64: + * @val : unsigned 64-bit value + * + * Byteswap unsigned 64-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_little64(val) (val) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_little64(val) (SWAP64(val)) +#endif + +/** + * swap_if_little32: + * @val : unsigned 32-bit value + * + * Byteswap unsigned 32-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_little32(val) (val) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_little32(val) (SWAP32(val)) +#endif + +/** + * swap_if_big16: + * @val : unsigned 16-bit value + * + * Byteswap unsigned 16-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_big16(val) (SWAP16(val)) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_big16(val) (val) +#endif + +/** + * swap_if_little16: + * @val : unsigned 16-bit value + * + * Byteswap unsigned 16-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ + +#if RETRO_IS_BIG_ENDIAN +#define swap_if_little16(val) (val) +#elif RETRO_IS_LITTLE_ENDIAN +#define swap_if_little16(val) (SWAP16(val)) +#endif + +/** + * store32be: + * @addr : pointer to unsigned 32-bit buffer + * @data : unsigned 32-bit value to write + * + * Write data to address. Endian-safe. Byteswaps the data + * first if necessary before storing it. + **/ +static INLINE void store32be(uint32_t *addr, uint32_t data) +{ + *addr = swap_if_little32(data); +} + +/** + * load32be: + * @addr : pointer to unsigned 32-bit buffer + * + * Load value from address. Endian-safe. + * + * Returns: value from address, byte-swapped if necessary. + **/ +static INLINE uint32_t load32be(const uint32_t *addr) +{ + return swap_if_little32(*addr); +} + +/** + * retro_cpu_to_le16: + * @val : unsigned 16-bit value + * + * Convert unsigned 16-bit value from system to little-endian. + * + * Returns: Little-endian represantation of val. + **/ + +#define retro_cpu_to_le16(val) swap_if_big16(val) + +/** + * retro_cpu_to_le32: + * @val : unsigned 32-bit value + * + * Convert unsigned 32-bit value from system to little-endian. + * + * Returns: Little-endian represantation of val. + **/ + +#define retro_cpu_to_le32(val) swap_if_big32(val) + +/** + * retro_cpu_to_le64: + * @val : unsigned 64-bit value + * + * Convert unsigned 64-bit value from system to little-endian. + * + * Returns: Little-endian represantation of val. + **/ + +#define retro_cpu_to_le64(val) swap_if_big64(val) + +/** + * retro_le_to_cpu16: + * @val : unsigned 16-bit value + * + * Convert unsigned 16-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +#define retro_le_to_cpu16(val) swap_if_big16(val) + +/** + * retro_le_to_cpu32: + * @val : unsigned 32-bit value + * + * Convert unsigned 32-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +#define retro_le_to_cpu32(val) swap_if_big32(val) + +/** + * retro_le_to_cpu16: + * @val : unsigned 64-bit value + * + * Convert unsigned 64-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +#define retro_le_to_cpu64(val) swap_if_big64(val) + +/** + * retro_cpu_to_be16: + * @val : unsigned 16-bit value + * + * Convert unsigned 16-bit value from system to big-endian. + * + * Returns: Big-endian represantation of val. + **/ + +#define retro_cpu_to_be16(val) swap_if_little16(val) + +/** + * retro_cpu_to_be32: + * @val : unsigned 32-bit value + * + * Convert unsigned 32-bit value from system to big-endian. + * + * Returns: Big-endian represantation of val. + **/ + +#define retro_cpu_to_be32(val) swap_if_little32(val) + +/** + * retro_cpu_to_be64: + * @val : unsigned 64-bit value + * + * Convert unsigned 64-bit value from system to big-endian. + * + * Returns: Big-endian represantation of val. + **/ + +#define retro_cpu_to_be64(val) swap_if_little64(val) + +/** + * retro_be_to_cpu16: + * @val : unsigned 16-bit value + * + * Convert unsigned 16-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +#define retro_be_to_cpu16(val) swap_if_little16(val) + +/** + * retro_be_to_cpu32: + * @val : unsigned 32-bit value + * + * Convert unsigned 32-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +#define retro_be_to_cpu32(val) swap_if_little32(val) + +/** + * retro_be_to_cpu64: + * @val : unsigned 64-bit value + * + * Convert unsigned 64-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +#define retro_be_to_cpu64(val) swap_if_little64(val) + +#ifdef __GNUC__ +/* This attribute means that the same memory may be referred through + pointers to different size of the object (aliasing). E.g. that u8 * + and u32 * may actually be pointing to the same object. */ +#define MAY_ALIAS __attribute__((__may_alias__)) +#else +#define MAY_ALIAS +#endif + +#pragma pack(push, 1) +struct retro_unaligned_uint16_s +{ + uint16_t val; +} MAY_ALIAS; +struct retro_unaligned_uint32_s +{ + uint32_t val; +} MAY_ALIAS; +struct retro_unaligned_uint64_s +{ + uint64_t val; +} MAY_ALIAS; +#pragma pack(pop) + +typedef struct retro_unaligned_uint16_s retro_unaligned_uint16_t; +typedef struct retro_unaligned_uint32_s retro_unaligned_uint32_t; +typedef struct retro_unaligned_uint64_s retro_unaligned_uint64_t; + +/* L-value references to unaligned pointers. */ +#define retro_unaligned16(p) (((retro_unaligned_uint16_t *)p)->val) +#define retro_unaligned32(p) (((retro_unaligned_uint32_t *)p)->val) +#define retro_unaligned64(p) (((retro_unaligned_uint64_t *)p)->val) + +/** + * retro_get_unaligned_16be: + * @addr : pointer to unsigned 16-bit value + * + * Convert unsigned unaligned 16-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +static INLINE uint16_t retro_get_unaligned_16be(void *addr) { + return retro_be_to_cpu16(retro_unaligned16(addr)); +} + +/** + * retro_get_unaligned_32be: + * @addr : pointer to unsigned 32-bit value + * + * Convert unsigned unaligned 32-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +static INLINE uint32_t retro_get_unaligned_32be(void *addr) { + return retro_be_to_cpu32(retro_unaligned32(addr)); +} + +/** + * retro_get_unaligned_64be: + * @addr : pointer to unsigned 64-bit value + * + * Convert unsigned unaligned 64-bit value from big-endian to native. + * + * Returns: Native represantation of big-endian val. + **/ + +static INLINE uint64_t retro_get_unaligned_64be(void *addr) { + return retro_be_to_cpu64(retro_unaligned64(addr)); +} + +/** + * retro_get_unaligned_16le: + * @addr : pointer to unsigned 16-bit value + * + * Convert unsigned unaligned 16-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +static INLINE uint16_t retro_get_unaligned_16le(void *addr) { + return retro_le_to_cpu16(retro_unaligned16(addr)); +} + +/** + * retro_get_unaligned_32le: + * @addr : pointer to unsigned 32-bit value + * + * Convert unsigned unaligned 32-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +static INLINE uint32_t retro_get_unaligned_32le(void *addr) { + return retro_le_to_cpu32(retro_unaligned32(addr)); +} + +/** + * retro_get_unaligned_64le: + * @addr : pointer to unsigned 64-bit value + * + * Convert unsigned unaligned 64-bit value from little-endian to native. + * + * Returns: Native represantation of little-endian val. + **/ + +static INLINE uint64_t retro_get_unaligned_64le(void *addr) { + return retro_le_to_cpu64(retro_unaligned64(addr)); +} + +/** + * retro_set_unaligned_16le: + * @addr : pointer to unsigned 16-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 16-bit little-endian value + * + **/ + +static INLINE void retro_set_unaligned_16le(void *addr, uint16_t v) { + retro_unaligned16(addr) = retro_cpu_to_le16(v); +} + +/** + * retro_set_unaligned_32le: + * @addr : pointer to unsigned 32-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 32-bit little-endian value + * + **/ + +static INLINE void retro_set_unaligned_32le(void *addr, uint32_t v) { + retro_unaligned32(addr) = retro_cpu_to_le32(v); +} + +/** + * retro_set_unaligned_32le: + * @addr : pointer to unsigned 32-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 32-bit little-endian value + * + **/ + +static INLINE void retro_set_unaligned_64le(void *addr, uint64_t v) { + retro_unaligned64(addr) = retro_cpu_to_le64(v); +} + +/** + * retro_set_unaligned_16be: + * @addr : pointer to unsigned 16-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 16-bit big-endian value + * + **/ + +static INLINE void retro_set_unaligned_16be(void *addr, uint16_t v) { + retro_unaligned16(addr) = retro_cpu_to_be16(v); +} + +/** + * retro_set_unaligned_32be: + * @addr : pointer to unsigned 32-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 32-bit big-endian value + * + **/ + +static INLINE void retro_set_unaligned_32be(void *addr, uint32_t v) { + retro_unaligned32(addr) = retro_cpu_to_be32(v); +} + +/** + * retro_set_unaligned_32be: + * @addr : pointer to unsigned 32-bit value + * @val : value to store + * + * Convert native value to unsigned unaligned 32-bit big-endian value + * + **/ + +static INLINE void retro_set_unaligned_64be(void *addr, uint64_t v) { + retro_unaligned64(addr) = retro_cpu_to_be64(v); +} + + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/retro_inline.h new/libretro-cap32-0~git20200508/cap32/retro_inline.h --- old/libretro-cap32-0~git20190907/cap32/retro_inline.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libretro-cap32-0~git20200508/cap32/retro_inline.h 2020-05-08 15:51:31.000000000 +0200 @@ -0,0 +1,39 @@ +/* Copyright (C) 2010-2020 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_inline.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_INLINE_H +#define __LIBRETRO_SDK_INLINE_H + +#ifndef INLINE + +#if defined(_WIN32) || defined(__INTEL_COMPILER) +#define INLINE __inline +#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L +#define INLINE inline +#elif defined(__GNUC__) +#define INLINE __inline__ +#else +#define INLINE +#endif + +#endif +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/cap32/z80.h new/libretro-cap32-0~git20200508/cap32/z80.h --- old/libretro-cap32-0~git20190907/cap32/z80.h 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/cap32/z80.h 2020-05-08 15:51:31.000000000 +0200 @@ -20,6 +20,7 @@ #define Z80_H #include <stdint.h> +#include <retro_endianness.h> #ifdef __cplusplus extern "C" { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/libretro-core.c new/libretro-cap32-0~git20200508/libretro/libretro-core.c --- old/libretro-cap32-0~git20190907/libretro/libretro-core.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/libretro-core.c 2020-05-08 15:51:31.000000000 +0200 @@ -18,7 +18,7 @@ char cart_name[512]="\0"; //TIME -#ifdef __CELLOS_LV2__ +#if defined (__CELLOS_LV2__) && !defined(__PSL1GHT__) #include "sys/sys_time.h" #include "sys/timer.h" #define usleep sys_timer_usleep @@ -38,7 +38,6 @@ computer_cfg_t retro_computer_cfg; extern int showkeyb; -extern int Core_PollEvent(void); extern int retro_disk_auto(); extern void change_model(int val); @@ -298,38 +297,6 @@ } } -long GetTicks(void) -{ // in MSec -#ifndef _ANDROID_ - -#ifdef __CELLOS_LV2__ - - //#warning "GetTick PS3\n" - - unsigned long ticks_micro; - uint64_t secs; - uint64_t nsecs; - - sys_time_get_current_time(&secs, &nsecs); - ticks_micro = secs * 1000000UL + (nsecs / 1000); - - return ticks_micro;///1000; -#else - struct timeval tv; - gettimeofday (&tv, NULL); - return (tv.tv_sec*1000000 + tv.tv_usec);///1000; - -#endif - -#else - - struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - return (now.tv_sec*1000000 + now.tv_nsec/1000);///1000; -#endif - -} - int HandleExtension(char *path,char *ext) { int len = strlen(path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/nukleargui/app.c new/libretro-cap32-0~git20200508/libretro/nukleargui/app.c --- old/libretro-cap32-0~git20190907/libretro/nukleargui/app.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/nukleargui/app.c 2020-05-08 15:51:31.000000000 +0200 @@ -21,8 +21,6 @@ extern void Screen_SetFullUpdate(int scr); extern void vkbd_key(int key,int pressed); -extern long GetTicks(void); - extern retro_input_poll_t input_poll_cb; extern retro_input_state_t input_state_cb; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/nukleargui/retro/RSDL_wrapper.h new/libretro-cap32-0~git20200508/libretro/nukleargui/retro/RSDL_wrapper.h --- old/libretro-cap32-0~git20190907/libretro/nukleargui/retro/RSDL_wrapper.h 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/nukleargui/retro/RSDL_wrapper.h 2020-05-08 15:51:31.000000000 +0200 @@ -10,6 +10,7 @@ #include <stdlib.h> #include <unistd.h> #include <time.h> +#include <retro_endianness.h> /* The number of elements in a table */ #define RSDL_TABLESIZE(table) (sizeof(table)/sizeof(table[0])) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/retro_events.c new/libretro-cap32-0~git20200508/libretro/retro_events.c --- old/libretro-cap32-0~git20190907/libretro/retro_events.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/retro_events.c 2020-05-08 15:51:31.000000000 +0200 @@ -59,6 +59,7 @@ static uint8_t keyboard_translation[MAX_KEYSYMS]; unsigned int last_input[PORTS_NUMBER] = {0,0}; uint32_t padnum = 0; +bool (*ev_events)(void); const uint8_t btnPAD[MAX_PADCFG][MAX_BUTTONS] = { { // JOYSTICK CFG diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/retro_events.h new/libretro-cap32-0~git20200508/libretro/retro_events.h --- old/libretro-cap32-0~git20190907/libretro/retro_events.h 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/retro_events.h 2020-05-08 15:51:31.000000000 +0200 @@ -154,8 +154,10 @@ #define JOY_EVENT_ID_Y 1 void ev_joysticks(); -bool (*ev_events)(void); +extern bool (*ev_events)(void); void ev_combo_set(unsigned btn); void ev_init(); +void Core_PollEvent(void); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libretro-cap32-0~git20190907/libretro/retro_snd.c new/libretro-cap32-0~git20200508/libretro/retro_snd.c --- old/libretro-cap32-0~git20190907/libretro/retro_snd.c 2019-09-07 20:30:53.000000000 +0200 +++ new/libretro-cap32-0~git20200508/libretro/retro_snd.c 2020-05-08 15:51:31.000000000 +0200 @@ -20,6 +20,7 @@ #include <libretro.h> #include <libretro-core.h> +#include <retro_endianness.h> #include "retro_snd.h"