Commit Graph

26602 Commits

Author SHA1 Message Date
Léo Lam 3f4952d57c
Merge pull request #8152 from lioncash/array-size
Common/CommonFuncs: Remove now-unneccessary ArraySize function
2019-06-06 13:35:57 +02:00
Léo Lam 824ec84e82
Merge pull request #8154 from lioncash/analytics
{Common/Analytics, Core/Analytics}: Minor C++17 transitional changes
2019-06-06 13:25:17 +02:00
booto 37919144c8 SI_DeviceGCAdapter: Stop it being detected as a steering wheel 2019-06-05 23:31:48 -04:00
JosJuice 3ab74f8cb7 HW/DI: Emulate rotational latency
This aims to emulate rotational latency as part of the disc drive
timings, which makes loading times have more variance (like on a
real disc drive) but should not affect the average loading times.
2019-06-05 20:47:08 +02:00
Lioncash e59f72739a Core/Analytics: Turn analytics URL into a C-string
Less reading and also doesn't store an unnecessary pointer value in the
executable, making it smaller by 8 bytes.
2019-06-05 13:24:35 -04:00
Lioncash ea9f887170 Core/Analytics: Use inline on static member variables
Starting with C++17, this allows for the same behavior as the existing
code, but without the need to manually write the out-of-class
definitions as well.
2019-06-05 13:24:35 -04:00
Lioncash ebf3de4d93 Core/Analytics: Use std::lock_guard deduction guides
Starting with C++17, the type of the mutex being locked no longer needs
to be hardcoded into the type declaration.
2019-06-05 13:24:35 -04:00
Lioncash 57454e90a7 Core/Analytics: Make MakeUniqueId() a const member function
This function doesn't modify instance state, so we can mark it as const.
2019-06-05 13:24:34 -04:00
Lioncash a5caa95a4b Core/Analytics: Use std::string_view where applicable
In these cases, the strings are treated as views anyways, so we can use
them here to avoid potential allocations.
2019-06-05 13:24:34 -04:00
Lioncash 2c2b9690bb Core/Analytics: Simplify static_assert
We can just use a std::array here to simplify the size calculation.
2019-06-05 13:24:34 -04:00
Lioncash 7935c27b52 Common/Analytics: Convert std::string overload into std::string_view
Allows for both string types to be non-allocating. We can't remove the
const char* overload in this case due to the fact that pointers can
implicitly convert to bool, so if we removed the overload all const
char arrays passed in would begin executing the bool overload instead of
the string_view overload, which is definitely not what we want to occur.
2019-06-05 13:24:31 -04:00
spycrab 78e566aaa5
Merge pull request #8156 from 8times9/resourcepack-header
Qt/ResourcePackManager: Remove column header bold text
2019-06-05 14:27:39 +02:00
Techjar 5f3bf405d4 Core/Movie: Store PAD_GET_ORIGIN bit in ControllerState
This fixes the desync on playback of start-from-boot input recordings
made while using the GC adapter, as well as other desyncs that could
potentially occur in other circumstances where this bit is used.

