Commit Graph

24509 Commits

Author SHA1 Message Date
Lioncash 4601136b08 WiimoteDevice: Get rid of pointer casting in CBigEndianBuffer
Gets rid of more places where we can violate alignment requirements and
aliasing rules.
2018-06-02 15:02:03 -04:00
Lioncash 13e828fd4d WiimoteDevice: Move CBigEndianBuffer to the cpp file
This is only used internally, so we don't need to expose it in the
header. This also allows getting rid of inclusion of the byte swapping
utilities in the header as well.
2018-06-02 14:55:05 -04:00
Anthony 8d1b2f9cae
Merge pull request #7045 from lioncash/fres
Interpreter_FloatingPoint: Don't store to destination in fres if VE or ZE is set and a relevant exception occurs
2018-06-02 11:42:34 -07:00
Lioncash b1c7ce75e4 EXI_DeviceIPL: Replace superfluous virtual with override on destructor 2018-06-02 14:18:49 -04:00
Lioncash 0d89650950 EXI_DeviceIPL: Use std::array where applicable 2018-06-02 14:18:02 -04:00
Lioncash bf4775f95f EXI_DeviceIPL: Normalize variable names
Makes naming consistent with our coding style.
2018-06-02 14:14:08 -04:00
Lioncash b6203c66c2 EXI_DeviceIPL: In-class initialize data members where applicable 2018-06-02 14:08:01 -04:00
spycrab f6865117e4 Qt/FilesystemWidget: Add size column 2018-06-02 18:59:56 +02:00
Léo Lam f09f83c309
Merge pull request #7019 from Ebola16/VSQT
Make DolphinQT2 the default project in dolphin-emu.sln
2018-06-02 14:23:20 +02:00
Léo Lam 62fdef0e6c
Merge pull request #7046 from lioncash/priv
EXI_DeviceMic: Make data members of CEXIMic private
2018-06-02 11:53:07 +02:00
Stenzek bc96557ec4 Externals: Update glslang to upstream commit 32d3ec3 2018-06-02 07:34:31 +00:00
spycrab 0e8db9fd1d Analytics: Report update track 2018-06-02 05:59:03 +02:00
Lioncash 3906859984 EXI_DeviceMic: Remove unimplemented StreamLog function prototype 2018-06-01 20:43:28 -04:00
Lioncash 9e068ad2c4 EXI_DeviceMic: Make data members of CEXIMic private
Given they were only made public so that the callback could access class
state, we can simply make the callback a private static function of
CEXIMic, which allows access to members from the callback function
without making all of said members public.
2018-06-01 20:43:28 -04:00
Lioncash 179d73ac0d Interpreter_FloatingPoint: Clear FPSCR.FI and FPSCR.FR if an SNaN is an input to fres
In the PEM manual, within Table 3-12, which lists what should occur for
invalid operation exceptions, the FPSCR.FI and FPSCR.FR bits are listed
as "Cleared" for when FPSCR.VE is unset and set. So we clear these bits
as well to match hardware behavior.
2018-06-01 20:21:13 -04:00
Lioncash a08ad82ace Interpreter_FloatingPoint: Don't store to destination in fres if VE or ZE is set and a relevant exception occurs
In the PowerPC Microprocessor Family: The Programming Environments
Manual for 32 and 64-bit Microprocessors, in section 3.3.6.1, Table
3-12 lists what should occur if an invalid operation exception occurs in
situations where VE is set and when VE is not set. In the case where VE
is set, it lists the frD as "Unchanged". It also lists the FPRF flags as
"Unchanged".

Further down in Table 3-13, the listings for what should occur when zero
divide exceptions occur is listed, both for when ZE is set, and when it
isn't. When ZE is set, it lists frD as "Unchanged". It also lists the
FPRF flags as "Unchanged" as well.

