From e8801687f232a6f8828b3ff5dadbc9fe1b0076fc Mon Sep 17 00:00:00 2001 From: crystalct Date: Sat, 5 Feb 2022 14:03:13 +0100 Subject: [PATCH] PS3 build fix (#208) --- Makefile | 44 +++++++----------------- deps/libchdr/include/libchdr/coretypes.h | 9 +++++ deps/libchdr/src/libchdr_chd.c | 2 +- deps/lzma-19.00/include/7zTypes.h | 2 ++ libretro.cpp | 4 +++ 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 1a834f3..4aca3b3 100644 --- a/Makefile +++ b/Makefile @@ -228,37 +228,19 @@ else ifeq ($(platform), qnx) AR = QCC -Vgcc_ntoarmv7le FLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp -# PS3 -else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght)) - TARGET := $(TARGET_NAME)_libretro_ps3.a - STATIC_LINKING = 1 - ENDIANNESS_DEFINES := -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN - - # sncps3 - ifneq (,$(findstring sncps3,$(platform))) - CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe - CXX = $(CC) - AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe - FLAGS += -DARCH_POWERPC_ALTIVEC - CXXFLAGS += -Xc+=exceptions - OLD_GCC := 1 - NO_GCC := 1 - - # PS3 - else ifneq (,$(findstring ps3,$(platform))) - CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe - CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe - AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe - FLAGS += -DARCH_POWERPC_ALTIVEC - OLD_GCC := 1 - - # Lightweight PS3 Homebrew SDK - else ifneq (,$(findstring psl1ght,$(platform))) - TARGET := $(TARGET_NAME)_libretro_$(platform).a - CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) - CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT) - AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) - endif +# Lightweight PS3 Homebrew SDK +else ifneq (,$(filter $(platform), ps3 psl1ght)) + TARGET := $(TARGET_NAME)_libretro_$(platform).a + STATIC_LINKING = 1 + ENDIANNESS_DEFINES := -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN + CC = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT) + AR = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)ar$(EXE_EXT) + CXX = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)g++$(EXE_EXT) + ifeq ($(platform), psl1ght) + FLAGS += -D__PSL1GHT__ + endif + FLAGS += -DARCH_POWERPC_ALTIVEC -D__PS3__ -DUSE_LIBRETRO_VFS + OLD_GCC := 1 # PSP else ifeq ($(platform), psp1) diff --git a/deps/libchdr/include/libchdr/coretypes.h b/deps/libchdr/include/libchdr/coretypes.h index 30f892f..a7f265b 100644 --- a/deps/libchdr/include/libchdr/coretypes.h +++ b/deps/libchdr/include/libchdr/coretypes.h @@ -20,6 +20,14 @@ typedef int32_t INT32; typedef int16_t INT16; typedef int8_t INT8; +#ifdef USE_LIBRETRO_VFS +#define core_file RFILE +#define core_fopen(file) rfopen(file, "rb") +#define core_fseek rfseek +#define core_ftell rftell +#define core_fread(fc, buff, len) fread(buff, 1, len, fc) +#define core_fclose rfclose +#else /* USE_LIBRETRO_VFS */ #define core_file FILE #define core_fopen(file) fopen(file, "rb") #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__) @@ -34,6 +42,7 @@ typedef int8_t INT8; #endif #define core_fread(fc, buff, len) fread(buff, 1, len, fc) #define core_fclose fclose +#endif /* USE_LIBRETRO_VFS */ static UINT64 core_fsize(core_file *f) { diff --git a/deps/libchdr/src/libchdr_chd.c b/deps/libchdr/src/libchdr_chd.c index 45c5680..bdca21b 100644 --- a/deps/libchdr/src/libchdr_chd.c +++ b/deps/libchdr/src/libchdr_chd.c @@ -48,9 +48,9 @@ #include #include +#include "zlib.h" #include "LzmaEnc.h" #include "LzmaDec.h" -#include "zlib.h" #undef TRUE #undef FALSE diff --git a/deps/lzma-19.00/include/7zTypes.h b/deps/lzma-19.00/include/7zTypes.h index 65b3af6..5562405 100644 --- a/deps/lzma-19.00/include/7zTypes.h +++ b/deps/lzma-19.00/include/7zTypes.h @@ -63,7 +63,9 @@ typedef int WRes; #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } #endif +#ifndef ZCONF_H typedef unsigned char Byte; +#endif typedef short Int16; typedef unsigned short UInt16; diff --git a/libretro.cpp b/libretro.cpp index b082ae0..48fd03a 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -30,6 +30,10 @@ #include "mednafen/msvc_compat.h" #endif +#ifdef __PS3__ +using namespace std; +#endif + std::string retro_base_directory; #define MEDNAFEN_CORE_NAME_MODULE "pce_fast"