Commit Graph
49565 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 3ca76c674c Outputs: Say the menus are on the device, instead of showing black
When no screen on the stack shows anything on an output (we're in the
menus), the background screen draws "Menus are on your device" there.
UI drawn to an output gets the primary's DPI scale, over the whole output.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 923611b445 Display layout: Disable move/resize while the game is on another output
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 7bd4b13baa iOS: Show the game on an AirPlay TV, with the controls on the phone
An external display (like an Apple TV over AirPlay) becomes a Game
output, when the backend is Metal. The game is shown there full screen,
and the phone shows the touch controls with "Playing on TV" in place of
the game. The menus stay on the phone. With other backends, iOS keeps
mirroring.

Up to iOS 26 the external display scene comes from the Info.plist role.
iOS 27 ignores that, and only offers the scene to apps that register a
scene accessory for it, so we do that too. The registration is withdrawn
when the view controller shuts down, so it follows a backend change, and
a restart now goes to the app's scene rather than the first one.

An Apple TV 4K only offers 3840x2160 over AirPlay, so the stream stays
4K, but we render at 1920x1080 and let the layer scale it up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 d491fc90cf Secondary outputs, and --game-window on Mac to show the game in a second window
The ScreenManager keeps a list of secondary outputs, each with its own
swapchain, recreated after a lost device. Platform code adds, resizes and
removes them from any thread through Native_AddOutput() and friends, which
take effect at the start of the next frame.

Each frame, every output is drawn by the topmost screen that claims it
(Screen::renderOutput). EmuScreen claims Game outputs: it presents the
game there, laid out for that output, and leaves it out of the backbuffer,
where the touch controls and the menus stay. Not in non-buffered mode,
which draws straight into the backbuffer.

--game-window opens such an output on Mac, with Metal. It's a smoke test
for multiple swapchains, and a stand-in for an AirPlay display.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 56c76ace35 thin3d: Swapchain objects, and multiple swapchains on Metal
The backbuffer is now a Swapchain, from GetPrimarySwapchain(), and
callers bind, measure and read it back through that instead of nullptr.
nullptr still means it too. Backends with one swapchain map the primary
to their old backbuffer path.

On Metal, CreateSwapchain() adds more, each with its own layer, depth
buffer and drawable. Passes merge per swapchain, and Present() presents
every drawable acquired that frame. The backbuffer is just the first
of them. Nothing creates a second one yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 26e302aa86 docs: Screens draw to secondary outputs through renderOutput()
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 4922859675 PresentationCommon: Take the output's size, insets and rotation as parameters
OutputParams describes the surface the game is presented to.
PrimaryOutputParams() builds it from g_display and the system's safe
area insets, as before. SetOutputOverride() lets the game go to another
output, like a TV, which will have its own size, rotation and insets.

No change for the primary output: frametests on Metal and Vulkan match
before and after.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 a2d18d21cd iOS: Make Metal the default graphics backend
Not on tvOS, where the Metal backend hasn't been run yet. Existing
installs keep the backend saved in their ini.

The multi-swapchain plan now does Metal before Vulkan to match.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik RydgårdandClaude Opus 5.5 7da7e71aea docs: Design for multiple swapchains and an iOS TV mode
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:42:53 +02:00
Henrik Rydgård 679d804c26 Merge pull request #22730 from hrydgard/config-constexpr-parentptr
Config: Alternative speeds in percent, constexpr setting tables, view parent pointers
2026-10-22 18:41:48 +02:00
Henrik RydgårdandClaude Opus 5.5 44b5dc1b95 Config: Default AutoFrameSkip to false
Its default called IsVREnabled() during static initialization, before VR is
set up, so it was always false in practice.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 18:00:17 +02:00
Henrik RydgårdandClaude Opus 5.5 5d8db2a22d UI: Give views a pointer to their parent group
Set by ViewGroup when a view is added, inserted or swapped in. Lets a view
find the scroll view it's in, for example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 15:34:51 +02:00
Henrik RydgårdandClaude Opus 5.5 729047d449 Config: Make the setting tables constexpr
SETTING now takes offsets with offsetof and passes them along with the
setting's type, instead of the block and member pointers, and the
ConfigSetting constructors are constexpr. So the tables are built at compile
time, and later per-setting metadata can be checked by the compiler too.

Defaults that weren't constants had to change:
- AutoFrameSkip called IsVREnabled() during static initialization, before VR
  is set up. It's now a default callback, evaluated when the config is
  loaded or reset, which can turn it on by default on VR devices.