I used a previously reserved bit in the ControllerState to store the
new data, so this shouldn't significantly break backwards
compatibility. However, tools that aren't aware of this new bit may set
it to 0, which will break input recordings that contain it.
2019-06-05 02:36:23 -04:00
8times9 ffb8f56a83 Qt/ResourcePackManager: Remove column header bold text 2019-06-04 19:13:39 -05:00
Lioncash 58e2cd5486 Common/Analytics: std::move std::string constructor parameter
Allows calling code to move into the constructor, avoiding the creation
of another string copy.
2019-06-03 20:13:00 -04:00
Lioncash f813c4951a Common/Analytics: Use deduction guides for std::lock_guard
Avoids needing to hardcode the type of mutex. We can also make use of
scoped_lock where two consecutive lock_guard instances are used.
2019-06-03 20:12:55 -04:00
Lioncash 6df65d7a5d Common/Analytics: Default AnalyticsReportingBackend()'s destructor
Stays consistent with AnalyticsReportBuilder.
2019-06-03 18:27:45 -04:00
Tillmann Karras 84e3391535 Mark files as non-executable 2019-06-02 12:31:40 +01:00
Lioncash a9663669dc Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
2019-06-01 10:07:57 -04:00
Lioncash c8b950e716 IOS/USB_KBD: Normalize variable names
Now, with all of the tidying done, we can cap it off by normalizing
variable names to abide by our code formatting guidelines.
2019-05-31 09:05:31 -04:00
Lioncash 7f5ca64c4d IOS/USB_KBD: Make the message type enum an enum class
Avoids polluting the surrounding scope with enum values. We can also
make use of it in MessageData's constructor to enforce proper type
passing.
2019-05-31 09:00:08 -04:00
Lioncash d89ea8bf41 IOS/USB_KBD: Make IsKeyPressed() a non-virtual const member function
No other class inherits the USB_KBD class, and this function doesn't
actually modify instance state, so it can be made a const member
function.
2019-05-31 08:51:46 -04:00
Lioncash bcdc5b5f7e IOS/USB_KBD: Add static assertion to enforce MessageData as trivially copyable
MessageData must be a trivially copyable type, given it's copied into
emulated memory via our memory copy function CopyToEmu. Under the
covers, this function utilizes memcpy. One of memcpy's requirements is
that pointers to it point to types that are trivially copyable,
otherwise the behavior is undefined.

Given that, we can enforce this requirement at compile-time.
2019-05-31 08:51:46 -04:00
Lioncash e0552e0642 IOS/USB_KBD: Rename SMessageData to MessageData
We don't need to prefix this with S to signify that it's a struct.
2019-05-31 08:51:43 -04:00
Lioncash cc54652fb3 IOS/USB_KBD: Migrate TODO comment above if statement
Prevents some wonky formatting from occurring.
2019-05-31 08:51:01 -04:00
Lioncash e8cc1b8d8a IOS/USB_KBD: Use std::array for member variables where applicable
Simplifies initialization code quite a bit, and replaces a pointer
variable for SMessageData with a type properly representing the whole
set of data it needs.
2019-05-31 08:50:58 -04:00
Léo Lam a4837a5c5d
Merge pull request #8143 from lioncash/loader
VertexLoader_*: Minor cleanup
2019-05-31 14:18:16 +02:00
Léo Lam eed4fcc218
Merge pull request #8135 from lioncash/cmake
CMakeLists: Specify header files in target sources
2019-05-31 14:03:12 +02:00
Lioncash 64564e337b IOS/USB_KBD: Make key code lookup tables immutable and internally linked
These aren't modified by the class, nor do they directly need anything
related to the class state, so they can solely live within the cpp file,
hidden from external view, and also be made const, so the compiler can
place it within the read-only segment.
2019-05-31 08:02:29 -04:00
Léo Lam 2cb59ab055
Merge pull request #8148 from lioncash/view
AudioCommon: Use std::string_view with feature querying functions
2019-05-31 14:01:15 +02:00
Léo Lam 478f359d8d
Merge pull request #8149 from lioncash/sdio
IOS/SDIOSlot0: Remove unimplemented prototype
2019-05-31 13:58:54 +02:00
Lioncash 2060390a9f IOS/SDIOSlot0: Tidy up parameter names of ExecuteCommand
Makes the names consistent between declaration and definition and
adjusts them to follow our code formatting guidelines.

Now all functions in the translation unit follow our formatting
guidelines.
2019-05-31 07:28:11 -04:00
Lioncash 61c25b3d23 IOS/SDIOSlot0: Remove unimplemented prototype
This function doesn't have an implementation, so we can remove it to
make for less reading (and a linker error waiting to happen).
2019-05-31 07:23:40 -04:00
Lioncash 78e96230b2 AudioCommon: Move static locals into the AudioCommon namespace
Given these are locals, they can be moved out of the global namespace.
While we're at it, turn the constants below it into constexpr variables.
2019-05-31 07:07:16 -04:00
Lioncash 15397e2a89 AudioCommon: Use emplace_back instead of push_back in GetSoundBackends()
Constructs the strings directly within the container instead of
performing a construction, then a copy.

The reasoning is that the BACKEND_* strings are const char arrays, so
the push_back code is equivalent to:

