Commit graph

61 commits

Author SHA1 Message Date
Lobsterzelda
ed54e1905a HostFileSystem: Set all NAND folders to be saved in save states when a movie is active 2022-11-10 14:02:29 -05:00
Pokechu22
e8221d7948 Common/PointerWrap: Remove DoPOD
This was added in 385d8e2b15, but became somewhat redundant with Do in 4c7bbd96e4, and completely redundant now that std::is_trivially_copyable_v is well-supported.
2022-10-06 11:25:36 -07:00
Minty-Meeo
69e32dea52 Resolve GCC Warnings 2022-06-30 15:26:48 -05:00
Dentomologist
c8e20c569b Convert PointerWrap::Mode to enum class 2022-05-25 13:16:46 -07:00
Dentomologist
f6b9acccfc Common: Refactor PointerWrap 2022-05-25 13:06:41 -07:00
Admiral H. Curtiss
ef760ee012
Common/PointerWrap: Prevent reads/writes past the end of the buffer. 2022-04-18 23:48:00 +02:00
Admiral H. Curtiss
853cf4f818
Common/PointerWrap: Hide internals. 2022-04-18 03:41:14 +02:00
Pokechu22
44e93e91d7 Common/Assert: Switch to fmt 2022-01-09 12:43:11 -08:00
Pokechu22
ba107819ec Create EnumMap 2021-10-24 11:48:36 -07:00
Pierre Bourdon
e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
JosJuice
8a0f5ea04a Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
JosJuice
b93983b50a Remove Atomic.h
The STL has everything we need nowadays.

I have tried to not alter any behavior or semantics with this
change wherever possible. In particular, WriteLow and WriteHigh
in CommandProcessor retain the ability to accidentally undo
another thread's write to the upper half or lower half
respectively. If that should be fixed, it should be done in a
separate commit for clarity. One thing did change: The places
where we were using += on a volatile variable (not an atomic
operation) are now using fetch_add (actually an atomic operation).

Tested with single core and dual core on x86-64 and AArch64.
2021-05-13 18:56:27 +02:00
ash!!
43ceba4fef optimize TextureCacheBase::SerializeTexture, ::DeserializeTexture
texture serialization and deserialization used to involve many memory
allocations and deallocations, along with many copies to and from
those allocations. avoid those by reserving a memory region inside the
output and writing there directly, skipping the allocation and copy to
an intermediate buffer entirely.
2021-04-18 13:40:42 -07:00
Lioncash
139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
JosJuice
2137fb7813 Externals: Add zstd
I had to rename Source/Common/Compiler.h because the VS build
confuses it with Externals/zstd/lib/common/compiler.h otherwise.
2020-05-13 20:53:10 +02:00
Pokechu22
a695b05b21 Add support for std::optional to PointerWrap 2020-01-04 11:43:26 -08:00
Stenzek
cecefa2d97 ChunkFile: Don't access element zero of empty container
This was causing assertion failures in debug MSVC builds.
2019-02-10 13:28:50 +10:00
Tillmann Karras
04a92482bf ChunkFile: treat vectors/strings as sized arrays 2019-02-01 05:13:16 +00:00
Lioncash
c825eecbc9 ChunkFile: Remove unnecessary includes
ChunkFile doesn't use any of the file utilities, so we can drop these
headers to avoid pulling in unnecessary dependencies. This also
uncovered a few indirect inclusions.
2018-06-09 16:49:59 -04:00
Lioncash
3f210836ad Compiler: Rename __forceinline define to DOLPHIN_FORCE_INLINE
This is much better as prefixed double underscores are reserved for the
implementation when it comes to identifiers. Another reason its better,
is that, on Windows, where __forceinline is a compiler built-in, with
the previous define, header inclusion software that detects unnecessary
includes will erroneously flag usages of Compiler.h as unnecessary
(despite being necessary on other platforms). So we define a macro
that's used by Windows and other platforms to ensure this doesn't
happen.
2018-06-09 12:20:25 -04:00
Lioncash
03414e8e84 Common: Add header for compiler-specifics
Instead of globbing things under an ambiguous Common.h header, move
compiler-specifics over to Compiler.h. This gives us a dedicated home
for anything related to compilers that we want to make functional across
all compilers that we support.

This moves us a little closer to eliminating Common.h entirely.
2018-06-09 12:10:05 -04:00
Léo Lam
5b90aba624 ChunkFile: Replace macro with a variable template
Note that std::is_trivially_copyable_v cannot be used yet (C++17 only).
2018-05-30 11:39:30 +02:00
Léo Lam
8a00a9e149 Remove old GCC version checks 2018-05-30 10:59:15 +02: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
72b7b96571 Remove IsTriviallyCopyable hack for VS 2017-11-13 19:51:16 +01:00
Lioncash
696e1b40b5 Common: Move version strings to their own header
Ideally Common.h wouldn't be a header in the Common library, and instead be renamed to something else, like PlatformCompatibility.h or something, but even then, there's still some things in the header that don't really fall under that label

This moves the version strings out to their own version header that doesn't dump a bunch of other unrelated things into scope, like what Common.h was doing.

