Merge pull request #4863 from babyhuey/feat/libscevideoout-busy-open

fix(libSceVideoOut): return RESOURCE_BUSY when a bus is opened twice
This commit is contained in:
Dean 2026-10-14 14:33:15 +13:00 committed by GitHub
commit 11b24ee816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View File

@ -80,9 +80,7 @@ int APS5_VABI sceVideoOutOpen(int userId, int busType, int index, const void* pa
throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
}
const int handle = VideoOutDriver::Get().Open(busType);
if (handle < 0) {
throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_RESOURCE_BUSY");
}
if (handle < 0) return VIDEO_OUT_ERROR_RESOURCE_BUSY;
return handle;
} catch (const ProcessShutdown&) {
LibcAwaitExit_nid_postfix();

View File

@ -340,7 +340,7 @@ int VideoOutDriver::Open(int busType) {
uint64_t generation = 1;
if (previous) {
std::lock_guard cfgLock(previous->mutex);
require(!previous->opened, "port already open");
if (previous->opened) return -1;
require(previous->generation != std::numeric_limits<uint64_t>::max(), "port generation overflow");
generation = previous->generation + 1;
}

View File

@ -21,6 +21,7 @@ static constexpr int MAIN_BUS = 0;
static constexpr int INVALID_VALUE = static_cast<int>(0x80290001);
static constexpr int INVALID_ADDRESS = static_cast<int>(0x80290002);
static constexpr int INVALID_HANDLE = static_cast<int>(0x8029000B);
static constexpr int RESOURCE_BUSY = static_cast<int>(0x80290009);
static constexpr int UNSUPPORTED_OUTPUT_MODE = static_cast<int>(0x80290016);
static constexpr int UNKNOWN_OUTPUT_MODE = static_cast<int>(0x8029001E);
@ -50,6 +51,7 @@ int main() {
return 77;
}
Require(handle > 0);
Require(sceVideoOutOpen(SYSTEM_USER, MAIN_BUS, 0, nullptr) == RESOURCE_BUSY);
Require(sceVideoOutIsOutputSupported(handle, 1, &options, nullptr, 0) == 1);
Require(sceVideoOutIsOutputSupported(handle, 1, nullptr, nullptr, 0) == 1);
const int highFrameRate = sceVideoOutIsOutputSupported(handle, 15, &options, nullptr, 0);

View File

@ -21,6 +21,7 @@
### Functional
- [sceVideoOutOpen](../../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - opening a bus that is already open returns `SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY` (`0x80290009`), as [shadPS4's](https://github.com/shadps4-emu/shadPS4/blob/e0a466753a1aacbc8db8253be685bf7ab4d9daae/src/core/libraries/videoout/driver.cpp#L53-L60) PS4 driver does for its main port; the PS5 result is unverified. PPSA99764 opens the main bus twice and carries on, presenting through the first handle
- [Overlay output bus](../../../core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp) (libSceVideoOut) - flips on a port opened with `SCE_VIDEO_OUT_BUS_TYPE_OVERLAY` complete and signal their events like main-bus flips, but their buffers are not shown: the overlay is not composited over the main output. Presenting them as whole frames made the window alternate between the two buses
- [Mouse capture and delta scaling](../../../core/libs/prx/libSceVideoOut/src/MouseInput.cpp) (libSceVideoOut) - the console's mouse reports relative motion only, so a host cursor can never coincide with the title's cursor; while a title has a mouse open and the window is focused the host cursor is hidden and captured (SDL relative mode, released on focus loss or while the pad's mouse-to-stick toggle is on). Motion deltas are scaled from the presented image's size in window units to the title's display resolution with sub-pixel carry; the console's deltas are counts, so a title that applies its own sensitivity moves its cursor that much faster than the host pointer would have. The scale takes SDL's relative motion in logical window units, the units of `SDL_GetWindowSize`; under Windows DPI scaling SDL may report it in physical pixels, which is unverified (no Windows run yet), and a drawable larger than the window does not change the scale.
- [Windows game controllers](../../../core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp) (libSceVideoOut) - SDL's DirectInput joystick backend is disabled at default hint priority before `SDL_InitSubSystem`, because its device enumeration blocks forever on some vendor HID devices (#1042). XInput and HIDAPI controllers are detected; controllers reachable only through DirectInput are not. Setting `SDL_DIRECTINPUT_ENABLED=1` restores them on hosts without such a device