This also alters the code so that we don't even calculate the result if
we don't need to compute it, making it a little bit less wasteful.
2018-06-01 20:21:09 -04:00
Léo Lam 69abaf3ec4 WiiSave: Merge Header and DataBinHeader to reduce noise
DataBinHeader is not used anywhere in the code other than via Header,
so let's merge them to reduce noise when accessing header fields
(currently we have to do header.hdr which looks silly).
2018-06-01 23:45:58 +02:00
Léo Lam 210377816d WiiSave: Get rid of some magic numbers
It would make sense for 0x80 and 0xf0c0 to be respectively
sizeof(BkHeader) and sizeof(Header) as Nintendo is signing anything
that comes after the header, including the BkHeader.
2018-06-01 23:44:24 +02:00
Léo Lam 8eafd1928e WiiSave: Move user interaction to UI frontends 2018-06-01 20:46:35 +02:00
Léo Lam 4df266f943 WiiSave: Use the correct length for paths
Paths can never exceed 0x40 characters as this is the maximum length
that is allowed by IOS (and probably the common FS library too).
2018-06-01 20:46:35 +02:00
Léo Lam 8af16fdd28 WiiSave: Use an enum class for save file type 2018-06-01 18:58:34 +02:00
Anthony fcae27981a
Merge pull request #7044 from JosJuice/android-refresh-all-fragments
Android: Refresh all fragments, not just the selected one
2018-06-01 09:53:19 -07:00
JosJuice 1b127bdf33 Android: Refresh all fragments, not just the selected one
This fixes the oddity of having to manually refresh after adding a
folder that contains games for a different tab than the one you're on.
2018-06-01 18:17:51 +02:00
Anthony a9684b5c67
Merge pull request #7041 from spycrab/qt_dbg_bselect
Qt/MemoryWidget: Allow operating on columns
2018-06-01 09:05:52 -07:00
Anthony d935f78692
Merge pull request #7043 from JosJuice/gamefile-includes
GameFile: Include necessary DiscIO headers
2018-06-01 09:05:10 -07:00
spycrab 3b59ebb226 Qt: Exit exclusive fullscreen on confirmation prompt 2018-06-01 17:40:07 +02:00
Ryan Meredith 4e010912cd Android: Consistently use description 2018-06-01 09:58:34 -04:00
JosJuice 533a49460a GameFile: Include necessary DiscIO headers 2018-06-01 14:19:16 +02:00
Léo Lam 94953670f2 WiiSave: Move overwrite prompt to Import
WriteHeader should just write the header and not do anything else.
2018-06-01 00:14:48 +02:00
spycrab 5f5b05f3dc Qt/MemoryWidget: Allow operating on columns 2018-05-31 22:07:05 +02:00
Léo Lam a46a8dd378 WiiSave: Refactor import/export code
The current WiiSave code is extremely messy, as it exposes all kinds of
implementation details in the header (including internal struct
definitions and magic numbers that don't have to be).

The read/write code is intermingled, so it's hard to tell which members
are used, or when/where they are set at all.

It also implicitly relies on some functions being called in a specific
order since it doesn't seek manually every time, which makes the code
even more fragile.

The logic is also hardcoded to only support bin->nand or nand->bin,
even though it would be useful to support nand->nand (for the
Movie save copying code, for example).

This commit attempts to solve these problems by getting rid of the
WiiSave class:

* Read/write code is moved to new Storage classes (NandStorage and
  DataBinStorage) with small, clear functions that do one and only
  one thing.

* The import/export logic was refactored into a generic Copy function
  that takes two storages as parameters.

* The existing import and export functions are now just small wrappers
  that call Copy with the appropriate storages.
2018-05-31 20:52:01 +02:00
Léo Lam 60dd2553c6
Merge pull request #7033 from lioncash/jitarm
JitArm64_BackPatch: Correct usage of an invalidated iterator after a std::map erase() call in HandleFastmemFault()
2018-05-31 18:05:47 +02:00
Anthony a9a03d1565
Merge pull request #7034 from lioncash/override
JitArm64/Jit_Util: Add missing override specifiers
2018-05-31 08:48:35 -07:00
Mat M dd77ace56a
Merge pull request #7005 from lioncash/div
Interpreter_FPUtils: Correct setting the FPSCR's zero divide exception flag in the 0/0 case in NI_div()
2018-05-31 11:22:45 -04:00
Mat M f1b7259446
Merge pull request #6978 from lioncash/fcti
Interpreter_FloatingPoint: Handle NaN flag setting within fctiw and fctiwz
2018-05-31 11:22:04 -04:00
spycrab 8e5a96fcfc Qt/GeneralWidget: Show tooltip when adapters are not supported by the backend 2018-05-31 03:52:18 +02:00
spycrab d453dc2342 Qt/MemoryWidget: Fix sidebar items being stretched out 2018-05-30 23:23:02 +02:00
spycrab 390fb37a29
Merge pull request #7032 from spycrab/qt_macos_mpbtn_round
Qt/macOS: Fix mapping buttons not being round
2018-05-30 22:45:15 +02:00
spycrab d1db841ada
Merge pull request #7035 from spycrab/qt_macos_info_width
Qt/macOS: Fix InfoWidget fields being too narrow
2018-05-30 19:13:08 +02:00
spycrab 5f9d4d625f Qt/macOS: Fix InfoWidget fields being too narrow 2018-05-30 17:26:37 +02:00
Lioncash bffcaf3218 JitArm64_BackPatch: Correct usage of an invalidated iterator after a std::map erase() call in HandleFastmemFault()
Given the iterator gets invalidated within the erase() call, just keep a
temporary around to store the pointer address.
2018-05-30 11:08:11 -04:00
Lioncash ba6c371746 JitArm64/Jit_Util: Add missing override specifiers 2018-05-30 10:50:11 -04:00
Markus Wick 6c7e9f73da
Merge pull request #7030 from lioncash/emitter
x64Emitter: Amend parameter ordering for WriteModRM()'s prototype
2018-05-30 16:39:26 +02:00
spycrab 102d469f9e Qt/macOS: Fix mapping buttons not being round 2018-05-30 16:39:07 +02:00
Markus Wick f02b2f0cad
Merge pull request #7031 from lioncash/naming
AudioInterface: Minor changes
2018-05-30 16:38:18 +02:00
Lioncash 038bb9b3e1 AudioInterface: Use member initializers where applicable for unions
Migrates more code to the initialization capabilities available since C++11
2018-05-30 09:49:28 -04:00
Lioncash b59cda1435 AudioInterface: Amend variable naming
Normalizes variable names to conform to our coding conventions.
Previously we were signifying some variables as externally linked
globals, which wasn't the case.
2018-05-30 09:47:08 -04:00
Lioncash 81e11b2406 x64Emitter: Amend parameter ordering for WriteModRM()'s prototype
The definition of the function uses the ordering {mod, reg, rm}, which
is correct. Match the prototype to this, so that the parameter list
isn't misleading.
2018-05-30 09:30:24 -04:00
Léo Lam bdfd331355
Merge pull request #7028 from lioncash/obsolete
GeneralPane: Replace usages of obsolete QString member function sprintf
2018-05-30 15:02:41 +02:00
Lioncash f845818cfe VolumeWii: Shorten padding checking code within CheckIntegrity()
We can just use std::any_of here to collapse the checking code down to a
single assignment as opposed to a loop. This also slightly improves on
the existing code, as this won't continue to iterate through the cluster
metadata if an entry that's non-zero is encountered.
2018-05-30 08:42:32 -04:00
Lioncash bd585f7389 GeneralPane: Replace usages of obsolete QString member function sprintf
sprintf is listed as obsolete within the documentation for Qt 5. Instead,
it recommends using the asprintf member function, arg(), or QTextStream.
2018-05-30 06:50:59 -04:00
Léo Lam 4fb2d580d8
Merge pull request #7026 from lioncash/name
JitAsmCommon: Normalize member variable names within CommonAsmRoutinesBase
2018-05-30 12:02:08 +02:00
Léo Lam fb124c2eb0 Use nested namespaces for IOS HLE
Pretty much all of the source files contain the following:

    namespace IOS
    {
    namespace HLE
    {
    namespace <name>
    {
    // actual code here
    }  // namespace <name>
    }  // namespace HLE
    }  // namespace IOS

which is really verbose boilerplate, because most of the files inside
of Core/IOS are for IOS HLE.

This commit replaces that with a more concise `namespace IOS::HLE`
or `namespace IOS::HLE::(name)`.
2018-05-30 11:40:05 +02: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
Lioncash 986d644a01 JitAsmCommon: Make CommonAsmRoutinesBase a struct
This is just used as a means of carting around routines. It's not meant
to directly have functionality embedded within it--this is the job of
the inheriting data structure--so we can just make this a basic struct.

Particularly given all the data members were public to begin with.
2018-05-30 05:22:41 -04:00
Lioncash f5f4c10fd1 JitAsmCommon: Amend member variable names for CommonAsmRoutinesBase 2018-05-30 05:22:36 -04:00
Léo Lam 8a00a9e149 Remove old GCC version checks 2018-05-30 10:59:15 +02:00
Lioncash efabfc0b54 VolumeWii: Use ReadSwapped for retrieving the partition data size in CheckIntegrity()
Also make this a little more robust by handling the failure case for
the read as well.
2018-05-30 04:34:57 -04:00
Lioncash 7bef470136 VolumeGC/VolumeWii: Dehardcode sizes where applicable
We can just use the relevant array to derive these sizes instead of hardcoding
them directly.
2018-05-30 04:14:42 -04:00
Markus Wick 4bebd52850
Merge pull request #7017 from lioncash/arm
Arm64Emitter: Use Common::BitCast where applicable
2018-05-30 09:50:59 +02:00
Lioncash 66122f037e Volume/VolumeGC/VolumeWii: Amend variable naming
Drops prefixed underscores and normalizes names to follow our coding
style.
2018-05-30 03:33:12 -04:00
JosJuice ae4aa0b25c
Merge pull request #7010 from leoetlino/can-of-worms
Don't switch to blank NAND in the middle of emulation
2018-05-30 08:00:15 +02:00
JosJuice 243f353688
Merge pull request #7016 from lioncash/mem
MemoryPatches: Minor changes
2018-05-30 07:45:34 +02:00
JosJuice 6cb81ca851
Merge pull request #7015 from lioncash/pcap
PcapFile: Namespace code under the Common namespace
2018-05-30 07:45:09 +02:00
JosJuice 2f561dafd9
Merge pull request #7014 from lioncash/const
DSPEmulator: Make the IsLLE() member function const-qualified
2018-05-30 07:40:44 +02:00
Mat M 1825e231a3
Merge pull request #7013 from degasus/double2single
Jit64: Fix MORE_ACCURATE_DOUBLETOSINGLE.
2018-05-29 21:01:47 -04:00
Ryan Meredith e9563f0a84 Make DolphinQT2 the default project in dolphin-emu.sln 2018-05-29 20:26:51 -04:00
spycrab c07b89792d Qt/GeneralWidget: Add icon and title to the backend switch confirm dialog 2018-05-30 01:19:31 +02:00
spycrab a729c375f3
Merge pull request #7011 from spycrab/qt_jit_instant
Qt/MenuBar: Fix JIT Menu options not being applied instantly
2018-05-30 00:53:20 +02:00
Lioncash 6fd7a79b93 Arm64Emitter: Use Common::BitCast where applicable
Gets rid of the need to set up memcpy boilerplate to reinterpret between
floating-point and integers.

While we're at it, also do a minor bit of tidying.
2018-05-29 18:19:01 -04:00
Lioncash 397b27e665 MemoryPatches: In-class initialize is_enabled state for MemoryPatch instances
Given this is what occurs in both constructors (as one just passes
through to another), we can just initialize the member directly.

While we're at it, amend the struct to follow the general ordering
convention of:

<new types>
<functions>
<variables>
2018-05-29 18:04:06 -04:00
Lioncash 4c33bb8dda MemoryPatches: std::move std::vector in the constructor
We can avoid copying the vector contents in this instance.
2018-05-29 18:01:16 -04:00
Lioncash 97c5a840db PcapFile: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-29 17:56:15 -04:00
Lioncash a7de492696 DSPEmulator: Make the IsLLE() member function const-qualified
This function only queries state and doesn't modify it, so this can be
made a const member function
2018-05-29 17:45:07 -04:00
degasus bde65d8b42 Jit64: Fix MORE_ACCURATE_DOUBLETOSINGLE.
This is broken since 3d12849967.
2018-05-29 23:25:30 +02:00
spycrab a1f15050a1 Qt/Mapping: Include "Always connected" option 2018-05-29 19:34:35 +02:00
spycrab d98affbf47 Qt/MenuBar: Fix JIT Menu options not being applied instantly 2018-05-29 16:40:05 +02:00
Léo Lam a4ec3ddef1 Don't switch to blank NAND in the middle of emulation
Switching to blank NAND when emulation is running is an extremely bad
idea. It's akin to opening up a Wii and replacing the NAND chip while
you're playing a game on it.

Except we're not even replacing it with a NAND that has the same
contents. The blank NAND has nothing in it except the save file for
the current game, which is likely to result in the emulated software
getting inconsistent results and possibly even crashing depending on
how it caches title information.

An example of games that check the saves for other games is
Mario Kart Wii -- it checks the filesystem for Super Mario Galaxy saves
to decide whether to unlock characters. With this 'switch NAND
while emulation is active' misfeature, this will likely break.
And that's the main problem: it encourages sloppy emulation and no one
really knows how many things it can break.

Just don't let the user do horrible things like that during emulation.
If they want to use a blank NAND, they can do so by starting input
recording before launching a game. It's likely they will want to do
this if they plan to share their DTM anyway.
2018-05-29 15:41:11 +02:00
Léo Lam 60c38d7781
Merge pull request #7007 from spycrab/qt_gecko_sort
Qt/GeckoCodeWidget: Autosort list and fix accessing the wrong element
2018-05-29 14:48:32 +02:00
Léo Lam 00d91db2ec
Merge pull request #7008 from spycrab/ddos_sux
Fix "Download Codes" hitting DDOS protection
2018-05-29 14:42:24 +02:00
Léo Lam 86bbf540cf
Merge pull request #7009 from lioncash/dsp
DSPEmulator: Default destructor in the cpp file
2018-05-29 14:16:50 +02:00
Lioncash c33228e466 DSPEmulator: Default destructor in the cpp file
This gets rid of a -Wweak-vtables warning
2018-05-29 07:54:39 -04:00
spycrab c086f894b1 Core/GeckoCodeConfig: Circumvent DDOS protection 2018-05-29 03:56:28 +02:00
spycrab 44784cf363 Common/HttpRequest: Add option to set cookies 2018-05-29 03:56:28 +02:00
spycrab a00250bfe6 Qt/GeckoCodeWidget: Autosort list and fix accessing the wrong element 2018-05-29 03:36:35 +02:00
spycrab e6273b177f Qt/MappingWindow: Fix profile saving not working when the index is not null 2018-05-29 01:32:07 +02:00
spycrab 5829ad21b7 Qt/MappingWidget: Fix profiles not loading properly 2018-05-29 01:21:42 +02:00
spycrab 75e87a8a0d
Merge pull request #6945 from spycrab/qt_sighandler
Qt/Unix: Implement signal handler
2018-05-28 22:05:52 +02:00
Lioncash 7bfeffe32f Interpreter_FPUtils: Unset FPSCR.FI and FPSCR.FR when FPSCR.ZX is set in NI_div()
Another bit of behavior that we weren't performing correctly is the
unsetting of FPSCR.FI and FPSCR.FR when FPSCR.ZX is supposed to be set.
This is supported in PEM's section 3.3.6.1 where the following is
stated:

"
When a zero divide condition occurs, the following actions are taken:

- Zero divide exception condition bit is set FPSCR[ZX] = 1.
- FPSCR[FR, FI] are cleared.
"

And so, this fixes that behavior.
2018-05-28 16:03:59 -04:00
Lioncash 3deadd1fff Interpreter_FPUtils: Correct setting the FPSCR's zero divide exception flag in the 0/0 case
FPSCR[ZX] is the bit defined to represent the zero divide exception
condition bit, and is defined as (according to PowerPC Microprocessor
Family: The Programming Environments Manual for 32 and 64-bit
Microprocessors, which will be referred to as "PEM" for the rest of this
commit message) at section 3.3.6.1:

"
A zero divide exception condition occurs when a divide instructions is
executed with a zero divisor value and a finite, nonzero dividend value
or when a floating reciprocal estimate single (fres) or a floating
reciprocal square root estimate (frsqrte) instruction is executed with a
zero operand value.
"

Note that it states the divisor must be zero and the dividend must be
nonzero in order for ZX to be set. This means that the interpreter was
performing the wrong behavior for the case where 0/0 (with any sign on
the zeros) is performed. We would incorrectly set the ZX bit when only
the VXZDZ bit should be set.

It's also worth pointing out that N/0 (where N is any finite nonzero
value) and 0/0 are not within the same exception class. N/0 is a zero
divide exception case, while 0/0 is considered an invalid operation
exception case, which is also indicated in the PEM section 3.3.6.1 as
well where it lists the criteria for invalid operation exceptions.

