Commit Graph

84 Commits

Author SHA1 Message Date
552c0d8404 Common: Move byte swapping utilities into their own header
This moves all the byte swapping utilities into a header named Swap.h.

A dedicated header is much more preferable here due to the size of the
code itself. In general usage throughout the codebase, CommonFuncs.h was
generally only included for these functions anyway. These being in their
own header avoids dumping the lesser used utilities into scope. As well
as providing a localized area for more utilities related to byte
swapping in the future (should they be needed). This also makes it nicer
to identify which files depend on the byte swapping utilities in
particular.

Since this is a completely new header, moving the code uncovered a few
indirect includes, as well as making some other inclusions unnecessary.
2017-03-03 17:18:18 -05:00
d9d069e024 OpcodeDecoding: Convert #defines into enum constants
Gets several constants out of global scope.
2017-02-08 00:05:17 -05:00
a7bf9271b5 Fix missing includes 2017-01-24 03:31:51 +01:00
23d99f2f2c specify custom brace style to fix unions
BreakBeforeBraces: Allman apparently includes all styles,
except for AfterUnion (which is false) when using clang-format -dump-config
2017-01-05 12:55:13 +01:00
18792b2328 FifoPlayer: Don't set BPMEM_PRELOAD_MODE on load
Since in this case we're setting it based on the state at record start
time, not when a register is loaded, UseMemory would not be called, so
this could potentially wipe out texture memory that was valid.
2017-01-03 21:16:05 +10:00
5f3c878ba2 FifoPlayer: Save/restore texture memory state for fifo logs 2017-01-03 21:16:05 +10:00
438989668e FifoDataFile: Add support for storing texture memory state
This bumps the file version to 4.
2017-01-03 21:16:04 +10:00
5b315b7bb4 FifoPlayer: Reload initial state when looping back to first frame
This should ensure that when playing with loop enabled, the first frame is
in the same state each time. There is potentially still issues when the
start frame is set to something other than zero, but I'm not sure how we
could work around this without capturing the entire state on each frame.
2017-01-03 17:32:45 +10:00
72e3f1ecec Remove unnecessary ConfigManager includes
Making changes to ConfigManager.h has always been a pain, because
it means rebuilding half of Dolphin, since a lot of files depend on
and include this header.

However, it turns out some includes are unnecessary. This commit
removes ConfigManager includes from files which don't contain
SConfig or GPUDeterminismMode or GPU_DETERMINISM (which means the
ConfigManager include is not used).