push_back(std::string(BACKEND_WHATEVER)) instead of forwarding the
arguments to a constructed instance directly in the container.
2019-05-31 07:03:54 -04:00
Lioncash 1a56e9d9e0 AudioCommon: Use std::string_view with feature querying functions
Provides the same behavior, but allows passed in strings to be
non-allocating in calling code.
2019-05-31 07:01:47 -04:00
Lioncash 3d27439d9a VideoCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash a41ba68c1e VideoVulkan/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash cd9281772a VideoSoftware/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash 115e7992c5 VideoOGL/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash 968d379cc4 VideoNull/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash 87a57a5584 UpdaterCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
Lioncash 4cdb493eab UICommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Lioncash 24f5acf9a5 InputCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Lioncash b453229a68 DolphinQt/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Lioncash 0c538ef523 DolphinNoGUI/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Lioncash cbcafd6830 DiscIO/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Lioncash cd351fd478 Core/CMakeLists: Specify headers in target sources 2019-05-31 06:54:24 -04:00
Lioncash b6d9b85293 AudioCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:52:44 -04:00
Lioncash 48b82e82db Common/CMakeLists: Specify headers alongside source files
Allows these files to show up as part of the project when generating IDE
builds from CMake.
2019-05-31 06:52:44 -04:00
Léo Lam 5ffbec6956
Merge pull request #8144 from lioncash/tie
Common/x64Emitter: Resolve TODO in OpArg's operator==
2019-05-31 11:05:33 +02:00
booto bc8a4f99c7 VideoCommon: Constrain the array_base registers
The array_base registers as part of CP state do not seem to incorporate
the upper bits in the physical address they try to access.
2019-05-31 03:22:00 -04:00
Techjar b0b4b69d6e Qt/NetPlayDialog: Change network mode options to radio buttons
This changes the Host Input Authority and Golf Mode checkboxes into a
set of radio buttons, consisting of Fair Input Delay, Host Input
Authority, and Golf Mode. This represents the 3 network modes we have.

Although Golf Mode is just an extension of Host Input Authority, it's
more logical to the user to present it as a separate option, rather
than enabling the Golf Mode checkbox only when Host Input Authority is
enabled. This also eliminates the need to first enable Host Input
Authority before Golf Mode can be enabled.

This also adds tooltips to provide brief descriptions of the options,
as well as reintroducing tooltips that were previously removed.
2019-05-31 02:33:41 -04:00
Techjar 199486ffb6 Qt/NetPlayDialog: Move settings loading into LoadSettings 2019-05-30 18:07:03 -04:00
Techjar cd3ba570df VideoCommon/ShaderGenCommon: Fix memcmp size in ShaderUid operators 2019-05-30 16:00:46 -04:00
Lioncash 2452747429 VertexLoader_TextCoord: Tidy up public function definitions
We can use u32 instead of unsigned int to shorten up these definitions
and make them much nicer to read.

While we're at it, change the size array to house u32 elements
to match the return value of the function.
2019-05-30 10:29:51 -04:00
Lioncash 9569c79ca2 VertexLoader_TextCoord: Make lookup tables immutable
Allows the compiler to place the data within the read-only segment.
2019-05-30 10:29:50 -04:00
Lioncash 16a03bade2 VertexLoader_TextCoord: Place helper functions in anonymous namespace
Gives them all internal linkage.
2019-05-30 10:29:50 -04:00
Lioncash 6f656b7219 VertexLoader_Position: Tidy up public function definitions
We can use u32 instead of unsigned int to shorten up these definitions
and make them much nicer to read.