Therefore we should only be setting the VXZDZ bit in the 0/0 case, not
VXZDZ and ZX. This was also verified via hardware tests to ensure that
this behavior indeed holds.
2018-05-28 16:00:23 -04:00
spycrab 112a174ae1 Qt/Unix: Implement signal handler 2018-05-28 21:47:46 +02:00
JosJuice b2d8d2a398
Merge pull request #7004 from lioncash/bp
BPMemory: Silence a -Wmissing-braces warning
2018-05-28 21:16:28 +02:00
Léo Lam f05eb10026
Merge pull request #7003 from lioncash/host
Common: Move host communication enum to Host.h
2018-05-28 20:57:34 +02:00
Lioncash 72feeb4d18 BPMemory: Silence a -Wmissing-braces warning
Fairly trivial to resolve, we just initialize the std::array with two
sets of braces (one set to create the array, the other to start and end the
aggregate data that we'll end up returning)
2018-05-28 14:52:59 -04:00
Lioncash 4288bfe0f9 Common: Move host communication enum to Host.h
Given this is actually a part of the Host interface, this should be
placed with it.

While we're at it, turn it into an enum class so that we don't dump its
contained values into the surrounding scope. We can also make
Host_Message take the enum type itself directly instead of taking a
general int value.

After this, it'll be trivial to divide out the rest of Common.h and
remove the header from the repository entirely
2018-05-28 14:34:59 -04:00
Lioncash 78a934bb12 Interpreter_FloatingPoint: Handle cases when FPSCR.VE is set and exceptions occur in fctiw and fctiwz
If invalid operation exceptions are enabled and an invalid operation
occurs, then the destination value remains untouched. This fixes issues
that may arise when using these two instructions where the destination
gets steamrolled by an infinity or NaN value.
2018-05-28 14:05:12 -04:00
Lioncash 8c4aa133ca Interpreter_FloatingPoint: Handle NaN flag setting within fctiw and fctiwz
If a NaN of any type is passed as the operand to either of these
instructions, we shouldn't go down the regular code path, as we end up
potentially setting the wrong flags. For example, we wouldn't set the
FPSCR.VXCVI bit properly. We'd also set FPSCR.FI, when in actuality it
should be unset.

If an SNaN is passed as an operand, we also need to set the FPSCR.VXSNAN
bit as well.

The flag setting behavior for these can be found in Appendix C.4.2 in
PowerPC Microprocessor Family: The Programming Environments Manual for
32 and 64-bit Microprocessors.
2018-05-28 14:05:08 -04:00
Lioncash 0125d9b099 Interpreter_FloatingPoint: Factor out common code from fctiw and fctiwz
fctiwz functions in the same manner as fctiw, with the difference being
that fctiwz always assumes the rounding mode being towards zero. Because
of this, we can implement fctiwz in terms of fctiw's code, but modify it
to accept a rounding mode, allowing us to preserve proper behavior for
both instructions.

We also move Helper_UpdateCR1 to a temporary home in
Interpreter_FPUtils.h for the time being. It would be more desirable to
move it to a new common header for all the helpers, so that even JITs
can use them if they so wish, however, this and the following changes
are intended to only touch the interpreter to keep changes minimal for
fixing instruction behavior.

JitCommon already duplicates the Helper_Mask function within
JitBase.cpp/.h, and the ARM JIT includes the Interpreter header in order
to call Helper_Carry. So a follow up is best suited here, as this
touches two other CPU backends.
2018-05-28 13:28:44 -04:00
Léo Lam a9f022a067
Merge pull request #6993 from lioncash/nan
Interpreter_FPUtils: Set VXSNAN if any input operands are a signaling NaN in remaining NI_* functions
2018-05-28 18:49:13 +02:00
spycrab 42bd1a91a6 Qt/AdvancedPane: Show seconds in custom RTC 2018-05-28 13:37:46 +02:00