Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPSSPP should use its own bundled ffmpeg #84737

Closed
2 tasks done
vit9696 opened this issue Sep 5, 2021 · 15 comments
Closed
2 tasks done

PPSSPP should use its own bundled ffmpeg #84737

vit9696 opened this issue Sep 5, 2021 · 15 comments
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@vit9696
Copy link
Contributor

vit9696 commented Sep 5, 2021

brew gist-logs <formula> link OR brew config AND brew doctor output

Unrelated

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

I was trying to play games (namely Valkyria Chronicles II) with PPSSPP and used a brew-provided version of PPSSPP.

What happened (include all command output)?

All the videos either stuttered or were unplayable: showed black screen soon after the first frame. There are multiple error messages in the logs like the following:

59:14:295 Odin_Main    E[ME]: HLE/sceMpeg.cpp:1384 UNIMPL sceMpegAvcDecodeFlush(08d571f0)
00:23:691 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2107): already stopped
00:30:271 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2109): already stopped
00:49:131 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2111): already stopped
00:52:142 Odin_Main    E[ME]: HLE/sceMpeg.cpp:1384 UNIMPL sceMpegAvcDecodeFlush(08d571f0)
00:52:243 Odin_Main    E[ME]: HLE/sceMpeg.cpp:1384 UNIMPL sceMpegAvcDecodeFlush(08d571f0)
01:26:443 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2144): already stopped
01:31:434 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2146): already stopped
01:48:812 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2148): already stopped
01:51:797 Odin_Main    E[ME]: HLE/sceMpeg.cpp:1384 UNIMPL sceMpegAvcDecodeFlush(08d571f0)
01:51:896 Odin_Main    E[ME]: HLE/sceMpeg.cpp:1384 UNIMPL sceMpegAvcDecodeFlush(08d571f0)
02:04:811 Odin_Main    E[SCEKERNEL]: HLE/sceKernelThread.cpp:2352 800201a2=sceKernelTerminateThread(2181): already stopped

What did you expect to happen?

I expected the videos to play normally, because I expected brew to use the ffmpeg package bundled within PPSSPP repository. PPSSPP includes a rather heavily modified ffmpeg version, so you cannot just use the system/upstream one. I recompiled PPSSPP manually with its own ffmpeg and this worked perfectly. Fortunately their ffmpeg is static.

Step-by-step reproduction instructions (by running brew commands)

1. Open Valkyria Chronicles II in PPSSPP.
2. Let the intro video play.
3. It will stutter quite a lot.
@vit9696 vit9696 added the bug Reproducible Homebrew/homebrew-core bug label Sep 5, 2021
@alebcay
Copy link
Member

alebcay commented Sep 5, 2021

Just for additional background (for other maintainers/readers), the described issue is tracked upstream at hrydgard/ppsspp#11490.

It sounds like the issue should have been addressed upstream (at least in some situations) by hrydgard/ppsspp#14188, which should already be included in this version of ppsspp. As is often the case, upstream also seems reluctant to fully support/fix this issue for non-patched ffmpeg installations, for various reasons described in the upstream issue.

@unknownbrackets
Copy link

Some points of clarification:

  1. Additional fixes for FFmpeg 3.1+ hrydgard/ppsspp#14188 is not included in the latest stable release, v1.11.3. It's included in the latest git, which is probably not the version that was used here.
  2. FFmpeg has removed/changed functionality that we relied upon in the latest versions. Additional fixes for FFmpeg 3.1+ hrydgard/ppsspp#14188 includes a workaround, but it will exhibit bugs for games that attempt to render videos in certain ways (I don't currently know of any specific games that do this, but I can and have written a test PSP app that does it.)
  3. The version of FFmpeg we bundle is by no means heavily modified; it's simply FFmpeg 3.0.2. That repo also has some build scripts for cut down binaries and some committed binaries.
  4. We include the binaries of FFmpeg mainly to make PPSSPP easier to build on Windows (it would require msys2 and many steps someone perfectly capable of installing Visual Studio and clicking Run would get scared away by.)

I know package managers always think people are "reluctant" to support the latest APIs because it takes work, but keep in mind that 1400+ PSP games were released and they were all written against Sony APIs for video decoding. Emulation means simulating those APIs, not rewriting the game logic and video looping to use new APIs.

Since the new FFmpeg APIs don't support the features we need to simulate Sony's video API, we're likely to remain reluctant for some time. Probably the end result will eventually be, unfortunately, reinventing the wheel on video decoding and writing our own (maybe copying parts of FFmpeg.)

I get that people shouldn't be writing software to decode video the ways FFmpeg no longer supports. Unfortunately, no one has been able to jump in a time machine and successfully convince Sony and PSP game developers of this. I don't anticipate this changing, so I wouldn't recommend holding your breath for our "reluctance" to end - unless you've got a time machine to change how PSP games were written.

-[Unknown]

@alebcay
Copy link
Member

alebcay commented Sep 12, 2021

Hi @vit9696, PPSSPP 1.1.3_1 is now available via Homebrew with the changes from #84738.

@vit9696
Copy link
Contributor Author

vit9696 commented Sep 12, 2021

Yes, thank you for taking your time on that. I will find some time to make PPSSPP release in binary.

@vit9696
Copy link
Contributor Author

vit9696 commented Sep 12, 2021

Posted in hrydgard/ppsspp#14839.

@vit9696
Copy link
Contributor Author

vit9696 commented Sep 18, 2021

