Commit Graph

46 Commits

Author SHA1 Message Date
Pierre Bourdon 9628333b86 AutoUpdater: support optionally restarting Dolphin after update 2018-03-23 11:10:25 +01:00
JosJuice b3b7aef09a Android: Extract Sys to a different folder than the User folder 2017-12-26 09:53:32 +01:00
Pierre Bourdon a641609857 WFSI: Implement patch install finalization. 2017-08-22 23:41:37 +02:00
JosJuice 09f3f9b41a Remove NonCopyable
The class NonCopyable is, like the name says, supposed to disallow
copying. But should it allow moving?

For a long time, NonCopyable used to not allow moving. (It declared
a deleted copy constructor and assigment operator without declaring
a move constructor and assignment operator, making the compiler
implicitly delete the move constructor and assignment operator.)
That's fine if the classes that inherit from NonCopyable don't need
to be movable or if writing the move constructor and assignment
operator by hand is fine, but that's not the case for all classes,
as I discovered when I was working on the DirectoryBlob PR.

Because of that, I decided to make NonCopyable movable in c7602cc,
allowing me to use NonCopyable in DirectoryBlob.h. That was however
an unfortunate decision, because some of the classes that inherit
from NonCopyable have incorrect behavior when moved by default-
generated move constructors and assignment operators, and do not
explicitly delete the move constructors and assignment operators,
relying on NonCopyable being non-movable.

So what can we do about this? There are four solutions that I can
think of:

1. Make NonCopyable non-movable and tell DirectoryBlob to suck it.

2. Keep allowing moving NonCopyable, and expect that classes that
   don't support moving will delete the move constructor and
   assignment operator manually. Not only is this inconsistent
   (having classes disallow copying one way and disallow moving
   another way), but deleting the move constructor and assignment
   operator manually is too easy to forget compared to how tricky
   the resulting problems are.

3. Have one "MovableNonCopyable" and one "NonMovableNonCopyable".
   It works, but it feels rather silly...

4. Don't have a NonCopyable class at all. Considering that deleting
   the copy constructor and assignment operator only takes two lines
   of code, I don't see much of a reason to keep NonCopyable. I
   suppose that there was more of a point in having NonCopyable back
   in the pre-C++11 days, when it wasn't possible to use "= delete".

I decided to go with the fourth one (like the commit title says).
The implementation of the commit is fairly straight-forward, though
I would like to point out that I skipped adding "= delete" lines
for classes whose only reason for being uncopyable is that they
contain uncopyable classes like File::IOFile and std::unique_ptr,
because the compiler makes such classes uncopyable automatically.
2017-08-22 16:40:34 +02: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
JosJuice cf94ce6305 Add a namespace to OpenFStream
For consistency with the other functions in FileUtil.h.
2017-06-15 21:34:04 +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
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
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 1dab2c8816 IOFile: Correct explicit operator bool semantics
The operator void* variant was m_good ? m_file : nullptr;
so this was leaving out the file handle check.
2017-01-08 22:52:44 -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
Lioncash 9b8f5bce22 IOFile: Change 'operator void*' into 'explicit operator bool'
'operator void*' is basically a pre-C++11-ism that was used, as C++03
only had the notion of implicit type-conversion operators, but not explicit type
conversion operators (allowing implicit conversion of a file handle to
bool can go downhill pretty quickly).
2017-01-04 18:10:21 -05:00
Lioncash c541e1099e IOFile: Make class variables private
Internals shouldn't be directly exposed.
2017-01-04 17:48:46 -05:00
Lioncash c21dad9e83 IOFile: Get rid of unnecessary unimplemented copy constructor/assignment operator.
IOFile already inherits NonCopyable.
2017-01-04 17:47:40 -05:00
JosJuice e56bec9c87 Fix outdated comments in ScanDirectoryTree 2016-12-25 21:57:33 +01:00
JosJuice de355a8521 Revert "IOS HLE: Prevent accessing host file system"
This reverts commit 141f3bfb3a.
The implementation of getting absolute paths wasn't working
on non-Windows systems, which is a huge problem for IOS HLE.
2016-11-26 15:50:28 +01:00
JosJuice 141f3bfb3a IOS HLE: Prevent accessing host file system 2016-11-13 10:03:23 +01:00
shuffle2 f121fa07c2 Merge pull request #2868 from sepalani/dolphin_ssl
Dolphin new Dump SSL features
2016-10-03 06:16:49 -07:00
Aestek 9c5b546e2e Add Wii sdcard to CommonPaths 2016-07-16 22:48:46 +02:00
Sepalani 529ca245d7 Added: more SSL features, plus SSL dump folder
Dump: rootca, peercert
2016-07-01 14:33:54 +04:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
mathieui f15ffda5a7 Correct ampersands as well 2016-01-21 21:27:56 +01:00
mathieui 3e283ea9f1 More asterisks 2016-01-21 21:16:51 +01:00
spxtr 2f50560602 Add support for sending game memory changes to outside processes 2015-12-29 17:59:16 -08:00
Mathieu Comandon f2ae1a2545 Implement relocatable builds on Linux
- Change the path of the Sys folder to the executable's location
- Add LINUX_LOCAL_DEV flag to use relocatable version on Linux
- Add CMake definition for relocatable build
2015-11-10 12:49:04 -08:00
spxtr d9d6cf8eda GC controller input using named pipes
Currently only works on unix, but can be extended to other systems. Can
also be extended to do wiimotes.