While we're at it, change the size array to house u32 elements to match
the return value of the function.
2019-05-30 10:29:50 -04:00
Lioncash 14e544eef8 VertexLoader_Position: Make lookup tables immutable
Allows the compiler to place these arrays within the read-only segment.
2019-05-30 10:29:50 -04:00
Lioncash be9a03b35f VertexLoader_Position: Place helper functions in anonymous namespace 2019-05-30 10:29:50 -04:00
Lioncash 60a1d0593c VertexLoader_Color: Place helper functions in anonymous namespace
While we're at it, convert the define into a constexpr variable.
2019-05-30 10:29:47 -04:00
Lioncash 66596c5176 Common/x64Emitter: Resolve TODO in OpArg's operator==
We now require C++17, so we can use std::tie here.
2019-05-30 10:27:28 -04:00
Léo Lam 00ecfb3c59
Merge pull request #8138 from lioncash/input-string
ControllerInterface/Device: Minor cleanup
2019-05-30 14:33:53 +02:00
Léo Lam 4e7a790648
Merge pull request #8140 from lioncash/vertex
VideoCommon/VertexLoader_Normal: Construct look-up table at compile-time
2019-05-30 14:28:59 +02:00
Léo Lam 90c9991086
Merge pull request #8141 from lioncash/init
VideoCommon/ShaderGenCommon: Simplify initialization of ShaderUid class
2019-05-30 14:15:02 +02:00
Léo Lam 2ce587f781
Merge pull request #8142 from lioncash/shader-view
VideoCommon/RenderBase: Use std::string_view with CreateShaderFromSource()
2019-05-30 14:12:18 +02:00
Lioncash f7eff6dab8 VideoCommon/ShaderGenCommon: Simplify operator!= for ShaderUid
This can be implemented as the negation of operator==, placing the
comparison logic for equality and inequality in the same place.
2019-05-30 06:41:57 -04:00
Lioncash 954246d10e VideoCommon/ShaderGenCommon: Remove use of a union within ShaderUid
This is only ever used to retrieve a raw view of the given UID data
structure, however it's already valid C++ to retrieve a char/unsigned
char view of an object for bytewise inspection.

u8 maps to unsigned char on all platforms we support, so we can just do
this directly with a reinterpret cast, simplifying the overall
interface.
2019-05-30 06:41:57 -04:00
Lioncash 149a97e396 VideoCommon: Remove unnecessary memset on ShaderUid instances.
Zero-initialization zeroes out all members and padding bits, so this is
safe to do. While we're at it, also add static assertions that enforce
the necessary requirements of a UID type explicitly within the ShaderUid
class.

This way, we can remove several memset calls around the shader
generation code that makes sure the underlying UID data is zeroed out.
Now our ShaderUid class enforces this for us, so we don't need to care about
it at the usage sites.
2019-05-30 06:41:54 -04:00
Lioncash 1831dcbe6f VideoVulkan/ShaderCompiler: Use non-member std::size instead of ArraySize()
Now that we're on C++17, we can use its non-member std::size function
instead of ours. This provides no functional change.
2019-05-30 04:16:20 -04:00
Lioncash d6a60050ff VideoVulkan/ShaderCompiler: Use a std::optional instead of bool+out variable
Now that we utilize C++17, we can simply return an optional containing
the code instead of using an out variable and a boolean result,
essentially combining them into one.

This provides a much more straightforward interface.
2019-05-30 04:16:17 -04:00
Lioncash e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00
Lioncash 0084aeb5d7 VideoCommon/VertexLoader_Normal: Use variable template variants of type traits
Same thing, less reading.
2019-05-30 00:52:59 -04:00
Lioncash 8268b6f454 VideoCommon/VertexLoader_Normal: Initialize function table at compile-time
Makes VertexLoader_Normal completely stateless, eliminating the need for
an Init() function, and by extension, also gets rid of the need for the
FifoAnalyzer to have an Init() function.
2019-05-30 00:52:57 -04:00
Lioncash 911755242d VideoCommon/VertexLoader_Normal: Remove E prefix from enums
This is old formatting that used to be used prior to the coding style
being introduced.
2019-05-29 22:15:46 -04:00
Lioncash 3b8fb22d93 VideoCommon/VertexLoader_Normal: Tidy up function declarations
We can use u32 to shorten up the function declarations. While we're at
it, remove unnecessary comments. These don't help with understanding.
2019-05-29 22:13:20 -04:00
Lioncash 8537f8e095 VideoCommon/PixelShaderGen: Fix up wonky comment formatting
This is likely a remnant of the initial transition to clang-format.
2019-05-29 22:03:02 -04:00
Lioncash 45934dd0c5 VideoCommon/PixelShaderGen: Make arrays immutable
Many of the arrays defined within this file weren't declared as
immutable, which can inhibit the strings being put into the read-only
segment. We can declare them constexpr to make them immutable.

