Commit Graph

33583 Commits

Author SHA1 Message Date
JosJuice 804b94ee9e
Merge pull request #11524 from K0bin/document-provider
Android: Implement DocumentProvider
2023-03-11 19:24:19 +01:00
JosJuice 08334015f9 Android: Remove SettingsActivityView parameters from Settings
No longer used for anything.
2023-03-11 18:49:43 +01:00
JosJuice 99600ef781 Android: Rework the "global" settings functions
getXGlobal() is now identical to getX(), and setXGlobal(int, X) is now
identical to setX(int, X) in the cases where setX(int, X) exists.
We can remove/rename them.
2023-03-11 18:49:43 +01:00
JosJuice 58fc347f8d Android: Don't require Settings object for reading a setting
Made unnecessary by the previous commit.
2023-03-11 18:49:43 +01:00
JosJuice 68fd133057 Android: Remove support for the old config system
All settings that we care about from an Android perspective are now
supported by the new config system, so we can remove all the Android code
for the old config system. This should have no impact on users.
2023-03-11 17:51:59 +01:00
JosJuice 53e7090f55 Migrate game INI profile setting to new config system 2023-03-11 17:51:58 +01:00
Admiral H. Curtiss 069280ddc6
HW/VideoInterface: Refactor to class. 2023-03-11 12:50:35 +01:00
Admiral H. Curtiss 2102e64299
HW/VideoInterface: Savestate members individually. 2023-03-11 12:48:02 +01:00
JosJuice 62ff2f1030
Merge pull request #11385 from JosJuice/android-input-overhaul
Android input overhaul
2023-03-11 12:37:44 +01:00
Admiral H. Curtiss 84542d915d
HW/MemoryInterface: Refactor to class. 2023-03-11 00:57:16 +01:00
Admiral H. Curtiss bf95d4012f
HW/EXI: Refactor ExpansionInterface to class. 2023-03-11 00:56:37 +01:00
Mai e4df388128
Merge pull request #11638 from JosJuice/tas-input-motionplus
DolphinQt: Add MotionPlus support to TAS input
2023-03-10 16:54:35 -05:00
Admiral H. Curtiss d31733ce64
HW/DVD: Rename DVDThreadManager to DVDThread. 2023-03-10 20:22:29 +01:00
Admiral H. Curtiss 25e883280a
HW/DVD: Merge DVDThread namespace into DVD. 2023-03-10 20:20:19 +01:00
JosJuice 4d34f86121 DolphinQt: Add MotionPlus support to TAS input
Will manually controlling both an accelerometer and a gyroscope at the
same time be reasonable to do? No idea. Was this easy to implement
thanks to the input override system? Yes.

