summaryrefslogtreecommitdiff
path: root/Source/Android/jni/MainAndroid.cpp
AgeCommit message (Collapse)Author
2025-01-10Merge pull request #13030 from JosJuice/android-wait-for-surface-in-runAdmiral H. Curtiss
Android: Wait for surface in Run
2024-11-15GDBStub: Signal Breakpoint Changes To Hostmitaclaw
2024-11-03VideoBackendBase: Clarify function nameDentomologist
Rename GetDefaultBackendName to GetDefaultBackendConfigName to distinguish it from the display name.
2024-10-23Host: Rename `JitCacheInvalidation`mitaclaw
There are two hard problems in computer science...
2024-10-19DolphinQt: JIT Widget Refreshmitaclaw
Fulfilling a certain six-year-old todo.
2024-10-18JitCache: Add WipeBlockProfilingData Functionmitaclaw
Accessible from DolphinQt and Android.
2024-10-04Partially revert "Revert "Audit uses of IsRunning and GetState""JosJuice
This reverts the revert commit bc67fc97c39628c76a4dbca411b0e8a9bfaf726a, except for the changes in BaseConfigLoader.cpp, which caused the bug that made us revert 72cf2bdb87f09deff22e1085de3290126aa4ad05. 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-08-21Android: Wait for surface in RunJosJuice
When we boot the core, it needs to have a valid surface to draw graphics to. Our Kotlin code does wait for a valid surface to exist before it calls NativeLibrary.Run, but there's a chance for the surface to be deleted before Run locks s_surface_lock. If that happens, the core boots without a valid surface, which presumably would cause a crash. (I haven't been able to reproduce the problem myself.)
2024-07-28MainAndroid: Thread Correctness In WriteJitBlockLogDumpmitaclaw
In a race condition, the core could shut down between the `JitInterface::GetCore` nullptr check and the `JitInterface::JitBlockLogDump` call which constructs a `CPUThreadGuard`. In this scenario, nothing horrible happens—`JitBlockLogDump` also checks for a nullptr—but it would be a failure to display the correct feedback to the user.
2024-07-27MainAndroid: Use JNI_FALSE instead of static_cast<jboolean>(false)mitaclaw
2024-06-26Revert "Audit uses of IsRunning and GetState"JosJuice
This reverts commit 72cf2bdb87f09deff22e1085de3290126aa4ad05. SYSCONF settings are getting cleared when they shouldn't be. Let's revert the change until I get proper time to figure out why it's broken.
2024-06-22Merge pull request #12828 from JosJuice/unify-state-variables-2Admiral H. Curtiss
Clean up Core::GetState
2024-06-21Audit uses of IsRunning and GetStateJosJuice
Some pieces of code are calling IsRunning because there's some particular action that only makes sense when emulation is running, for instance showing the state of the emulated CPU. IsRunning is appropriate to use for this. Then there are pieces of code that are calling IsRunning because there's some particular thing they must avoid doing e.g. when the CPU thread is running or IOS is running. IsRunning isn't quite appropriate for this. Such code should also be checking for the states Starting and Stopping. Keep in mind that: * When the state is Starting, the state can asynchronously change to Running at any time. * When we try to stop the core, the state gets set to Stopping before we take any action to actually stop things. This commit adds a new method Core::IsUninitialized, and changes all callers of IsRunning and GetState that look to me like they should be changed.
2024-06-21Core: Store current state in less placesJosJuice
Core::GetState reads from four different pieces of state: s_is_stopping, s_hardware_initialized, s_is_booting, and CPUManager::IsStepping. I'm keeping that last one as is for now because there's code in Dolphin that sets it directly, but we can unify the other three to make things easier to reason about. This commit also gets rid of s_is_started. This was previously used in Core::IsRunningAndStarted to ensure true wouldn't be returned until the CPU thread was started, but it wasn't used in Core::GetState, so Core::GetState would happily return State::Running after we had initialized the hardware but before we had initialized the CPU thread. As far as I know, there are no callers that have any real need to know whether the boot process is currently initializing the hardware or the CPU thread. Perhaps once upon a time there was a desire to make the apploader debuggable, but a long time has passed without anyone stepping up to implement it, and the way CBoot::RunApploader is implemented makes it rather difficult. So this commit makes all the functions in Core.cpp consider the core to still be starting until the CPU thread is started.
2024-05-31TAS Input: Enable hotkeys and controller input when Input has focusDentomologist
Enable emulator hotkeys and controller input (when that option is enabled) when a TAS Input window has focus, as if it was the render window instead. This allows TASers to use frame advance and the like without having to switch the focused window or disabling Hotkeys Require Window Focus which also picks up keypresses while other apps are active. Cursor updates are disabled when the TAS Input window has focus, as otherwise the Wii IR widget (and anything else controlled by the mouse) becomes unusable. The cursor continues to work normally when the render window has focus.
2024-05-03Core::SetState: Avoid Global System Accessormitaclaw
2024-05-01Core::IsRunning: Avoid Global System Accessormitaclaw
2024-04-13Merge pull request #12691 from mitaclaw/jit-profiling-restorationAdmiral H. Curtiss
JitCache: Software Profiling Restoration
2024-04-09JitCache: Software Profiling Restorationmitaclaw
Rekindle software JIT profiling with a std::chrono conversion and a config connection.
2024-04-08Core::GetState: Avoid Global System Accessormitaclaw
2024-03-31Merge pull request #12645 from mitaclaw/ppc-symbols-signalAdmiral H. Curtiss
DolphinQt: A Ubiquitous Signal For When Symbols Change
2024-03-28DolphinQt: A Ubiquitous Signal For When Symbols Changemitaclaw
There were three distinct mechanisms for signaling symbol changes in DolphinQt: `Host::NotifyMapLoaded`, `MenuBar::NotifySymbolsUpdated`, and `CodeViewWidget::SymbolsChanged`. The behavior of these signals has been consolidated into the new `Host::PPCSymbolsUpdated` signal, which can be emitted from anywhere in DolphinQt to properly update symbols everywhere in DolphinQt.
2024-03-23Core: Remove RunAsCPUThreadmitaclaw
It's a fine function, but CPUThreadGuard is more vogue. Also, its potential for being confused with RunOnCPUThread will not be missed.
2024-03-22Merge pull request #12606 from mitaclaw/state-global-systemAdmiral H. Curtiss
State: Avoid Global System Accessor
2024-03-22Merge pull request #12620 from mitaclaw/jit-interface-cpu-thread-guardAdmiral H. Curtiss
JitInterface::ClearCache: Modernize With CPUThreadGuard
2024-03-18Core: Avoid (Some) Global System Accessormitaclaw
2024-03-17Merge pull request #12616 from mitaclaw/dvd-interface-cpu-thread-guardAdmiral H. Curtiss
DVDInterface: Modernize With CPUThreadGuard
2024-03-08DVDInterface: Modernize With CPUThreadGuardmitaclaw
2024-03-04JitInterface::ClearCache: Modernize With CPUThreadGuardmitaclaw
It is recommended to view this diff with whitespace changes hidden.
2024-03-01BootManager: Avoid Global System Accessormitaclaw
2024-03-01State: Avoid Global System Accessormitaclaw
2024-01-31Migrate SConfig::bWii to System.Admiral H. Curtiss
2023-11-25Android: Remove HostThreadLocks that are no longer neededJosJuice
71ce8bb6f00f4d1cbc1012270d6daefdbda4254d got rid of the need to be the host or CPU thread when writing to the config.
2023-06-21Android: Declare host thread when generating analytics IDJosJuice
Another instance of the host thread check failing.
2023-06-19Merge pull request #11935 from nitanmarcel/patch-1JosJuice
Use getCacheDir if getExternalCacheDir returns null.
2023-06-13Use getCacheDir if getExternalCacheDir returns null.Marcel Alexandru Nitan
2023-06-12Android: Add HostThreadLock where necessaryJosJuice
2023-06-12Android: And Lock and Unlock wrappers to HostThreadLockJosJuice
This way we can ensure DeclareAsHostThread and UndeclareAsHostThread are called when locking and unlocking.
2023-06-12Android: Move host thread lock to a separate fileJosJuice
2023-06-11VideoBackends:Vulkan: Allow loading custom drivers on AndroidRobin Kertels
... using libadrenotools
2023-06-02Core: Assert that only the Host thread may call PauseAndLock().Admiral H. Curtiss
2023-03-26JitInterface: Refactor to class, move to System.Admiral H. Curtiss
2023-03-11Merge pull request #11385 from JosJuice/android-input-overhaulJosJuice
Android input overhaul
2023-03-10HW/DVDInterface: Refactor to class.Admiral H. Curtiss
2023-03-07Android: Change how the overlay controller setting worksJosJuice
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-03Android: Stop extracting pre-defined controller INIsJosJuice
2023-03-03Android: Remove old motion input implementationJosJuice
2023-03-03ControllerInterface/Android: Rip out ButtonManagerJosJuice
ButtonManager is very different from how a normal input backend works, and is making it hard for us to improve controller support on Android. The following commits will add a new input backend in its place.
2023-02-28Jit: Don't use a second stackJosJuice
This second stack leads to JNI problems on Android, because ART fetches the address and size of the original stack using pthread functions (see GetThreadStack in art/runtime/thread.cc), and (presumably) treats stack addresses outside of the original stack as invalid. (What I don't understand is why some JNI operations on the CPU thread work fine despite this but others don't.) Instead of creating a second stack, let's borrow the approach ART uses: Use pthread functions to find out the stack's address and size, then install guard pages at an appropriate location. This lets us get rid of a workaround we had in the MsgAlert function. Because we're no longer choosing the stack size ourselves, I've made some tweaks to where the put the guard pages. Previously we had a stack of 2 MiB and a safe zone of 512 KiB. We now accept stacks as small as 512 KiB (used on macOS) and use a safe zone of 256 KiB. I feel like this should be fine, but haven't done much testing beyond "it seems to work". By the way, on Windows it was already the case that we didn't create a second stack... But there was a bug in the implementation! The code for protecting the stack has to run on the CPU thread, since it's the CPU thread's stack we want to protect, but it was actually running on EmuThread. This commit fixes that, since now this bug matters on other operating systems too.
2023-01-31Cleanup headersScott Mansell