Split ppsspp into subpackages (libretro).

This commit is contained in:
bentley
2025-11-13 13:20:52 +00:00
parent d3e70b4900
commit a6affa78e5
11 changed files with 223 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
COMMENT = Sony PlayStation Portable core for retroarch
PKGNAME = libretro-ppsspp-$V
PPSSPP_SUBDIR_CONFIGURE_ARGS = -DLIBRETRO=ON
WANTLIB += ${COMPILER_LIBCXX}
WANTLIB += GL GLEW GLU ICE SM X11 Xext avcodec avformat avutil
WANTLIB += m miniupnpc png snappy swresample swscale z zip zstd
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/lib/libretro
${INSTALL_PROGRAM} ${WRKBUILD}/lib/ppsspp_libretro.so \
${PREFIX}/lib/libretro
.include <bsd.port.mk>
+2
View File
@@ -0,0 +1,2 @@
SHA256 (ppsspp-1.19.3.tar.xz) = BUQB+n//vZm3/YDpiilR1vDD3oPLS1RxmJnJi/rZlhQ=
SIZE (ppsspp-1.19.3.tar.xz) = 58131440
@@ -0,0 +1,32 @@
- Honor CFLAGS and DEBUG
- Use system libpng on arm platforms
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -1080,16 +1080,6 @@ add_library(cityhash STATIC
)
target_include_directories(cityhash PRIVATE ext/cityhash)
-if(NOT MSVC)
- # These can be fast even for debug.
- target_compile_options(udis86 PRIVATE "-O2")
- target_compile_options(cityhash PRIVATE "-O2")
- if(NOT ZLIB_FOUND)
- target_compile_options(zlib PRIVATE "-O2")
- endif()
-endif()
-
-
find_package(LIBZIP)
if(LIBZIP_FOUND AND USE_SYSTEM_LIBZIP)
include_directories(${LIBZIP_INCLUDE_DIRS})
@@ -1233,7 +1223,7 @@ else()
endif()
# Arm platforms require at least libpng17.
-if(ANDROID OR ARMV7 OR ARM64 OR ARM OR IOS)
+if(ANDROID OR IOS)
set(PNG_REQUIRED_VERSION 1.7)
else()
set(PNG_REQUIRED_VERSION 1.6)
@@ -0,0 +1,14 @@
Build with newer FFmpeg
Index: Core/AVIDump.cpp
--- Core/AVIDump.cpp.orig
+++ Core/AVIDump.cpp
@@ -94,7 +94,7 @@ bool AVIDump::Start(int w, int h)
bool AVIDump::CreateAVI() {
#ifdef USE_FFMPEG
- AVCodec *codec = nullptr;
+ const AVCodec *codec = nullptr;
// Use gameID_EmulatedTimestamp for filename
std::string discID = g_paramSFO.GetDiscID();
@@ -0,0 +1,23 @@
Build with newer FFmpeg
Index: Core/HLE/sceMpeg.cpp
--- Core/HLE/sceMpeg.cpp.orig
+++ Core/HLE/sceMpeg.cpp
@@ -719,7 +719,7 @@ static bool InitPmp(MpegContext * ctx){
pmp_want_pix_fmt = AV_PIX_FMT_RGBA;
// Create H264 video codec
- AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264);
+ const AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (pmp_Codec == NULL){
ERROR_LOG(Log::Mpeg, "Can not find H264 codec, please update ffmpeg");
return false;
@@ -928,7 +928,7 @@ static bool decodePmpVideo(PSPPointer<SceMpegRingBuffe
avcodec_send_packet(pCodecCtx, &packet);
int len = avcodec_receive_frame(pCodecCtx, pFrame);
if (len == 0) {
- len = pFrame->pkt_size;
+ len = packet.size;
got_picture = 1;
} else if (len == AVERROR(EAGAIN)) {
len = 0;
@@ -0,0 +1,50 @@
Build with newer FFmpeg
Index: Core/HW/MediaEngine.cpp
--- Core/HW/MediaEngine.cpp.orig
+++ Core/HW/MediaEngine.cpp
@@ -365,7 +365,7 @@ void MediaEngine::closeContext() {
m_pCodecCtxs.clear();
// These are streams allocated from avformat_new_stream.
for (auto &it : m_codecsToClose) {
- avcodec_close(it);
+ avcodec_free_context(&it);
}
m_codecsToClose.clear();
if (m_pFormatCtx)
@@ -406,7 +406,7 @@ bool MediaEngine::addVideoStream(int streamNum, int st
// no need to add an existing stream.
if ((u32)streamNum < m_pFormatCtx->nb_streams)
return true;
- AVCodec *h264_codec = avcodec_find_decoder(AV_CODEC_ID_H264);
+ const AVCodec *h264_codec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (!h264_codec)
return false;
AVStream *stream = avformat_new_stream(m_pFormatCtx, h264_codec);
@@ -429,7 +429,7 @@ bool MediaEngine::addVideoStream(int streamNum, int st
}
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 16, 100)
- AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
+ const AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
AVCodecContext *codecCtx = avcodec_alloc_context3(codec);
#else
AVCodecContext *codecCtx = stream->codec;
@@ -517,7 +517,7 @@ bool MediaEngine::setVideoStream(int streamNum, bool f
AVStream *stream = m_pFormatCtx->streams[streamNum];
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
- AVCodec *pCodec = avcodec_find_decoder(stream->codecpar->codec_id);
+ const AVCodec *pCodec = avcodec_find_decoder(stream->codecpar->codec_id);
if (!pCodec) {
WARN_LOG_REPORT(Log::ME, "Could not find decoder for %d", (int)stream->codecpar->codec_id);
return false;
@@ -683,7 +683,7 @@ bool MediaEngine::stepVideo(int videoPixelMode, bool s
avcodec_send_packet(m_pCodecCtx, &packet);
int result = avcodec_receive_frame(m_pCodecCtx, m_pFrame);
if (result == 0) {
- result = m_pFrame->pkt_size;
+ result = packet.size;
frameFinished = 1;
} else if (result == AVERROR(EAGAIN)) {
result = 0;
@@ -0,0 +1,41 @@
Build with newer FFmpeg
Index: Core/HW/SimpleAudioDec.cpp
--- Core/HW/SimpleAudioDec.cpp.orig
+++ Core/HW/SimpleAudioDec.cpp
@@ -133,7 +133,7 @@ class FFmpegAudioDecoder : public AudioDecoder { (priv
int channels_;
AVFrame *frame_ = nullptr;
- AVCodec *codec_ = nullptr;
+ const AVCodec *codec_ = nullptr;
AVCodecContext *codecCtx_ = nullptr;
SwrContext *swrCtx_ = nullptr;
@@ -286,7 +286,7 @@ FFmpegAudioDecoder::~FFmpegAudioDecoder() {
avcodec_free_context(&codecCtx_);
#else
// Future versions may add other things to free, but avcodec_free_context didn't exist yet here.
- avcodec_close(codecCtx_);
+ avcodec_free_context(&codecCtx_);
av_freep(&codecCtx_->extradata);
av_freep(&codecCtx_->subtitle_header);
av_freep(&codecCtx_);
@@ -327,7 +327,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf,
int err = avcodec_receive_frame(codecCtx_, frame_);
int len = 0;
if (err >= 0) {
- len = frame_->pkt_size;
+ len = packet.size;
got_frame = 1;
} else if (err != AVERROR(EAGAIN)) {
len = err;
@@ -392,7 +392,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf,
if (!swrCtx_ || swr_init(swrCtx_) < 0) {
ERROR_LOG(Log::ME, "swr_init: Failed to initialize the resampling context");
- avcodec_close(codecCtx_);
+ avcodec_free_context(&codecCtx_);
codec_ = 0;
return false;
}
@@ -0,0 +1,27 @@
Index: cmake/Modules/FindFFmpeg.cmake
--- cmake/Modules/FindFFmpeg.cmake.orig
+++ cmake/Modules/FindFFmpeg.cmake
@@ -33,7 +33,6 @@ set(_FFmpeg_ALL_COMPONENTS
avfilter
avformat
avutil
- postproc
swresample
swscale
)
@@ -42,7 +41,6 @@ set(_FFmpeg_DEPS_avcodec avutil)
set(_FFmpeg_DEPS_avdevice avcodec avformat avutil)
set(_FFmpeg_DEPS_avfilter avutil)
set(_FFmpeg_DEPS_avformat avcodec avutil)
-set(_FFmpeg_DEPS_postproc avutil)
set(_FFmpeg_DEPS_swresample avutil)
set(_FFmpeg_DEPS_swscale avutil)
@@ -51,7 +49,6 @@ set(_FFmpeg_HEADER_avdevice avdevice)
set(_FFmpeg_HEADER_avfilter avfilter)
set(_FFmpeg_HEADER_avformat avformat)
set(_FFmpeg_HEADER_avutil avutil)
-set(_FFmpeg_HEADER_postproc postprocess)
set(_FFmpeg_HEADER_swresample swresample)
set(_FFmpeg_HEADER_swscale swscale)
@@ -0,0 +1,14 @@
hijack FreeBSD codepaths
Index: ext/cpu_features/include/cpu_features_macros.h
--- ext/cpu_features/include/cpu_features_macros.h.orig
+++ ext/cpu_features/include/cpu_features_macros.h
@@ -91,7 +91,7 @@
// Os
////////////////////////////////////////////////////////////////////////////////
-#if (defined(__freebsd__) || defined(__FreeBSD__))
+#if (defined(__freebsd__) || defined(__FreeBSD__) || defined(__OpenBSD__))
#define CPU_FEATURES_OS_FREEBSD
#endif
+2
View File
@@ -0,0 +1,2 @@
libretro-ppsspp provides a Sony PlayStation Portable emulation core to the
RetroArch emulator frontend, based on PPSSPP.
+2
View File
@@ -0,0 +1,2 @@
lib/libretro/
@so lib/libretro/ppsspp_libretro.so