Commit Graph

1688 Commits

Author SHA1 Message Date
24b0bf01d5 Merge pull request #12836 from JosJuice/opensles-buffer-size
Android: Ask system for optimal audio buffer size and sample rate
2025-06-07 23:07:37 -04:00
5d2518d490 Android: Add android.hardware.microphone to manifest
Google Play is now blocking distribution for Android TV unless we
explicitly set the android.hardware.microphone hardware feature as
android:required="false", because it's inferring
android.hardware.microphone from the android.permission.RECORD_AUDIO we
added for Wii Speak emulation, with android:required defaulting to true.
I was under the belief that setting android:required="false" on
android.permission.RECORD_AUDIO would solve this, but looking closer at
the definition of <uses-permission>, it doesn't actually support
android:required attributes, so that presumably has no effect.
2025-06-04 21:30:51 +02:00
f99d3dbd5c Android: Ask system for optimal audio buffer size and sample rate
This can reduce audio latency according to
https://developer.android.com/ndk/guides/audio/opensl/opensl-prog-notes#perform.

Previously we were using the hardcoded values of 48000 Hz and 256 frames
per buffer. The sample rate we use with this change is 48000 Hz on all
devices I'm aware of, but the buffer size does vary across devices.

Terminology note: The old code used the term "sample" to refer to what
Android refers to as a "frame". "Frame" is a clearer term to use for
this, so I've changed OpenSLESStream's terminology. One frame consists
of one sample per channel.
2025-05-25 11:59:33 +02:00
a62449711f Merge pull request #12769 from sepalani/wii-speak
IOS/USB: Emulate Wii Speak using cubeb
2025-05-21 13:54:56 -04:00
f1ffcf2b00 Merge pull request #13654 from JosJuice/android-clear-without-dismiss
Android: Don't dismiss AdvancedMappingDialog when pressing Clear
2025-05-16 14:33:49 -04:00
eeae30e2bb Android: Don't dismiss AdvancedMappingDialog when pressing Clear
If you already have a mapping set in the advanced mapping dialog and
want to change it, the easiest way to do it is to press Clear and then
select the new mapping from the list. But pressing Clear causes the
dialog to close, forcing you to open it again, which is inconvenient.
This commit makes it so the Clear button doesn't close the dialog.
2025-05-12 21:40:55 +02:00
cf3702cbc8 Merge pull request #13046 from SuperSamus/vi-overclock
Add VBI Frequency Override
2025-05-12 13:36:55 -04:00
832570c658 Core: Add VBI Frequency Override
This feature allows overriding the frequency of the Vertical Blank Interrupt. For many games, this means that their gameplay speed will change without affecting audio, which would be useful by itself (e.g. grinding in RPGs).

However, there are games that use delta time for their game logic, which allows them to be played at >60 FPS at the same gameplay speed!

Some games aren't dynamic though, and require a patch to adjust their game speed variable.
2025-05-12 18:54:36 +02:00
5af5c83428 Merge pull request #13559 from tygyh/Android-Apply-style-alignment-refactorings
Android: Apply style alignment refactorings
2025-05-07 22:37:09 +02:00
61ab0faab8 Config: Rename MAIN_WII_SPEAK_CONNECTED to MAIN_WII_SPEAK_MUTED 2025-05-07 20:33:22 +04:00
dbc09bfb0d Android: Add emulated Wii Speak 2025-05-07 20:33:22 +04:00
6129953666 Android: Remove unused onSettingsFileNotFound and friends
Old cruft from when the Android code was loading INI files manually.
We don't have any handling for failing to load settings anymore.

This change also updates related comments to reflect how things actually
work nowadays.
2025-05-02 14:25:01 +02:00
fcb4b04168 Merge pull request #13613 from JosJuice/android-ldrtl-list-item-mapping-id
Android: Fix incorrect ID in layout-ldrtl/list_item_mapping.xml
2025-05-01 21:33:09 -04:00
1963305bea Merge pull request #13605 from JosJuice/android-cinit-native
Android: Don't call NativeLibrary methods during class init
2025-05-01 21:31:21 -04:00
d64c20a67c Android: Fix incorrect ID in layout-ldrtl/list_item_mapping.xml
Probably a copy-paste error from layout-ldrtl/list_item_setting.xml.
This error made it so a long setting name could overlap with the
checkbox next to it if Dolphin was running with right-to-left layout.

The incorrect ID was apparently also causing the app:lintVitalRelease
build task to fail. I guess we're not running that build task, because I
only heard of this from someone building Dolphin locally.
2025-05-01 11:57:07 +02:00
7fa92160a2 Android: Don't call NativeLibrary methods during class init
There's no guarantee that directory initialization has completed by this
point, so we can't safely use NativeLibrary.