This also places them into the Common namespace, as opposed to letting them sit in the global namespace.
2017-09-09 19:28:10 -04:00
Shawn Hoffman
f16599f4a8 DolphinWX: defer gamelist scanning and switch to single-file cache. 2017-06-23 17:25:53 -07: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
Léo Lam
ea0335f7c1 Fix ChunkFile for std::set
Without this, attempts to savestate std::set will fail with an error
about dropping the const qualifier.

<Lioncash> leoetlino: I'll try to break it down: So, when you do a
 ranged-for on a container, it's essentially syntactic sugar over begin
 and end iterators. std::set is an associative container where the key
 type is the same as the value type, and so it's required that all
 iterator functions return constant iterators. If this wasn't a
 requirement, it would allow changing the ordering of elements from
 outside of the set's API (this is bad).
2017-01-14 19:00:19 +01:00
EmptyChaos
17c34ae0b1 CoreTiming: Data structure cleanup
Replace adhoc linked list with a priority heap. Performance
characteristics are mostly the same, but is more cache friendly.

[Priority Queues have O(log n) push/pop compared to the linked
list's O(n) push/O(1) pop but the queue is not big enough for
that to matter, so linear is faster over linked. Very slight gains
when framelimit is unlimited (Wind Waker), 1900% -> 1950%]
2016-09-03 12:46:14 +10:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
dhust
19fed720ff _DEFAULT_SOURCE flag added, and clang check for IsTriviallyCopyable macro
fix clang ver check for 4.0 +

using clang macro __has_feature

__GLIBCXX__ check added

fix __has_feature
2016-06-19 18:32:19 -03:00
Lioncash
4ae4b241ec ChunkFile: Handle bool in a stable way across platforms
bool is not always guaranteed to be the same size on every platform.
On some platforms it may be one byte, on others it can be 8 bytes if the
platform dictates it. It's implementation-defined.

This can be problematic when it comes to storing this
data to disk (it can also be space-inefficient, but that's not really an
issue). Also say for some reason you moved your savestates to another
platform, it's possible they won't load correctly due to differences in size.

This change stores all bools to savestates as if they were a byte in size
and handles the loading of them accordingly.
2016-04-14 22:55:03 -04:00
mathieui
3e283ea9f1 More asterisks 2016-01-21 21:16:51 +01:00
Tillmann Karras
ae999cb43c Wiimote: simplify DoState() parameters 2015-10-11 23:37:34 +02:00
Tillmann Karras
0f1b287402 Misc. style fixes 2015-10-10 17:44:42 +02:00
Lioncash
c6678687b0 ChunkFile: Provide additional helpers for C-style arrays
Gets rid of magic numbers in cases where the array size is known at compile time.
This is also useful for future entries that are stack allocated arrays as these
functions prevent incorrect sizes being provided.
2015-09-30 19:45:46 -04:00
Lioncash
cc036ca86c Common: Remove other Common prefixed headers from Common.h 2015-09-26 18:51:58 -04:00
Lioncash
19ac565e0d Common: Move asserts to their own header 2015-09-26 18:51:27 -04:00
Shawn Hoffman
66a3951c3b [windows] Add workaround(HACK) for vs2015 implementating a conformant std::is_trivially_copyable...
see https://github.com/dolphin-emu/dolphin/pull/2218
2015-09-03 04:39:06 -07:00
degasus
ebad10f2a1 Common: Fix IsTriviallyCopyable macro for GCC 5
Based on quarthex's patch in PR #2440
2015-05-26 19:50:14 +02: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
Jordan Cristiano
4051da75e4 Made cycle count atomic to avoid using a mutex 2015-03-31 04:09:33 -04:00
Stevoisiak
93b16a4a2d Formatting/Whitespace Cleanup
Various fixes to formatting and whitespace
2015-02-25 10:48:21 -05:00
Augustin Cavalier
1e17bbce0f DolphinQt: GameList! 2014-11-21 18:36:49 -05:00
Tony Wasserka
6d4fd54683 ChunkFile: Add a DoArray overload which takes an std::array.
This is inconsistent with how other containers are used (i.e. with Do()), but making std::array be used with Do() seems rather confusing when there's also a DoArray available.
2014-09-21 10:38:22 +02:00
Rohit Nirmal
fbc64984ca Include CommonTypes.h instead of Common.h. 2014-09-08 15:39:58 -04:00
comex
faa2666393 PointerWrap currently checks its mode for every individual byte of everything it 'does', including all of RAM. Make it not do that.
Decreases total Wii state save time (not counting compression) from
~570ms to ~18ms.

The compiler can't remove this check because of potential aliasing; this
might be fixable (e.g. by making mode const), but there is no reason to
have the code work in such a braindead way in the first place.

- DoVoid now uses memcpy.
- DoArray now uses DoVoid on the whole rather than Doing each element
(would fail for an array of STL structures, but we don't have any of
those).
- Do also now uses DoVoid.  (In the previous version, it replicated
DoVoid's code in order to ensure each type gets its own implementation,
which for small types then becomes a simple load/store in any modern
compiler.  Now DoVoid is __forceinline, which addresses that issue and
shouldn't make a big difference otherwise - perhaps a few extra copies
of the code inlined into DoArray or whatever.)
2014-08-28 15:35:19 -04:00
comex
de7294ecc1 Add Flag support to ChunkFile.h 2014-08-26 12:43:39 -04:00