Fixes https://bugs.dolphin-emu.org/issues/12443.
2023-03-10 19:36:17 +01:00
Admiral H. Curtiss d26a540253
HW/DVD: Rename DVDInterfaceManager to DVDInterface. 2023-03-10 18:37:46 +01:00
Admiral H. Curtiss ee35103ed9
HW/DVD: Rename DVDInterface namespace to DVD. 2023-03-10 18:37:18 +01:00
Admiral H. Curtiss dca8e9dc1e
HW/DVDThread: Refactor to class. 2023-03-10 18:12:59 +01:00
Admiral H. Curtiss eb25c46a91
HW/DVDInterface: Refactor to class. 2023-03-10 18:12:59 +01:00
Admiral H. Curtiss 929222ffbd
HW/DSP: Refactor to class. 2023-03-09 22:35:29 +01:00
Mai 40ff9b25b7
Merge pull request #11633 from AdmiralCurtiss/ai-class
HW/AudioInterface: Refactor to class.
2023-03-09 11:59:47 -05:00
Admiral H. Curtiss 1023e5dd4f
Merge pull request #11441 from JosJuice/jit64-lea-fixup
Jit64: Fix the offsetAddedToAddress correction
2023-03-09 16:13:25 +01:00
Admiral H. Curtiss 9ed388fc8a
Merge pull request #11557 from AdmiralCurtiss/split-file-reader
DiscIO: Add support for CleanRip-style split ISOs.
2023-03-09 16:13:15 +01:00
Admiral H. Curtiss 8c7997d6ca
Merge pull request #11601 from Dentomologist/bluetooth_adapter_missing_message
Config: Restore Bluetooth adapter missing message in Controller Settings
2023-03-09 16:10:14 +01:00
Admiral H. Curtiss 234c5dd90e
Merge pull request #11622 from JosJuice/tas-input-nonblocking
DolphinQt: Rework TAS input threading
2023-03-09 16:08:30 +01:00
Charles Lombardo a6b1b2f9a5
Merge pull request #11631 from K0bin/pref-divider
Android: Only show divider in settings for headers
2023-03-08 23:56:39 -05:00
Admiral H. Curtiss d638d2dcb7
HW/AudioInterface: Refactor to class. 2023-03-09 02:40:29 +01:00
Dentomologist d6a8e6caaf ControllerInterface: Fix deadlock when Wii Remote disconnects
In UpdateInput, lock m_devices_population_mutex before m_devices_mutex
to be consistent with other ControllerInterface functions. Normally the
former lock isn't needed in UpdateInput, but when a Wii Remote
disconnects it calls RemoveDevice which results in the mutexes being
locked in the wrong order.
2023-03-08 17:22:27 -08:00
Robin Kertels 13ed46a488
Android: Implement DocumentProvider
This allows users to access the Dolphin user directory.
2023-03-08 23:09:49 +01:00
Admiral H. Curtiss a1c2651fee
HW/EXI: Pass System to IEXIDevice. 2023-03-08 22:51:17 +01:00
Admiral H. Curtiss 7044cff011
Core/Boot: Pass around System. 2023-03-08 22:41:43 +01:00
Admiral H. Curtiss 912cd456fb
Core: Add System parameter to CPUThreadGuard. 2023-03-08 22:41:42 +01:00
Robin Kertels 1b47144312
Android: Center list view headers 2023-03-08 18:57:19 +01:00
Robin Kertels edde253724
Android: Only show divider in settings for headers 2023-03-08 18:57:08 +01:00
Mai c592c94395
Merge pull request #11630 from AdmiralCurtiss/globals-cpu
HW/CPU: Refactor to class, move to System.
2023-03-08 11:52:30 -05:00
JosJuice 0300b44d23 DolphinQt: Rework TAS input threading, part 2 (analog inputs) 2023-03-08 17:49:03 +01:00
JosJuice 11e4d46927 DolphinQt: Remove unneeded out parameters in TASInputWindow
IIRC we needed this before the input override system was added.
2023-03-08 17:49:03 +01:00
JosJuice 3eac1fc284 DolphinQt: Rework TAS input threading, part 1 (buttons)
This gets rid of a blocking operation, improving performance and fixing
https://bugs.dolphin-emu.org/issues/12893.