I'm making this change because of a crash being reported in Google Play
Console. The exact way it's crashing is mysterious to me, so I'm not
sure if this commit fixes the crash, but I think this commit is
a reasonable change to make even if it doesn't fix the crash. Backtrace
from Google Play Console:

  #00  pc 0x0000000000469074  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>::pair[abi:nn180000]<char const* const&, char const* const&, 0>(char const* const&, char const* const&)) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #01  pc 0x0000000000468e9c  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (std::__ndk1::pair<std::__ndk1::__tree_iterator<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::__tree_node<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, void*>*, long>, bool> std::__ndk1::__tree<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::__map_value_compare<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>>>::__emplace_unique_impl<char const* const&, char const* const&>(char const* const&, char const* const&)) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #02  pc 0x0000000000462f08  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (Common::Log::LogManager::GetLogTypes()) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #03  pc 0x000000000044339c  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (Java_org_dolphinemu_dolphinemu_NativeLibrary_GetLogTypeNames+56) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #04  pc 0x000000000031456c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+108)
  #05  pc 0x0000000000781508  /apex/com.android.art/lib64/libart.so (nterp_helper+152)
  #06  pc 0x00000000002d94d4  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/base.apk (org.dolphinemu.dolphinemu.features.settings.ui.SettingsFragmentPresenter.<clinit>+16)
[...]
2025-04-28 21:37:03 +02:00
3ed3fb05af Android: Allow reporting start to analytics for non-main activity
a1691a4 made it so analytics start events can only be generated when
starting the main activity. However, some users launch Dolphin's
emulation activity from a separate frontend application, bypassing
Dolphin's main activity. This change adjusts the logic so that start
events can be generated if any activity is started after 6 hours of
inactivity. This more closely matches the behavior we had before
a1691a4, while still ensuring duplicate start events aren't generated.

I've also fixed the inconsistent indentation in ActivityTracker.kt.
2025-04-26 10:45:56 +02:00
a95779add0 Merge pull request #13506 from JosJuice/android-time-played
Android: Show time played in game details
2025-04-25 01:43:53 +01:00
25fdde4204 Android: Update platform enum values
71f654c added a new platform in the middle of the C++ platform enum
without updating the corresponding Android code, making the Android code
incorrectly treat Wii discs as WAD files, WAD files as DOL/ELF files,
and so on. This commit fixes the problem.

To be able to add the new Triforce entry into the Platform enum without
it leading to the UI getting an additional tab, I'm splitting the enum
into Platform and PlatformTab. Platform now exactly matches the C++
enum (previously it excluded ELFOrDOL), and PlatformTab has the same
content as the old Platform.
2025-04-22 20:07:15 +02:00
71249dec33 Android: Apply style alignment refactorings 2025-04-22 13:34:21 +02:00
494e2c05c2 Adding support for detecting .bin images 2025-04-21 22:05:24 +10:00
a1691a4031 Prevent android generating duplicate analytics events
dolphin-start event was being generated twice for the normal
end-user case, as can be seen in analytics data for some years.
The problem occured when:
* Android reaped the process hosting the dolphin activity
  (e.g. for power/memory saving).
and
* Dolphin activity was in "stopped" state for > 6 hours before
  being switched back to.

Under above conditions, both calls to ReportStartToAnalytics
would be performed, as dolphin thought it was being launched anew,
and also thought it had been asleep for > 6 hours.

fixes https://bugs.dolphin-emu.org/issues/13675
2025-04-19 22:16:01 -07:00
b8e70df413 Android: Show time played in game details
Unlike in DolphinQt, there isn't much space to show playtimes directly in
the game list, so I've put it in the game details dialog instead.
2025-04-19 14:34:49 +02:00
3eee52cb6b Android: Create toggle for enabling/disabling time tracking 2025-04-19 14:29:49 +02:00
877864c23a Improve Performance of Granular Buffering + User Adjustable Buffer Size 2025-04-01 18:17:21 -04:00
9e9faf3be1 Android: Show message when trying to map disconnected device
Having the MotionAlertDialog immediately close is confusing for users.
Let's show a message to tell them what went wrong.
2025-03-23 21:39:08 +01:00
516c1314d2 Android: Don't use separate thread for MotionAlertDialog
This is an Android continuation of bc95c00. We now call
InputDetector::Update immediately after receiving an input event from
Android instead of periodically calling it in a sleep loop. This
improves detection of very short inputs, which are especially likely to
occur for volume buttons on phones (or at least on my phone) if you
don't intentionally keep them held down.
2025-03-23 21:39:04 +01:00
ddb82a5e8c InputCommon/ControllerEmu: Break out functionality of EmulatedController
to eliminate redundant unused members in Wii Remote extension objects.
2025-03-15 14:30:43 -05:00
e637a05707 Merge pull request #12866 from JosJuice/android-log-types-sorting
Android: Replace log type names map with array
2025-03-15 16:01:33 +01:00
f09ba10daa AudioCommon: Added Granular Synthesis 2025-03-14 01:22:35 -05:00
01099d67cb Merge pull request #13326 from nlebeck/taskviewmodel-mustrestartapp
Eliminate TaskViewModel's `mustRestartApp` field
2025-02-20 21:58:18 -06:00
adc5b81c31 DolphinQt: Rename the pack/unpack SD Card buttons. 2025-02-12 13:30:48 -06:00
56fd1f39d8 Eliminate TaskViewModel's mustRestartApp field
Instead of having UserDataImportWarningDialog set an
`onResultDismiss` callback that examines `mustRestartApp`, and having
UserDataActivity set `mustRestartApp`, just have UserDataActivity set
the callback directly.

