Confirmed by a hardware test and a quick diassembly of /dev/es.
I'm not aware of anything that opens several ES handles, but
technically, this fixes a small inaccuracy in IOS HLE.
For IOCTL_STM_EVENTHOOK, IOS checks if there is already an event hook
to prevent overriding an existing event hook message with a new one,
without first releasing it.
Removes #defines which have been unused for years and cleans up
naming.
This also changes IPC_REP_ASYNC to simply IPC_REPLY because it turns
out it's actually not specific to async replies, but used for all
command replies.
- Use an enum instead of defines.
- Only use the FS_ prefix for return codes which are actually related
to FS stuff, not for everything.
- Remove duplicated error codes and clean up the names.
Size is internally stored as a size_t, so having an int parameter
would cause implicit sign-conversion from a signed value to an
unsigned value to occur.
This removes Open() and Close() functions from devices whenever they
did nothing more than the base class (setting m_Active, returning a
default reply).
Also, since IOS close commands practically always return FS_SUCCESS,
writing the return code is moved to HandleCommand() in WII_IPC_HLE,
which has two benefits: it's not duplicated all over the place
(so people will not forget it) and it gets rid of having to check
the force parameter, since HandleCommand() is always called for
real IOS commands, so command_address is guaranteed to be valid.
It looks like at some point Dolphin device IDs coincided with IOS file
descriptors, but this is not the case anymore, so keeping those
WriteReturnCode(GetDeviceID()) in every single IOS HLE device,
as if the device ID was used as IOS fd, is both unnecessary
and confusing.
Jan 04 22:55:01 <leoetlino> fwiw, it looks like there are new warnings in the RegCache code
Jan 04 22:55:04 <leoetlino> Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp:13:33: warning: declaration shadows a variable in the global namespace [-Wshadow]
Jan 04 22:56:19 <@Lioncash> yeah, the jit global should have a g_ prefix.
This fixes shadowing warnings and adds the g_ prefix to a global.
Other settings options are nouns rather than verbs so this change makes the configuration option consistent with others. Also makes the menu option label the same as the windows title.
The constructor shouldn't be used as a dumping ground for all UI-related
initialization. Doing so makes it somewhat more difficult to reason about
how certain UI elements get created. It also puts unrelated identifiers in
the same scope.
This separates the UI creation out so code relevant to each component
is self-contained.
We don't really have to keep track of device opens/closes manually,
since we can already check that by calling IsOpened() on the device.
This also replaces some loops with for range loops.
Certain parts of the standard library try to determine whether or not a
transfer operation should either be a copy or a move. The prevalent notion
of move constructors/assignment operators is that they should not throw,
they simply move an already existing resource somewhere else.
This is typically done with 'std::move_if_noexcept'. Like the name says,
if a type's move constructor is noexcept, then the functions retrieves an
r-value reference (for move semantics), or an l-value (for copy semantics)
if it is not noexcept.
As IOFile deletes the copy constructor and copy assignment operators,
using IOFile with certain parts of the standard library can fail in
unexcepted ways (especially when used with various container
implementations). This prevents that.
'operator void*' is basically a pre-C++11-ism that was used, as C++03
only had the notion of implicit type-conversion operators, but not explicit type
conversion operators (allowing implicit conversion of a file handle to
bool can go downhill pretty quickly).
ExecuteCommand was becoming pretty confusing with unused variables
for some commands, confusing names (device ID != IOS file descriptor),
duplicated checks, not keeping the indentation level low, and having
tons of things into a single function.
This commit gives more correct names to variables, deduplicates the
device checking code, and splits ExecuteCommand so that it's
easier to read.
It's worth noting that some device checks have been forgotten in the
past, which has caused a bug (which was recently fixed in 288e75f6).
From what I can tell, the emulated GPU places (0,0) at the lower left of
the image, and we were generating texture coordinates so that (0,0) was
at the upper-left in the expansion geometry shader, causing textures
used by point sprites to be flipped vertically.
Fixes the upside-down A button in Mario Golf.
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.
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.
Doing it from the add dialogs instead would prevent the call to these dialogs outside of a breakpointWindow which would be necessary for hotkeys binding.
This also makes it a strongly-typed enum.
Considering that the flushing mode is a trait/behavior for the register
cache, it doesn't really make sense to have the enum separate from it.
This also has the benefit of removing constants from global scope.
This is done to not have the device combo box be too small in width when making the main sizer fit into the window. Not fitting the sizer would alternatively break Hidpi so it was best to just add an empty sizer to workaround this problem.
I think it's best to remove these if we are going to be adding new hotkeys since these would work no matter what so I can simply make these the default one instead.