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>
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>
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>
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>
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>
- 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
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
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>
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>
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>
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>
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>
- 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>
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>
- 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>
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>
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>
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>
- Cancel on the "missing file browser" popup opened the help page anyway,
and More info closed the memstick screen as if a folder had been picked,
because any child dialog finishing with DR_OK did that.
- When switching to the new folder failed, the error was set but never
shown. After a move, the screen was left with no buttons.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Importing showed "File not found" when the file existed and the import
failed, and the other message when it was missing.
- The game ID check returned without closing the cheat file.
- Closing the download popup with Back started a download of an empty URL.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Both worked out the ID themselves with a copy of the homebrew rule that
lacks the PS1 exception added to GameInfoCache in 7ced173c17. For a PS1
EBOOT in PSP/GAME, Game Settings then edited the global config even though
Create Game Config had made a per-game one under the real ID.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
CreateSettingsViews and CreateContentViews both cleared all the view
pointers, and which runs first depends on orientation. In landscape, Install
and Play were never disabled during an install; in portrait, the done and
error notices never showed. Reset them once in BeforeCreateViews instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The static string was only initialized on the first call, so the text
editor (used where there's no native input dialog) showed whatever was
typed the first time, even after picking another server from the list.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The static analysis cleanup in d6ebfed432 dropped the negation, so the CPU
name was only shown when it was "Unknown".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The format was set on the wrong slider (alternative speed 2, which already
had it).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Building a settings tab should only create views, so that the tabs can
later be described as data and searched without being shown.
- Don't reset the MSAA level when the device has none. The GPU already
falls back to no MSAA (UpdateMSAALevel), and the reset overwrote the
setting, including per-game ones.
- Read the reporting state in the constructor. It was only read when the
System tab was built, but always written back on exit, so leaving
settings without opening System turned reporting off.
- Move the Windows memstick location probe (which writes a temp file next
to the exe) out of the System tab, and keep the checkboxes' enabled
state in members instead of poking at the views.
- Show the Android/UWP memstick path through a callback instead of a
copy made at build time, and drop a USB path computation whose result
was never used.
- Make the reliable-UDP checkbox follow the UDP setting directly instead
of recreating all views when it changes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The volume key filter in NativeKey left unmapped volume keys to the OS, so
they never reached the dialog and couldn't be mapped. A new InputMode::AllKeys
lets a screen ask for them; the dialog consumes them so the volume doesn't
change while mapping.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A recent input refactor made NativeKey return false for volume keys before
queueing them, so mapping them to L/R (handy on a phone without a controller)
stopped working in the menus, and in game the OS changed the volume as well.
In the menus they still change the volume too. Unmapped volume keys go to the
OS only, as before.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
--mount ISO used to be headless-only, and EmuScreen always cleared
CoreParameter::mountIso. Pass it from the command line into the first
EmuScreen, which keeps it across resets and drops it when another game
is booted.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
While the XMB is running, the pause screen offers "Insert UMD" with the
drive empty, opening the Switch UMD game picker, and "Eject UMD" with a disc
in. The XMB notices the change through its drive callback, as it does over
the debugger's game.umd.insert/eject. Games keep "Switch UMD".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The game browser left out EBOOTs with the PS1 category, which couldn't
run. Now they're listed where the Media Engine can be emulated
(Memory::CanCreateMESpace). And as a PS1 game's PARAM.SFO has no
DISC_TOTAL, the browser took it for homebrew and gave it a made-up ID
(SCUS00580 for Crash Bandicoot's SCUS94900): its own is kept now.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
SYSPROP_HAS_ACCELEROMETER was true for every phone and tablet, whether or
not it had the sensor. The activity now tells the native side what the
sensor manager found, which also answers the new SYSPROP_HAS_GYRO. VR
headsets still report neither. Every other platform returns false for the
gyro for now.
The "Use gyroscope" checkbox uses the new property instead of waiting for
gyro data to show up.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Appended to the end of the tilt types, so stored values keep their meaning.
It shares the left stick's deadzone settings and preview, and like other
right-stick input it goes to CTRL_STICK_RIGHT.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Tilt used the raw accelerometer as the gravity vector, which jitters with
sensor noise and jumps when the device is shaken. Now, when gyro data is
coming in, a complementary filter integrates the gyro rates and only pulls
the result toward the accelerometer with a 0.5 s time constant, trusting
the accelerometer less the further it reads from 1g. The fused vector goes
through the same ProcessTilt path, so calibration and sensitivity work as
before. Without a gyro, nothing changes.
The fusion lives in TiltEventProcessor behind NativeGyroscope(), so other
sources (DualSense) can feed it too. Android registers TYPE_GYROSCOPE next
to the accelerometer. A "Use gyroscope" checkbox (on by default, per game)
appears in tilt setup once gyro data has been seen.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The restart shut the GPU down after PrepareCopyDisplayToOutput had bound its
pipelines in the open backbuffer pass, which trips the pipelinesToCheck_
assert in VulkanRenderManager::CheckNothingPending. The failed load already
stops the frame from running, so nothing is lost by restarting first.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
MeCore owns a second MIPSState in the ME's address space, held in reset
until released (SetReset). It runs on the interpreter, a slice behind the
main CPU: CoreTiming runs it for the cycles the main CPU has just used, in
Advance and ForceCheck. Its own PRId (COP0 22) and mfic/mtic flag; MMIO
counts as kernel mode on it, and a syscall stops it with an error rather
than reaching HLE. The interpreter's block stepping reads delay slots
through the stepping CPU's memory, and cache instructions log at verbose
level, as ME code flushes its caches in a loop.
Created at boot only for homebrew (PBP with MG category or no SFO, ELF;
the VSH counts, as vshmain.prx loads as an ELF), when "Enable ME
emulation for homebrew" is on: a global checkbox in developer settings,
off by default and not translated yet, or --me-core. Saved in its own
section after MMIO (SaveStart v5), with its own memory; loading a state
creates or removes the ME to match.
The boot page now starts with a reset stub that sends the ME on to
0xBFC00040, where homebrew puts its code (from the firmware's reset code,
read on a PSP-1000).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>