Commit Graph

103 Commits

Author SHA1 Message Date
Shawn Hoffman 49590c9a42 FileUtil: handle some error conditions 2020-08-23 13:55:14 -07:00
JosJuice 15d9fab0bb Common: Rename UTF16ToUTF8
This function does *not* always convert from UTF-16. It converts
from UTF-16 on Windows and UTF-32 on other operating systems.

Also renaming UTF8ToUTF16 for consistency, even though it
technically doesn't have the same problem since it only was
implemented on Windows.
2020-07-08 14:51:35 +02:00
Léo Lam f4e12f85bc
Merge pull request #8393 from CookiePLMonster/long-paths
Support Windows 10 long paths
2019-11-09 21:10:16 +01:00
Pierre Bourdon 1f3d1a9b7f
Merge pull request #8352 from rlnilsen/motion-controller-support-via-cemuhook-protocol
Support for motion controllers like the DualShock 4
2019-10-28 16:39:10 +01:00
rlnilsen da1f153b47 Rename all instances of "CemuhookUDPServer"/"UDPServer" to "DualShockUDPClient"/"DSUClient". 2019-10-27 16:05:22 +01:00
rlnilsen 4cb3baba5c Add support for motion controllers via the CemuHook controller input protocol.
This is done by:
1) Implementing said protocol in a new controller input class CemuHookUDPServer.
2) Adding functionality in the WiimoteEmu class for pushing that motion input to the emulated Wiimote and MotionPlus.
3) Suitably modifying the UI for configuring an Emulated Wii Remote.
2019-10-26 02:19:53 +02:00
JosJuice 2210a0a70c Rebuild D_REDUMPCACHE_IDX path when needed 2019-10-25 20:49:28 +02:00
Silent 689378b435
Move GetModuleName to Common
This unifies GetModuleFileName calls between Dolphin and WinUpdater
and allows to gracefully remove MAX_PATH limit from GetExePath
2019-10-07 22:46:36 +02:00
Silent 3b21d32865
Remove MAX_PATH limit from:
- GetTempFilenameForAtomicWrite
- SetUserDirectory
2019-10-07 22:45:16 +02:00
JosJuice 22933d8502 VolumeVerifier: Add datfile parsing 2019-08-24 16:37:19 +02:00
Lioncash 7346679986 Common/FileUtil: Use std::string::data within ReadFileToString
With C++17, .data() for std::string now has a non-const overload, so we
can make use of that instead of taking the address of the first element.
2019-05-29 07:06:56 -04:00
Lioncash c0f499b7f7 Common/FileUtil: Use std::string_view with WriteStringToFile
Allows writing out other forms of strings (e.g. C strings) without the
need to allocate a std::string and discard it after use.
2019-05-29 07:06:56 -04:00
Lioncash eb475025b8 Common/FileUtil: Make WriteStringToFile consistent with ReadFileToString
Makes the parameter ordering consistent and less error-prone.
2019-05-29 07:06:53 -04:00
Vlad Firoiu f4d950f4e2 Revert "Core: Remove MemoryWatcher"
This reverts commit 0c02e77eee.
2019-05-05 21:43:45 +01:00
booto 2ff0486335 Debugger/Memory: Add support for address spaces
Different address spaces can be chosen in the memory view panel.
 * Effective (or virtual): Probably the view people mostly want. Address
   translation goes through MMU.
 * Auxiliary: ARAM address space. Does not display anything in Wii mode.
 * Physical: Physical address space. Only supports mem1 and mem2 (wii
   mode) so far.
2019-05-02 21:14:30 -04:00
Techjar 0c02e77eee Core: Remove MemoryWatcher
MemoryWatcher only works on Linux and affects emulation determinism due
to scheduling additional events, which causes NetPlay to desync.
Considering that this interface is a rather specialized use case, the
communication with it is kinda crappy *and* it's affecting emulation, I
think it's best to just axe it and come up with a better implementation
of the functionality.
2019-04-28 06:22:27 -04:00
spycrab 3e3f6922c0 Common/FileUtil: Fix GetExePath() cutting off the bundle name 2019-02-26 20:00:23 +01:00
spycrab 63cdebba88 UICommon/AutoUpdate: Add macOS support 2019-02-06 20:50:09 +01:00
spycrab 71d53c922f Implement resource packs 2018-12-19 11:03:09 +01:00
spycrab 8fb3085b07 Revert "Revert "Qt/GameList: Add option to show covers in grid mode"" 2018-07-30 03:16:37 +02:00
Pierre Bourdon 9b94c76f81
Revert "Qt/GameList: Add option to show covers in grid mode" 2018-07-28 03:03:21 +02:00
spycrab 5ade5f4fe7 Qt/GameList: Add option to show covers in grid mode 2018-07-27 11:14:24 +02:00
Ryan Meredith 45b9b7d211 Give Dump Objects dedicated folder and tooltip 2018-06-06 08:42:41 -04:00
Lioncash a85aa73c4d
FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToString()
We can just use IOFile's GetSize() function to do the same thing. While
we're at it, get rid of unnecessary variables.
2018-05-11 16:27:33 -04:00
spycrab 0170052f5d Qt: Allow custom stylesheets 2018-05-08 15:07:50 +02:00
spycrab db0e5108dc Win32/FileUtil: Fix IsDirectory() not working for certain directories 2018-05-04 23:53:41 +02:00
JosJuice 6e96f62b41 Remove code related to UI.ini
We don't use it for anything, we just create it and leave it empty.
2018-05-02 18:18:27 +02:00
Pierre Bourdon 9628333b86 AutoUpdater: support optionally restarting Dolphin after update 2018-03-23 11:10:25 +01:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
JosJuice b3b7aef09a Android: Extract Sys to a different folder than the User folder 2017-12-26 09:53:32 +01:00
JosJuice d1c1793a34 Don't expose SYSDATA_DIR in a header 2017-12-24 17:13:04 +01:00
JosJuice 87d982982d Fix regression in File::CopyDir
This apparently fixes https://bugs.dolphin-emu.org/issues/10499 somehow.