This approach is no more data-race-y than the previous approach, and it
simplifies the code. (The behavior of restarting the app when the task
finishes is specific to the user data import flow, and there is no
reason for TaskViewModel to be directly aware of it.)
2025-02-02 12:24:51 -08:00
f28e134c88 Clean up CRLF line endings 2025-01-12 11:06:04 +01:00
75abda6a3a Merge pull request #12864 from JosJuice/android-window-compat
Android: Replace deprecated setSystemUiVisibility
2025-01-10 04:45:11 +01:00
764bf314e1 Android: Fix VSync option not working
It happened due to a typo from SECTION_GFX_HARDWARE
2024-12-24 10:41:45 +01:00
7b8610f4ea VideoBackendBase: Clarify function name
Rename GetDefaultBackendName to GetDefaultBackendConfigName to
distinguish it from the display name.
2024-11-03 12:26:57 -08:00
bab34ca060 Merge pull request #13140 from dreamsyntax/skip-efb-default-flip
GraphicsSettings: EFBAccessEnable=false by default
2024-10-28 18:58:37 -04:00
9dacefcbf1 GraphicsSettings: EFBAccessEnable=false by default
Makes Graphics -> Hacks -> Skip EFB Access from CPU enabled by default. Some GPU drivers stall when EFB access occurs in games where EFB is not used. Most games that require this setting set to 'true' already have this defined in their game inis.
2024-10-22 12:28:14 -07:00
ff9be97ea1 JitCache: Add WipeBlockProfilingData Function
Accessible from DolphinQt and Android.
2024-10-18 23:50:26 -07:00
564e640acf Android: Add vsync setting
Recently we have been getting some requests to make the existing vsync
setting available in the Android GUI:

https://bugs.dolphin-emu.org/issues/13650
https://forums.dolphin-emu.org/Thread-vsync-toggle-for-android

I don't quite understand why enabling the vsync setting is helpful when
Android already enforces vsync, but I guess having the option available
doesn't hurt. I'm putting the setting under Advanced, unlike in
DolphinQt, since there's no clear reason why the typical user would want
to use this setting.
2024-10-14 12:20:15 +02:00
8d5b6e8e86 Merge pull request #13069 from JosJuice/android-real-balance-board
Android: Add the "Real Balance Board" setting
2024-10-13 15:17:26 -04:00
35ec2e97a8 Merge pull request #13079 from JosJuice/android-16k
Android: Add 16 KiB page size support
2024-10-12 10:11:33 +01:00
c5ce90b786 Merge pull request #13080 from JosJuice/androidx-edge-to-edge
Android: Use enableEdgeToEdge
2024-10-12 10:11:11 +01:00
6ca2da53e8 Partially revert "Revert "Audit uses of IsRunning and GetState""
This reverts the revert commit bc67fc97c3,
except for the changes in BaseConfigLoader.cpp, which caused the bug
that made us revert 72cf2bdb87. PR 12917
contains an improved change to BaseConfigLoader.cpp, which can be merged
(or rejected) independently.

A few changes have also been made based on review comments.
2024-10-04 18:35:41 +02:00
d0e6573ac7 Android: Use enableEdgeToEdge
Dolphin has been using edge-to-edge rendering for a little while now,
but it has required a bit of manual work. Now that edge-to-edge is
becoming something expected of apps in Android 15, there's a nicer API
we can use.

Tested on Android 8, 11 and 13, with no changes in behavior noted.
2024-09-28 18:20:31 +02:00
14a802b58b Android: Add 16 KiB page size support
So far, Dolphin hasn't been able to run on Android devices that use a
16 KiB page size. 16 KiB page sizes are a very new Android feature that
no phones have shipped with so far, so we're still compatible with the
phones that exist out there, but let's get this fixed before phones
start shipping with 16 KiB page sizes.

Because I couldn't get Android Studio's emulator to work, I haven't been
able to confirm that this change actually makes Dolphin fully compatible
with devices that use a 16 KiB page size. But I have confirmed that this
doesn't break anything on a regular 4 KiB page size device.
2024-09-28 13:43:49 +02:00
0c1070a07b Android: Add the "Real Balance Board" setting 2024-09-22 21:51:12 +02:00
10f06a48ef Merge pull request #12863 from JosJuice/android-gamepad-sensors
Android: Fix and enable input device sensor input
2024-08-18 13:48:30 +01:00
0c18393691 Merge pull request #12965 from JosJuice/android-ndk-27
Android: Update to NDK 27.0.12077973
2024-07-30 13:09:53 -04:00