dolphin/Source/Core/Common
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
..
Assembler Avoid map/set double lookups 2025-07-08 06:53:42 +02:00
Config Config: Use maximum value of size_t instead of -1 as default value in ConfigChangedCallbackID 2025-11-08 11:35:31 -05:00
Crypto Merge pull request #13522 from tygyh/Enforce-overriding-destructor-style-Core&UnitTests 2025-06-07 17:55:14 -05:00
Debug Simplify std::find_if with std::ranges::find and projections 2025-03-09 13:26:35 -07:00
GL Make overriding explicit and remove redundant virtual specifiers on overriding destructors - Core & UnitTests 2025-05-01 15:00:37 +02:00
Logging Logging: Don't overwrite LDEBUG verbosity in Release builds 2025-09-19 13:25:42 -07:00
Align.h Common: Better AlignUp implementation 2023-06-29 02:35:44 -05:00
Analytics.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Analytics.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Arm64Emitter.cpp Merge pull request #13875 from JosJuice/jitarm64-orr-base-without-mirror 2025-11-10 20:16:21 +01:00
Arm64Emitter.h Emitters: Define Trivial Getters Inline 2024-07-21 21:35:29 -07:00
ArmCommon.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
ArmCPUDetect.cpp ArmCPUDetect: Add OpenBSD support for elf_aux_info 2025-01-22 22:58:00 -05:00
ArmFPURoundMode.cpp Common: Move FPU-related helpers into Common namespace 2023-03-21 10:58:13 -04:00
Assert.h Logging: Don't overwrite LDEBUG verbosity in Release builds 2025-09-19 13:25:42 -07:00
BitField.h Common/BitField: Make deleted functions public. 2025-05-05 19:34:35 -05:00
BitField.natvis Improve BitField natvis 2022-01-02 14:39:34 -08:00
BitSet.h Merge pull request #12473 from Dentomologist/bitset64_fix_iterator_incrementation 2024-01-01 22:03:11 +01:00
BitUtils.h Common/BitUtils: Add overloads of AsU8Span/AsWritableU8Span that handle conversions from contiguous ranges. 2025-11-09 03:08:14 -06:00
BlockingLoop.h Common: Convert BlockingLoop::StopMode to enum class 2023-06-12 17:12:25 -07:00
Buffer.h Common and VideoCommon: Change texture data from std::vector to Common::UniqueBuffer. 2025-05-03 18:32:30 -05:00
build_info.txt.in Update min win10 version from 1703/15063 to 1903/18362 2025-03-16 00:59:45 -05:00
ChunkFile.h Common: Replace enable_if with concepts and other minor modernizations. 2025-05-05 19:34:24 -05:00
CMakeLists.txt Common: Add a DirectIOFile class that allows for copies which are entirely thread safe. 2025-11-09 03:08:14 -06:00
CodeBlock.h Cached Interpreter 2.0 2024-07-23 14:06:21 -07:00
ColorUtil.cpp linter: Apply clang-format 19.1 formatting 2025-04-23 11:19:20 +02:00
ColorUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Common.h Common/MsgHandler: Remove non-format variants of PanicAlert 2022-01-09 12:44:14 -08:00
CommonFuncs.cpp CommonFuncs: Add StrerrorString version of LastStrerrorString that accepts an error number. 2025-10-04 14:51:17 -05:00
CommonFuncs.h CommonFuncs: Add StrerrorString version of LastStrerrorString that accepts an error number. 2025-10-04 14:51:17 -05:00
CommonPaths.h chore: remove unused Logs/Mail/ dir 2025-09-24 17:42:59 -05:00
CommonTypes.h New FrameTime/VBlank Analyzer + Graph 2022-12-23 19:52:53 -05:00
CompatPatches.cpp linter: Apply clang-format 19.1 formatting 2025-04-23 11:19:20 +02:00
Contains.h Common: Replace Contains and ContainsSubrange with C++23 std::ranges equivalents 2025-06-05 19:18:08 -04:00
CPUDetect.h CPUDetect: improve win/arm64 support 2022-07-25 21:21:11 -07:00
DirectIOFile.cpp Common: Treat DirectIOFile as unable to create SAF files 2025-11-18 23:17:03 +01:00
DirectIOFile.h Common: Add a DirectIOFile class that allows for copies which are entirely thread safe. 2025-11-09 03:08:14 -06:00
DynamicLibrary.cpp Replace 'reinterpret_cast' with 'static_cast' 2024-11-08 07:26:47 +01:00
DynamicLibrary.h VideoBackends:Vulkan: Allow loading custom drivers on Android 2023-06-11 13:52:34 +02:00
ENet.cpp Netplay: Fix building on clang 17. 2023-11-03 16:15:04 +01:00
ENet.h Netplay: Fix building on clang 17. 2023-11-03 16:15:04 +01:00
EnumFormatter.h Common: Replace enable_if with concepts and other minor modernizations. 2025-05-05 19:34:24 -05:00
EnumMap.h Common: Replace enable_if with concepts and other minor modernizations. 2025-05-05 19:34:24 -05:00
EnumMap.natvis Create EnumMap natvis 2022-01-02 15:36:47 -08:00
EnumUtils.h EnumUtils: Add Common::ToUnderlying 2023-06-17 07:15:33 -05:00
Event.h IOS: Only have one USBScanner 2025-04-21 21:57:49 +02:00
FatFsUtil.cpp fmt: Replace deprecated fmt::localtime usage with Common::LocalTime 2025-06-04 13:32:12 +02:00
FatFsUtil.h Common: Make SD pack/unpack strings translatable 2025-02-23 23:09:24 +01:00
FileSearch.cpp Merge pull request #13116 from mitaclaw/ranges-modernization-8-trivial-of 2024-12-26 16:51:53 -05:00
FileSearch.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FilesystemWatcher.cpp Fix various warnings 2025-07-12 12:47:30 +02:00
FilesystemWatcher.h Common: Add class 'FilesystemWatcher' that is used to watch paths and receive callbacks about filesystem level events for anything under that path 2025-06-06 23:03:02 -05:00
FileUtil.cpp AdvancedPane: Add a button to restore default settings 2025-10-27 15:59:33 +01:00
FileUtil.h AdvancedPane: Add a button to restore default settings 2025-10-27 15:59:33 +01:00
FixedSizeQueue.h Common: Move FixedSizeQueue into Common namespace 2023-03-22 01:23:15 -04:00
Flag.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FloatUtils.cpp FloatUtils: Replace quieting SNaNs via 0.0 + x with MakeQuiet 2025-08-17 11:24:38 -04:00
FloatUtils.h FloatUtils: Move MakeQuiet function here from Interpreter_FPUtils 2025-08-17 11:23:12 -04:00
FormatUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FPURoundMode.h Common: Move FPU-related helpers into Common namespace 2023-03-21 10:58:13 -04:00
Functional.h Common/Functional: Fix MoveOnlyFunction from inadvertently creating references from lvalues. 2025-10-22 05:06:41 -05:00
GekkoDisassembler.cpp Merge pull request #13586 from Tilka/spr_disasm 2025-05-09 18:55:53 -04:00
GekkoDisassembler.h GekkoDisassembler: Remove unused parameter dmode from fdabc function 2023-07-27 10:47:46 -07:00
GenericCPUDetect.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GenericFPURoundMode.cpp Common: Move FPU-related helpers into Common namespace 2023-03-21 10:58:13 -04:00
Hash.cpp Remove redundant 32-bit code 2023-11-28 23:03:26 +11:00
Hash.h Common/Hash: use zlib-ng for adler32. small cleanups. 2022-08-01 10:07:27 -07:00
HookableEvent.h Common: Remove the string parameters from the HookableEvent interface. 2025-11-06 22:34:40 -06:00
HostDisassembler.cpp Make overriding explicit and remove redundant virtual specifiers on overriding destructors - Core & UnitTests 2025-05-01 15:00:37 +02:00
HostDisassembler.h DolphinQt: JIT Widget Refresh 2024-10-19 02:30:44 -07:00
HRWrap.cpp fmt 10.0.0-10.1.1 compile fixes 2023-09-21 01:19:23 +02:00
HRWrap.h fmt 10.0.0-10.1.1 compile fixes 2023-09-21 01:19:23 +02:00
HttpRequest.cpp HttpRequest: remove some legacy code for windows < 8.1 2025-04-20 11:46:09 -07:00
HttpRequest.h Common/HTTP: Implement Multiform 2023-12-01 19:52:21 +01:00
Image.cpp Common and VideoCommon: Change texture data from std::vector to Common::UniqueBuffer. 2025-05-03 18:32:30 -05:00
Image.h Common and VideoCommon: Change texture data from std::vector to Common::UniqueBuffer. 2025-05-03 18:32:30 -05:00
IniFile.cpp Common/IniFile: Fix case sensitivity mismatch in IniFile::Section::Delete() 2025-01-08 05:30:39 +01:00
IniFile.h IniFile: Migrate Common::CaseInsensitiveLess to StringUtil 2024-09-21 23:15:42 -07:00
Inline.h Change _WIN32 check to a _MSC_VER check in Inline.h 2022-05-02 01:57:36 -05:00
Intrinsics.h Core/Common: Fix typos 2025-03-11 19:48:45 -04:00
IOFile.cpp 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
IOFile.h 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
JitRegister.cpp JitRegister: Remove OProfile profiler 2025-10-26 20:48:15 +01:00
JitRegister.h Common/JitRegister: Move interface into Common namespace 2023-05-02 12:00:05 -04:00
JsonUtil.cpp Common: add file serialization/deserialization functions for JSON 2024-05-31 22:36:12 -05:00
JsonUtil.h Common: update json util function for converting to numeric value to use a static_cast. As discussed, a Saturating cast doesn't make sense when converting a double to a float 2024-05-31 23:08:05 -05:00
Lazy.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
LdrWatcher.cpp Remove redundant semicolons 2024-08-20 14:59:54 +02:00
LdrWatcher.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
LinearDiskCache.h LinearDiskCache: Use make_unique_for_overwrite. 2025-04-19 17:13:40 -05:00
make_scmrev.h.js ScmRevGen: Set commits ahead to zero when on a tag 2024-06-29 22:59:40 -04:00
MathUtil.h MathUtil: Simplify SaturatingCast implementation with std::cmp_less/cmp_greater and fix a floating point edge case. 2025-08-27 21:24:46 -05:00
Matrix.cpp Common: add transpose function to Matrix class 2025-09-17 11:14:09 -05:00
Matrix.h Common: add transpose function to Matrix class 2025-09-17 11:14:09 -05:00
MemArena.h MemArena: Add Darwin implementation 2025-01-08 12:46:31 -05:00
MemArenaAndroid.cpp Common/MemArena: A zero-byte allocation is invalid. 2023-09-07 14:41:24 +02:00
MemArenaDarwin.cpp MemArenaDarwin: Initialize all address variables passed to vm_map 2025-04-16 00:50:54 -04:00
MemArenaUnix.cpp Common/MemArena: Set MAP_NORESERVE in LazyMemoryRegion on Linux. 2023-09-10 14:52:34 +02:00
MemArenaWin.cpp Modernize std::lower_bound/upper_bound with ranges and projections 2025-03-09 13:26:38 -07:00
MemoryUtil.cpp MemoryUtil: Remove availability checks for macOS 11 2025-04-21 00:24:58 -04:00
MemoryUtil.h Jit: Add more error checking to ProtectStack 2023-08-29 22:46:50 +02:00
MinizipUtil.h minizip-ng: Stop using compatibility mode 2025-05-22 12:51:55 +02:00
MsgHandler.cpp Common/MsgHandler: Use caller's file and line number in log messages 2022-01-09 12:44:14 -08:00
MsgHandler.h Common: Fix compile failure with fmt>=11 2025-01-04 19:13:05 +01:00
Mutex.h Common: Add AtomicMutex and SpinMutex classes as faster alternatives to std::mutex. 2025-11-02 20:45:55 -06:00
NandPaths.cpp WiiSaveBanner: fall back to $userdir/Load/WiiBanners 2025-07-04 23:15:50 +01:00
NandPaths.h WiiSaveBanner: fall back to $userdir/Load/WiiBanners 2025-07-04 23:15:50 +01:00
Network.cpp Common/Network: Add BluetoothAddress struct and string conversion functions. 2025-10-04 14:51:17 -05:00
Network.h Common/Network: Add BluetoothAddress struct and string conversion functions. 2025-10-04 14:51:17 -05:00
PcapFile.cpp BBA/HLE: Fix random PCAP file corruption 2023-11-23 22:07:44 +04:00
PcapFile.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Profiler.cpp Common: Make Profiler thread safe 2025-03-29 15:05:02 +01:00
Profiler.h Common: Make Profiler thread safe 2025-03-29 15:05:02 +01:00
Projection.h Common: Create Range Projections For std::pair 2025-03-09 13:19:41 -07:00
QoSSession.cpp macoS: update QoSSession with SO_NET_SERVICE_TYPE. 2025-09-22 17:30:18 -04:00
QoSSession.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Random.cpp use std-provided randomness for JitArm64 unittests 2023-02-22 12:55:12 -08:00
Random.h use std-provided randomness for JitArm64 unittests 2023-02-22 12:55:12 -08:00
Result.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
scmrev.h.in Replace SCM_IS_MASTER with SCM_COMMITS_AHEAD_MASTER 2024-03-23 16:48:52 -05:00
SCMRevGen.vcxproj msbuild: simplify lang/scm projects a bit 2022-04-27 15:06:04 -07:00
ScopeGuard.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SDCardUtil.cpp msvc: remove warning disables which no longer fire 2021-07-17 18:24:36 -07:00
SDCardUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Semaphore.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SettingsHandler.cpp fmt: Replace deprecated fmt::localtime usage with Common::LocalTime 2025-06-04 13:32:12 +02:00
SettingsHandler.h Split SettingsHandler into separate reader and writer classes 2024-10-21 20:20:15 -07:00
SFMLHelper.cpp Migrate to SFML>=3.0.0 2025-02-25 06:42:13 +01:00
SFMLHelper.h Common: Replace enable_if with concepts and other minor modernizations. 2025-05-05 19:34:24 -05:00
SmallVector.h Common: Move some duplicate container element construction logic into a ManuallyConstructedValue template. 2025-04-30 14:56:07 -05:00
SocketContext.cpp Socket: Fix connect issues when using ReShade 2024-06-11 12:18:42 +04:00
SocketContext.h rewrite tapserver interface for better error handling 2024-03-17 18:37:55 -07:00
SpanUtils.h VideoCommon: Use GetSpanForAddress safely in texture decoding 2024-04-20 18:31:08 +02:00
SPSCQueue.h Common: Move some duplicate container element construction logic into a ManuallyConstructedValue template. 2025-04-30 14:56:07 -05:00
StringLiteral.h Apply suggestions from code review 2023-02-09 18:36:20 +13:00
StringUtil.cpp StringUtil: Replace strerror with Common::LastStrerrorString. 2025-11-02 00:36:04 -05:00
StringUtil.h StringUtil: Fix many clang-tidy warnings. 2025-11-02 00:36:04 -05:00
Swap.h fmt 10.0.0-10.1.1 compile fixes 2023-09-21 01:19:23 +02:00
SymbolDB.cpp PPCSymbolDB: Don't return non-const pointers 2025-07-27 17:03:57 +02:00
SymbolDB.h PPCSymbolDB: Don't return non-const pointers 2025-07-27 17:03:57 +02:00
Thread.cpp Fix building on OpenBSD 2023-04-29 19:21:48 -04:00
Thread.h Jit: Don't use a second stack 2023-02-28 20:29:46 +01:00
Timer.cpp Common/Timer: Add a SteadyAwakeClock class which counts non-suspended system running time. 2025-07-24 23:56:10 -05:00
Timer.h Common/Timer: Add a SteadyAwakeClock class which counts non-suspended system running time. 2025-07-24 23:56:10 -05:00
TimeUtil.cpp fmt: Replace deprecated fmt::localtime usage with Common::LocalTime 2025-06-04 13:32:12 +02:00
TimeUtil.h fmt: Replace deprecated fmt::localtime usage with Common::LocalTime 2025-06-04 13:32:12 +02:00
TraversalClient.cpp TraversalClient: Resolve -Wsign-compare warning 2023-12-11 18:01:29 -05:00
TraversalClient.h Traversal: Notify user of TTL to be used 2023-05-20 17:15:10 +02:00
TraversalProto.h Core/Common: Fix typos 2025-03-11 19:48:45 -04:00
TraversalServer.cpp Common/TraversalServer: Make use of fmt more 2023-12-18 13:08:57 -05:00
TypeUtils.h MMU: Use templates for Read/Write functions 2025-10-08 11:27:06 +02:00
UnixUtil.h Common: Add some utilities to a new UnixUtil header. 2025-10-04 14:51:17 -05:00
Unreachable.h BranchWatchTableModel: Assume Unreachable Code Truly Is 2024-06-05 19:59:39 -07:00
UPnP.cpp Common/UPnP: Move interface into Common namespace 2023-04-12 14:15:58 -04:00
UPnP.h Common/UPnP: Move interface into Common namespace 2023-04-12 14:15:58 -04:00
VariantUtil.h VariantUtil: Introduce WithVariantAlternative to dynamically construct and visit a variant alternative. 2025-02-25 17:22:59 -06:00
Version.cpp Add user agent to headers for all RetroAchievements server calls 2024-06-03 00:24:43 -04:00
Version.h Add user agent to headers for all RetroAchievements server calls 2024-06-03 00:24:43 -04:00
WaitableFlag.h IOS: Only have one USBScanner 2025-04-21 21:57:49 +02:00
WindowsDevice.cpp WindowsDevice: Silence missing property log spam 2025-10-13 11:55:12 -07:00
WindowsDevice.h WindowsDevice: Add some utility functions for getting device properties using CfgMgr32. 2025-10-12 12:33:13 -05:00
WindowsRegistry.cpp Remove redundant semicolons 2024-08-20 14:59:54 +02:00
WindowsRegistry.h Remove redundant semicolons 2024-08-20 14:59:54 +02:00
WindowSystemInfo.h Core/Common: Fix typos 2025-03-11 19:48:45 -04:00
WorkQueueThread.h WorkQueueThread: Fix Cancel() race with internal command queue. 2025-05-20 21:51:25 -05:00
x64ABI.cpp Common:X64ABI: Work around clang-format being dumb 2022-08-11 23:57:28 -05:00
x64ABI.h Core/Common: Fix typos 2025-03-11 19:48:45 -04:00
x64CPUDetect.cpp StringUtil: Remove JoinStrings 2024-09-22 21:09:36 -07:00
x64Emitter.cpp x64Emitter: Fix missing-declarations warning 2025-10-30 12:35:22 +01:00
x64Emitter.h Jit64: Dynamic length of regular jump instruction (for known addresses) 2025-10-08 00:15:57 +02:00
x64FPURoundMode.cpp Common: Move FPU-related helpers into Common namespace 2023-03-21 10:58:13 -04:00
x64Reg.h x64Emitter: Support YMM registers 2025-09-02 22:15:16 +02:00