The first changed line of this commit is just for performance - the
second changed line is where the difference in behavior is.
2017-08-25 19:14:14 +02:00
Pierre Bourdon a641609857 WFSI: Implement patch install finalization. 2017-08-22 23:41:37 +02:00
Léo Lam 6f923ffae4 FileUtil: Simplify File::Copy on non-Windows platforms
The old way of doing it is error prone and unnecessarily complex.
2017-08-21 18:31:46 +02:00
Pierre Bourdon 873521ce0b Revert "Try to fix File::Copy with non-1024-byte aligned sizes" 2017-08-21 18:29:58 +02:00
Markus Wick 8280d15357 Merge pull request #5939 from JonnyH/WIP/broken-fstream-copy
Try to fix File::Copy with non-1024-byte aligned sizes
2017-08-21 17:01:16 +02:00
Sepalani 4e5fe6366a CommonFuncs: LastStrerrorString added 2017-08-18 20:08:50 +01:00
Jonathan Hamilton 643b3ba9f8 Try to fix File::Copy with non-1024-byte aligned sizes
ifstream::read() sets the failbit if trying to read over the end, which
means that (!input) would be hit for the 'last' block if it wasn't
exactly BSIZE (1024) bytes.
2017-08-17 14:08:56 -07:00
JosJuice 5ca3aee00a FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row
(in particular, FileUtil.cpp itself did it a lot...), which is
a waste since it's possible to call stat a single time and then
read all three values from the stat struct. This commit adds a
File::FileInfo class that calls stat once on construction and
then lets Exists/IsDirectory/GetSize be executed very quickly.

The performance improvement mostly matters for functions that
can be handling a lot of files, such as File::ScanDirectoryTree.

I've also done some cleanup in code that uses these functions.
For instance, some code had checks like !Exists() || !IsDirectory(),
which is functionally equivalent to !IsDirectory(), and some
code was using File::GetSize even though there was an IOFile
object that the code could call GetSize on.
2017-06-29 19:07:29 +02:00
Léo Lam 01faa5c852 FileUtil: Use errno for printing errors in IsDirectory
stat() returns an error code in errno on both POSIX compliant
platforms and Windows.

This means we should always use errno instead of GetLastErrorMsg
which uses GetLastError() (Win32) on Windows.
2017-06-16 12:43:41 +02:00
Léo Lam aa63199977 FileUtil: Don't manually strip trailing slashes
POSIX allows one or more trailing slashes for directories.

From POSIX.1-2008, section 3.271 (Base Definitions / Pathname):

> A pathname can optionally contain one or more trailing <slash>
> characters. Multiple successive <slash> characters are considered to
> be the same as one <slash>, except for the case of exactly two
> leading <slash> characters.

On Windows, the extra trailing slashes are ignored for directories too.
2017-06-16 12:31:26 +02:00
JosJuice f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +02:00
Shawn Hoffman 9357cee2ef do not assign in conditional statements 2017-06-07 20:09:44 -07:00
Shawn Hoffman e1a3e41bf3 fix various instances of -1 being assigned to unsigned types 2017-06-07 19:52:07 -07:00
Ryan Houdek a2f5c3dbe0 Add some missing INI files to FileUtil 2017-02-16 09:33:50 +01:00
Chris Burgener 5224771dac Copy Wii save for current game for Netplay and TAS 2017-02-05 13:17:05 -05:00
Michael Maltese 713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
Pierre Bourdon 45d27f7fc7 CommonPaths: Add D_WFSROOT_IDX.
Defaults to $USERDIR/WFS. Used to store the contents normally stored on
WFS mass storage devices.
2017-01-14 17:06:40 +01:00
Lioncash 6f08ef9a25 IOFile: Get rid of IOFile's ReleaseHandle function
Transfer of handles should be done via std::move.
2017-01-12 12:34:06 -05:00
Lioncash 045a8400e6 IOFile: Make the move constructor and move assignment operator noexcept
Certain parts of the standard library try to determine whether or not a
transfer operation should either be a copy or a move. The prevalent notion
of move constructors/assignment operators is that they should not throw,
they simply move an already existing resource somewhere else.

This is typically done with 'std::move_if_noexcept'. Like the name says,
if a type's move constructor is noexcept, then the functions retrieves an
r-value reference (for move semantics), or an l-value (for copy semantics)
if it is not noexcept.

As IOFile deletes the copy constructor and copy assignment operators,
using IOFile with certain parts of the standard library can fail in
unexcepted ways (especially when used with various container
implementations). This prevents that.
2017-01-04 18:37:48 -05:00