- DisplayRefreshRate read g_Config's own initial value, which is 60.

Path defaults now share the string member of the default union.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 15:34:47 +02:00
Henrik RydgårdandClaude Opus 5.5 71b38e58e6 Config: Store the alternative speeds in percent
The settings screen showed them in percent but they were stored as frame
rates out of 60, so the screen kept converted copies and wrote them back. Now
they're stored in percent under new ini keys (AltSpeedPercent,
AltSpeedPercent2, AnalogAltSpeedPercent), migrated from the old frame rate
keys like the audio volumes were, and converted to a frame rate where the
timing needs one.

Low percentages no longer round to a 0 fps limit, which meant unlimited.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 15:28:18 +02:00
Henrik Rydgård a9175126e2 Merge pull request #22718 from LunaMoo/overlays
Add overlay (bezel) support
2026-10-22 14:42:15 +02:00
LunaMooandClaude Opus 5.5 c986b4000f Display layout: keep the overlay on Reset
Reset is about size, position and aspect. The overlay is a separate choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGBg32EFPsTXjAFu7dnTcz
2026-10-22 14:09:58 +02:00
LunaMooandClaude Opus 5.5 519f282f99 Overlay: follow display offset/scale, avoid needless reloads
- Apply the display layout's scale and offset to the overlay itself instead
  of always centering it, so moving/resizing the display in Display Layout
  moves the overlay with the game inside it, and the portrait default
  (screen high up) is respected.
- Rescanning overlays (done whenever the display layout screen recreates its
  views, e.g. after closing the picker popup) no longer unloads the active
  overlay unless its definition changed.
- Re-picking the current overlay no longer posts GPU config change
  notifications, which caused an audio glitch with a game running behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGBg32EFPsTXjAFu7dnTcz