This also makes us no longer directly access the state of certain UI
elements from the CPU thread, which probably wasn't thread-safe but
doesn't seem to have caused any observable issues so far.
2023-03-08 17:49:02 +01:00
Admiral H. Curtiss 3b364c5c16
HW/CPU: Refactor to class, move to System. 2023-03-08 12:23:37 +01:00
Mai f1e4b6a141
Merge pull request #11494 from t895/orientation-jank
Android: Rewrite Wii system updates in Kotlin
2023-03-08 01:42:53 -05:00
Admiral H. Curtiss 0b9002ec2a
Merge pull request #11568 from SMarioMan/socket-broadcast
Network/Socket: Enable broadcast permissions in socket requests
2023-03-08 00:11:44 +01:00
Charles Lombardo 75ce7a04ca Android: Use coroutine for system updates 2023-03-07 15:45:41 -05:00
Charles Lombardo d66d8210bf Android: Switch to indeterminate progress bar on system update cancel 2023-03-07 15:45:41 -05:00
Charles Lombardo 917ca2273e Android: Remove hardcoded strings from system update dialogs 2023-03-07 15:45:41 -05:00
Charles Lombardo 410aaef56e Android: Remove orientation lock on system update dialog 2023-03-07 15:45:41 -05:00
Charles Lombardo c0868f04a9 Android: Use Kotlin extensions for lifecycle components 2023-03-07 15:45:41 -05:00
Charles Lombardo 5eeb0a540b Android: Convert OnlineUpdateRegionSelectDialogFragment to Kotlin 2023-03-07 15:45:41 -05:00
Charles Lombardo 0ac4fe763b Android: Convert SystemMenuNotInstalledDialogFragment to Kotlin 2023-03-07 15:45:41 -05:00
Charles Lombardo c8907349be Android: Convert SystemUpdateResultFragment to Kotlin 2023-03-07 15:45:40 -05:00
Charles Lombardo 60cb886cd4 Android: Convert WiiUtils to Kotlin 2023-03-07 15:45:40 -05:00
Charles Lombardo 2b17e0334a Android: Convert SystemUpdateViewModel to Kotlin 2023-03-07 15:45:40 -05:00
Charles Lombardo 6dfa555099 Android: Convert SystemUpdateProgressBarDialogFragment to Kotlin 2023-03-07 15:45:40 -05:00
Mai 16023ece6d
Merge pull request #11621 from deReeperJosh/skylandersfilefix
Skylander Portal: Clearing and Reloading fix
2023-03-07 15:24:46 -05:00
Admiral H. Curtiss 6d38dd9821
Qt/WatchWidget: Don't update if not paused. 2023-03-07 20:31:15 +01:00
JosJuice 75fb1a7edf Android: Disable input device sensor input due to crash 2023-03-07 17:39:34 +01:00
JosJuice 1788a797e7 Android: Add "more settings" button to overlay control setting dialog
Some people might wonder where the ability to select an extension
and the Sideways Wii Remote went. This button will take them to the
general settings, which is where those settings now live.

At some point in the future, we should probably move everything to the
general settings. But this pull request is already big enough as it is!
2023-03-07 17:39:34 +01:00
JosJuice 6b5f82c12f Android: Change how the overlay controller setting works, part 2
The previous commit wasn't enough for getting inputs to work for
controllers 2-4.
2023-03-07 17:39:34 +01:00
JosJuice 1b55d7c594 Android: Change how the overlay controller setting works
Up until now, there have been two settings on Android that stored the
selected Wii Remote extension: the normal one that's also used on PC,
and a SharedPreferences one that's used by the overlay controls to
determine what controls to show. It is possible for these two to end up
out of sync, and my input changes have made that more likely to happen.