While we're at it, we can use std::array, to allow bounds conditional
bounds checking with standard libraries. The declarations can also be
shortened in the future when all platform toolchain versions we use
support std::array deduction guides. Currently macOS and FreeBSD
builders fail on them.
2019-05-29 22:00:58 -04:00
Lioncash e28d08e973 VideoCommon/PixelShaderGen: Brace control structures that travel more than one line
Them's the code formatting rules.
2019-05-29 20:16:41 -04:00
Lioncash 0263435050 ControllerInterface/Device: Make DetectInput() a const member function
This doesn't actually modify object instance state, so it can be made
const.
2019-05-29 19:23:54 -04:00
Lioncash 27346fee8a ControllerInterface/Device: Take vector by const reference in DetectInput()
The vector is only ever queryied and it's contents aren't modified, so
there's no reason to take the vector by value. We can take a constant
reference to it to avoid unnecessary allocating.
2019-05-29 19:12:21 -04:00
Lioncash 246e2a77ce ControllerInterface/Device: std::move strings in constructor where applicable
Allows callers to move std::string values into the constructor,
potentially avoiding copies.
2019-05-29 18:46:49 -04:00
Lioncash 1355b43fd2 ControllerInterface/Device: Use std::string_view where applicable
In these cases, the given string is only ever compared against other
string, so std::string can be turned into a std::string_view to allow
non-allocating inputs.
2019-05-29 18:42:24 -04:00
Vincent Duvert 2c3c8bbb90 GCAdapter: Update Android-specific source
Fix the Android version of GCAdapter.cpp so it matches the new definitions in GCAdapter.h.
2019-05-29 18:28:24 +02:00
Vincent Duvert 9e7d4d2abb GCAdapter: Handle dynamic status updates for non-hotplug libusb
Detect when the setup function found no adapter, or found one but could
not connect to it, and report the new status in that case.
2019-05-29 18:28:24 +02:00
Vincent Duvert 2ac1ca133f GCPadWiiUConfigDialog: Update the adapter state dynamically
Update the GC adapter config GUI if the adapter is plugged or unplugged.
2019-05-29 18:28:24 +02:00
Vincent Duvert b08e2ec959 GCAdapter: Report libusb open errors to the user
If opening the adapter fails, report the libusb error message in the GUI
instead of “No Adapter Detected”.

The error condition is removed when the adapter is unplugged.
2019-05-29 18:28:24 +02:00
Vincent Duvert 0165e5e703 GCAdapter: Close libusb handle if an open error occurs
The handle was previously kept open, which was causing future adapter
plug/unplug events to be ignored.
2019-05-29 18:28:24 +02:00
Léo Lam 80d8173d29
Merge pull request #8132 from lioncash/string
Common/FileUtil: Use std::string_view with WriteStringToFile
2019-05-29 15:32:18 +02:00
JosJuice f25367a7a2 DiscIO: Avoid copies when comparing FileSystemGCWii file names 2019-05-29 14:53:39 +02:00
weihuoya 0dec8feadb android: thread local env 2019-05-29 20:22:26 +08:00
Léo aca46b11f8
Merge pull request #8070 from leoetlino/usb-fixes
Update and patch libusb to fix USB issues
2019-05-29 14:07:19 +02:00
Léo Lam 918d707f3f
Merge pull request #8131 from lioncash/move
UICommon/ResourcePack/Manager: Resolve use-after-move in Add()
2019-05-29 13:24:08 +02:00
Léo Lam 0cfdcf436d
Merge pull request #8136 from lioncash/arglist
VideoCommon/{NetPlayChatUI/NetPlayGolfUI}: Minor changes
2019-05-29 13:18:03 +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
Lioncash 1a0f8e7804 VideoCommon/VertexLoaderX64: Add missing header guard 2019-05-29 06:35:22 -04:00
Lioncash 778623c48c VideoCommon/NetPlayGolfUI: Remove unused header
This header doesn't actually make use of any std::string facilities.
2019-05-29 06:20:57 -04:00