2026-10-22 14:09:51 +02:00
LunaMooandClaude Opus 5.5 3ce3973781 Add overlay (bezel) support
Draws a user image around or behind the PSP screen, to fill the black bars
on displays whose aspect ratio doesn't match the PSP's (#20325).

- Overlays are PNGs in PSP/OVERLAYS. A plain PNG there just works: it's
  drawn in front of the game, and its transparent hole is found by walking
  from the image center to each edge until a nearly opaque pixel. Existing
  RetroArch overlay images can be dropped in as-is.
- A subfolder with an overlay.ini can define overlays with a Name, Layer
  (Foreground/Background) and an explicit Hole=x,y,w,h.
- "Load overlay image..." in the display layout screen imports any PNG
  (including Android content URIs) into the overlays folder and selects it.
- The overlay is fit to the screen (aspect preserved, centered). The hole is
  mapped with the same scale, and the game is fit into it with the normal
  stretch / integer scale / aspect ratio options. Offset and scale don't
  apply while an overlay with a hole is active. This goes through
  CalculateDisplayOutputRect, so touch mapping and post shaders agree.
- The selection is a per-orientation, per-game DisplayLayout setting.
- Disabled in VR, Cardboard, and with skip buffer effects (except software
  rendering), since the presentation path doesn't run there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGBg32EFPsTXjAFu7dnTcz
2026-10-22 14:09:51 +02:00
Henrik Rydgård ff3d184b43 Merge pull request #22725 from hrydgard/dns-safe-fixes
Net: Harden the direct DNS lookup and inet_pton
2026-10-22 13:33:22 +02:00
Henrik Rydgård 18f2a59fc2 Merge pull request #22727 from hrydgard/ios-airplay
iOS: AirPlay audio fixes, stuck touch and exit crash
2026-10-22 13:32:34 +02:00
Henrik RydgårdandClaude Opus 5.5 b8c9e82fe6 iOS: Leave PlayAndRecord when a game stops recording
The session category was switched before the audio unit's input was
turned off, and iOS refuses ('!pri') to leave PlayAndRecord while the
input runs. So after a game used the microphone, the session stayed in
PlayAndRecord, ignoring the silent mode setting. Switch it while the
unit is stopped instead.

Also log the two setCategory failures separately, and the route's input.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 12:31:43 +02:00
Henrik RydgårdandClaude Opus 5.5 f993f3b9b2 iOS: Allow AirPlay while recording, log audio route changes
The playback categories we use route to AirPlay on their own (checked
with screen mirroring to an Apple TV, with every combination of the
silent mode and mix-with-others settings). PlayAndRecord, used while a
game records from the microphone, needs AllowAirPlay for that.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 12:25:42 +02:00
Henrik RydgårdandClaude Opus 5.5 2de8008ec8 iOS: Don't abort when exiting with the Exit button
EXIT_APP is handled on the render thread, and calling exit() there ran
the destructor of the still joinable render thread std::thread, which
calls std::terminate. Shut the view controller down on the main thread
first, which joins the render thread, then exit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 12:25:42 +02:00
Henrik RydgårdandClaude Opus 5.5 61ea2710bd iOS: Lift stuck touches when the scene resigns active
Pulling down Control Center starts a touch on our view that UIKit
doesn't always end or cancel. The tracker kept that slot down forever,
and touch input stopped working until the app was restarted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 12:25:42 +02:00
Henrik Rydgård 35180fb0bc Merge pull request #22726 from hrydgard/webserver-shutdown-no-hang
WebServer: Don't make shutdown wait for a stuck server registration
2026-10-22 12:22:45 +02:00
Henrik Rydgård bf3d9e7388 Merge pull request #22724 from hrydgard/vsh-kernel-fpl
HLE: Resolve the kernel sceKernelAllocateFpl
2026-10-22 12:09:10 +02:00
Henrik Rydgård bc785fa07c Merge pull request #22723 from hrydgard/ios-generic-controllers
iOS: Accept controllers without thumbsticks
2026-10-22 12:03:07 +02:00
Henrik RydgårdandClaude Opus 5.5 ab2328b53d Net: Stricter inet_pton, reject empty labels in direct DNS lookups
- inet_pton's IPv6 half is rewritten as a plain parser of the groups before
  and after "::". It no longer rejects a valid trailing "::" after seven
  groups or accepts nine groups around a "::", writes bytes in network order
  without assuming the host's, and only touches the output on success.
- The IPv4 half rejects empty octets ("1..2.3"), and an unsupported family
  returns -1 like the POSIX one, instead of success.
- An empty label ("a..b", ".example.com") ended the encoded name early, so
  the direct lookup asked for something else and cached it under the name
  that was asked for.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 11:51:17 +02:00
Henrik RydgårdandClaude Opus 5.5 66fb9f7ab4 Net: Harden the direct DNS lookup and inet_pton
- inet_pton could write outside its output for IPv6 strings with more than
  eight colons or two "::". Only reachable through AF_INET today, but it's a
  public function. Added a unit test.
- The direct DNS lookup took any datagram that arrived within its timeout as
  the answer, and cached it until restart. The socket is now connected, so the
  OS drops packets from anyone else, the query has a random ID, and replies
  with a different ID, without the response bit, truncated or with an error
  code are rejected.
- Packet fields are read and written with memcpy instead of through unaligned
  pointers, which can fault on 32-bit ARM.
- The lookup cache has a lock. Only the emu thread uses it so far.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 11:45:43 +02:00
Henrik Rydgård 55f10e5590 Merge pull request #22712 from hrydgard/mapped-volume-keys
Input: Let mapped volume keys reach the menus, and consume them in game
2026-10-22 11:37:47 +02:00
Henrik Rydgård 4932e0466d Merge pull request #22721 from hrydgard/settings-bugfixes
Assorted UI bugfixes
2026-10-22 11:31:42 +02:00
Henrik Rydgård b1611a3b47 Merge pull request #22719 from hrydgard/text-measure-cache
TextDrawer: Cache wrapped text, hash the string caches
2026-10-22 11:31:07 +02:00
Henrik RydgårdandClaude Opus 5.5 a1b4a93cac HLE: Resolve the kernel sceKernelAllocateFpl
It was left unresolved with the kernel mutex calls, as they all let the
flash drivers reach the NAND controller during a VSH boot. It's the
mutexes that do that: with only the FPL resolved, sceIdStorage_Service
allocates from its pool and every firmware's VSH in 1.50-6.61 boots to
the same XMB picture as without it. Resolving the mutexes still hangs on
0xbd101300.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 11:24:14 +02:00
Henrik RydgårdandClaude Opus 5.5 a79999e715 WebServer: Don't make shutdown wait for a stuck server registration
Registering with report.ppsspp.org starts with a DNS lookup that can't be
cancelled, and it ran on the server thread, so ShutdownWebServer() from
onDestroy waited for it on the main thread (an ANR on Play). It now runs on its
own thread, which the server leaves behind if it's still in the lookup.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 11:22:04 +02:00
Henrik RydgårdandClaude Opus 5.5 234917043f iOS: Accept controllers without thumbsticks
- Fixes #22365

Controllers with no sticks, like the 8BitDo FlipPad, don't get an extended
gamepad profile, so InitController ignored them. Fall back to looking up
the same buttons in the physical input profile by name, requiring at least
an A button and a D-pad, and log the element names it found.

Such a pad can have a micro gamepad profile, which InitSiriRemote would
have taken as a remote, so it now skips anything with a B button.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 11:14:30 +02:00
Henrik Rydgård 4b71f833d0 Merge pull request #22720 from hrydgard/ci-old-apple-clang
Fix the iOS/tvOS libretro build with Xcode 16.0, and make CI catch it
2026-10-22 11:00:16 +02:00
Henrik Rydgård 57dc5bf956 Fix the enabled state of some settings hints 2026-10-22 10:59:44 +02:00
Henrik RydgårdandClaude Opus 5.5 9e6fdb5be7 Settings: Make the two nickname fields behave the same
The Networking copy showed a warning for the default name but didn't fill
in an empty infrastructure username; the System one did the reverse, and
didn't refresh the views. Both now use one helper that does both.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 b530b477f7 DevTools: Don't touch a deleted view when the trace file is picked
The save dialog's callback set the path on a stored InfoItem pointer. If
the views were recreated while the dialog was open, that view was gone.
Recreate the views instead, which reads the path from the tracer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 37be6ce4e8 Config: Clamp the touch layout snap grid size on load
The layout editor divides by it, and drawing the grid never finishes when
it's 0. Only the slider limited it, so a hand-edited ini could hang.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 b5b37954b3 Achievements: Don't crash recreating a leaderboard screen after the game is unloaded
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 0eeaeef610 Pause: Don't offer Load State on a screenshot in hardcore mode
The slot list already hides it. From the screenshot view, the load was
refused, but the pause menu still closed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 a897b95b75 GameScreen: Know whether the game is homebrew before creating either pane
isHomebrew_ was set in CreateSettingsViews, but CreateContentViews uses it
too, and in portrait it's created first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 75b0fbe30c CustomButtonMapping: Keep unsaved button choices when the views are recreated
The checkbox array was reloaded from the config on every view creation,
but only saved when a popup closed or the screen finished. Rotating the
device reverted the choices. Also stop leaking a handler per button on
each rebuild.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:31 +02:00
Henrik RydgårdandClaude Opus 5.5 75ac7b6de8 DisplayLayout: Fix a few stale states
- The aspect ratio slider captured a copy of the layout config, so its
  enabled state never followed the Stretch and Integer scale checkboxes.
- Reset didn't refresh the views, which depend on the rotation.
- The shader list popup kept its old index mapping when recreated, so the
  current shader wasn't highlighted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00
Henrik RydgårdandClaude Opus 5.5 fbf101de36 Touch controls: Rotate with the current orientation's display layout
The D-pad and sticks always used the landscape layout's rotation settings,
while the screen and physical pads use the current orientation's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00
Henrik RydgårdandClaude Opus 5.5 20686814a3 ControlMapping: Fix Autoconfigure in portrait, and Escape on the analog limiter
- In portrait the settings pane is a popup, so it got the list's
  dialogFinished and the pad was never autoconfigured. Use a callback.
- Escape was meant to cancel mapping the analog speed limiter (3cb4207369),
  but since the combo mapping rewrite it got mapped to it instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00
Henrik RydgårdandClaude Opus 5.5 8fc75c0344 Settings: Write the alternative speeds back only when they're changed
The percentages were converted back to frame rates whenever any dialog
closed with OK. That overwrote the values Restore Defaults had just set,
and the integer rounding drifted unchanged values down (100 fps became 99
on any unrelated change). Restoring defaults also had the old reporting
choice written back on exit; it's now re-read too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00
Henrik RydgårdandClaude Opus 5.5 0c8c447284 Settings: Fix a blank page when reopening settings on the Search tab
The saved tab was selected before the Search tab was added, so the index
was out of range and no tab was created. Select it after adding Search, and
create the current tab anyway if the saved one no longer exists (Search is
hidden on small screens).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00
Henrik RydgårdandClaude Opus 5.5 f5059f9948 DevTools: Encode the notification positions like the other screens do
None is -1, but the developer tools list had it last at index 8, which is
CENTER. Building the tab clamped None to Bottom Left, and picking None
showed notifications centered instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:55:30 +02:00