Searches the Pipes folder for readable named pipes and creates a dolphin
input device out of them. Send controller inputs to the game by writing
to the file. Commands are described in Pipes.h.
2015-10-24 20:20:03 -07:00
Lioncash cc036ca86c Common: Remove other Common prefixed headers from Common.h 2015-09-26 18:51:58 -04:00
Lioncash 1d42db2439 Common: Move NonCopyable to its own header 2015-09-26 18:50:35 -04:00
JosJuice d276d1abbb Fix VolumeDirectory
Fixes the regression from a225426 and clarifies a related comment.
2015-08-26 19:21:09 +02:00
comex dc91e8b607 Add a mode to use a dummy Wii NAND.
Eventually, netplay will be able to use the host's NAND, but this could
still be useful in some cases; for TAS it definitely makes sense to have
a way to avoid using any preexisting NAND.

In terms of implementation: remove D_WIIUSER_IDX, which was just WIIROOT
+ "/", as well as some other indices which are pointless to have as
separate variables rather than just using the actual path (fixed, since
they're actual Wii NAND paths) at the call site.  Then split off
D_SESSION_WIIROOT_IDX, which can point to the dummy NAND directory, from
D_WIIROOT_IDX, which always points to the "real" one the user
configured.
2015-05-28 19:14:42 -04:00
comex a225426510 Rewrite FileSearch and improve ScanDirectoryTree.
- FileSearch is now just one function, and it converts the original glob
  into a regex on all platforms rather than relying on native Windows
  pattern matching on there and a complete hack elsewhere.  It now
  supports recursion out of the box rather than manually expanding
  into a full list of directories in multiple call sites.

  - This adds a GCC >= 4.9 dependency due to older versions having
  outright broken <regex>.  MSVC is fine with it.

- ScanDirectoryTree returns the parent entry rather than filling parts
  of it in via reference.  The count is now stored in the entry like it
  was for subdirectories.

- .glsl file search is now done with DoFileSearch.

- IOCTLV_READ_DIR now uses ScanDirectoryTree directly and sorts the
  results after replacements for better determinism.
2015-05-28 19:14:42 -04:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Lioncash b0613bb1c8 General: Apply the const specifier where applicable 2015-04-15 02:04:03 -04:00
Ryan Houdek aaf04aeaca Fix user directories at times doing stupid things.
With my previous changes Dolphin would fail to create the user directory if it didn't exist, and would dump all the configuration options in to the cwdir.
This was a bit more complicated to fix in a clean fashion, so I took to moving around code concerning user directories.
Instead of having GetUserPath serve a dual purpose of both getting and setting our user directories, break out to a new SetUserPath function.

GetUserPath will know only get the configured user path.
SetUserPath will set our user paths and setup the internal user path state.

This ending up being a lot cleaner overall, which is nice. Also less mind bending when attempting to read the code.

So now we won't dump all of our configuration in to the cwdir if ~/.dolphin-emu isn't found.

Fixes issue 8371.
2015-03-15 09:19:48 -05:00
Rachel Bryk b1e14a65a2 Read game title from ini file, or titles.txt if it exists. 2014-10-22 22:19:40 -04:00
Lioncash a82675b7d5 Kill off some usages of c_str.
Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
2014-03-14 13:51:23 -04:00
Tillmann Karras d802d39281 clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
2014-03-09 21:14:26 +01:00
Pierre Bourdon 83b7bb64aa Make Common/ mostly IWYU clean (and fix errors in rest of the project detected by this change). 2014-02-22 23:37:29 +01:00
Lioncash 2afe215271 Convert all includes to relative paths. 2014-02-18 02:19:10 -05:00
Lioncash 3fd87a7636 Second and final pass of clearing out tabs. 2014-02-17 02:19:41 -05:00
lioncash d2038049f5 Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Lioncash ebb48d019e Clean up some struct indentations
Also cleaned up the indentations of some variable declarations.
2014-02-09 19:40:11 -05:00
Jasper St. Pierre 34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00