(I've also had to get rid of some indirect includes.)
2016-11-27 22:38:38 +01:00
39fd6dcd5b Fix missing includes
Aren't indirect includes great?
2016-10-07 23:46:41 +02:00
d557310371 Support for dynamic BAT modification (dynamic-bat).
Fundamentally, all this does is enforce the invariant that we always
translate effective addresses based on the current BAT registers and
page table before we do anything else with them.

This change can be logically divided into three parts.  The first part is
creating a table to represent the current BAT state, and keeping it up to
date (PowerPC::IBATUpdated, PowerPC::DBATUpdated, etc.).  This does
nothing by itself, but it's necessary for the other parts.

The second part (mostly in MMU.cpp) is simply removing all the hardcoded
checks for specific untranslated addresses, and consistently translating
addresses using the current BAT configuration. Very straightforward, but a
lot of code changes because we hardcoded assumptions all over the place.

The third part (mostly in Memmap.cpp) is making the fastmem arena reflect
the current BAT configuration.  We do this by redoing the mapping (calling
memmap()) based on the BAT table whenever it changes.

One additional minor change is that translation can fail in two ways:
either the segment is a direct store segment, or page table lookup failed.
The difference doesn't usually matter, but the difference affects cache
instructions, like dcbz.
2016-09-06 08:43:22 +02:00
8b5e94a102 FifoPlayer: const correctness 2016-08-01 18:33:46 -04:00
bb52aad546 Fix building with PCH disabled. 2016-07-12 12:43:03 -05:00
f3e459091b Merge pull request #3874 from dolphin-emu/revert-3873-argh
Revert "Undo the addition of a translatable string during the string freeze"
2016-07-05 12:07:53 +02:00
7ad74832e6 Revert "Undo the addition of a translatable string during the string freeze" 2016-07-05 21:44:38 +12:00
9bfafed5b8 FifoPlayer: Get rid of semicolons on namespace braces 2016-07-01 04:36:05 -04:00
06ccfef1c1 FifoPlayer: Get rid of unnecessary includes 2016-07-01 04:25:40 -04:00
396ae89e5c FifoDataFile: Convert FifoFrameInfo's fifoData member into a vector 2016-06-29 02:54:49 -04:00
437b1294bb FifoDataFile: Convert MemoryUpdate data member to std::vector 2016-06-29 02:29:34 -04:00
8943d23a4c FifoDataFile: Make Load return a unique_ptr 2016-06-28 21:23:55 -04:00
1dee75a68e FifoRecorder: Use lock_guard instead of explicit lock/unlock 2016-06-27 04:15:16 -04:00
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
e5ffc91265 Undo the addition of a translatable string during the string freeze 2016-05-30 22:41:08 +02:00
c1922783f8 Core: Threadsafety Synchronization Fixes (Frame Advance / FifoPlayer)
Fix Frame Advance and FifoPlayer pause/unpause/stop.

CPU::EnableStepping is not atomic but is called from multiple threads
which races and leaves the system in a random state; also instruction
stepping was unstable, m_StepEvent had an almost random value because
of the dual purpose it served which could cause races where CPU::Run
would SingleStep when it was supposed to be sleeping.

FifoPlayer never FinishStateMove()d which was causing it to deadlock.
Rather than partially reimplementing CPU::Run, just use CPUCoreBase
and then call CPU::Run(). More DRY and less likely to have weird bugs
specific to the player (i.e the previous freezing on pause/stop).

Refactor PowerPC::state into CPU since it manages the state of the
CPU Thread which is controlled by CPU, not PowerPC. This simplifies
the architecture somewhat and eliminates races that can be caused by
calling PowerPC state functions directly instead of using CPU's
(because they bypassed the EnableStepping lock).
2016-05-13 09:23:44 +10:00
2db2672810 Always clear memory when booting
Reading uninitalized memory is non-deterministic. We used to only
clear the memory when using EmulatedBS2_GC or FifoPlayer, but we
now do it during Memory::Init instead so it always gets done.
2016-04-01 21:35:26 +02:00
a4a2928905 FifoPlayer: Sleep while high watermark is set. 2016-01-27 07:23:17 +01:00
159d83c5a9 FifoPlayer: Use more enums. 2016-01-26 19:19:21 +01:00
f45e1bff37 VideoInterface: Change a global into a translation-unit local variable 2016-01-21 00:39:24 -05:00
f2038b9e90 HW: Remove unnecessary header inclusions 2016-01-13 02:47:32 -05:00
790a836736 FifoAnalyzer: Fix a few warnings that visual studio missed. 2015-12-28 20:20:30 +13:00
02f476cd09 FifoRecorder: Fix bug with normal vertex arrays.
Detected by the previous commit. We had forgotten to make sure the
Vertex Loader's table of normal sizes is initilzied, resulting in
the wrong offsets/sizes being used for vertices with normals.
2015-11-23 23:02:42 +13:00
3a36bfbcbb FifoAnalyzer: Double check command size while recording.
Since we now return the value, might as well check it's correct.
2015-11-23 23:02:41 +13:00
17b7102b35 FifoAnalyzer: Remove layer of indirection. 2015-11-23 23:02:40 +13:00
9872f5b518 FifoAnalyzer: Remove old code that was meant to handle EFB copies
It wasn't working, I'm not really sure why.
Since #2997 we rely on video common to mark efb copies 'written'
during recording, and for old dffs we just ignore the bad texture
while playing back in the texture cache.
2015-11-23 23:02:39 +13:00
0367c3107d FifoAnalyzer: Unify DecodeOp/DecodeCommand
We actually discovered a bug while combining the two functions with
FifoRecordAnalzyer's vertex array loading code. If per-vertex
postion or texture matrices were enabled and vertex arrays in use
then the wrong data would be used to calculate the minimum/maxmium
indices, which would result in either too much or too little vertex
data being included in the dff.

So this commit also increments the dff version number, so we can
identify old broken dffs later.
2015-11-23 23:02:38 +13:00
1656b2788d FifoAnalyzer: Convert FifoPlaybackAnalyzer to namespace 2015-11-23 23:02:38 +13:00
da7fb568de FifoAnalyzer: Convert FifoRecordAnalyzer to namespace.
And a few minor cleanups.
2015-11-23 23:02:37 +13:00
9b60fd2381 FifoAnalyzer: remove un-implemented header 2015-11-23 23:02:35 +13:00
e6274284b0 Fifoplayer: Load the Correct version number. 2015-11-08 01:24:08 +13:00
008386fc7f Just a minor cleanup. Totally not the cause of random FifoCi failures.
This 'absolutely not' a read of uninitialized memory is '100% not'
the cause of our non-deterministic behavior on the Intel NUC.

If there was a such an error, it would show up on all FifoCi
backends equally. This is 'probably' unrelated to the fact that
the Intel NUC is the only fifoci runner not running under virtualization.
2015-11-04 23:23:35 +13:00
695ffefef7 FifoAnalyzer: Replace loop with std::accumulate 2015-10-19 10:29:00 -04:00
a2b3cdc393 FifoDataFile: Revert PadFile changes from 4.0-1127.
Fixes #9006.
2015-10-04 13:53:01 +02:00
19ac565e0d Common: Move asserts to their own header 2015-09-26 18:51:27 -04:00
aba083dd3a FifoPlayer: remove leftover code 2015-09-24 05:09:41 +02:00
aa1fec6fc3 FifoPlayer: Fixup style of types. 2015-09-23 00:03:43 +12:00
a355d9868e FifoRecorder: Use Video Common to record efb2ram correctly.
Texture updates have been moved into TextureCache, while
TMEM updates where moved into bpmem. Code for handling
efb2ram updates was added to TextureCache.

There was a bug for preloaded RGBA8 textures, it only copied
half the texture. The TODO was wrong too.
2015-09-22 23:59:16 +12:00
ac467d9fb9 FifoPlayer: Don't check efb copy hashes when plaing back a broken dff 2015-09-07 05:20:25 +12:00
633be0387d General: Remove unimplemented function prototypes 2015-09-05 22:01:07 -04:00
f6e4a8e680 FifoPlayer: Use VI derived timing, not hardcoded 60Hz 2015-09-01 20:24:42 +08:00
c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00