- Re-organize VideoInterface::Update() to count half-lines starting at 0 instead of 1
- Use horizontal position when checking if we should assert some display interrupt
- Add some more descriptive comments
With the SI poll line count fixed, pretty much all games are polling
twice per frame anyways, making this option superfluous. Since it's a
bit of a gross hack and makes DTMs incompatible with console, let's
just bin it.
Much of our native code assumes that UICommon::Init has been called
(for reasons such as wanting to access the user's settings),
so not calling it until emulation start heavily limits what native
code we can use in the Android GUI (except during emulation).
Play can only be used when a game is selected and emulation is not
running. Start can be used when a game is selected (to start from
cold boot) or when emulation is running (to start from a savestate).
https://bugs.dolphin-emu.org/issues/11826
This new setting is like Override Language on NTSC Games, except
instead of only applying to the GameCube language setting,
it also applies to the Wii language setting.
Fixes https://bugs.dolphin-emu.org/issues/11299
Previously, IR calibration data with an invalid checksum was used, because the calibration produced a strange offset. I've replaced it with calibration data that encodes the same values as the data Nintendo falls back to when the checksum is bad.
This variable isn't std::moved anywhere and is just read out of into a
string. Instead of making a copy, and then another copy of the data into
a std::string, we can take it by reference, only copying the data once.
This isn't std::moved wholesale into a member variable or further
std::moved into another function, so it's better to take it by const
reference here to avoid unnecessary reallocations of contained
std::string instances.
Moves it closer to where its used, narrowing its visible scope, as well
as preventing unnecessary std::string constructor executions in the
event invalid data is encountered (the continue branch).
std::function is allowed to heap allocate in order to store captured
variables, etc, so std::function isn't a trivial type. We can std::move
here in order to avoid potential reallocating.
While we're at it, make the definition's parameter name match the
declaration's parameter name for consistency.
If the parameter is const, then a move won't actually be able to occur,
making the std::move non-functional. We can remove the const qualifier
to remedy this.
This is a giant hack which was previously removed because it causes
broken rendering. However, it seems that some devices still do not
support logical operations (looking at you, Adreno/Mali). Therefore, for
a handful of cases where the hack actually makes things slightly better,
we can use it.
... but not without spamming the log with warnings. With my warning
message PR, we can inform the users before emulation starts anyway.
PARTITION_NONE technically has a runtime static constructor otherwise.
This allows compile-time instances of Partition to be created without
the use of a static constructor.
Introduced in a995e2f5ba
We need to be performing a bitwise AND on the flags and not a logical
AND, otherwise we could end up counting device objects that don't
support forced feedback.
Makes it a little more explicit which dialog outcomes we're expecting.
While we're at it, we can invert them into guard clauses to unindent
code a little bit.
Avoids propagating headers into scopes where they're not necessary.
Also uncovered reliance on an indirect inclusion within
CheatsManager.cpp, which is now fixed.
If a user indicates that they want to clone and edit an AR code, then
click cancel on the following dialog, we shouldn't actually clone the
code.
We also shouldn't resave the codes if the edit dialog is opened and then
closed again via cancel, as there's nothing that actually changed. This
way we don't perform disk accesses unless they're actually necessary.
Previously, the constructor of GameConfigEdit wasn't doing anything with
the passed in parent pointer. This is dangerous because it can result in
memory being leaked in certain scenarios. It can also affect layout
decisions made by the parent. Instead, pass it through to the base class.
Current usages of the class pass in nullptr as the parent, so this is a
safe change to make with regards to the class hierarchy.
While we're at it, we can std::move the passed in QString into the class
member, allowing calling code to move strings into the constructor,
avoiding copies.
API has been made stricter, layers are now managed with shared pointers,
so using them temporarily increased their reference counters.
Additionally, any s_layers map has been guarded by a read/write lock,
as concurrent write/reads to it were possible.
QStringLiterals generate a buffer so that during runtime there's very
little cost to constructing a QString. However, this also means that
duplicated strings cannot be optimized out into a single entry that gets
referenced everywhere, taking up space in the binary.
Rather than use QStringLiteral(""), we can just use QString{} (the
default constructor) to signify the empty string. This gets rid of an
unnecessary string buffer from being created, saving a tiny bit of
space.
While we're at it, we can just use the character overloads of particular
functions when they're available instead of using a QString overload.
The characters in this case are Latin-1 to begin with, so we can just
specify the characters as QLatin1Char instances to use those overloads.
These will automatically convert to QChar if needed, so this is safe.
Previously code assumed that if DX11.1 runtime is supported, logic ops will,
but Windows 7 SP1 with a Platform Update supports DX11.1 runtime without logic ops.
This created pretty jarring visual artifacts, which now should be gone OR replaced
with much less jarring errors.
AddMessage() by itself doesn't perform string formatting facilities, so
this message was actually using the EFB scale as a duration value, not a
format argument. This corrects that.
Same behavior without hardcoding the type of the mutex within the lock
guards. This means the type of the mutex would be able to be changed
without needing to also change all occurrences lock guards are used.
Allows callers to std::move strings into the functions (or automatically
assume the move constructor/move assignment operator for rvalue
references, potentially avoiding copies altogether.
Removes constructors and destructors that don't actually provide any
behavior (i.e. doesn't constain generated code related to non-trivial
members in a cpp file, etc).
Lessens the amount of code present.
This is already provided in the base class, which performs the same
exact behavior. Given the function in the base class isn't virtual, this
also essentially resolves an instance of shadowing.
Continues the migration over to using fmt. Given fmt is also compatible
with std::string and std::string_view, we can convert some parameters
over to std::string_view, such as the message parameter for
StopMessage() and the name parameter for an overload of SaveScreenShot()
Since Dolphin can do NUS downloads over plain HTTP, we really don't
want people to be able to silently disable signature verification
indefinitely. Removing the setting shouldn't have any significant
negative impact now that signature verification always is disabled
when installing WAD files.
Apparently nobody is using good dumps, meaning that the warning
is a nuisance rather than useful information for most people.
Especially so for people who don't install WADs permanently.
It is still possible to verify the signature using the Verify
tab of the game properties, which matches how Dolphin handles
checking the signatures of Wii discs.
The old implementation of this was not able to distinguish between
a title that had the common key index set to 1 because it actually
was Korean and a title that had the common key index set to 1 due to
fakesigning. This new implementation solves the problem by
decrypting a content with each possible common key and checking
which result matches the provided SHA-1 hash.
The problem that the old implementation causes has only been reported
to affect a certain pirated WAD of Chronos Twins DX (WC6EUP), but it's
possible that the problem would start affecting more WADs if we add
support for the vWii common key (which uses index 2). Adding support
for the vWii common key would also prevent us from using the simpler
solution of always forcing the index to 0 if the title is not Korean.
...in addition to the existing function CreateVolume
(renamed from CreateVolumeFromFilename).
Lets code easily add constraints such as not letting the user
select a WAD file when using the disc changing functionality.
This header doesn't actually make use of MathUtil.h within itself, so
this can be removed. Many other source files used VideoCommon.h as an
indirect include to include MathUtil.h, so these includes can also be
adjusted.
While we're at it, we can also migrate valid inclusions of VideoCommon.h
into cpp files where it can feasibly be done to minimize propagating it
via other headers.
This lets us convert CalculateVertexElementSizes() from a function using
an out pointer into one that simply returns the array data as a return
value.
It also lets us dehardcode some values, as we can just query
std::array's size() member function instead.
Fix up the calculation of the length fields and check that the returned
response is the expected length. This touches many files because it
converts a parameter name from the SI_Device interface from 'length' to
'request_length'. Prior, this field seemed to be used as request length
sometimes, as response length sometimes, and usually just totally ignored.
This isn't used anywhere, so it can be removed. This also potentially
fixes an underlying compilation error waiting to happen, given DECSTAT
could have potentially been used, someone disables statistics (for
whatever reason), then gets a compilation error due to the #else case
not containing an empty definition of DECSTAT.
Makes the global variable follow our convention of prefixing g_ on
global variables to make it obvious in surrounding code that it's not a
local variable.
Rather than making Statistics' member functions operate on the global
variable instance of itself, we can make these functions member
functions and operate on a by-instance state, removing the direct
dependency on the global variable itself.
This also makes for less reading, as there's no need to repeat "stats."
for all variable accesses.
Normalizes all variables related to statistics so that they follow our
coding style.
These are relatively low traffic areas, so this modification isn't too
noisy.
At its only usage point, its return value is stored into a u32, and the
default implementation returns 0xFFFFFFFF (-1), which would be an
unsigned integer. Given all of the bits are used to determine a color,
it makes slightly more sense to treat this as an unsigned value as
opposed to a signed one.
We're allowed (by the standard) to forward declare types within
std::vector, so we can replace direct includes with forward declarations
and then include the types where they're directly needed.
While we're at it, we can remove an unused inclusion of <cstring>, given
nothing in the header uses anything from it. This also revealed an
indirect inclusion, which this also resolves.
Previously u32 was being used for part of the interface and unsigned int
was being used for other parts. This makes the interface fully consistent by
using only one type.
We opt for u32 here given they communicate the same thing (for platforms
we care about where int is 32-bit), while also being less to read.
While we're at it, we can also default the constructor and destructor of
inheriting classes in their respective cpp file to prevent the
construction and destruction of non-trivial types being inlined into
other regions of code.
This was in DolphinWX but not DolphinQt. It's useful for telling if
users who post screenshots have an up-to-date version of Dolphin.
The old implementation of this prepended the version in DolphinWX code
rather than Core code, but I thought it'd be simpler to do it in Core.
This isn't as serious as copying global INIs into user game INIs,
but still not good. We want to be able to remove settings from
default game INIs and have those removals apply.
IOLinux.cpp should include <sys/select.h> as it uses select() functionality.
On certain platforms it's included implicitly by other headers, which is why
it compiled before. This makes it also work on musl platforms.
libusb transfer callbacks might be called immediately during transfer
submission in some cases. (libusb doesn't even specify what thread
the callback is invoked on.) In other words, it is possible to reach
the transfer callback from the CPU thread, and not just from the
USB event handling thread.
So CoreTiming::FromThread::NON_CPU is incorrect and should instead
be ANY.
Unfortunately, it appears that using libusb's synchronous transfer API
from several threads causes nasty race conditions in event handling and
can lead to deadlocks, despite the fact that libusb's synchronous API
is documented to be perfectly fine to use from several threads (only
the manual polling functionality is supposed to require special
precautions).
Since usbdk was the only real reason for using a single libusb context
and since usbdk (currently) has so many issues with Dolphin, I think
dropping support for it in order to fix other backends is acceptable.
Now that the floating point members are assigned in bulk, we can remove
their setter macro. While we're at it, we can also remove the setter for
unsigned int, given it's not used.
We were doing quite a bit of unnecessary work within CMake to handle and
make sure the necessary libraries were copied over. That approach has
several downsides:
1. It's not possible to handle multi-configuration generators (like
Visual Studio) in an easy manner. The existing script would fail to
copy over the necessary libraries if one configuration was built, and
then another one was built.
2. If you have Qt already installed (properly) by the official binary,
the existing script would copy *all* dlls even if they weren't
necessary. This is pretty bad, since it can waste quite a bit of
space.
Instead, we can just delegate off to the official deployment application
bundled with Qt's libraries that determines what the necessary libraries
are and copies them over as necessary. This also means we can properly
support both release and debug binaries in the same directory, like how
the old handcrafted Visual Studio project files allowed.
Its sufficient to simply specify a debug postfix instead of using an
separate variable. What's nice about this approach is that it will
actually work :p
Previously the code wouldn't work for multi-configuration generators
like Visual Studio.
When the bluetooth adapter device is opened/closed by dolphin, the
kernel driver is automatically detached/reattached.
This enables transparent sharing of the same bluetooth wiimotes and
bluetooth adapters between the hosts system and the emulated one using
the same.
ImGui::Text() assumes that the incoming text is intended to be
formatted, but we don't actually use it to format anything. We can be
explicit by using the relevant function.
This also has a plus of not needing to go through the formatter itself,
but the gains from that are probably minimal.
Previously these functions were declared without the static specifier,
giving them external linkage, which isn't really ideal.
Instead, we can place these functions up by the relevant file-scope
variables and place them inside an anonymous namespace with said variables,
giving them internal linkage.
Avoids the use of the null pointer to represent an empty string.
Instead, we can simply pass an empty string_view instance. Using
std::string_view enforces this invariant at the API level.
Due to the lack of cast here, this will actually print out the ascii
value, rather than the character itself, due to promoting to integral
values. Instead, we can eliminate the use of character operands and just
print the value itself directly, given it's equivalent behavior with
less code.
Allows these arrays to be placed within the read-only segment (and
enforces the immutability in the code itself). While we're at it, we can
make use of std::array here.
Now that the std::map less-than comparitor is capable of being used with
heterogenous lookup, we're able to convert many of the querying
functions that took std::string references over to std::string_view.
Now these functions may be used without potentially allocating a
std::string instance unnecessarily.
Previously, when performing find() operations or indexing operations on
the section map, it would need to operate on a std::string key.
This means cases like:
map.find(some_string_view)
aren't usable, which kind of sucks, especially given for most cases, we
use regular string literals to perform operations in calling code.
However, since C++14, it's possible to use heterogenous lookup to avoid
needing to construct exact key types. In otherwords, we can perform the
above or use string literals without constructing a std::string instance
around them implicitly.
We simply need to specify a member type within our comparison struct
named is_transparent, to allow std::map to perform automatic type
deduction.
We also slightly alter the algorithm to an equivalent compatible with
std::string_view (which need not be null-terminated), as strcasecmp
requires null-terminated strings.
While we're at it, we can also provide a helper function to the struct
for comparing string equality rather than only less than. This allows
removing other usages of strcasecmp in other functions, allowing for the
transition of them to std::string_view.
fmt diverges from printf in that '.' as a precision specifier may only
be used for floating-point values (makes sense, given it's indicating
precision after the decimal point).
This fixes the problem where OBS game capture only grabs the region
inside an ImGui window whenever one is open, when using the OpenGL
backend. Shouldn't have any negative effects, as the scissor would've
been something completely arbitrary anyways.
This may affect other capture software that uses the same hooking
method, but I've only tested OBS.
In a few cases we needed to alter... less than ideal parameter types.
While u8 may have been OK with printf-style formatting, which promotes
most smaller types back to int, this won't work with fmt. fmt preserves
the type of the passed in arguments, meaning that u8, being an alias of
uint8_t (itself being an alias of unsigned char on all the platforms we
support), will print out as a character, not a numeric value.
As such, we amend some functions to operate on u32 values for two
reasons:
1. We actually want it to print out as a value
2. Arithmetic on unsigned types smaller than unsigned int will actually promote to an int,
not unsigned int. This is very non-obvious to some and makes for
error-prone code. < sizeof(int) types are great for storage, not so
much for performing unsigned arithmetic, despite the signedness of
the type.
While we do have this library as part of the public linkage interface in
the common library target, which will be used in the future for the
logging macros, we should still be explicit that we're using this
library. Therefore, we privately link it in to be explicit about it.