This moves the unordered_map used to store connected Wiimotes IDs to
WiimoteReal, and makes the ID insert/erase logic common so we don't
have to duplicate this code in scanner backends.
The Balance board detection logic is already implemented in a simpler
way in Wiimote::IsBalanceBoard() (since hidapi also needs it).
Therefore, IOWin now only needs to check if a device is a Wiimote.
This is intended to make reconnecting Wiimotes easier with a DolphinBar.
Unfortunately, this change isn't enough as it doesn't always catch
disconnections for Wiimotes connected with a DolphinBar.
But it's better than nothing and eventually a disconnection will be
detected when something tries to write to the Wiimote, instead of never.
There is no other solution as the DolphinBar always exposes 4 HIDs even
when the associated Wiimotes are not connected.
We could try to detect this using the fake input reports sent by the
DolphinBar, but this only works for the first HID (probably because of
a bug in the firmware?), so this method is not an option.
If FindWiimotes() took more time than the UI shutting down, the scanner
would try connecting a Wiimote and sending an event to the UI code
long after it has shut down, which causes a segfault.
This fixes the race by ignoring any found Wiimotes during shutdown.
Normally this would have never happened, but it is possible with hidapi
since Wiimotes can be connected before Dolphin starts.
wxWidgets causes a segfault if Host_ConnectWiimote is called and we try
to create an event from the Wiimote scanner thread while the GUI is
still initialising.
Based on ca0c2efe7a. Credits go to flacs.
However, unlike the original commit, hidapi does not completely replace
the current implementations, so we can still connect Wiimotes with 1+2
(without pairing).
Also, it is only used on Linux and OS X for now. This removes the
advantage of having only one implementation but there is no other
choice: using hidapi on Windows is currently impossible because
hid_write() is implemented in a way that won't work with Wiimotes.
Additionally:
* We now check for the device name in addition to the PID/VID so we can
support the Balance Board and maybe third-party Wiimotes too. This
doesn't achieve anything with the DolphinBar but it does with hidraw.
* Added a check to not connect to the same device more than once.
Should fix a possible reference to deleted framebuffers, as well as fixing
the issues with the render area being correct if the game's source area
changes, or auto-scaling is enabled.
Same thing but allows both GeckoCode and Code to be utilized directly
without predicates for equality/inequality in stardard algorithms
The size check for std::vectors is unnecessary, as this is built into std::vector's operator==
Because of the way this works, randomly overwriting the handler
when loading a savestate will break things because of the
self-modifying nature of the handler.
GeckoCodes require address hooks which don't correspond to any
symbol in the symbol table. The hooks get deleted when repatching
the game because they did not persist across calls to
HLE::PatchFunctions.
Dolphin emulates GeckoCodes by fiddling with the CPU state when a
VI Interrupt occurs. The problem with this is that we don't know
where the PC is so it's non-deterministic and not necessarily
suitable for use with the codehandler.
There are two options: Patch the game like Gecko OS either directly
or using HLE::Patch, or use a trampoline so we can branch from any
PC even if it would otherwise not be valid. The problem with Gecko OS
patches is there are 10 of them and they have to be configured
manually (i.e. Game INIs to would need to have a [Core]GeckoHookType
property).
HLE_Misc::GeckoReturnTrampoline enables the Code Handler to be
entered from anywhere, the trampoline restores all the registers that
had to be secretly saved to the stack.
If the installation fails because codehandler.bin is missing or
unusable then Dolphin will try again every single frame even though
it's highly unlikely a disk file will have changed. Better to just
fail once then only try again when the active code set is changed.
Suppresses generating 60 log messages per second.
Turns out one of the magic numbers was very magic. The gameid is
an ad-hoc comm protocol with HLE_Misc to control the number of times
the ICache is reset.
The code table builder cuts off the end of codes that won't fit
after already writing part of it. That seems quite unlikely to
work the way anyone would find useful since the codes can contain
actual PPC instructions.
The active codes vector cannot safely be used outside the mutex,
move the lock out into RunCodeHandler. s_code_handler_installed was
also racing against SetActiveCodes since it's being written both
inside and outside the lock.
General cleanup. Add s_ prefixes, use constexpr, remove C casts.
Executing PPC code inside an external events callback is a bad idea.
CoreTiming::Advance does not support recursion properly which will
cause timing glitches. The interpreter has a slice length hack that
counters this but without it this would cause a 20000 cycles time
skip. It isn't clear what this was supposed to accomplish that just
changing the current PC would not. Changing the PC works fine.
Deleting instead of overwriting makes the INI cleaner.
Also, in case we change defaults in the future, users will
get the new default when using a new version even if
they have pressed the Reset button in an older version.
Makes the buffering code a bit more explicit (circular buffer, but
blocks until individual buffers get unqueued by OpenAL), and fixes a
bug in the startup of Super Mario Sunshine:
https://bugs.dolphin-emu.org/issues/9811
When standby mode is enabled, this causes games to ES_Launch the system
menu instead of directly asking IOS (the STM more precisely) to shut
down, which prevents graceful shutdown from working
(it'll appear to hang).
Dolphin never supported WC24 standby mode anyway, so this shouldn't
cause any issues. (This should be reverted if and when WC24 standby is
implemented…)
This adds support for triggering the power event (in the STM), so that
stopping emulation first triggers a shutdown event, which notably gives
emulated software time to save game data (issue 8979) and clean up
SYSCONF (to disconnect Wiimotes and update their state in the SYSCONF).
On the first press, the stop button/hotkey/whatever will trigger a STM
power event. On a second try, we will forcefully stop emulation, just
like how it was working before.
There was as far as I know no reason to put everything in the header.
Separating the declaration from the implementation reduces build
times in case the implementation is updated without changing
any declaration.
This is needed because for some reason the WSI for NV Vulkan drivers
doesn't return VK_ERROR_OUT_OF_DATE_KHR, so there is no other way to know
that a resize has occured apart from polling, which is a poor solution for
X11 (since it is blocking).
Considering there's a public method in the class using it, leaving the
definition in the cpp file can cause a linker error if any method outside
that cpp file calls it for one reason or another.
Single step: Fix an oddity when a breakpoint is hit at the beginning of a block, then after, a single step is performed and finally, hitting play, the breakpoint will be skipped even in the case when it would be hit again. This was done by using the interpreter version of single step. Also, remove some redundant update request.
Step over: fix some GUI lags.
Step out: Add consideration for conditional branching by checking the condition as the interpreter does. Now, every bclr instructions except those that changes the LR (because it would not be the end of the function) will cause the end of the step out and not just blr instructions. Also now stops if a bp is detected and finally, remove redundant GUI updates calls.
This also removes a superfluous draw call on the GUI as the codeView was refreshing twice per event to do so.
It was never used, even when the code tried to make sure it was initialised and passed correctly. This is a supplementary fix for the memCheck dialog as this option will now work correctly.
The old one wasn't very optimal because not only the user would likely want to enter an address instead of a range, but it also made entering just one address confusing (you had to have the same value on both start and end). Also, you should only chose one option between read, write or both, there is no point to not have any.
This is why I made more clear how to add an address and it is the default option using radio buttons and I also made the action flags and the flags to be radio buttons.
It looks like the debug output is also output as SJIS (similar to
OSReport text), so we need to convert it to UTF-8 to prevent it from
all showing up as �.
This doesn't fix all display issues, but fixes all SJIS/UTF-8 related
ones.
This changes GetSymbolFromName to not require the passed name to
completely match with the symbol name. Instead, we now match
against the stripped symbol name (i.e. only the function name).
This fixes a regression introduced by #4160, which prevented
HLE::PatchFunctions() from working properly.
This is the same as PR #3991, but for MainNoGUI.
nogui/headless will shut down cleanly on SIGINT and SIGTERM, just like
it would when closing the render window.
The default signal handler will be restored after a first shutdown
signal so a second signal will exit Dolphin forcefully.
These functions don't actually depend on any state from the class
instance, so they don't really belong in the header, and are just
an implementation detail.
Fixes the issue on macOS where quitting Dolphin from the Dock causes a
crash report (https://bugs.dolphin-emu.org/issues/9794). I'm not
exactly sure why this works, but it feels right and it turns out to fix
the problem.
It didn't really made sense to disable 2 logs levels in releases builds while the level LDEBUG should really be where logs that would impact performance be. Info should be logs that report potentially usefull information and debug should report info that would only be usefull in debug context as they are called very often. To make this work, a lot of info log would have to be made debug log.
It also avoid inaccurate logs level done due to not using debug builds. While searching through the code, I saw a ton of logs that should have been info log, likely done to avoid using a debug build (which shouldn't happen considering the level debug exists anyway).
The whole idea is to have more meaningful logs in release builds while maintaining minimal performance loss from choosing the highest level. This could potentially help to diagnose issues or to know more about what the emulator is actually doing.
The next commit aims to sort the log levels for this purpose.
clang-format really *wants* the two empty lines to be removed;
otherwise, it will always flag MemoryUtil as needing formatting changes
which is an annoyance when it is used as a git filter driver.
clang-format really *wants* the two empty lines to be removed;
otherwise, it will always flag MemoryUtil as needing formatting changes
which is an annoyance when it is used as a git filter driver.
This adds a recenter control binding which allows recentering the
cursor when relative input is enabled.
(EnableSettingControl is renamed to avoid confusions.)
This makes the GUI show the settings that are loaded when the config
gets reloaded, instead of showing potentially outdated settings that
are not applied.
This adds an option to enable relative input for the Wiimote IR
as described in issue 9014.
Enabling it will result in the pointer not going back to the centre
and the inputs will control the direction, not the absolute position.
Also adds a Dead Zone setting which is really needed when relative
input is enabled to prevent the cursor from slowly drifting on
most controllers. (Note: the Deadzone setting has no effect when
relative input is disabled)
These were made when the button images were first remade many months ago, but they were never committed since there was no use for them at the time (and laziness :P). BUT now there is a PR that finally has use for these images, so it's time to get this into Dolphin and available for use!
Call Advance at the start of each timing slice instead of the end.
Possibly fixed a bug where a slice would randomly branch straight
back to Advance() because the flags were not set to the right
values before branching to the dispatcher entrypoint.
This fix a double break bug when hitting a memcheck and hitting play on the same instruction it broke to earlier. The state is put back to CPU_RUNNING after.
Doing this forces the window to be drawn before reparenting it. It fixes the possibility of creating an empty floating window if the selected tab wasn't corespoinding to the window.
There might be a better way to highlight the options when adding the memory check, but for now, this works and the breakpoint list reports the right settings anyway.
These are needed for the next commit. I had to modify the implementation of the DSP one too, but since it basically isn`t used, I don`t think it matters much. These options only matters when adding one.
It wouldn't impact performance until at least one memcheck is enabled. Because of this, it can be used in release builds without much impact, the only thing that woudl change is the use of HasAny method instead of preprocessor conditionals. Since the perforamnce decrease comes right when the first memcheck is added and restored when the last is removed, it basically is all beneficial and works the same way.