4241 Commits

Author SHA1 Message Date
Dentomologist
448d61f262 Windows/DirectIOFile: Don't request DELETE access for read-only Open
Aside from being unnecessary, on Windows the flag prevents two instances
of Dolphin (one instance from before 2509-371 when the flag was
introduced and the other after) from running the same ROM
simultaneously.

Attempting to do so generated the false error `"[Rom]" is an invalid
GCM/ISO file, or is not a GC/Wii ISO.` followed by `Failed to init core`
and emulation shutdown on the second instance to start the game. Fixing
the incorrect error message is a task I'm deferring to another PR.

The problem didn't happen when both instances were 2509-371 or later,
but I ran into it while bisecting an issue and it'd be nice to avoid
that problem in the future.
2025-11-29 14:02:24 -08:00
JosJuice
490615c72a Merge pull request #14142 from JosJuice/directiofile-cant-create-saf
Common: Treat DirectIOFile as unable to create SAF files
2025-11-23 09:50:44 +01:00
Jordan Woyak
151d295b2c Merge pull request #14148 from jordan-woyak/hookable-event-add-remove-inside-trigger
HookableEvent: Allow hooks to be added and removed from within a Trigger callback.
2025-11-23 02:20:47 -06:00
JosJuice
30dbcb2f80 Merge pull request #14128 from jordan-woyak/fix-run-on-object-race
DolphinQt/QtUtils: Simplify RunOnObject and eliminate Common::Event race. Introduce Common::OneShotEvent class.
2025-11-22 21:52:17 +01:00
Jordan Woyak
11318e0be5 HookableEvent: Allow hooks to be added and removed from within a Trigger callback. This fixes a deadlock in FIFOFifoRecorder. 2025-11-21 16:58:20 -06:00
JosJuice
9883235c0c Common: Treat DirectIOFile as unable to create SAF files
In 405baed805, we made the assumption that whether OpenAndroidContent
is able to create a new file depends on the open mode, the document
provider, and the positions of the celestial bodies. However, I'm
fairly sure that it can't create files at all as currently implemented.

First, ContentResolver.openFileDescriptor is documented as throwing
FileNotFoundException if the file doesn't exist. Now, the SAF
documentation is notoriously unreliable on matters like these, and
document providers can do whatever they want anyway, so we can't
actually trust this to mean that FileNotFoundException will always
be thrown if the file doesn't exist. But second, the Dolphin function
ContentHandler.unmangle is also unable to handle files that don't
already exist (unless the passed-in URI isn't mangled to begin with,
but to the best of my knowledge, there's no way to get a non-mangled URI
for a file that doesn't exist (unless you make assumptions about how the
document provider's URI scheme works, which we don't do in Dolphin)).
Summed up, it looks a lot like OpenAndroidContent can't create files,
or at the very least can't do so reliably.

Therefore I'm making DirectIOFile throw an assertion and return false
in situations where it's being asked to create a file under SAF. For
reference, there's no code in Dolphin that actually tries to create a
file under SAF. In all instances where we use SAF to write to files, the
file is created by the system file picker before it returns the URI of
the file to us.

What does this change gain us? First, if someone in the future tries to
use DirectIOFile to create a file under SAF, they'll be immediately
informed that this isn't supported rather than discovering it doesn't
work and chalking it up to SAF being bad for unpredictable reasons.
Second, we get rid of a call to File::Exists, which is a notable
performance improvement for game list scanning due to SAF and Dolphin's
"unmangling" being bad for reasons that unfortunately are entirely
predictable to those of us who have stared into the SAF void.

