Commit Graph

357 Commits

Author SHA1 Message Date
JosJuice 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
mitaclaw 5f90673686 StringUtil: Remove `JoinStrings`
With 12 uses of `JoinStrings` in the codebase vs 36 uses of `fmt::join`, fmtlib's range adapter for string concatenation with delimiters is clearly the preferred option.
2024-09-22 21:09:36 -07:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
mitaclaw 4f0954dd44 MainAndroid: Thread Correctness In WriteJitBlockLogDump
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-28 16:10:59 -07:00
mitaclaw 7cafd78ffc MainAndroid: Use JNI_FALSE instead of static_cast<jboolean>(false) 2024-07-27 20:22:25 -07:00
Admiral H. Curtiss 5ea3d9fca0
Merge pull request #12856 from LillyJadeKatrin/retroachievements-pause-v2
Handle Pausing in AchievementManager
2024-07-04 22:53:04 +02:00
Tilka 7f0ee9dddd
Merge pull request #12894 from deReeperJosh/infinity-base-numbers
IOS/USB: Use Enum for Infinity Base Positions
2024-06-30 16:04:20 +01:00
Joshua de Reeper cfcdaab514 IOS/USB: Use Enum for Infinity Base Positions 2024-06-27 20:57:27 +01:00
JosJuice bc67fc97c3 Revert "Audit uses of IsRunning and GetState"
This reverts commit 72cf2bdb87.

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-26 20:36:46 +02:00
JosJuice 01b44837f4 Android: Track whether app is in foreground 2024-06-23 18:16:33 -04:00
Admiral H. Curtiss 9b33b777cf
Merge pull request #12828 from JosJuice/unify-state-variables-2
Clean up Core::GetState
2024-06-22 20:20:54 +02:00
JosJuice 72cf2bdb87 Audit uses of IsRunning and GetState
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-21 20:52:55 +02:00
JosJuice 962230f91e Core: Store current state in less places
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-06-21 20:46:44 +02:00
Dentomologist c3bdd05d2a TAS Input: Enable hotkeys and controller input when Input has focus
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-31 15:14:44 -07:00
mitaclaw 0b04975c26 Core::SetState: Avoid Global System Accessor 2024-05-03 21:04:44 -07:00
mitaclaw 0df401b164 Core::IsRunning: Avoid Global System Accessor 2024-05-01 08:54:17 -07:00
Admiral H. Curtiss 0c1a76398b
Merge pull request #12691 from mitaclaw/jit-profiling-restoration
JitCache: Software Profiling Restoration
2024-04-13 01:35:25 +02:00
mitaclaw ee8bcf2ccc JitCache: Software Profiling Restoration
Rekindle software JIT profiling with a std::chrono conversion and a config connection.
2024-04-09 13:43:31 -07:00
mitaclaw eb92d6f0a8 Core::GetState: Avoid Global System Accessor 2024-04-08 16:23:23 -07:00
mitaclaw be27c4f877 NativeLibrary: Create displayToastMsg Method 2024-04-06 15:41:23 -07:00
Admiral H. Curtiss a2074a8583
Merge pull request #12645 from mitaclaw/ppc-symbols-signal
DolphinQt: A Ubiquitous Signal For When Symbols Change
2024-03-31 06:36:09 +02:00
mitaclaw b52a08d533 DolphinQt: A Ubiquitous Signal For When Symbols Change
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-28 09:57:22 -07:00
mitaclaw 73f9904f2a Core: Remove RunAsCPUThread
It's a fine function, but CPUThreadGuard is more vogue. Also, its potential for being confused with RunOnCPUThread will not be missed.
2024-03-23 03:33:26 -07:00
Admiral H. Curtiss 3948ac9513
Merge pull request #12606 from mitaclaw/state-global-system
State: Avoid Global System Accessor
2024-03-22 04:27:12 +01:00
Admiral H. Curtiss f814dc58b5
Merge pull request #12620 from mitaclaw/jit-interface-cpu-thread-guard
JitInterface::ClearCache: Modernize With CPUThreadGuard
2024-03-22 04:17:33 +01:00
mitaclaw f09b71582e Core: Avoid (Some) Global System Accessor 2024-03-18 01:35:42 -07:00
Admiral H. Curtiss c964d552c9
Merge pull request #12616 from mitaclaw/dvd-interface-cpu-thread-guard
DVDInterface: Modernize With CPUThreadGuard
2024-03-17 16:14:56 +01:00
mitaclaw fe61efcd7a DVDInterface: Modernize With CPUThreadGuard 2024-03-08 15:17:41 -08:00
mitaclaw 4568446398 JitInterface::ClearCache: Modernize With CPUThreadGuard
It is recommended to view this diff with whitespace changes hidden.
2024-03-04 19:45:34 -08:00
mitaclaw 16c609dcd4 BootManager: Avoid Global System Accessor 2024-03-01 23:39:04 -08:00
mitaclaw 0d4cb5ddc7 State: Avoid Global System Accessor 2024-03-01 10:52:50 -08:00
JosJuice 6cf55ab1ee InputCommon: Unify GetProfileName and GetProfileDirectoryName
After reading the previous commit, you might think "hold on, what's the
difference between GetProfileName and GetProfileDirectoryName"? These
two are being used for the exact same thing - figuring out where
profiles are stored - yet they return different values for certain
controllers like GC keyboards! As far as I can tell, the existing code
has been broken for GC keyboards since they were introduced a decade
ago. The GUI (and more recently, also InputCycler) would write and read
profiles in one location, and our code for loading profiles specified in
a game INI file would read profiles in another location.

