Commit Graph

2604 Commits

Author SHA1 Message Date
Tom Pratt
8d565e0331 Use the dual pane netplay screen layout only if the width is sufficient
To avoid using dual pane layout on very small devices, ensure that the current width available for display is at least medium (600dp).

It also has to be landscape, the dual pane mode looks weird on a tablet in portrait mode since there's not that much content.
2026-05-19 12:03:02 +02:00
Tom Pratt
4d1e749977 WithSession helper function
Handles the repeated boiler plate of using a weak reference to NetplaySession from NetplayUICallbacks
2026-05-19 12:03:02 +02:00
Tom Pratt
06cc09cf09 Pass immutable games list to NetplayUICallbacks
Remove corresponding jni config.

Rename Netplay to NetplaySession in jni config to match new kotlin name.
2026-05-19 12:03:02 +02:00
Tom Pratt
f63b81dd39 Use unique_ptr when creating netplay client / server 2026-05-19 12:03:01 +02:00
Tom Pratt
22863b3703 Add @Keep annotation to Player constructor
Since it's only instantiated from c++.
2026-05-19 12:03:01 +02:00
Tom Pratt
1bc64a0e6e Fix netplay license headers 2026-05-19 12:03:01 +02:00
Tom Pratt
df5e7a9767 Update compose dependencies
Was using 2025 instead of 2026! Fixed some buggy bottom sheet behaviour.

Minor tidying of the chat UI in the bottom sheet
2026-05-19 12:03:01 +02:00
Tom Pratt
4c0bf2944b Implement DoAllPlayersHaveGame() check 2026-05-19 12:03:01 +02:00
Tom Pratt
76ae445694 Add network mode picker for host 2026-05-19 12:03:00 +02:00
Tom Pratt
1c2806dfe9 Add host buffer settings for fair input delay mode
Also rename max buffer to client buffer for better consistency with settings and c++
2026-05-19 12:03:00 +02:00
Tom Pratt
86de5ef4b0 Handle traversal state changes and errors
Traversal connections show in the joining info UI.
Non fatal errors show the retry button.
Fatal errors end the netplay session.
2026-05-19 12:03:00 +02:00
Tom Pratt
86a0f22887 Show joining info for local and external IP addresses
Doesn't support traversal yet
2026-05-19 12:03:00 +02:00
Tom Pratt
6655672ee3 Add ability to choose game when hosting
Also fix bottom sheets so they survive rotation
2026-05-19 12:02:59 +02:00
Tom Pratt
68e9fd6cde Send own messages to chat
A player's own messages don't come back via the server.
2026-05-19 12:02:59 +02:00
Tom Pratt
77f08364db Create NetPlayServer and start game 2026-05-19 12:02:59 +02:00
Tom Pratt
b63ccacdfa Hosting UI 2026-05-19 12:02:59 +02:00
Tom Pratt
f9baecd5ed Implement OnMsgPowerButton 2026-05-19 12:02:59 +02:00
Tom Pratt
acbf9e155f Game digest progress dialog
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.
2026-05-19 12:02:58 +02:00
Tom Pratt
117d1d71ac Handle desync messages
Show them in the chat window and also in a toast during game play.
2026-05-19 12:02:58 +02:00
Tom Pratt
abd324e98d Make NetplaySession not a singleton
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.
2026-05-19 12:02:58 +02:00
Tom Pratt
183d6d778c Use existing settings API instead of custom jni calls 2026-05-19 12:02:58 +02:00
Tom Pratt
8141a74671 Show save transfer progress
When transferring saves from the host. Equivalent of ChunkedProgressDialog in QT.
2026-05-19 12:02:57 +02:00
Tom Pratt
480968f05e Dont try to load temporary save states when launching netplay
An orientation change can trigger this code path immediately when a game starts. e.g. dolphin is portrait when launching the game but settings force gameplay to landscape. We want to avoid this and continue to the netplay launch code below.

If the user backgrounds dolphin during netplay and then resumes after the process has died it will actually resume from the save state in single player mode, not sure if thats good or bad but fine for now.

