Only poll for hotkeys while EmulationActivity is resumed and at least
one supported hotkey is mapped. Otherwise the scheduler thread waits on
an event instead of polling.
Also trigger abort / dismiss from the host when closing the dialog.
Add explicit "finished" property to GameDigestProgress since the UI is different depending on this state.
By using the title database we ship with Dolphin, we get more uniform
game titles than if we grab what's in each game's opening.bnr file.
It also becomes possible for users to supply a custom titles.txt file.
This has been implemented in DolphinQt since a long time ago.
We just about get away with using a StateFlow in NetplaySession since the host sends AbortGameDigest when closing their own dialog. Without that it would be harder for the UI to distinguish between subsequent dialogs. If that wasn't the case then NetplaySession might need to expose the individual progress and result updates and have the view model assemble it into the overall GameDigestProgress.
Create a new NetplaySession each time we try to join a netplay game. Hold onto it in NetplayManager so its available to the different activities that need to access it. Close the session when backing out of the netplay UI. Some guardrails in case things go out of sync: creating a session closes the old one if it is still around for some reason, finalizer in NetplaySession to release native resources if not closed explicitly for some reason. Profiling done to ensure all kotlin and native objects are successfully cleared / garbage collected.
Boot session data is already handled when the game is booted so this is just fallback in case the game launch fails in some weird way.
Add missing @Keep annotations to functions called from C++
For some reason, NativeLibrary.kt calling Log for the alert message text
makes Dolphin die with a JNI error. Supposedly the jstring passed to the
logging function is invalid. I don't understand why, because the dialog
that we show right afterwards is able to read the string just fine. The
error happens even if I pass the string directly to Log without
prepending any extra text.
There's no real downside to having the logging in C++ instead of Kotlin,
so let's move it to C++ to avoid the JNI error.
Now with cancel button and an actual progress bar. For simplicity, we do
two passes on the progress bar, one for loading the NAND into memory and
one for extracting it. The user directory is likely on an SSD, making
the extraction pass invisibly fast.