This commit gets rid of the set of values used by the game INI code in
favor of the other set. This does breaking existing setups where a
GCKey profile has been configured in a game INI, but I think the number
of working such setups is vanishingly small. The alternative would make
existing GCKey profiles go missing from the profile dropdown in the GUI,
which I think would be more disruptive. The alternative would also force
new GCKey profiles into the same directory as GCPad profiles.

This commit also fixes a regression from d6c0f8e749. The Android GUI was
using GetProfileName to figure out what key to use in the game INI,
which made it use incorrect game INI entries for GameCube controller
profiles but not Wii Remote profiles. Now the Android GUI uses
GetProfileKey for this, fixing the problem.
2024-02-04 17:55:08 +01:00
Admiral H. Curtiss 9a3e770c23
Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
Lioncash 4bef3b93b4 AndroidCommon: Resolve -Wsign-compare warning 2023-12-11 18:06:40 -05:00
JosJuice d80f9d53fc Android: Expose config changed callbacks 2023-12-07 21:09:17 +01:00
Mai ac53766058
Merge pull request #12215 from JosJuice/android-si-devices
Android: Add more GameCube controller types
2023-11-28 19:21:29 +01:00
JosJuice 5bda811a00 Android: Remove HostThreadLocks that are no longer needed
71ce8bb6f0 got rid of the need to be the
host or CPU thread when writing to the config.
2023-11-25 14:06:29 +01:00
Mandar1jn afdf6de041
Skylanders: Improve figure data view and generation
Co-authored-by: deReeperJosh <joshua@dereeper.co.nz>
2023-11-05 18:06:10 +01:00
JosJuice d811c12196 Android: Add more GameCube controller types
For all your PSO needs.
2023-10-01 18:47:49 +02:00
JosJuice d6c0f8e749 Android: Get profile name from core
To avoid duplicating information between Kotlin and C++.
2023-10-01 18:47:49 +02:00
JosJuice d8e00c98e8 Android: Remove a stray backtick 2023-10-01 13:37:04 +02:00
get 63467559b2
fmt 10.0.0-10.1.1 compile fixes
Implicit conversion operators and enums was removed for parity with std::format (fce74caa15).
2023-09-21 01:19:23 +02:00
JosJuice 190e71a318 Android: Use JNI for setting/getting ISO paths
This gets rid of the last Android-specific code that directly interfaces
with INI files.
2023-09-02 12:58:20 +02:00
JosJuice f9959656e7
Merge pull request #11919 from t895/kotlin-controls
Android: Convert "features.input" package to Kotlin
2023-08-26 19:10:56 +02:00
Charles Lombardo 09c2c6541d Android: Convert GameFileCache to Kotlin 2023-08-25 14:54:17 -04:00
Charles Lombardo a56ee1a62e Android: Convert GameFile to Kotlin 2023-08-25 14:54:16 -04:00
Charles Lombardo 9ac1847cbd Android: Convert NumericSetting to Kotlin 2023-08-25 14:20:31 -04:00
Charles Lombardo 82298dc408 Android: Convert CoreDevice to Kotlin 2023-08-25 14:20:31 -04:00
Charles Lombardo 3011c0dc64 Android: Convert EmulatedController to Kotlin 2023-08-25 13:31:21 -04:00
Charles Lombardo 4ce069cf4f Android: Convert ControlReference to Kotlin 2023-08-25 13:31:04 -04:00