I've tested that game list scanning and game conversion still works.
2025-11-18 23:17:03 +01:00
Jordan Woyak
d25742fe8b Common: Introduce a OneShotEvent class. Unlike Common::Event, OneShotEvent is safe in situations when being immediately destructed. 2025-11-18 14:19:21 -06:00
Jordan Woyak
605cc579a4 Common/Functional: Add InvokerOf template which can convert function pointers to functor types. 2025-11-18 14:19:21 -06:00
Jordan Woyak
1b63776f2d Common/ScopeGuard: Fix move constructor. 2025-11-18 14:19:21 -06:00
Jordan Woyak
9dea0859eb Common/BitField: Silence two warnings:
warning: definition of implicit copy constructor for 'BitField<2, 2, ColorChannel>' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
Redundant access specifier has the same accessibility as the previous access specifier.
2025-11-15 20:32:14 -06:00
Jordan Woyak
f51eaf3282 Merge pull request #14052 from jordan-woyak/DirectIOFile
Common and DiscIO: Introduce a thread safe DirectIOFile and make BlobReader implementations use it.
2025-11-10 17:29:43 -06:00
JosJuice
cd4902f0ed Merge pull request #13875 from JosJuice/jitarm64-orr-base-without-mirror
JitArm64: Add missing ORR pattern in MOVI2RImpl
2025-11-10 20:16:21 +01:00
Admiral H. Curtiss
6435ee1d20 Merge pull request #14026 from jordan-woyak/move-only-function-fix
Common/Functional: Fix MoveOnlyFunction from inadvertently creating references from lvalues.
2025-11-09 14:49:20 +01:00
Jordan Woyak
9e2fc7f4dd Common/IOFile: Remove the Duplicate function. The duplicate handles shared a read/write position making them effectively not thread-safe. 2025-11-09 03:08:14 -06:00
Jordan Woyak
b98acb9a37 Common/BitUtils: Add overloads of AsU8Span/AsWritableU8Span that handle conversions from contiguous ranges. 2025-11-09 03:08:14 -06:00
Jordan Woyak
405baed805 Common: Add a DirectIOFile class that allows for copies which are entirely thread safe. 2025-11-09 03:08:14 -06:00
OatmealDome
02ad041866 Merge pull request #14086 from Simonx22/android/use-native-analytics
Android: Use the shared HTTP analytics backend
2025-11-08 14:03:06 -05:00
OatmealDome
a459dc0d25 Merge pull request #14082 from Simonx22/analytics/reload-on-setting-change
DolphinAnalytics: Reload backend when config changes
2025-11-08 14:00:03 -05:00
Simonx22
82f658a28f Android: Use the shared HTTP analytics backend
We can now route Android analytics through Common::HttpAnalyticsBackend, drop the Volley sender, and keep the JNI layer limited to only transfer metadata since https://bugs.dolphin-emu.org/issues/11772 has been fixed.
2025-11-08 12:14:40 -05:00
JosJuice
958db7c78c Merge pull request #14020 from jordan-woyak/string-util-cleanups
StringUtil: Cleanups and add some character encoding conversion unit tests.
2025-11-08 17:36:54 +01:00
Simonx22
f67691d564 Config: Use maximum value of size_t instead of -1 as default value in ConfigChangedCallbackID
Co-authored-by: OatmealDome <julian@oatmealdome.me>
2025-11-08 11:35:31 -05:00
JosJuice
ba14222a2b Merge pull request #13939 from Dentomologist/logging_avoid_overwriting_debug_verbosity_in_release_builds
Logging: Don't overwrite LDEBUG level in Release builds
2025-11-08 14:47:27 +01:00
Jordan Woyak
da6c65bf3b Common: Remove the string parameters from the HookableEvent interface. 2025-11-06 22:34:40 -06:00
Jordan Woyak
2170080f53 Merge pull request #14061 from jordan-woyak/config-info-spin-mutex
ConfigInfo: Cleanups and change mutex to a spin lock.
2025-11-04 14:09:35 -06:00
Jordan Woyak
999333c0a1 Config: Make ConfigInfo use Common::SpinLock to protect the CachedValue. These locks are nearly always uncontested and this makes Config::Get faster. 2025-11-02 20:45:55 -06:00
Jordan Woyak
46369ef1b1 Common: Add AtomicMutex and SpinMutex classes as faster alternatives to std::mutex. 2025-11-02 20:45:55 -06:00
Jordan Woyak
fc9f25a418 Config/ConfigInfo: Cleanups. 2025-11-02 20:30:35 -06:00
Jordan Woyak
f289b06e0d Common: Make HookableEvent use non-static data.
Co-authored-by: Dentomologist <dentomologist@gmail.com>
2025-11-02 17:30:43 -06:00
Jordan Woyak
5650b2ef37 StringUtil: Replace strerror with Common::LastStrerrorString. 2025-11-02 00:36:04 -05:00
Jordan Woyak
da7c813edf StringUtil: Make non-Windows WStringToUTF8 implementation use iconv instead of deprecated std::codecvt features. 2025-11-02 00:36:04 -05:00
Jordan Woyak
b073b5303b StringUtil: Fix many clang-tidy warnings. 2025-11-02 00:36:04 -05:00
JosJuice
828e72d604 Merge pull request #14034 from JoshuaVandaele/byeprofile
JitRegister: Remove OProfile profiler
2025-11-01 10:05:11 +01:00
Joshua Vandaële
2383e68fd8 x64Emitter: Fix missing-declarations warning 2025-10-30 12:35:22 +01:00
Joshua Vandaële
33fd06d7f3 AdvancedPane: Add a button to restore default settings 2025-10-27 15:59:33 +01:00
Joshua Vandaële
713dfb41df JitRegister: Remove OProfile profiler
OProfile is not used at all these days, most major distributions do not ship it anymore (Debian, Fedora, and Alpine to name the few I've checked) and following a discussion on Discord, nobody is apparently using it, most devs not even being aware of it. This removes an optional dependency from Dolphin.
2025-10-26 20:48:15 +01:00
Jordan Woyak
ba5edce2af Common/Functional: Fix MoveOnlyFunction from inadvertently creating references from lvalues. 2025-10-22 05:06:41 -05:00
JMC47
2e490cefa0 Merge pull request #13978 from JoshuaVandaele/libiconv-1.18
Externals: Update libiconv to 1.18
2025-10-17 18:45:48 -04:00
Dentomologist
4e359cf1c5 WindowsDevice: Silence missing property log spam
Don't log a warning in GetPropertyHelper when the property isn't
present. The function returns an optional, so any callers that want to
log a warning when nullopt is returned can do so themselves.

This prevents plugged-in devices (an Xbox One controller in my case)
from spamming the message "W[COMMON]: CM_Get_DevNode_Property returned:
37" twice per second (that value being CR_NO_SUCH_VALUE).
2025-10-13 11:55:12 -07:00
Jordan Woyak
3978e1eb2c WindowsDevice: Add some utility functions for getting device properties using CfgMgr32. 2025-10-12 12:33:13 -05:00
JMC47
d8bcd6d82e Merge pull request #13996 from SuperSamus/jit64-dynamic-known-jmp-len
Jit64: Dynamic length of regular jump instruction (for known addresses)
2025-10-09 14:07:13 -04:00
JMC47
4f7a910e92 Merge pull request #13964 from ryanmcgrath/macos/qos
macoS: update QoSSession with SO_NET_SERVICE_TYPE.
2025-10-09 14:05:42 -04:00
Martino Fontana
8a97ce9124 MMU: Use templates for Read/Write functions 2025-10-08 11:27:06 +02:00
Martino Fontana
f6e5448b43 Jit64: Dynamic length of regular jump instruction (for known addresses)
Conditional jumps already do that, so let's be consistent.
2025-10-08 00:15:57 +02:00
JosJuice
03ef9b4995 Merge pull request #13995 from Dentomologist/deletedirrecursively_dont_report_error_if_directory_is_absent
DeleteDirRecursively: Don't report error for absent directory
2025-10-06 20:04:32 +02:00
Dentomologist
f64e57442c DeleteDirRecursively: Don't report error for absent directory
Check if the return value of std::filesystem::remove_all is -1 rather
than 0; the former is the specified return value if there's an error
while 0 just means the directory already didn't exist (which is the end
result we want).

Previously error messages such as the following were possible:
E[COMMON]: DeleteDirRecursively: [path]/User/RedirectSession/ failed The
operation completed successfully.

Also adds a period in the error string to make it look nicer.
2025-10-05 16:29:41 -07:00
Jordan Woyak
b2fef6ee1f Common/Network: Add BluetoothAddress struct and string conversion functions. 2025-10-04 14:51:17 -05:00
Jordan Woyak
b1e8de82a6 Common: Add some utilities to a new UnixUtil header. 2025-10-04 14:51:17 -05:00
Jordan Woyak
504ea99cfa CommonFuncs: Add StrerrorString version of LastStrerrorString that accepts an error number. 2025-10-04 14:51:17 -05:00
Martino Fontana
4f737b7aaf dcbz: Fix AVX path 2025-10-01 21:09:18 +02:00
JosJuice
0c89c00d8b Merge pull request #13929 from SuperSamus/dcbz-jit-improvements
Jit: Small `dcbz` improvements
2025-09-30 18:52:09 +02:00