To fix this, let's rework how the overlay controller setting works.
We don't want it to encode the currently selected Wii Remote extension.
However, we can't simply get rid of the setting, because for some Wii
games we need the ability to switch between a GameCube controller and a
Wii Remote. What this commit does is give the user the option to select
any of the 4 GameCube controllers and any of the 4 Wii Remotes. (Before,
controllers 2-4 weren't available in the overlay.) Could be useful for
things like the Psycho Mantis fight in Metal Gear Solid. I'm also
switching from SharedPreferences to Dolphin.ini while I'm at it.
2023-03-07 17:39:34 +01:00
JosJuice 4c326f2030 Android: Remove the in-emulation IR sensitivity options
This too can be set in the normal controller settings now.
2023-03-07 17:39:34 +01:00
JosJuice ee2c7dc24b Android: Remove the in-emulation motion control options
You can set this in the normal controller settings now.
2023-03-07 17:39:34 +01:00
JosJuice 9b9b6d97bc Config: Simplify IsSettingSaveable's handling of Android section
The Android-specific controller mapping system is now gone,
so IsSettingSaveable can be greatly simplified.
2023-03-07 17:39:34 +01:00
JosJuice 32cb41007b Android: Allow changing controller settings during emulation 2023-03-07 17:39:34 +01:00
JosJuice c2779aef06 Android: Add the advanced input mapping dialog
It's missing a lot of features from the PC version for now, like
buttons for inserting functions and the ability to see what the
expression evaluates to. I mostly just wanted to get something in
place so you can set up rumble.

Co-authored-by: Charles Lombardo <clombardo169@gmail.com>
2023-03-07 17:39:30 +01:00
Admiral H. Curtiss f389da2a33
HW/HSP: Refactor to class, move to System. 2023-03-07 02:11:39 +01:00
Admiral H. Curtiss 655cc7f75c
DiscIO: Add support for CleanRip-style split ISOs. 2023-03-05 19:23:55 +01:00
Scott Mansell 4acdbc0e84
Merge pull request #11625 from phire/eventhook_nodiscard
Fix KillRenderer config changed regression
2023-03-06 03:09:12 +13:00
Scott Mansell 901f12c935 HookableEvents: Add [[nodiscard]] to Register 2023-03-06 00:12:26 +13:00
Scott Mansell b7db2510ef Don't discard ConfigChanged callback handle 2023-03-06 00:12:26 +13:00
Scott Mansell 70cfb46f8e Fix duplicated FPS
This is a small regression from KillRenderer, which caused duplicated
frames to be counted on the FPS counter when the "Skip Presenting
Duplicated Frames" option was disabled.
2023-03-05 23:31:12 +13:00
Shawn Hoffman 5bf9ad7d82 msvc: enable compiler checks added in vs 17.5 2023-03-04 14:18:18 -08:00
Shawn Hoffman 35bde3e7c8 msvc: bump required version to align with vs 17.5 2023-03-04 14:18:18 -08:00
Joshua de Reeper 2585ae9b2c Skylander Portal: Clearing and Reloading fix 2023-03-04 20:13:54 +13:00
JosJuice 42943672bb Android: Add selecting input profile per game 2023-03-03 22:28:25 +01:00
JosJuice 1eeded23df Android: Add input profile management
Co-authored-by: Charles Lombardo <clombardo169@gmail.com>
2023-03-03 22:28:25 +01:00
JosJuice 7ef229d908 Android: Show warning when using old pre-defined controller INIs
Co-authored-by: Charles Lombardo <clombardo169@gmail.com>
2023-03-03 22:28:25 +01:00
JosJuice 8b78f73e80 Android: Add Default and Clear actions for controllers 2023-03-03 22:28:25 +01:00
JosJuice ea3200d4ba Android: Prevent showing mapping dialog with no device selected 2023-03-03 22:28:25 +01:00
JosJuice a1cc19f443 Android: Add "Create mappings for other devices" 2023-03-03 22:28:24 +01:00
JosJuice 2b1dd52750 Android: Add input device selection 2023-03-03 22:28:24 +01:00
JosJuice 2113bf5e3a Android: Implement enabling/disabling control groups
All this code for just a single checkbox... Ah well, it has to be done
2023-03-03 22:28:24 +01:00
JosJuice a78dca5fb0 Android: Move Sideways Wii Remote setting one submenu up
A slight departure from DolphinQt, but I think it makes sense, because
it will make the important Sideways Wii Remote setting easier to find.
2023-03-03 22:28:24 +01:00
JosJuice e7530a1cb9 Android: Split Wii Remote settings into submenus
Too much stuff on one screen otherwise. This split matches DolphinQt.
2023-03-03 22:28:24 +01:00
JosJuice 0dd8bbbbbb Android: Add extension selection 2023-03-03 22:28:24 +01:00
JosJuice 1c26a85e35 Android: Add NumericSetting support 2023-03-03 22:28:24 +01:00
JosJuice 2c529b9db1 Android: Add new input mapping implementation 2023-03-03 22:28:24 +01:00
JosJuice dd8976f18d Android: Remove old input mapping implementation
This old code is of no use now that ButtonManager is gone.
2023-03-03 22:28:24 +01:00
JosJuice 304d898966 Android: Remove copyAsset's overwrite parameter
Because of the previous commit, this is no longer needed.
2023-03-03 22:28:24 +01:00
JosJuice 93657cce54 Android: Stop extracting pre-defined controller INIs 2023-03-03 22:28:24 +01:00
JosJuice 9a8a395560 GCPadEmu/WiimoteEmu: Reorder control groups
This way, Android (which will show groups in the order they're defined)
will show groups in a more logical order similar to DolphinQt.

The main thing that was annoying me was how early Rumble was for
Wii Remotes. Some of the other changes I'm making in this commit,
like the order of Shake/Tilt/Swing, are more arbitrary and were
made for consistency with DolphinQt. But there are also places
where I didn't go all the way with matching DolphinQt. Most notably,
DolphinQt puts sticks before buttons, but I don't see any reason
to do that for Android.
2023-03-03 22:28:24 +01:00
JosJuice e0562abb7d ControllerEmu: Add default mappings for Android
Unlike PCs, Android doesn't really have any input method (not counting
touch) that can reasonably be expected to exist on most devices.
Because of this, I don't think shipping with a default mapping for the
buttons and sticks of GameCube controllers and Wii Remotes makes sense.
I would however like to ship default mappings for a few things:

1. Mapping the Wii Remote's accelerometer and gyroscope to the device's
   accelerometer and gyroscope. This functionality is useful mainly
   for people who use the touchscreen, but can also be useful when
   using a clip-on controller. The disadvantage of having this mapped
   by default is that games disable pointer input if the accelerometer
   reports that the Wii Remote is pointed at the ceiling.

2. Mapping GC keyboards for use with a physical keyboard, like on PC.
   After all, there's no other way of mapping them that makes sense.

3. Mapping rumble to the device's vibrator.

Aside from the GC keyboards, this approach is effectively the same as
what we were doing before the input overhaul.
2023-03-03 22:28:23 +01:00
JosJuice 8e33458f48 ControllerInterface/Android: Implement rumble 2023-03-03 22:28:23 +01:00
JosJuice 065481d989 ControllerInterface/Android: Automatically suspend sensors
This is a battery-saving measure. Whether a sensor should be suspended
is determined in the same way as whether key events and motion events
should be handled by the OS rather than consumed by Dolphin.
2023-03-03 22:28:23 +01:00
JosJuice 36acb17700 ControllerInterface/Android: Implement sensor input for InputDevices
This functionality was added in Android 12 to let apps get motion data
for gamepads.
2023-03-03 22:28:23 +01:00
JosJuice 5e51b56d72 ControllerInterface/Android: Implement sensor input 2023-03-03 22:28:23 +01:00
JosJuice 104ea09892 ControllerInterface/Android: Implement hotplug 2023-03-03 22:28:23 +01:00
JosJuice d6af294a23 ControllerInterface/Android: Return whether input was handled
When Android presents an input event to an app, it wants the app to
return true or false depending on whether the app handled the event or
not. If the event wasn't handled by the app, it will be passed on to
the system, which may decide to take an action depending on what kind
of input event it is. For instance, if a B button press is passed on to
the system, it will be turned into a Back press. But if an R1 press is
passed on to the system, nothing in particular happens.

It's important that we get this return value right in Dolphin. For
instance, the user generally wouldn't want a B button press to open
the EmulationActivity menu, so B button presses usually shouldn't be
passed on to the system - but volume button presses usually should be
passed on to the system, since it would be hard to adjust the volume
otherwise. What ButtonManager did was to pass on input events that are
for a button which the user has not mapped, which I think makes sense.
But exactly how to implement that is more complicated in the new input
backend than in ButtonManager, because now we have a separation between
the input backend and the code that keeps track of the user's mappings.

What I'm going with in this commit is to treat an input as mapped if
it has been polled recently. In part I chose this because it seemed
like a simple way of implementing it that wouldn't cause too many
layering violations, but it also has two useful side effects:

1. If a controller is not being polled (e.g. GameCube controllers in
   Wii games that don't use them), its mappings will not be considered.
2. Once sensor input is implemented in the Android input backend,
   we will be able to use this "polled recently" tracking to power down
   the sensors at times when the game is using a Wii Remote reporting
   mode that doesn't include motion data. (Assuming that the sensor
   inputs only are mapped to Wii Remote motion controls, that is.)
2023-03-03 22:28:23 +01:00
JosJuice ca508e4503 ControllerInterface/Android: Handle input events
Android doesn't let us poll inputs whenever we want. Instead, we
listen to input events (activities will have to forward them to the
input backend), and store the received values in atomic variables
in the Input classes. This is similar in concept to how ButtonManager
worked, but without its homegrown second input mapping system.
2023-03-03 22:28:23 +01:00
JosJuice 792cb62195 ControllerInterface/Android: Implement device population 2023-03-03 22:28:23 +01:00
JosJuice 68ebb5c33e Android: Remove old rumble implementation 2023-03-03 22:28:23 +01:00
JosJuice 9e7a2ee0fb Android: Remove old motion input implementation 2023-03-03 22:28:23 +01:00