* add setting for limiting frames ahead of GPU with INI support
* removing logging
* clang-format
* change default to true
* add setting to android side with UI
* ui for desktop
* license headers
* Adjusted setting title and description
Additionally fixes the Qt frontend having an incorrect description for this setting
* Disable setting by default due to performance regressions
---------
Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
* refactor android input settings completely to enable per-game settings and saving in config.ini, as well as more efficient storage of setting information
# Conflicts:
# src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/CitraSettings.kt
# src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/InputBindingSetting.kt
* add migration function
* merge turbo toggle/hold changes into input refactor
* remove extraneous log
* Migration fixes
* move all event handling to GamepadEventHandler
* minor issue fixes
* allow empty mappings for input bindings
* reset on ACTION_CANCEL
* license
* config: Add `sample_count` renderer option
Option is only enabled when the renderer is set to Vulkan, for now.
* vk_blit_helper: Add `d24s8_to_rgba8_ms_comp`
Helper host-shader for blitting multi-sampled DS24S8 textures to multi-sampled RGBA8
* vk_instance: Add detection of MSAA features
Full multi-sample support is when renderpass-2 and depth-stencil-resolve extensions are available and when sample-rate-shading and msaa-storage-images are supported.
* rasterizer_cache: Initial support for multi-sample surfaces
* renderer_vulkan: Implement multisample pipeline/renderpass support
Allows multi-sample render passes and graphics pipelines to be created, using sample-rate shading rather than coverage-based MSAA.
* renderer_vulkan: Implement multisample texture runtime
This seems to be enough for simple programs to render with MSAA enabled!
* renderer_vulkan: Fix multisample texture init barrier
Should address the MultiSampled image directly since the multisampled image is just a transient image and not the leading state of the image.
* renderer_vulkan: Fix `Framebuffer::sample_count` move-operator
`sample_count` needs to be move/copied over.
Also reorder the accessor order to match the declaration of variables.
* renderer_vulkan: Fix dangling surface reference during msaa resolve
These individual parameters need to be copied as the reference to the surface-object only lasts within the scope of this function.
* renderer_vulkan: Derive framebuffer sample-count from attachments
Derive the framebuffer sample-count from the input color and depth operands. Similar to how `res_scale` is determined.
* renderer_vulkan: Fix initialization of image handles
Try to optimally create the new image handles when a change in res scale or sample-count has actually occured. MSAA images need to be updated too in the case that the resolution scale has changed
* renderer_vulkan: Fix cleanup and debug-naming for `d24s8_to_rgba8_ms_comp`
* renderer_vulkan: Add `TextureRuntime::ResolveTexture`
Rather than use a big lambda, just rip this out into a proper function for other blit functions to utilize.
* renderer_vulkan: Fix narrowing byte conversion
Fixes a compilation error on Unix platforms.
* renderer_vulkan: Fix MSAA framebuffer target resolve surface
Use the specified type rather than defaulting to the surface's current one(implicit `ImageView` argument).
* renderer_vulkan: Fix `Surface::ScaleUp` scale/sample increase
This should be checking the _new_ value to possibly cull upscaled texture creation rather than the current value of the surface. Fixes broken up render passes when drawing UI in some games.
* renderer_vulkan: Fix `ConvertDS24S8ToRGBA8` image targets
Ensure that the Multi-Sample texture is used for the destination color image as well. Should the dest image be MSAA too? Or should all the values be resolved into a minimum depth and some combination of stencil-values here?
* renderer_vulkan: Fix multisample `ClearTextureWithRenderpass`
Ensure that the multisample framebuffer is used rather than the usual one when using a render pass to clear the textures.
That way, a MSAA-render AND resolve is used to clear the textures at the same time.
* renderer_vulkan: Fix multisample framebuffer creation
MSAA renderpasses require the "current" image as the main resolve target, and the MSAA image as the second attachment.
* renderer_vulkan: Fix MSAA image debug name
* renderer_vulkan: Fix Multisample `ConvertDS24S8ToRGBA8`
Migrate `ResolveTexture` to `BlitHelper`.
If the conversion was multi-sample, do a final resolve at the end of the conversion to ensure the non-multisample textures are updated as well.
Fixes Pokemon!
* config: Refactor `sample_count` to `antialiasing` setting
Intended to allow for other anti-aliasing methods to be introduced
* renderer_gl: Initial MSAA implementation
Basically copied over some of the paradigms over from Vulkan. Covers most rendering uses-cases except for conversions such as `ConvertDS24S8ToRGBA8` and `ConvertRGBA4ToRGB5A1`
* renderer_gl: Fix surface `ScaleUp` implementation
Should assign the new `res_scale` and `sample_count`
* renderer_gl: Implement multisample `Convert{DS24S8ToRGBA8,RGBA4ToRGB5A1}`
* renderer_gl: Resolve framebuffer after each draw
Brute force approach while trying to determine a better heuristic. Framebuffer changes are not enough to determine the end of a "render pass". An 'msaa dirty flag' is likely the better way here.
* renderer_gl: Implement `TextureRuntime::ClearTexture` MSAA clears
When ArbClearTexture is not available, ensure the fallback implementation also clears the MSAA texture as well.
* renderer_gl: Fix MakeHandle string-view hazard
`glObjectLabel` expects a null-terminated string, but an `std::string_view` is not necessarily null-terminated
* renderer_gl: Add layer/level specifier to MSAA resolves
* renderer_vulkan: Conditionally compile `DS24S8->RGBA8` multisample pipeline
This will crash on apple due to the lack of support for MSAA texture storage operations. This gets MacOS running generally now, but will likely require a refactor of some kind into a fragment shader and graphics pipeline rather than a compute shader for MacOS in particular.
* config: Stub support for up to `MSAAx16`
This is primarily to claim the enum value before other anti-aliasing methods get added. Eventually, support for the RHI device's sample-count will have to be detected and used opportunistically. Maybe "MSAA" is the anti-aliasing method and the actual sample-count comes from someplace else?
* config: Disable `MSAAx{8,16}` options by default
These are not guaranteed to be supported and should be disabled by default for now.
We still want the config options to be allocated. They should just not user-facing until these values can be conditionally enabled with fallbacks.
* renderer_vulkan: Remove unneeded sample-count info from `RasterizerVulkan::AccelerateDisplay`
We're always resolving into the best non-msaa image.
This isnt needed here. OpenGL doesn't need it either.
* core: Fix license headers
Also fix some clang-format formatting
* renderer_vulkan: Disable MSAA functionality from MacOS
The features required to support this at the moment are out of the scope of
this PR, thus MSAA is disabled for now and will be re-enabled in a later PR.
All MSAA anti-aliasing settings are removed when running on MacOS.
The main features holding this back are:
* Dynamically detecting the number of samples that the host GPU
supports(up to x4 is required, but x8 and x16 need to be detected when
initializing the backend)
* Blit-helper needs to have non-compute-shader variants of its MSAA
reinterpretation functions, but Metal(MoltenVK) does not support writing to
individual MSAA samples from a compute shader, and instead must be done from
a regular fragment-shader from within a render-pass.
* renderer_vulkan: Fix recycling of MSAA textures
Fixes an issue where reducing the sample count at run-time was causing
crashes due to previous MSAA textures, with a higher sample count, being
re-used. This also re-orders the criteria for recycling sentenced
textures to allow for better short-circuiting. The criteria for a
texture to be recycled must strictly be the "ScaleUp" case, and not the
case where the sample-count is being _reduced_. This recycling could be
a bit smarter to consider cases where a texture can have its
sample-count reduced but not its resolution scale. But that's an
optimization that is out of the scope of this PR, I feel.
* renderer_vulkan: Fix enabled extension array size
There are 16 total calls to `add_extension` that indicates that the `enabled_extensions` array should be 16 rather than 13.
* renderer_vulkan: Disable MSAA functionality from UI
This reverts commit 26939156c0.
MSAA requires some advanced configuration features that are not quite
ready yet. Currently, `shaderStorageImageMultisample` support needs to
be detected at config-time to allow MSAA to be used. Otherwise, the
reinterpret-passes need to have a non-compute alternative implemented.
Both are pretty larege features that should not increase the scale of
this PR for now.
To mitigate people from interfacing with this feature for
now, anti-aliasing options that involve MSAA will be disabled from the
UI and only operable from editing the ini configurations. This is to
allow for other anti-aliasing methods to be allowed in the team time.
* ptm: Add battery charge-level to ptm state
Update enum to be u8 rather than u32
* config: Add battery-level-source and battery-level configs
Allow either a fixed battery level or source the battery-level from the user's system.
* input_common: System battery-state implementation
Use the Input interface to derive the system's battery information. Enable the POWER backend for SDL.
* ptm: Implement configurable system/fixed battery state
Either uses a fixed definition, or a system-derived battery-level and charge-state
* input_common: Refactor battery-state interface
Use a singular function to get the total state of the battery rather than several functions.
* config: Add fixed battery charging state configuration
* input_common: Limit controller `SDL` engine usage with `HAVE_SDL2` preprocessor
Should fix some issues when compiling for libretro-windows.
* chore: Update modified file licenses to gplv3
* cmake: Fix `std::aligned_alloc` compilation error during libretro-android builds
libretro android builds are built using API level 21, which does not support aligned alloc(added in API level 28).
One way to mitigate this seems to be to utilize `BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC` specifically for libretro Android builds to disable usage of `std::aligned_alloc`.
* dsp: Drop the backlog of the FIFO if it grows too much
* audio: Add disable audio effects option and time stretching off by default
* sdl: Make controller event pumping faster
* qt: Render OpenGL on a different thread
* renderer: limit frames ahead of the GPU
* Fix license
Version detection is gated on .git/objects existing, which it does not in a
linked worktree, where .git is a file pointing at the common gitdir. Every
worktree build fell through to the self-packed-archive branch and was stamped
UNKNOWN, so the title bar read "azahar UNKNOWN" and the log reported
"UNKNOWN | UNKNOWN-UNKNOWN". Testing for .git itself covers both layouts; a
source tree with no .git at all still takes the archive branch.
That is enough for the branch name and the description, which shell out to git,
but not for the hash. get_git_head_revision() resolves HEAD by hand, and a
worktree keeps its own HEAD while the ref that HEAD names lives in the common
gitdir, which GetGitRevisionDescription.cmake does not follow. Fall back to git
rev-parse, which knows where to look. A normal checkout resolves the hash as
before and never reaches the fallback.
* Link FFmpeg into Azahar directly rather than using Common::DynamicLibrary
* Support FFmpeg 7.x and pin required version to specifically 7.x
* cmake: Make FFmpeg version error more helpful
* cmake: Don't error out if FFmpeg version is unknown, just warn
* ci: Get FFmpeg building and linking on macOS
* Get FFmpeg building and linking on Windows MSVC
* ci: Configure MSVC FFmpeg with a more useful set of options
* cmake: Also show ENABLE_FFMPEG suggestion if FFmpeg is simply missing
* Updated license headers
* ci: Move checkouts back to top of job steps
This was kind of just to make testing easier. The least reliable thing in this chain is GitHub itself, so having this near the top to fail fast if there's an issue is optimal.
* Removed unused function ShowFFmpegErrorMessage
This commit adds a new recognized environment variable `CITRA_USE_TAG_AS_VERSION` which, when defined, sets the Azahar version string to the output of:
git describe --tags --dirty
...which is either just the latest tag if there's an exact match, or, if there have been commits since the latest tag, the latest tag, the number of commits since that tag, and the current hash in this format:
<tag>-<num commits since>-<hash>
* Bugfix: All desktop hotkeys now work in dual-window mode.
The fullscreen hotkey now works differently. It always changes
the fullscreen setting, and attempts to fullscreen both windows
in dual-screen mode *if* they are on different screens. Othewise
it only fullscreens the main screen for consistency between layouts.
Geometry is always saved and restored from UISettings for more
consistency.
* return to single-window fullscreening behavior
* network: Replace NetSettings with Settings for web service configuration
* qt: Add network configuration options for username, API URL, and token
* qt: Rename tab from "Web" to "Network" in configuration dialog
* Update default configuration for network username and web api url
* qt: Rename configuration_web to "configuration_network"
* android: Add network configuration options for username, API URL, and token
* remove network_username setting and use the one from cfg
* Initial network room creation/joining support on Android
Co-Authored-By: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com>
Co-Authored-By: zhang wei <zwdreams@gmail.com>
* Make multiplayer.cpp a class and init on `MainActivity`
* Add public lobby browsing and joining support
* NetPlayManager.kt: Fix multiple networking deprecations
* Use ip_address instead of a blank string for room creation (again)
* Add the ability to select preferred game from room creation
* Fix format and licensing
* Do not use username setting
* Fix bugs related to public room browsing
---------
Co-authored-by: Kleidis <167202775+kleidis@users.noreply.github.com>
Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
Co-authored-by: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com>
Co-authored-by: zhang wei <zwdreams@gmail.com>
Co-authored-by: Reg Tiangha <rtiangha@users.noreply.github.com>
* update_checker.cpp: Tiny correctness adjustment
* android: Initial UpdateChecker object implementation
No actual frontend functionality yet
* android: Very initial implementation of frontend update checker notifications
* android: Fix UpdateChecker returnning incorrectly formatted tag when using stable channel
* android: Add downgrade mitigation to update checker, mirroring Qt
* Display new version number in Android update check notification
* android: Fix update checker notification not having a cancel button
* android: Add user-configurable options to control update checker behaviour
* android: Auto-disable update checker for debug builds
* Don't show update checker settings when using Google Play build
Not like they would do anything anyway, but they shouldn't be visible
* android: Improve hardiness of tag decoding in update checker
* controller hotkey support and SDL refactor to use GameController API,
which adds more user-readable names to controller input maps
* Add "Press A (right) button" command to input automap that will map in nintendo layout if the user has a nintendo layout / prefers to match letters rather than position.
* honor shortcut context with controller hotkeys
* fix profiles not saving correctly
* analog_from_keyboard display fix, build error fix
* attempt to fix event_queue bugs
* Do not signal savestate if system is powered off
---------
Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
* Base starting commit for Feature Impl
* Base commit 2 (off of closed PR, impl details of the actual button will likely be different.)
* Added Combo Button Bool setting to use for later implementation.
* Added Combo Button Submenu and associated strings. Need to implement button displaying for user to interact with.
* Added layout file for combo settings for potential impl
* Removed combo settings as it wasn't liked. Starting Multi Choice impl
* Added Multi Choice Impl. Need to Refactor OnClick for MultiChoice and debug Impl when adding combo button.
* Change List<> in Multi Files to be MutableSet<> to allow adds while prevent potential duplicates. Finished primary multi choice backend impl.
* used correct lisencing procedure for multi files
* Added code in arrays.xml to display the buttons.
This code has the buttons display but clicking on them crashes the app. Will debug further.
Also replaced setSelectedValues with add and remove SelectedValue for clarity purposes.
* Deleted Int Combo Value array in arrays.xml as it was not needed. Able to Click multiple buttons at once but unchecking them causes app to crash. (within the MultiChoice OnClick for SettingsAdapter.kt)
Also debating whether to remove the normal MultiChoice addition as it wasn't added.
* Attempt to deal with merge conflicts
* Moved OnSettingChange after I add or remove selected vals to fix crashing issue.
* Displayed combo button in both landscape and portrait
* WIP on Button Impl, made combo button setting run time editable
* Changed the combo_key string into button_combo, added functionality (impl could be better), added combo key as an input bindable setting within the buttons tab
* Moved Combo Settings into just controls instead of having its own submenu
* Made ComboHelper code more readable and added the key setting to be toggleable in game
* Edited Layout integers of combo button. Made Combo Button display properly in normal portrait mode.
* Code Cleanup and Start of Reimplementation based off #1430
* Progress commit for better impl, need to have the pop up menu show up to select buttons
* Code cleanup and bug fix to properly map values.
* Deleted Multi String Setting, added basic error handling, added comment explaining hardcoded size
* Changed Combo Button to be a HotKey, changed impl to be default multi choice, and removed StringMultiChoice details
* Remove Commented Code
* Changed ComboHelper.kt to use Native Button ints, removed rest of initial implementation traces
* Commented out debug logging, added back missing TODO statement regarding magic numbers
* Cleanup
* Changed Combo Key to Combo Button in kotlin code (will need to test)
* Trying to integrate combo button as a SettingsKey setting. Running into issues with malformed/missing key
* latest changes (added setting to default ini). Still debugging file issue
* added possible fix to touchscreen latency issue, will need to test
* Reverted MultiChoice code to original, removed unused strings and variables and ensured consistent naming, fixed latency issues with button,
* reverted int list setting change as its no longer needed.
* `combo_buttons` --> `combo_button_buttons`
* default_ini.h: Adjust ini comment for combo_button_buttons
* Fix "Reset Overlay" not affecting combo button
* Better center default position of combo button in portrait layout
* `combo_button_options` --> `combo_button_settings`
Better reflects string content
* Last-minute minor string nitpicks
---------
Co-authored-by: OpenSauce <opensauce04@gmail.com>
* macos: fix Vulkan/Metal renderer on macOS 26+ and bump MoltenVK
Four related changes that together let the Vulkan backend boot a game
on Apple Silicon Macs running macOS 26.x. Each is needed independently;
the combination was tested on a Mac16,6 (M4 Max) / macOS 26.4.1.
CMakeModules/DownloadExternals.cmake:
Bump bundled MoltenVK from v1.2.9 to v1.4.1. v1.2.9 does not
recognize macOS 26 surface objects and traps with an Objective-C
"unrecognized selector" inside vkGetPhysicalDeviceSurfaceCapabilitiesKHR.
src/video_core/renderer_vulkan/vk_instance.cpp:
Disable VK_EXT_tooling_info on MoltenVK. MoltenVK advertises the
extension but does not expose vkGetPhysicalDeviceToolPropertiesEXT
through its dispatcher, so the call inside CollectToolingInfo()
trips a vulkan-hpp assertion in Debug and dereferences NULL in
Release.
src/citra_qt/bootmanager.cpp:
Force-install a fresh CAMetalLayer on the NSView before handing it
to createMetalSurfaceEXT. Qt 6.11's QWindow::MetalSurface does not
always back the view with a CAMetalLayer on macOS 26, and MoltenVK
1.3+ aborts in MVKSurface::getNaturalExtent() if the layer is not
the right class. Implemented via objc_msgSend so no .mm conversion
is needed.
src/citra_meta/CMakeLists.txt:
Gate LaunchScreen.storyboard behind 'if (IOS)'. The storyboard is
iOS-only and previously broke the Xcode generator on macOS with
"iOS storyboards do not support target device type 'mac'."
* Move Metal layer creation logic into MetalUtil::CreateMetalLayer ObjC++ function
This change makes the code much more readable, as the logic is now in its native language
---------
Co-authored-by: SergeyMild <>
Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
* Add a new Secondary Display Layout option on android that makes the secondary display honor swap button
* add quick menu option for secondary layout
* fix icon
* added other secondary layouts
* Add a new Secondary Display Layout option on android that makes the secondary display honor swap button
# Conflicts:
# src/core/frontend/framebuffer_layout.cpp
* add quick menu option for secondary layout
* fix icon
* added other secondary layouts
* updated secondary menu with functionality to switch external displays
Conflicts:
src/android/app/src/main/java/org/citra/citra_emu/display/SecondaryDisplay.kt
* safety checks for crash prevention
* make secondary menu only appear if a secondary display is available
* update default displayid behavior to exclude "Built"
* update odin 2 bugfix to handle other languages
* Apply clang-format
* Rename "Opposite of Primary Display" option for brevity
* Rename menu_secondary_layout_reverse_primary for consistency
* Rename SecondaryDisplayLayout::ReversePrimary for consistency
* first round of code fixes based on review
* Added android-side enable_secondary_display boolean setting, replacing secondary_display_layout = none on the android side. Exposed it in Layout settings, and secondary display layout is now only selectable if it is enabled. Support for the old option is still in the code, but should no longer be selectable.
Also renamed opposite to reverse_primary in a few other places.
* Update framebuffer layout and renderers to correctly render hybrid mode on both primary and secondary displays
* Apply clang format
* Re-apply terminology changes which were undone by a recent commit
* Removed unused string emulation_secondary_display_default
---------
Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
* [cmake] Fix MoltenVK fetch order/library conflicts
Rather than dealing with `find_library` shenanigans, just set the
library path directly (when using bundled MoltenVK). System MoltenVK
solely uses `find_library`.
Avoids cache nonsense that can cause system/bundled versions to get
mixed up, and overall makes the system/bundled mvk handling a lot more
consistent
```
cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON
-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.
cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=OFF
-- Using MoltenVK at /Users/crueter/code/azahar/build/externals/MoltenVK/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib.
cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON
-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.
```
Signed-off-by: crueter <crueter@eden-emu.dev>
* remove old comment
Signed-off-by: crueter <crueter@eden-emu.dev>
* Cleanup
---------
Signed-off-by: crueter <crueter@eden-emu.dev>
Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
Touch pointer rendering is now always enabled, but unless a controller is being used to move the touchscreen cursor, it will be hidden due to the timeout which is also enabled by default.
- Allow GIT-COMMIT and GIT-TAG files to override real git info (useful for testing version-related functionality such as update checks)
- Always re-configure scm_rev.cpp when configuring with CMake (fixes an issue where the version number would just not update in incremental builds)
* Convert all setting keys in settings.h into hana strings
* Derive libretro setting keys from common/settings.h hana strings
* settings.h: Reduce code repetition in key definitions via macro
* Implemented mechanism to pass our C++ setting keys to Android/Kotlin
None of the Android keys have been moved over as of this commit, this is just prep work
* jni_settings_keys.cpp.in: Removed redundant code
* Migrate (almost) all Android setting string keys over to SettingKeys
Also some slight cleanup
* Updated license headers
* Fixed top custom width erroneously being used in place of top custom height
* Migrate (probably) all setting string keys to Settings::QKeys
* Migrated several previously missed string keys to generated keys
* SettingKeys.kt: Visually seperate shared and Android-exclusive keys, similar to GenerateSettingKeys.cmake
* android: sdl2_config --> android_config
Not sure why these values are named this way. Hold-over from SDL2 frontend?
* android: Generate and validate default config.ini dynamically
* Settings: Assume C-style string keys by default
Relative to the previous commit, the following names have changed:
- Settings::Keys --> Settings::HKeys
- Settings::CKeys --> Settings::Keys
* default_ini.h: Fixed formatting warning
* Comment cleanup
* android: Fixed compilation failure due to incorrect namespace
* config.cpp: Use ASSERT_MSG instead of LOG_ERROR and ASSERT(false)