Netplay doesnt handle rotation very well, seems to go more and more out of sync the more rotations.
2026-05-19 12:02:57 +02:00
Tom Pratt
b52ffa3e8b Release boot session data during Netplay cleanup
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++
2026-05-19 12:02:57 +02:00
Tom Pratt
b1b133b036 Implement OnConnectionLost, show a dialog on the main netplay screen forcing the user to exit 2026-05-19 12:02:56 +02:00
Tom Pratt
38b5c7370c Implement StopGame callback and use it to finish the emulation activity 2026-05-19 12:02:56 +02:00
Tom Pratt
86956b21be Settings refactor
Remove the big saveSetup function and set individual settings immediately after being changed in the UI. Group them all under Netplay.Settings
2026-05-19 12:02:56 +02:00
Tom Pratt
65e4c60158 Max buffer 2026-05-19 12:02:56 +02:00
Tom Pratt
e49451b28e Put players table in an OutlinedBox, makes the UI look more consistent. 2026-05-19 12:02:56 +02:00
Tom Pratt
c32732714e Implement more NetPlayUICallbacks
Includes chat, game changes, pad buffer changes and host input authority. Merges them all into the chat window.
2026-05-19 12:02:55 +02:00
Tom Pratt
dfa3384281 Netplay chat UI 2026-05-19 12:02:55 +02:00
Tom Pratt
d9e2725e85 Implement player list 2026-05-19 12:02:55 +02:00
Tom Pratt
af2fda5649 Reorder netplay class
Put all the boring settings at the bottom to reduce scrolling!
2026-05-19 12:02:55 +02:00
Tom Pratt
b72f3c1afc Add mostly empty Netplay screen, equivalent of NetPlayDialog in QT.
All it can do at this point is quit the current netplay session when backing out of this screen.
2026-05-19 12:02:55 +02:00
Tom Pratt
5527e8138e Move NetplaySetupScreen to its own file 2026-05-19 12:02:55 +02:00
Tom Pratt
f52ca02ca2 Show client connection errors and handle connection result
If result is a success sent event to launch the next netplay screen. if it fails, clear up the netplay client
2026-05-19 12:02:54 +02:00
Tom Pratt
3ed9174208 Store netplay BootSessionData and use it to run the netplay game 2026-05-19 12:02:54 +02:00
Tom Pratt
766374434c Pass game list to NetPlayUICallbacks and implement OnMsgChangeGame, OnMsgStartGame, FindGameFile 2026-05-19 12:02:54 +02:00
Tom Pratt
1464fdfc28 Add NetPlayClient join and stub NetPlayUICallbacks 2026-05-19 12:02:54 +02:00
Tom Pratt
a1983e5fa2 Add Netplay settings JNI layer and wire up NetplaySetupViewModel 2026-05-19 12:02:54 +02:00
Tom Pratt
f10022f2dc Netplay setup UI
Only for connecting, no hosting yet.
2026-05-19 12:02:53 +02:00
Tom Pratt
c716c32ce8 Add compose dependencies for Android and empty NetplaySetupActivity
Derive compose colour theming from the existing XML styles already set at the activity level.
2026-05-19 12:02:53 +02:00
JosJuice
4470534dc5 Android: Move alert message log from Kotlin to 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.
2026-05-08 10:56:51 +02:00
Dentomologist
30a20d75d2
Merge pull request #14629 from Simonx22/android/convert-tvutil-to-kotlin
Android: Convert TvUtil to Kotlin
2026-05-07 13:23:48 -07:00
Simonx22
a7e98c776d Android: Convert TvUtil to Kotlin 2026-04-30 16:23:32 -04:00
JosJuice
c73dde2193 Android: Remove HostThreadLock
Follow-up to 068947e. HostThreadLock no longer serves a purpose.
2026-04-29 18:55:18 +02:00
OatmealDome
af15769d57
Merge pull request #14569 from Simonx22/android/convert-gamefilecachemanager-to-kotlin
Android: Convert GameFileCacheManager to Kotlin
2026-04-26 12:03:57 -04:00
Dentomologist
a94854309b
Merge pull request #14608 from JosJuice/gcadapter-auto-start
GCAdapter: Automatically start and stop thread
2026-04-24 19:51:51 -07:00
JosJuice
cc01a60347 GCAdapter: Automatically start and stop thread
This keeps the logic encapsulated inside GCAdapter.cpp so callers don't
have to think about it.
2026-04-18 19:40:25 +02:00
JosJuice
4aaecbb148 Android: Add page table fastmem to Debug settings 2026-04-18 08:42:34 +02:00