With hrydgard/ppsspp#14839 merged we should get official PPSSPP releases as of 1.12.0. CC @alebcay, @Gcenx.

@vit9696
Copy link
Contributor Author

vit9696 commented Oct 12, 2021

@alebcay @Gcenx, from now on PPSSPP provides official binary releases for macOS. What should our route be to include PPSSPP in Homebrew Cask? I see the following options:

  1. We remove ppsspp formula and create ppsspp cask as a replacement.
  2. We rename ppsspp formula to ppsspp-cli and add ppsspp cask.
  3. We add ppsspp-app cask.

My personal preference is route (2), but I am not sure of the general Homebrew policy here.

@Gcenx
Copy link
Contributor

Gcenx commented Oct 12, 2021

@vit9696 if the cmake file is to be believed (10.8 min target), I’d opt for dropping the brew formula and instead provide a cask as ppsspp is a GUI app and not really a cli app. (I believe that’s how brew maintainers would see this)

Off topic but the minimum target should really be 10.9 when using -stdlib=libc++

@carlocab
Copy link
Member

carlocab commented Oct 12, 2021

You can also call the cask ppsspp without renaming the formula. I suggest you try this first.

@unknownbrackets
Copy link

Off topic but the minimum target should really be 10.9 when using -stdlib=libc++

Used to be 10.7, which was the minimum for libc++. We only upped to 10.8 as of last year. I don't think we've heard any complaints from people using 10.8 or people who were using 10.7 before that (that said, macOS is eclipsed by Android and Windows in usage, by far... it's not impossible that the few people still on 10.8 haven't said anything.)

-[Unknown]

@Gcenx
Copy link
Contributor

Gcenx commented Oct 12, 2021

Used to be 10.7, which was the minimum for libc++. We only upped to 10.8 as of last year. I don't think we've heard any complaints from people using 10.8 or people who were using 10.7 before that (that said, macOS is eclipsed by Android and Windows in usage, by far... it's not impossible that the few people still on 10.8 haven't said anything.)

While true libc++ on 10.7 is rather lacking when compared to 10.8 but Apple sets the minimum target to 10.9 for modern SDKs in most cases. Still I'd be surprised if there's many users still using below 10.11 these days.

@vit9696
Copy link
Contributor Author

vit9696 commented Oct 13, 2021

Actually this is not compatible with 10.8, but not due to libc++.

Date/Time:       2021-10-13 00:06:13.923 +0000
OS Version:      Mac OS X 10.8.5 (12F2560)
Report Version:  10

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_CAMetalLayer
  Referenced from: /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
  Expected in: /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
 in /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
Date/Time:       2021-10-13 03:08:08.835 +0300
OS Version:      Mac OS X 10.9.5 (13F1911)
Report Version:  11
Anonymous UUID:  ABB5B1A7-0D4F-75FB-BA5B-C94051C63886

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_CAMetalLayer
  Referenced from: /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
  Expected in: /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
 in /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
Date/Time:             2021-10-13 03:09:52.434 +0300
OS Version:            Mac OS X 10.10.5 (14F2511)
Report Version:        11
Anonymous UUID:        4C4D268E-45EF-BDE5-4440-BFDA3F7D9A72

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_CAMetalLayer
  Referenced from: /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
  Expected in: /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
 in /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
Date/Time:             2021-10-13 01:11:11.106 +0100
OS Version:            Mac OS X 10.11.6 (15G22010)
Report Version:        11
Anonymous UUID:        BE6B860F-08FB-8D00-B45A-8D31959E34BE

Dyld Error Message:
  Symbol not found: ____chkstk_darwin
  Referenced from: /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
  Expected in: /usr/lib/libSystem.B.dylib
Date/Time:             2021-10-12 17:13:32.135 -0700
OS Version:            Mac OS X 10.12.6 (16G2136)
Report Version:        12
Anonymous UUID:        D7F251E8-F25B-F3F1-FC4A-C8C64D011EC3

Dyld Error Message:
  Symbol not found: ____chkstk_darwin
  Referenced from: /Users/USER/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL
  Expected in: /usr/lib/libSystem.B.dylib

10.13 shows a warning: You can’t use this version of the application “PPSSPPSDL” with this version of macOS. You have macOS 10.13.6. The application requires macOS 10.15 or later. Running from terminal crashes:

dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/user/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/user/Desktop/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libSystem.B.dylib

10.14 shows a warning: You can’t use this version of the application “PPSSPPSDL” with this version of macOS. You have macOS 10.14.6. The application requires macOS 10.15 or later.. Running from terminal works fine.

@unknownbrackets
Copy link

Hmm, I see. Seems like when Metal was added, it wasn't done in a way that preserves older macOS - I guess no one has reported anything even from 10.14... so I guess that was in hrydgard/ppsspp#12583.

Not sure if the latter issues are a target issue or maybe an issue with the library, similarly?

In that case we should indeed either raise the min or fix it. But that's more a PPSSPP problem than here.

-[Unknown]

@vit9696
Copy link
Contributor Author

vit9696 commented Oct 13, 2021

PPSSPP is built without -mmacosx-version-min=10.8, that is the problem. I see the following command embedded into PPSSPPSDL. If it is added back, I believe the binaries should work fine.

Screenshot 2021-10-13 at 03 31 44

@vit9696
Copy link
Contributor Author

vit9696 commented Oct 19, 2021

PPSSPP 1.12.3 with legacy macOS fixes landed upstream. Shall we drop the formula and switch to casks?

@github-actions github-actions bot added the outdated PR was locked due to age label Nov 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants