summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt8
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt2
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt29
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt8
-rw-r--r--src/android/app/src/main/res/layout-w600dp/fragment_about.xml5
-rw-r--r--src/android/app/src/main/res/layout-w600dp/fragment_game_info.xml155
-rw-r--r--src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml1
-rw-r--r--src/android/app/src/main/res/layout/card_driver_option.xml1
-rw-r--r--src/android/app/src/main/res/layout/card_folder.xml6
-rw-r--r--src/android/app/src/main/res/layout/fragment_about.xml5
-rw-r--r--src/android/app/src/main/res/layout/fragment_addons.xml4
-rw-r--r--src/android/app/src/main/res/layout/fragment_applet_launcher.xml4
-rw-r--r--src/android/app/src/main/res/layout/fragment_driver_manager.xml2
-rw-r--r--src/android/app/src/main/res/layout/fragment_early_access.xml5
-rw-r--r--src/android/app/src/main/res/layout/fragment_emulation.xml8
-rw-r--r--src/android/app/src/main/res/layout/fragment_folders.xml3
-rw-r--r--src/android/app/src/main/res/layout/fragment_game_info.xml3
-rw-r--r--src/android/app/src/main/res/layout/fragment_game_properties.xml5
-rw-r--r--src/android/app/src/main/res/layout/fragment_games.xml1
-rw-r--r--src/android/app/src/main/res/layout/fragment_home_settings.xml3
-rw-r--r--src/android/app/src/main/res/layout/fragment_installables.xml4
-rw-r--r--src/android/app/src/main/res/layout/fragment_licenses.xml4
-rw-r--r--src/android/app/src/main/res/layout/fragment_settings.xml2
-rw-r--r--src/android/app/src/main/res/layout/list_item_addon.xml2
-rw-r--r--src/android/app/src/main/res/layout/list_item_settings_header.xml1
-rw-r--r--src/core/hle/service/cmif_serialization.h71
-rw-r--r--src/core/hle/service/cmif_types.h112
-rw-r--r--src/core/hle/service/jit/jit.cpp14
-rw-r--r--src/core/hle/service/ro/ro.cpp3
29 files changed, 376 insertions, 95 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
index 9b08f008d..26cddecf4 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
@@ -193,6 +193,10 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
193 return super.dispatchKeyEvent(event) 193 return super.dispatchKeyEvent(event)
194 } 194 }
195 195
196 if (emulationViewModel.drawerOpen.value) {
197 return super.dispatchKeyEvent(event)
198 }
199
196 return InputHandler.dispatchKeyEvent(event) 200 return InputHandler.dispatchKeyEvent(event)
197 } 201 }
198 202
@@ -203,6 +207,10 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
203 return super.dispatchGenericMotionEvent(event) 207 return super.dispatchGenericMotionEvent(event)
204 } 208 }
205 209
210 if (emulationViewModel.drawerOpen.value) {
211 return super.dispatchGenericMotionEvent(event)
212 }
213
206 // Don't attempt to do anything if we are disconnecting a device. 214 // Don't attempt to do anything if we are disconnecting a device.
207 if (event.actionMasked == MotionEvent.ACTION_CANCEL) { 215 if (event.actionMasked == MotionEvent.ACTION_CANCEL) {
208 return true 216 return true
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
index 5b5f800c1..5ab38ffda 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
@@ -77,7 +77,7 @@ class AboutFragment : Fragment() {
77 } 77 }
78 78
79 binding.textVersionName.text = BuildConfig.VERSION_NAME 79 binding.textVersionName.text = BuildConfig.VERSION_NAME
80 binding.textVersionName.setOnClickListener { 80 binding.buttonVersionName.setOnClickListener {
81 val clipBoard = 81 val clipBoard =
82 requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager 82 requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
83 val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH) 83 val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH)
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index d17e087fe..22da1d0e5 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -38,6 +38,7 @@ import androidx.window.layout.WindowLayoutInfo
38import com.google.android.material.dialog.MaterialAlertDialogBuilder 38import com.google.android.material.dialog.MaterialAlertDialogBuilder
39import com.google.android.material.slider.Slider 39import com.google.android.material.slider.Slider
40import kotlinx.coroutines.Dispatchers 40import kotlinx.coroutines.Dispatchers
41import kotlinx.coroutines.flow.collect
41import kotlinx.coroutines.flow.collectLatest 42import kotlinx.coroutines.flow.collectLatest
42import kotlinx.coroutines.launch 43import kotlinx.coroutines.launch
43import org.yuzu.yuzu_emu.HomeNavigationDirections 44import org.yuzu.yuzu_emu.HomeNavigationDirections
@@ -184,10 +185,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
184 185
185 override fun onDrawerOpened(drawerView: View) { 186 override fun onDrawerOpened(drawerView: View) {
186 binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED) 187 binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
188 binding.inGameMenu.requestFocus()
189 emulationViewModel.setDrawerOpen(true)
187 } 190 }
188 191
189 override fun onDrawerClosed(drawerView: View) { 192 override fun onDrawerClosed(drawerView: View) {
190 binding.drawerLayout.setDrawerLockMode(IntSetting.LOCK_DRAWER.getInt()) 193 binding.drawerLayout.setDrawerLockMode(IntSetting.LOCK_DRAWER.getInt())
194 emulationViewModel.setDrawerOpen(false)
191 } 195 }
192 196
193 override fun onDrawerStateChanged(newState: Int) { 197 override fun onDrawerStateChanged(newState: Int) {
@@ -239,6 +243,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
239 requireContext().theme 243 requireContext().theme
240 ) 244 )
241 } 245 }
246 binding.inGameMenu.requestFocus()
242 true 247 true
243 } 248 }
244 249
@@ -247,6 +252,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
247 null, 252 null,
248 Settings.MenuTag.SECTION_ROOT 253 Settings.MenuTag.SECTION_ROOT
249 ) 254 )
255 binding.inGameMenu.requestFocus()
250 binding.root.findNavController().navigate(action) 256 binding.root.findNavController().navigate(action)
251 true 257 true
252 } 258 }
@@ -256,6 +262,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
256 args.game, 262 args.game,
257 Settings.MenuTag.SECTION_ROOT 263 Settings.MenuTag.SECTION_ROOT
258 ) 264 )
265 binding.inGameMenu.requestFocus()
259 binding.root.findNavController().navigate(action) 266 binding.root.findNavController().navigate(action)
260 true 267 true
261 } 268 }
@@ -287,6 +294,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
287 ) 294 )
288 } 295 }
289 } 296 }
297 binding.inGameMenu.requestFocus()
290 NativeConfig.saveGlobalConfig() 298 NativeConfig.saveGlobalConfig()
291 true 299 true
292 } 300 }
@@ -295,7 +303,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
295 emulationState.stop() 303 emulationState.stop()
296 emulationViewModel.setIsEmulationStopping(true) 304 emulationViewModel.setIsEmulationStopping(true)
297 binding.drawerLayout.close() 305 binding.drawerLayout.close()
298 binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) 306 binding.inGameMenu.requestFocus()
299 true 307 true
300 } 308 }
301 309
@@ -312,12 +320,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
312 if (!NativeLibrary.isRunning()) { 320 if (!NativeLibrary.isRunning()) {
313 return 321 return
314 } 322 }
315 323 emulationViewModel.setDrawerOpen(!binding.drawerLayout.isOpen)
316 if (binding.drawerLayout.isOpen) {
317 binding.drawerLayout.close()
318 } else {
319 binding.drawerLayout.open()
320 }
321 } 324 }
322 } 325 }
323 ) 326 )
@@ -408,6 +411,18 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
408 } 411 }
409 } 412 }
410 } 413 }
414 launch {
415 repeatOnLifecycle(Lifecycle.State.CREATED) {
416 emulationViewModel.drawerOpen.collect {
417 if (it) {
418 binding.drawerLayout.open()
419 binding.inGameMenu.requestFocus()
420 } else {
421 binding.drawerLayout.close()
422 }
423 }
424 }
425 }
411 } 426 }
412 } 427 }
413 428
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt
index f34870c2d..b66f47fe7 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt
@@ -6,6 +6,7 @@ package org.yuzu.yuzu_emu.model
6import androidx.lifecycle.ViewModel 6import androidx.lifecycle.ViewModel
7import kotlinx.coroutines.flow.MutableStateFlow 7import kotlinx.coroutines.flow.MutableStateFlow
8import kotlinx.coroutines.flow.StateFlow 8import kotlinx.coroutines.flow.StateFlow
9import kotlinx.coroutines.flow.asStateFlow
9 10
10class EmulationViewModel : ViewModel() { 11class EmulationViewModel : ViewModel() {
11 val emulationStarted: StateFlow<Boolean> get() = _emulationStarted 12 val emulationStarted: StateFlow<Boolean> get() = _emulationStarted
@@ -23,6 +24,9 @@ class EmulationViewModel : ViewModel() {
23 val shaderMessage: StateFlow<String> get() = _shaderMessage 24 val shaderMessage: StateFlow<String> get() = _shaderMessage
24 private val _shaderMessage = MutableStateFlow("") 25 private val _shaderMessage = MutableStateFlow("")
25 26
27 private val _drawerOpen = MutableStateFlow(false)
28 val drawerOpen = _drawerOpen.asStateFlow()
29
26 fun setEmulationStarted(started: Boolean) { 30 fun setEmulationStarted(started: Boolean) {
27 _emulationStarted.value = started 31 _emulationStarted.value = started
28 } 32 }
@@ -49,6 +53,10 @@ class EmulationViewModel : ViewModel() {
49 setTotalShaders(max) 53 setTotalShaders(max)
50 } 54 }
51 55
56 fun setDrawerOpen(value: Boolean) {
57 _drawerOpen.value = value
58 }
59
52 fun clear() { 60 fun clear() {
53 setEmulationStarted(false) 61 setEmulationStarted(false)
54 setIsEmulationStopping(false) 62 setIsEmulationStopping(false)
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
index 655e49219..a5eba6474 100644
--- a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
+++ b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
@@ -11,12 +11,14 @@
11 android:id="@+id/appbar_about" 11 android:id="@+id/appbar_about"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:fitsSystemWindows="true"> 14 android:fitsSystemWindows="true"
15 android:touchscreenBlocksFocus="false">
15 16
16 <com.google.android.material.appbar.MaterialToolbar 17 <com.google.android.material.appbar.MaterialToolbar
17 android:id="@+id/toolbar_about" 18 android:id="@+id/toolbar_about"
18 android:layout_width="match_parent" 19 android:layout_width="match_parent"
19 android:layout_height="?attr/actionBarSize" 20 android:layout_height="?attr/actionBarSize"
21 android:touchscreenBlocksFocus="false"
20 app:navigationIcon="@drawable/ic_back" 22 app:navigationIcon="@drawable/ic_back"
21 app:title="@string/about" /> 23 app:title="@string/about" />
22 24
@@ -28,6 +30,7 @@
28 android:layout_height="match_parent" 30 android:layout_height="match_parent"
29 android:fadeScrollbars="false" 31 android:fadeScrollbars="false"
30 android:scrollbars="vertical" 32 android:scrollbars="vertical"
33 android:defaultFocusHighlightEnabled="false"
31 app:layout_behavior="@string/appbar_scrolling_view_behavior"> 34 app:layout_behavior="@string/appbar_scrolling_view_behavior">
32 35
33 <LinearLayout 36 <LinearLayout
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_game_info.xml b/src/android/app/src/main/res/layout-w600dp/fragment_game_info.xml
new file mode 100644
index 000000000..90d95dbb7
--- /dev/null
+++ b/src/android/app/src/main/res/layout-w600dp/fragment_game_info.xml
@@ -0,0 +1,155 @@
1<?xml version="1.0" encoding="utf-8"?>
2<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools"
5 android:id="@+id/coordinator_about"
6 android:layout_width="match_parent"
7 android:layout_height="match_parent"
8 android:background="?attr/colorSurface">
9
10 <com.google.android.material.appbar.AppBarLayout
11 android:id="@+id/appbar_info"
12 android:layout_width="match_parent"
13 android:layout_height="wrap_content"
14 android:fitsSystemWindows="true"
15 android:touchscreenBlocksFocus="false">
16
17 <com.google.android.material.appbar.MaterialToolbar
18 android:id="@+id/toolbar_info"
19 android:layout_width="match_parent"
20 android:layout_height="?attr/actionBarSize"
21 android:touchscreenBlocksFocus="false"
22 app:navigationIcon="@drawable/ic_back" />
23
24 </com.google.android.material.appbar.AppBarLayout>
25
26 <androidx.core.widget.NestedScrollView
27 android:id="@+id/scroll_info"
28 android:layout_width="match_parent"
29 android:layout_height="wrap_content"
30 android:defaultFocusHighlightEnabled="false"
31 app:layout_behavior="@string/appbar_scrolling_view_behavior">
32
33 <LinearLayout
34 android:id="@+id/content_info"
35 android:layout_width="match_parent"
36 android:layout_height="wrap_content"
37 android:orientation="horizontal"
38 android:paddingHorizontal="16dp"
39 android:baselineAligned="false">
40
41 <LinearLayout
42 android:layout_width="match_parent"
43 android:layout_height="match_parent"
44 android:orientation="vertical"
45 android:layout_weight="3"
46 android:gravity="top|center_horizontal"
47 android:paddingHorizontal="16dp">
48
49 <com.google.android.material.button.MaterialButton
50 android:id="@+id/button_copy"
51 style="@style/Widget.Material3.Button"
52 android:layout_width="wrap_content"
53 android:layout_height="wrap_content"
54 android:layout_marginTop="16dp"
55 android:text="@string/copy_details" />
56
57 <com.google.android.material.button.MaterialButton
58 android:id="@+id/button_verify_integrity"
59 style="@style/Widget.Material3.Button"
60 android:layout_width="wrap_content"
61 android:layout_height="wrap_content"
62 android:layout_marginTop="10dp"
63 android:text="@string/verify_integrity" />
64
65 </LinearLayout>
66
67 <LinearLayout
68 android:layout_width="match_parent"
69 android:layout_height="match_parent"
70 android:orientation="vertical"
71 android:layout_weight="1">
72
73 <com.google.android.material.textfield.TextInputLayout
74 android:id="@+id/path"
75 android:layout_width="match_parent"
76 android:layout_height="wrap_content"
77 android:paddingTop="16dp">
78
79 <com.google.android.material.textfield.TextInputEditText
80 android:id="@+id/path_field"
81 android:layout_width="match_parent"
82 android:layout_height="wrap_content"
83 android:editable="false"
84 android:importantForAutofill="no"
85 android:inputType="none"
86 android:minHeight="48dp"
87 android:textAlignment="viewStart"
88 tools:text="1.0.0" />
89
90 </com.google.android.material.textfield.TextInputLayout>
91
92 <com.google.android.material.textfield.TextInputLayout
93 android:id="@+id/program_id"
94 android:layout_width="match_parent"
95 android:layout_height="wrap_content"
96 android:paddingTop="16dp">
97
98 <com.google.android.material.textfield.TextInputEditText
99 android:id="@+id/program_id_field"
100 android:layout_width="match_parent"
101 android:layout_height="wrap_content"
102 android:editable="false"
103 android:importantForAutofill="no"
104 android:inputType="none"
105 android:minHeight="48dp"
106 android:textAlignment="viewStart"
107 tools:text="1.0.0" />
108
109 </com.google.android.material.textfield.TextInputLayout>
110
111 <com.google.android.material.textfield.TextInputLayout
112 android:id="@+id/developer"
113 android:layout_width="match_parent"
114 android:layout_height="wrap_content"
115 android:paddingTop="16dp">
116
117 <com.google.android.material.textfield.TextInputEditText
118 android:id="@+id/developer_field"
119 android:layout_width="match_parent"
120 android:layout_height="wrap_content"
121 android:editable="false"
122 android:importantForAutofill="no"
123 android:inputType="none"
124 android:minHeight="48dp"
125 android:textAlignment="viewStart"
126 tools:text="1.0.0" />
127
128 </com.google.android.material.textfield.TextInputLayout>
129
130 <com.google.android.material.textfield.TextInputLayout
131 android:id="@+id/version"
132 android:layout_width="match_parent"
133 android:layout_height="wrap_content"
134 android:paddingTop="16dp">
135
136 <com.google.android.material.textfield.TextInputEditText
137 android:id="@+id/version_field"
138 android:layout_width="match_parent"
139 android:layout_height="wrap_content"
140 android:editable="false"
141 android:importantForAutofill="no"
142 android:inputType="none"
143 android:minHeight="48dp"
144 android:textAlignment="viewStart"
145 tools:text="1.0.0" />
146
147 </com.google.android.material.textfield.TextInputLayout>
148
149 </LinearLayout>
150
151 </LinearLayout>
152
153 </androidx.core.widget.NestedScrollView>
154
155</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml b/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
index 551f255c0..7cdef569f 100644
--- a/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
+++ b/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
@@ -14,6 +14,7 @@
14 android:clipToPadding="false" 14 android:clipToPadding="false"
15 android:fadeScrollbars="false" 15 android:fadeScrollbars="false"
16 android:scrollbars="vertical" 16 android:scrollbars="vertical"
17 android:defaultFocusHighlightEnabled="false"
17 app:layout_constraintEnd_toEndOf="parent" 18 app:layout_constraintEnd_toEndOf="parent"
18 app:layout_constraintStart_toEndOf="@+id/icon_layout" 19 app:layout_constraintStart_toEndOf="@+id/icon_layout"
19 app:layout_constraintTop_toTopOf="parent"> 20 app:layout_constraintTop_toTopOf="parent">
diff --git a/src/android/app/src/main/res/layout/card_driver_option.xml b/src/android/app/src/main/res/layout/card_driver_option.xml
index 1dd9a6d7d..bda524f0f 100644
--- a/src/android/app/src/main/res/layout/card_driver_option.xml
+++ b/src/android/app/src/main/res/layout/card_driver_option.xml
@@ -23,6 +23,7 @@
23 android:layout_width="wrap_content" 23 android:layout_width="wrap_content"
24 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
25 android:layout_gravity="center_vertical" 25 android:layout_gravity="center_vertical"
26 android:focusable="false"
26 android:clickable="false" 27 android:clickable="false"
27 android:checked="false" /> 28 android:checked="false" />
28 29
diff --git a/src/android/app/src/main/res/layout/card_folder.xml b/src/android/app/src/main/res/layout/card_folder.xml
index 4e0c04b6b..ed4a7ca8f 100644
--- a/src/android/app/src/main/res/layout/card_folder.xml
+++ b/src/android/app/src/main/res/layout/card_folder.xml
@@ -6,16 +6,14 @@
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="wrap_content" 7 android:layout_height="wrap_content"
8 android:layout_marginHorizontal="16dp" 8 android:layout_marginHorizontal="16dp"
9 android:layout_marginVertical="12dp" 9 android:layout_marginVertical="12dp">
10 android:focusable="true">
11 10
12 <androidx.constraintlayout.widget.ConstraintLayout 11 <androidx.constraintlayout.widget.ConstraintLayout
13 android:layout_width="match_parent" 12 android:layout_width="match_parent"
14 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
15 android:orientation="horizontal" 14 android:orientation="horizontal"
16 android:padding="16dp" 15 android:padding="16dp"
17 android:layout_gravity="center_vertical" 16 android:layout_gravity="center_vertical">
18 android:animateLayoutChanges="true">
19 17
20 <com.google.android.material.textview.MaterialTextView 18 <com.google.android.material.textview.MaterialTextView
21 android:id="@+id/path" 19 android:id="@+id/path"
diff --git a/src/android/app/src/main/res/layout/fragment_about.xml b/src/android/app/src/main/res/layout/fragment_about.xml
index 38090fa50..7f32e139a 100644
--- a/src/android/app/src/main/res/layout/fragment_about.xml
+++ b/src/android/app/src/main/res/layout/fragment_about.xml
@@ -11,12 +11,14 @@
11 android:id="@+id/appbar_about" 11 android:id="@+id/appbar_about"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:fitsSystemWindows="true"> 14 android:fitsSystemWindows="true"
15 android:touchscreenBlocksFocus="false">
15 16
16 <com.google.android.material.appbar.MaterialToolbar 17 <com.google.android.material.appbar.MaterialToolbar
17 android:id="@+id/toolbar_about" 18 android:id="@+id/toolbar_about"
18 android:layout_width="match_parent" 19 android:layout_width="match_parent"
19 android:layout_height="?attr/actionBarSize" 20 android:layout_height="?attr/actionBarSize"
21 android:touchscreenBlocksFocus="false"
20 app:title="@string/about" 22 app:title="@string/about"
21 app:navigationIcon="@drawable/ic_back" /> 23 app:navigationIcon="@drawable/ic_back" />
22 24
@@ -28,6 +30,7 @@
28 android:layout_height="match_parent" 30 android:layout_height="match_parent"
29 android:scrollbars="vertical" 31 android:scrollbars="vertical"
30 android:fadeScrollbars="false" 32 android:fadeScrollbars="false"
33 android:defaultFocusHighlightEnabled="false"
31 app:layout_behavior="@string/appbar_scrolling_view_behavior"> 34 app:layout_behavior="@string/appbar_scrolling_view_behavior">
32 35
33 <LinearLayout 36 <LinearLayout
diff --git a/src/android/app/src/main/res/layout/fragment_addons.xml b/src/android/app/src/main/res/layout/fragment_addons.xml
index a25e82766..b029b4209 100644
--- a/src/android/app/src/main/res/layout/fragment_addons.xml
+++ b/src/android/app/src/main/res/layout/fragment_addons.xml
@@ -11,6 +11,7 @@
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:fitsSystemWindows="true" 13 android:fitsSystemWindows="true"
14 android:touchscreenBlocksFocus="false"
14 app:layout_constraintEnd_toEndOf="parent" 15 app:layout_constraintEnd_toEndOf="parent"
15 app:layout_constraintStart_toStartOf="parent" 16 app:layout_constraintStart_toStartOf="parent"
16 app:layout_constraintTop_toTopOf="parent"> 17 app:layout_constraintTop_toTopOf="parent">
@@ -19,6 +20,7 @@
19 android:id="@+id/toolbar_addons" 20 android:id="@+id/toolbar_addons"
20 android:layout_width="match_parent" 21 android:layout_width="match_parent"
21 android:layout_height="?attr/actionBarSize" 22 android:layout_height="?attr/actionBarSize"
23 android:touchscreenBlocksFocus="false"
22 app:navigationIcon="@drawable/ic_back" /> 24 app:navigationIcon="@drawable/ic_back" />
23 25
24 </com.google.android.material.appbar.AppBarLayout> 26 </com.google.android.material.appbar.AppBarLayout>
@@ -28,6 +30,8 @@
28 android:layout_width="match_parent" 30 android:layout_width="match_parent"
29 android:layout_height="0dp" 31 android:layout_height="0dp"
30 android:clipToPadding="false" 32 android:clipToPadding="false"
33 android:defaultFocusHighlightEnabled="false"
34 android:nextFocusDown="@id/button_install"
31 app:layout_behavior="@string/appbar_scrolling_view_behavior" 35 app:layout_behavior="@string/appbar_scrolling_view_behavior"
32 app:layout_constraintBottom_toBottomOf="parent" 36 app:layout_constraintBottom_toBottomOf="parent"
33 app:layout_constraintEnd_toEndOf="parent" 37 app:layout_constraintEnd_toEndOf="parent"
diff --git a/src/android/app/src/main/res/layout/fragment_applet_launcher.xml b/src/android/app/src/main/res/layout/fragment_applet_launcher.xml
index fe8fae40f..95e6d6a6b 100644
--- a/src/android/app/src/main/res/layout/fragment_applet_launcher.xml
+++ b/src/android/app/src/main/res/layout/fragment_applet_launcher.xml
@@ -10,12 +10,14 @@
10 android:id="@+id/appbar_applets" 10 android:id="@+id/appbar_applets"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:fitsSystemWindows="true"> 13 android:fitsSystemWindows="true"
14 android:touchscreenBlocksFocus="false">
14 15
15 <com.google.android.material.appbar.MaterialToolbar 16 <com.google.android.material.appbar.MaterialToolbar
16 android:id="@+id/toolbar_applets" 17 android:id="@+id/toolbar_applets"
17 android:layout_width="match_parent" 18 android:layout_width="match_parent"
18 android:layout_height="?attr/actionBarSize" 19 android:layout_height="?attr/actionBarSize"
20 android:touchscreenBlocksFocus="false"
19 app:navigationIcon="@drawable/ic_back" 21 app:navigationIcon="@drawable/ic_back"
20 app:title="@string/applets" /> 22 app:title="@string/applets" />
21 23
diff --git a/src/android/app/src/main/res/layout/fragment_driver_manager.xml b/src/android/app/src/main/res/layout/fragment_driver_manager.xml
index 6cea2d164..56d8e6bb8 100644
--- a/src/android/app/src/main/res/layout/fragment_driver_manager.xml
+++ b/src/android/app/src/main/res/layout/fragment_driver_manager.xml
@@ -15,12 +15,14 @@
15 android:layout_width="match_parent" 15 android:layout_width="match_parent"
16 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
17 android:fitsSystemWindows="true" 17 android:fitsSystemWindows="true"
18 android:touchscreenBlocksFocus="false"
18 app:liftOnScrollTargetViewId="@id/list_drivers"> 19 app:liftOnScrollTargetViewId="@id/list_drivers">
19 20
20 <com.google.android.material.appbar.MaterialToolbar 21 <com.google.android.material.appbar.MaterialToolbar
21 android:id="@+id/toolbar_drivers" 22 android:id="@+id/toolbar_drivers"
22 android:layout_width="match_parent" 23 android:layout_width="match_parent"
23 android:layout_height="?attr/actionBarSize" 24 android:layout_height="?attr/actionBarSize"
25 android:touchscreenBlocksFocus="false"
24 app:navigationIcon="@drawable/ic_back" 26 app:navigationIcon="@drawable/ic_back"
25 app:title="@string/gpu_driver_manager" /> 27 app:title="@string/gpu_driver_manager" />
26 28
diff --git a/src/android/app/src/main/res/layout/fragment_early_access.xml b/src/android/app/src/main/res/layout/fragment_early_access.xml
index 644b4dd45..12e233afc 100644
--- a/src/android/app/src/main/res/layout/fragment_early_access.xml
+++ b/src/android/app/src/main/res/layout/fragment_early_access.xml
@@ -11,12 +11,14 @@
11 android:id="@+id/appbar_ea" 11 android:id="@+id/appbar_ea"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:fitsSystemWindows="true"> 14 android:fitsSystemWindows="true"
15 android:touchscreenBlocksFocus="false">
15 16
16 <com.google.android.material.appbar.MaterialToolbar 17 <com.google.android.material.appbar.MaterialToolbar
17 android:id="@+id/toolbar_about" 18 android:id="@+id/toolbar_about"
18 android:layout_width="match_parent" 19 android:layout_width="match_parent"
19 android:layout_height="?attr/actionBarSize" 20 android:layout_height="?attr/actionBarSize"
21 android:touchscreenBlocksFocus="false"
20 app:navigationIcon="@drawable/ic_back" 22 app:navigationIcon="@drawable/ic_back"
21 app:title="@string/early_access" /> 23 app:title="@string/early_access" />
22 24
@@ -30,6 +32,7 @@
30 android:paddingBottom="20dp" 32 android:paddingBottom="20dp"
31 android:scrollbars="vertical" 33 android:scrollbars="vertical"
32 android:fadeScrollbars="false" 34 android:fadeScrollbars="false"
35 android:defaultFocusHighlightEnabled="false"
33 app:layout_behavior="@string/appbar_scrolling_view_behavior"> 36 app:layout_behavior="@string/appbar_scrolling_view_behavior">
34 37
35 <LinearLayout 38 <LinearLayout
diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml
index 5252adf54..c01117d14 100644
--- a/src/android/app/src/main/res/layout/fragment_emulation.xml
+++ b/src/android/app/src/main/res/layout/fragment_emulation.xml
@@ -5,6 +5,7 @@
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 android:keepScreenOn="true" 7 android:keepScreenOn="true"
8 android:defaultFocusHighlightEnabled="false"
8 tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment" 9 tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment"
9 tools:openDrawer="start"> 10 tools:openDrawer="start">
10 11
@@ -24,7 +25,8 @@
24 android:layout_height="match_parent" 25 android:layout_height="match_parent"
25 android:layout_gravity="center" 26 android:layout_gravity="center"
26 android:focusable="false" 27 android:focusable="false"
27 android:focusableInTouchMode="false" /> 28 android:focusableInTouchMode="false"
29 android:defaultFocusHighlightEnabled="false" />
28 30
29 <com.google.android.material.card.MaterialCardView 31 <com.google.android.material.card.MaterialCardView
30 android:id="@+id/loading_indicator" 32 android:id="@+id/loading_indicator"
@@ -32,7 +34,7 @@
32 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
33 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
34 android:layout_gravity="center" 36 android:layout_gravity="center"
35 android:focusable="false" 37 android:defaultFocusHighlightEnabled="false"
36 android:clickable="false"> 38 android:clickable="false">
37 39
38 <androidx.constraintlayout.widget.ConstraintLayout 40 <androidx.constraintlayout.widget.ConstraintLayout
@@ -118,6 +120,7 @@
118 android:layout_gravity="center" 120 android:layout_gravity="center"
119 android:focusable="true" 121 android:focusable="true"
120 android:focusableInTouchMode="true" 122 android:focusableInTouchMode="true"
123 android:defaultFocusHighlightEnabled="false"
121 android:visibility="invisible" /> 124 android:visibility="invisible" />
122 125
123 <Button 126 <Button
@@ -160,6 +163,7 @@
160 android:layout_width="wrap_content" 163 android:layout_width="wrap_content"
161 android:layout_height="match_parent" 164 android:layout_height="match_parent"
162 android:layout_gravity="start" 165 android:layout_gravity="start"
166 android:focusedByDefault="true"
163 app:headerLayout="@layout/header_in_game" 167 app:headerLayout="@layout/header_in_game"
164 app:menu="@menu/menu_in_game" 168 app:menu="@menu/menu_in_game"
165 tools:visibility="gone" /> 169 tools:visibility="gone" />
diff --git a/src/android/app/src/main/res/layout/fragment_folders.xml b/src/android/app/src/main/res/layout/fragment_folders.xml
index 74f2f3754..b5c7676d8 100644
--- a/src/android/app/src/main/res/layout/fragment_folders.xml
+++ b/src/android/app/src/main/res/layout/fragment_folders.xml
@@ -15,12 +15,14 @@
15 android:layout_width="match_parent" 15 android:layout_width="match_parent"
16 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
17 android:fitsSystemWindows="true" 17 android:fitsSystemWindows="true"
18 android:touchscreenBlocksFocus="false"
18 app:liftOnScrollTargetViewId="@id/list_folders"> 19 app:liftOnScrollTargetViewId="@id/list_folders">
19 20
20 <com.google.android.material.appbar.MaterialToolbar 21 <com.google.android.material.appbar.MaterialToolbar
21 android:id="@+id/toolbar_folders" 22 android:id="@+id/toolbar_folders"
22 android:layout_width="match_parent" 23 android:layout_width="match_parent"
23 android:layout_height="?attr/actionBarSize" 24 android:layout_height="?attr/actionBarSize"
25 android:touchscreenBlocksFocus="false"
24 app:navigationIcon="@drawable/ic_back" 26 app:navigationIcon="@drawable/ic_back"
25 app:title="@string/game_folders" /> 27 app:title="@string/game_folders" />
26 28
@@ -31,6 +33,7 @@
31 android:layout_width="match_parent" 33 android:layout_width="match_parent"
32 android:layout_height="wrap_content" 34 android:layout_height="wrap_content"
33 android:clipToPadding="false" 35 android:clipToPadding="false"
36 android:defaultFocusHighlightEnabled="false"
34 app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 37 app:layout_behavior="@string/appbar_scrolling_view_behavior" />
35 38
36 </androidx.coordinatorlayout.widget.CoordinatorLayout> 39 </androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/src/android/app/src/main/res/layout/fragment_game_info.xml b/src/android/app/src/main/res/layout/fragment_game_info.xml
index 53af15787..f29e7e376 100644
--- a/src/android/app/src/main/res/layout/fragment_game_info.xml
+++ b/src/android/app/src/main/res/layout/fragment_game_info.xml
@@ -11,12 +11,14 @@
11 android:id="@+id/appbar_info" 11 android:id="@+id/appbar_info"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:touchscreenBlocksFocus="false"
14 android:fitsSystemWindows="true"> 15 android:fitsSystemWindows="true">
15 16
16 <com.google.android.material.appbar.MaterialToolbar 17 <com.google.android.material.appbar.MaterialToolbar
17 android:id="@+id/toolbar_info" 18 android:id="@+id/toolbar_info"
18 android:layout_width="match_parent" 19 android:layout_width="match_parent"
19 android:layout_height="?attr/actionBarSize" 20 android:layout_height="?attr/actionBarSize"
21 android:touchscreenBlocksFocus="false"
20 app:navigationIcon="@drawable/ic_back" /> 22 app:navigationIcon="@drawable/ic_back" />
21 23
22 </com.google.android.material.appbar.AppBarLayout> 24 </com.google.android.material.appbar.AppBarLayout>
@@ -25,6 +27,7 @@
25 android:id="@+id/scroll_info" 27 android:id="@+id/scroll_info"
26 android:layout_width="match_parent" 28 android:layout_width="match_parent"
27 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:defaultFocusHighlightEnabled="false"
28 app:layout_behavior="@string/appbar_scrolling_view_behavior"> 31 app:layout_behavior="@string/appbar_scrolling_view_behavior">
29 32
30 <LinearLayout 33 <LinearLayout
diff --git a/src/android/app/src/main/res/layout/fragment_game_properties.xml b/src/android/app/src/main/res/layout/fragment_game_properties.xml
index cadd0bc4a..436ebd79d 100644
--- a/src/android/app/src/main/res/layout/fragment_game_properties.xml
+++ b/src/android/app/src/main/res/layout/fragment_game_properties.xml
@@ -12,7 +12,8 @@
12 android:layout_height="match_parent" 12 android:layout_height="match_parent"
13 android:scrollbars="vertical" 13 android:scrollbars="vertical"
14 android:fadeScrollbars="false" 14 android:fadeScrollbars="false"
15 android:clipToPadding="false"> 15 android:clipToPadding="false"
16 android:defaultFocusHighlightEnabled="false">
16 17
17 <LinearLayout 18 <LinearLayout
18 android:id="@+id/layout_all" 19 android:id="@+id/layout_all"
@@ -86,7 +87,7 @@
86 android:id="@+id/list_properties" 87 android:id="@+id/list_properties"
87 android:layout_width="match_parent" 88 android:layout_width="match_parent"
88 android:layout_height="match_parent" 89 android:layout_height="match_parent"
89 tools:listitem="@layout/card_simple_outlined" /> 90 android:defaultFocusHighlightEnabled="false" />
90 91
91 </LinearLayout> 92 </LinearLayout>
92 93
diff --git a/src/android/app/src/main/res/layout/fragment_games.xml b/src/android/app/src/main/res/layout/fragment_games.xml
index a0568668a..cc280b1ff 100644
--- a/src/android/app/src/main/res/layout/fragment_games.xml
+++ b/src/android/app/src/main/res/layout/fragment_games.xml
@@ -27,6 +27,7 @@
27 android:layout_width="match_parent" 27 android:layout_width="match_parent"
28 android:layout_height="match_parent" 28 android:layout_height="match_parent"
29 android:clipToPadding="false" 29 android:clipToPadding="false"
30 android:defaultFocusHighlightEnabled="false"
30 tools:listitem="@layout/card_game" /> 31 tools:listitem="@layout/card_game" />
31 32
32 </RelativeLayout> 33 </RelativeLayout>
diff --git a/src/android/app/src/main/res/layout/fragment_home_settings.xml b/src/android/app/src/main/res/layout/fragment_home_settings.xml
index d84093ba3..c179f9341 100644
--- a/src/android/app/src/main/res/layout/fragment_home_settings.xml
+++ b/src/android/app/src/main/res/layout/fragment_home_settings.xml
@@ -7,7 +7,8 @@
7 android:background="?attr/colorSurface" 7 android:background="?attr/colorSurface"
8 android:scrollbars="vertical" 8 android:scrollbars="vertical"
9 android:fadeScrollbars="false" 9 android:fadeScrollbars="false"
10 android:clipToPadding="false"> 10 android:clipToPadding="false"
11 android:defaultFocusHighlightEnabled="false">
11 12
12 <androidx.appcompat.widget.LinearLayoutCompat 13 <androidx.appcompat.widget.LinearLayoutCompat
13 android:id="@+id/linear_layout_settings" 14 android:id="@+id/linear_layout_settings"
diff --git a/src/android/app/src/main/res/layout/fragment_installables.xml b/src/android/app/src/main/res/layout/fragment_installables.xml
index 3a4df81a6..47ef3869f 100644
--- a/src/android/app/src/main/res/layout/fragment_installables.xml
+++ b/src/android/app/src/main/res/layout/fragment_installables.xml
@@ -10,12 +10,14 @@
10 android:id="@+id/appbar_installables" 10 android:id="@+id/appbar_installables"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:fitsSystemWindows="true"> 13 android:fitsSystemWindows="true"
14 android:touchscreenBlocksFocus="false">
14 15
15 <com.google.android.material.appbar.MaterialToolbar 16 <com.google.android.material.appbar.MaterialToolbar
16 android:id="@+id/toolbar_installables" 17 android:id="@+id/toolbar_installables"
17 android:layout_width="match_parent" 18 android:layout_width="match_parent"
18 android:layout_height="?attr/actionBarSize" 19 android:layout_height="?attr/actionBarSize"
20 android:touchscreenBlocksFocus="false"
19 app:title="@string/manage_yuzu_data" 21 app:title="@string/manage_yuzu_data"
20 app:navigationIcon="@drawable/ic_back" /> 22 app:navigationIcon="@drawable/ic_back" />
21 23
diff --git a/src/android/app/src/main/res/layout/fragment_licenses.xml b/src/android/app/src/main/res/layout/fragment_licenses.xml
index 6b31ff5b4..59d68b112 100644
--- a/src/android/app/src/main/res/layout/fragment_licenses.xml
+++ b/src/android/app/src/main/res/layout/fragment_licenses.xml
@@ -10,12 +10,14 @@
10 android:id="@+id/appbar_licenses" 10 android:id="@+id/appbar_licenses"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:fitsSystemWindows="true"> 13 android:fitsSystemWindows="true"
14 android:touchscreenBlocksFocus="false">
14 15
15 <com.google.android.material.appbar.MaterialToolbar 16 <com.google.android.material.appbar.MaterialToolbar
16 android:id="@+id/toolbar_licenses" 17 android:id="@+id/toolbar_licenses"
17 android:layout_width="match_parent" 18 android:layout_width="match_parent"
18 android:layout_height="?attr/actionBarSize" 19 android:layout_height="?attr/actionBarSize"
20 android:touchscreenBlocksFocus="false"
19 app:title="@string/licenses" 21 app:title="@string/licenses"
20 app:navigationIcon="@drawable/ic_back" /> 22 app:navigationIcon="@drawable/ic_back" />
21 23
diff --git a/src/android/app/src/main/res/layout/fragment_settings.xml b/src/android/app/src/main/res/layout/fragment_settings.xml
index ebedbf1ec..110c70eef 100644
--- a/src/android/app/src/main/res/layout/fragment_settings.xml
+++ b/src/android/app/src/main/res/layout/fragment_settings.xml
@@ -11,6 +11,7 @@
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:fitsSystemWindows="true" 13 android:fitsSystemWindows="true"
14 android:touchscreenBlocksFocus="false"
14 app:elevation="0dp"> 15 app:elevation="0dp">
15 16
16 <com.google.android.material.appbar.CollapsingToolbarLayout 17 <com.google.android.material.appbar.CollapsingToolbarLayout
@@ -24,6 +25,7 @@
24 android:id="@+id/toolbar_settings" 25 android:id="@+id/toolbar_settings"
25 android:layout_width="match_parent" 26 android:layout_width="match_parent"
26 android:layout_height="?attr/actionBarSize" 27 android:layout_height="?attr/actionBarSize"
28 android:touchscreenBlocksFocus="false"
27 app:layout_collapseMode="pin" 29 app:layout_collapseMode="pin"
28 app:navigationIcon="@drawable/ic_back" /> 30 app:navigationIcon="@drawable/ic_back" />
29 31
diff --git a/src/android/app/src/main/res/layout/list_item_addon.xml b/src/android/app/src/main/res/layout/list_item_addon.xml
index 3a1382fe2..9b1c0e6fc 100644
--- a/src/android/app/src/main/res/layout/list_item_addon.xml
+++ b/src/android/app/src/main/res/layout/list_item_addon.xml
@@ -6,7 +6,7 @@
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="wrap_content" 7 android:layout_height="wrap_content"
8 android:background="?attr/selectableItemBackground" 8 android:background="?attr/selectableItemBackground"
9 android:focusable="true" 9 android:focusable="false"
10 android:paddingHorizontal="20dp" 10 android:paddingHorizontal="20dp"
11 android:paddingVertical="16dp"> 11 android:paddingVertical="16dp">
12 12
diff --git a/src/android/app/src/main/res/layout/list_item_settings_header.xml b/src/android/app/src/main/res/layout/list_item_settings_header.xml
index 21276b19e..615860368 100644
--- a/src/android/app/src/main/res/layout/list_item_settings_header.xml
+++ b/src/android/app/src/main/res/layout/list_item_settings_header.xml
@@ -12,4 +12,5 @@
12 android:textAlignment="viewStart" 12 android:textAlignment="viewStart"
13 android:textColor="?attr/colorPrimary" 13 android:textColor="?attr/colorPrimary"
14 android:textStyle="bold" 14 android:textStyle="bold"
15 android:focusable="false"
15 tools:text="CPU Settings" /> 16 tools:text="CPU Settings" />
diff --git a/src/core/hle/service/cmif_serialization.h b/src/core/hle/service/cmif_serialization.h
index 8e8cf2507..9eb10e816 100644
--- a/src/core/hle/service/cmif_serialization.h
+++ b/src/core/hle/service/cmif_serialization.h
@@ -97,20 +97,20 @@ constexpr RequestLayout GetDomainReplyOutLayout() {
97 }; 97 };
98} 98}
99 99
100template <bool Domain, typename MethodArguments> 100template <typename MethodArguments>
101constexpr RequestLayout GetReplyInLayout() { 101constexpr RequestLayout GetReplyInLayout(bool is_domain) {
102 return Domain ? GetDomainReplyInLayout<MethodArguments>() : GetNonDomainReplyInLayout<MethodArguments>(); 102 return is_domain ? GetDomainReplyInLayout<MethodArguments>() : GetNonDomainReplyInLayout<MethodArguments>();
103} 103}
104 104
105template <bool Domain, typename MethodArguments> 105template <typename MethodArguments>
106constexpr RequestLayout GetReplyOutLayout() { 106constexpr RequestLayout GetReplyOutLayout(bool is_domain) {
107 return Domain ? GetDomainReplyOutLayout<MethodArguments>() : GetNonDomainReplyOutLayout<MethodArguments>(); 107 return is_domain ? GetDomainReplyOutLayout<MethodArguments>() : GetNonDomainReplyOutLayout<MethodArguments>();
108} 108}
109 109
110using OutTemporaryBuffers = std::array<Common::ScratchBuffer<u8>, 3>; 110using OutTemporaryBuffers = std::array<Common::ScratchBuffer<u8>, 3>;
111 111
112template <bool Domain, typename MethodArguments, typename CallArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t HandleIndex = 0, size_t InBufferIndex = 0, size_t OutBufferIndex = 0, bool RawDataFinished = false, size_t ArgIndex = 0> 112template <typename MethodArguments, typename CallArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t HandleIndex = 0, size_t InBufferIndex = 0, size_t OutBufferIndex = 0, bool RawDataFinished = false, size_t ArgIndex = 0>
113void ReadInArgument(CallArguments& args, const u8* raw_data, HLERequestContext& ctx, OutTemporaryBuffers& temp) { 113void ReadInArgument(bool is_domain, CallArguments& args, const u8* raw_data, HLERequestContext& ctx, OutTemporaryBuffers& temp) {
114 if constexpr (ArgIndex >= std::tuple_size_v<CallArguments>) { 114 if constexpr (ArgIndex >= std::tuple_size_v<CallArguments>) {
115 return; 115 return;
116 } else { 116 } else {
@@ -134,25 +134,25 @@ void ReadInArgument(CallArguments& args, const u8* raw_data, HLERequestContext&
134 std::memcpy(&std::get<ArgIndex>(args), raw_data + ArgOffset, ArgSize); 134 std::memcpy(&std::get<ArgIndex>(args), raw_data + ArgOffset, ArgSize);
135 } 135 }
136 136
137 return ReadInArgument<Domain, MethodArguments, CallArguments, ArgAlign, ArgEnd, HandleIndex, InBufferIndex, OutBufferIndex, false, ArgIndex + 1>(args, raw_data, ctx, temp); 137 return ReadInArgument<MethodArguments, CallArguments, ArgAlign, ArgEnd, HandleIndex, InBufferIndex, OutBufferIndex, false, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
138 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InInterface) { 138 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InInterface) {
139 constexpr size_t ArgAlign = alignof(u32); 139 constexpr size_t ArgAlign = alignof(u32);
140 constexpr size_t ArgSize = sizeof(u32); 140 constexpr size_t ArgSize = sizeof(u32);
141 constexpr size_t ArgOffset = Common::AlignUp(DataOffset, ArgAlign); 141 constexpr size_t ArgOffset = Common::AlignUp(DataOffset, ArgAlign);
142 constexpr size_t ArgEnd = ArgOffset + ArgSize; 142 constexpr size_t ArgEnd = ArgOffset + ArgSize;
143 143
144 static_assert(Domain); 144 ASSERT(is_domain);
145 ASSERT(ctx.GetDomainMessageHeader().input_object_count > 0); 145 ASSERT(ctx.GetDomainMessageHeader().input_object_count > 0);
146 146
147 u32 value{}; 147 u32 value{};
148 std::memcpy(&value, raw_data + ArgOffset, ArgSize); 148 std::memcpy(&value, raw_data + ArgOffset, ArgSize);
149 std::get<ArgIndex>(args) = ctx.GetDomainHandler<ArgType::Type>(value - 1); 149 std::get<ArgIndex>(args) = ctx.GetDomainHandler<ArgType::Type>(value - 1);
150 150
151 return ReadInArgument<Domain, MethodArguments, CallArguments, ArgAlign, ArgEnd, HandleIndex, InBufferIndex, OutBufferIndex, true, ArgIndex + 1>(args, raw_data, ctx, temp); 151 return ReadInArgument<MethodArguments, CallArguments, ArgAlign, ArgEnd, HandleIndex, InBufferIndex, OutBufferIndex, true, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
152 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InCopyHandle) { 152 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InCopyHandle) {
153 std::get<ArgIndex>(args) = std::move(ctx.GetObjectFromHandle<typename ArgType::Type>(ctx.GetCopyHandle(HandleIndex))); 153 std::get<ArgIndex>(args) = ctx.GetObjectFromHandle<typename ArgType::Type>(ctx.GetCopyHandle(HandleIndex)).GetPointerUnsafe();
154 154
155 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex + 1, InBufferIndex, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 155 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex + 1, InBufferIndex, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
156 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InLargeData) { 156 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InLargeData) {
157 constexpr size_t BufferSize = sizeof(ArgType); 157 constexpr size_t BufferSize = sizeof(ArgType);
158 158
@@ -172,7 +172,7 @@ void ReadInArgument(CallArguments& args, const u8* raw_data, HLERequestContext&
172 172
173 std::memcpy(&std::get<ArgIndex>(args), buffer.data(), std::min(BufferSize, buffer.size())); 173 std::memcpy(&std::get<ArgIndex>(args), buffer.data(), std::min(BufferSize, buffer.size()));
174 174
175 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex + 1, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 175 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex + 1, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
176 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InBuffer) { 176 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InBuffer) {
177 using ElementType = typename ArgType::Type; 177 using ElementType = typename ArgType::Type;
178 178
@@ -193,14 +193,14 @@ void ReadInArgument(CallArguments& args, const u8* raw_data, HLERequestContext&
193 193
194 std::get<ArgIndex>(args) = std::span(ptr, size); 194 std::get<ArgIndex>(args) = std::span(ptr, size);
195 195
196 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex + 1, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 196 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex + 1, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
197 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutLargeData) { 197 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutLargeData) {
198 constexpr size_t BufferSize = sizeof(ArgType); 198 constexpr size_t BufferSize = sizeof(ArgType);
199 199
200 // Clear the existing data. 200 // Clear the existing data.
201 std::memset(&std::get<ArgIndex>(args), 0, BufferSize); 201 std::memset(&std::get<ArgIndex>(args), 0, BufferSize);
202 202
203 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 203 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
204 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutBuffer) { 204 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutBuffer) {
205 using ElementType = typename ArgType::Type; 205 using ElementType = typename ArgType::Type;
206 206
@@ -217,15 +217,15 @@ void ReadInArgument(CallArguments& args, const u8* raw_data, HLERequestContext&
217 217
218 std::get<ArgIndex>(args) = std::span(ptr, size); 218 std::get<ArgIndex>(args) = std::span(ptr, size);
219 219
220 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 220 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
221 } else { 221 } else {
222 return ReadInArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 222 return ReadInArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, HandleIndex, InBufferIndex, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
223 } 223 }
224 } 224 }
225} 225}
226 226
227template <bool Domain, typename MethodArguments, typename CallArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t OutBufferIndex = 0, bool RawDataFinished = false, size_t ArgIndex = 0> 227template <typename MethodArguments, typename CallArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t OutBufferIndex = 0, bool RawDataFinished = false, size_t ArgIndex = 0>
228void WriteOutArgument(CallArguments& args, u8* raw_data, HLERequestContext& ctx, OutTemporaryBuffers& temp) { 228void WriteOutArgument(bool is_domain, CallArguments& args, u8* raw_data, HLERequestContext& ctx, OutTemporaryBuffers& temp) {
229 if constexpr (ArgIndex >= std::tuple_size_v<CallArguments>) { 229 if constexpr (ArgIndex >= std::tuple_size_v<CallArguments>) {
230 return; 230 return;
231 } else { 231 } else {
@@ -243,23 +243,23 @@ void WriteOutArgument(CallArguments& args, u8* raw_data, HLERequestContext& ctx,
243 243
244 std::memcpy(raw_data + ArgOffset, &std::get<ArgIndex>(args), ArgSize); 244 std::memcpy(raw_data + ArgOffset, &std::get<ArgIndex>(args), ArgSize);
245 245
246 return WriteOutArgument<Domain, MethodArguments, CallArguments, ArgAlign, ArgEnd, OutBufferIndex, false, ArgIndex + 1>(args, raw_data, ctx, temp); 246 return WriteOutArgument<MethodArguments, CallArguments, ArgAlign, ArgEnd, OutBufferIndex, false, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
247 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutInterface) { 247 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutInterface) {
248 if constexpr (Domain) { 248 if (is_domain) {
249 ctx.AddDomainObject(std::get<ArgIndex>(args)); 249 ctx.AddDomainObject(std::get<ArgIndex>(args));
250 } else { 250 } else {
251 ctx.AddMoveInterface(std::get<ArgIndex>(args)); 251 ctx.AddMoveInterface(std::get<ArgIndex>(args));
252 } 252 }
253 253
254 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, true, ArgIndex + 1>(args, raw_data, ctx, temp); 254 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, true, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
255 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutCopyHandle) { 255 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutCopyHandle) {
256 ctx.AddCopyObject(std::get<ArgIndex>(args).GetPointerUnsafe()); 256 ctx.AddCopyObject(std::get<ArgIndex>(args));
257 257
258 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 258 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
259 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutMoveHandle) { 259 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutMoveHandle) {
260 ctx.AddMoveObject(std::get<ArgIndex>(args).GetPointerUnsafe()); 260 ctx.AddMoveObject(std::get<ArgIndex>(args));
261 261
262 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 262 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
263 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutLargeData) { 263 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutLargeData) {
264 constexpr size_t BufferSize = sizeof(ArgType); 264 constexpr size_t BufferSize = sizeof(ArgType);
265 265
@@ -272,7 +272,7 @@ void WriteOutArgument(CallArguments& args, u8* raw_data, HLERequestContext& ctx,
272 ctx.WriteBufferC(&std::get<ArgIndex>(args), BufferSize, OutBufferIndex); 272 ctx.WriteBufferC(&std::get<ArgIndex>(args), BufferSize, OutBufferIndex);
273 } 273 }
274 274
275 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 275 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
276 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutBuffer) { 276 } else if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutBuffer) {
277 auto& buffer = temp[OutBufferIndex]; 277 auto& buffer = temp[OutBufferIndex];
278 const size_t size = buffer.size(); 278 const size_t size = buffer.size();
@@ -287,9 +287,9 @@ void WriteOutArgument(CallArguments& args, u8* raw_data, HLERequestContext& ctx,
287 } 287 }
288 } 288 }
289 289
290 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>( args, raw_data, ctx, temp); 290 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex + 1, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
291 } else { 291 } else {
292 return WriteOutArgument<Domain, MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(args, raw_data, ctx, temp); 292 return WriteOutArgument<MethodArguments, CallArguments, PrevAlign, DataOffset, OutBufferIndex, RawDataFinished, ArgIndex + 1>(is_domain, args, raw_data, ctx, temp);
293 } 293 }
294 } 294 }
295} 295}
@@ -297,11 +297,10 @@ void WriteOutArgument(CallArguments& args, u8* raw_data, HLERequestContext& ctx,
297template <bool Domain, typename T, typename... A> 297template <bool Domain, typename T, typename... A>
298void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) { 298void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
299 // Verify domain state. 299 // Verify domain state.
300 if constexpr (Domain) { 300 if constexpr (!Domain) {
301 ASSERT_MSG(ctx.GetManager()->IsDomain(), "Domain reply used on non-domain session");
302 } else {
303 ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Non-domain reply used on domain session"); 301 ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Non-domain reply used on domain session");
304 } 302 }
303 const bool is_domain = Domain ? ctx.GetManager()->IsDomain() : false;
305 304
306 using MethodArguments = std::tuple<std::remove_reference_t<A>...>; 305 using MethodArguments = std::tuple<std::remove_reference_t<A>...>;
307 306
@@ -310,7 +309,7 @@ void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
310 309
311 // Read inputs. 310 // Read inputs.
312 const size_t offset_plus_command_id = ctx.GetDataPayloadOffset() + 2; 311 const size_t offset_plus_command_id = ctx.GetDataPayloadOffset() + 2;
313 ReadInArgument<Domain, MethodArguments>(call_arguments, reinterpret_cast<u8*>(ctx.CommandBuffer() + offset_plus_command_id), ctx, buffers); 312 ReadInArgument<MethodArguments>(is_domain, call_arguments, reinterpret_cast<u8*>(ctx.CommandBuffer() + offset_plus_command_id), ctx, buffers);
314 313
315 // Call. 314 // Call.
316 const auto Callable = [&]<typename... CallArgs>(CallArgs&... args) { 315 const auto Callable = [&]<typename... CallArgs>(CallArgs&... args) {
@@ -319,12 +318,12 @@ void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
319 const Result res = std::apply(Callable, call_arguments); 318 const Result res = std::apply(Callable, call_arguments);
320 319
321 // Write result. 320 // Write result.
322 constexpr RequestLayout layout = GetReplyOutLayout<Domain, MethodArguments>(); 321 const RequestLayout layout = GetReplyOutLayout<MethodArguments>(is_domain);
323 IPC::ResponseBuilder rb{ctx, 2 + Common::DivCeil(layout.cmif_raw_data_size, sizeof(u32)), layout.copy_handle_count, layout.move_handle_count + layout.domain_interface_count}; 322 IPC::ResponseBuilder rb{ctx, 2 + Common::DivCeil(layout.cmif_raw_data_size, sizeof(u32)), layout.copy_handle_count, layout.move_handle_count + layout.domain_interface_count};
324 rb.Push(res); 323 rb.Push(res);
325 324
326 // Write out arguments. 325 // Write out arguments.
327 WriteOutArgument<Domain, MethodArguments>(call_arguments, reinterpret_cast<u8*>(ctx.CommandBuffer() + rb.GetCurrentOffset()), ctx, buffers); 326 WriteOutArgument<MethodArguments>(is_domain, call_arguments, reinterpret_cast<u8*>(ctx.CommandBuffer() + rb.GetCurrentOffset()), ctx, buffers);
328} 327}
329// clang-format on 328// clang-format on
330 329
diff --git a/src/core/hle/service/cmif_types.h b/src/core/hle/service/cmif_types.h
index b80028c19..2610c49f3 100644
--- a/src/core/hle/service/cmif_types.h
+++ b/src/core/hle/service/cmif_types.h
@@ -15,19 +15,21 @@ namespace Service {
15template <typename T> 15template <typename T>
16class Out { 16class Out {
17public: 17public:
18 /* implicit */ Out(T& t) : raw(&t) {} 18 using Type = T;
19
20 /* implicit */ Out(Type& t) : raw(&t) {}
19 ~Out() = default; 21 ~Out() = default;
20 22
21 T* Get() const { 23 Type* Get() const {
22 return raw; 24 return raw;
23 } 25 }
24 26
25 T& operator*() { 27 Type& operator*() {
26 return *raw; 28 return *raw;
27 } 29 }
28 30
29private: 31private:
30 T* raw; 32 Type* raw;
31}; 33};
32 34
33template <typename T> 35template <typename T>
@@ -45,51 +47,93 @@ struct ClientProcessId {
45 u64 pid; 47 u64 pid;
46}; 48};
47 49
50struct ProcessId {
51 explicit operator bool() const {
52 return pid != 0;
53 }
54
55 const u64& operator*() const {
56 return pid;
57 }
58
59 u64 pid;
60};
61
48using ClientAppletResourceUserId = ClientProcessId; 62using ClientAppletResourceUserId = ClientProcessId;
63using AppletResourceUserId = ProcessId;
49 64
50template <typename T> 65template <typename T>
51class InCopyHandle : public Kernel::KScopedAutoObject<T> { 66class InCopyHandle {
52public: 67public:
53 using Type = T; 68 using Type = T;
54 69
55 template <typename... Args> 70 /* implicit */ InCopyHandle(Type* t) : raw(t) {}
56 /* implicit */ InCopyHandle(Args&&... args) : Kernel::KScopedAutoObject<T>(std::forward<Args...>(args)...) {} 71 /* implicit */ InCopyHandle() : raw() {}
57 ~InCopyHandle() = default; 72 ~InCopyHandle() = default;
58 73
59 InCopyHandle& operator=(InCopyHandle&& rhs) { 74 InCopyHandle& operator=(Type* rhs) {
60 Kernel::KScopedAutoObject<T>::operator=(std::move(rhs)); 75 raw = rhs;
61 return *this; 76 return *this;
62 } 77 }
78
79 Type* Get() const {
80 return raw;
81 }
82
83 Type& operator*() const {
84 return *raw;
85 }
86
87 Type* operator->() const {
88 return raw;
89 }
90
91 explicit operator bool() const {
92 return raw != nullptr;
93 }
94
95private:
96 Type* raw;
63}; 97};
64 98
65template <typename T> 99template <typename T>
66class OutCopyHandle : public Kernel::KScopedAutoObject<T> { 100class OutCopyHandle {
67public: 101public:
68 using Type = T; 102 using Type = T*;
69 103
70 template <typename... Args> 104 /* implicit */ OutCopyHandle(Type& t) : raw(&t) {}
71 /* implicit */ OutCopyHandle(Args&&... args) : Kernel::KScopedAutoObject<T>(std::forward<Args...>(args)...) {}
72 ~OutCopyHandle() = default; 105 ~OutCopyHandle() = default;
73 106
74 OutCopyHandle& operator=(OutCopyHandle&& rhs) { 107 Type* Get() const {
75 Kernel::KScopedAutoObject<T>::operator=(std::move(rhs)); 108 return raw;
76 return *this; 109 }
110
111 Type& operator*() {
112 return *raw;
77 } 113 }
114
115private:
116 Type* raw;
78}; 117};
79 118
80template <typename T> 119template <typename T>
81class OutMoveHandle : public Kernel::KScopedAutoObject<T> { 120class OutMoveHandle {
82public: 121public:
83 using Type = T; 122 using Type = T*;
84 123
85 template <typename... Args> 124 /* implicit */ OutMoveHandle(Type& t) : raw(&t) {}
86 /* implicit */ OutMoveHandle(Args&&... args) : Kernel::KScopedAutoObject<T>(std::forward<Args...>(args)...) {}
87 ~OutMoveHandle() = default; 125 ~OutMoveHandle() = default;
88 126
89 OutMoveHandle& operator=(OutMoveHandle&& rhs) { 127 Type* Get() const {
90 Kernel::KScopedAutoObject<T>::operator=(std::move(rhs)); 128 return raw;
91 return *this; 129 }
130
131 Type& operator*() {
132 return *raw;
92 } 133 }
134
135private:
136 Type* raw;
93}; 137};
94 138
95enum BufferAttr : int { 139enum BufferAttr : int {
@@ -105,12 +149,15 @@ enum BufferAttr : int {
105 149
106template <typename T, int A> 150template <typename T, int A>
107struct Buffer : public std::span<T> { 151struct Buffer : public std::span<T> {
108 static_assert(std::is_trivial_v<T>, "Buffer type must be trivial"); 152 static_assert(std::is_trivially_copyable_v<T>, "Buffer type must be trivially copyable");
109 static_assert((A & BufferAttr_FixedSize) == 0, "Buffer attr must not contain FixedSize"); 153 static_assert((A & BufferAttr_FixedSize) == 0, "Buffer attr must not contain FixedSize");
110 static_assert(((A & BufferAttr_In) == 0) ^ ((A & BufferAttr_Out) == 0), "Buffer attr must be In or Out"); 154 static_assert(((A & BufferAttr_In) == 0) ^ ((A & BufferAttr_Out) == 0), "Buffer attr must be In or Out");
111 static constexpr BufferAttr Attr = static_cast<BufferAttr>(A); 155 static constexpr BufferAttr Attr = static_cast<BufferAttr>(A);
112 using Type = T; 156 using Type = T;
113 157
158 /* implicit */ Buffer(const std::span<T>& rhs) : std::span<T>(rhs) {}
159 /* implicit */ Buffer() = default;
160
114 Buffer& operator=(const std::span<T>& rhs) { 161 Buffer& operator=(const std::span<T>& rhs) {
115 std::span<T>::operator=(rhs); 162 std::span<T>::operator=(rhs);
116 return *this; 163 return *this;
@@ -139,11 +186,14 @@ using OutArray = Buffer<T, BufferAttr_Out | A>;
139 186
140template <typename T, int A> 187template <typename T, int A>
141struct LargeData : public T { 188struct LargeData : public T {
142 static_assert(std::is_trivial_v<T>, "LargeData type must be trivial"); 189 static_assert(std::is_trivially_copyable_v<T>, "LargeData type must be trivially copyable");
143 static_assert((A & BufferAttr_FixedSize) != 0, "LargeData attr must contain FixedSize"); 190 static_assert((A & BufferAttr_FixedSize) != 0, "LargeData attr must contain FixedSize");
144 static_assert(((A & BufferAttr_In) == 0) ^ ((A & BufferAttr_Out) == 0), "LargeData attr must be In or Out"); 191 static_assert(((A & BufferAttr_In) == 0) ^ ((A & BufferAttr_Out) == 0), "LargeData attr must be In or Out");
145 static constexpr BufferAttr Attr = static_cast<BufferAttr>(A); 192 static constexpr BufferAttr Attr = static_cast<BufferAttr>(A);
146 using Type = T; 193 using Type = T;
194
195 /* implicit */ LargeData(const T& rhs) : T(rhs) {}
196 /* implicit */ LargeData() = default;
147}; 197};
148 198
149template <typename T, BufferAttr A> 199template <typename T, BufferAttr A>
@@ -159,7 +209,17 @@ struct RemoveOut {
159 209
160template <typename T> 210template <typename T>
161struct RemoveOut<Out<T>> { 211struct RemoveOut<Out<T>> {
162 using Type = T; 212 using Type = typename Out<T>::Type;
213};
214
215template <typename T>
216struct RemoveOut<OutCopyHandle<T>> {
217 using Type = typename OutCopyHandle<T>::Type;
218};
219
220template <typename T>
221struct RemoveOut<OutMoveHandle<T>> {
222 using Type = typename OutMoveHandle<T>::Type;
163}; 223};
164 224
165enum class ArgumentType { 225enum class ArgumentType {
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index d8fefff89..1f2cbcb61 100644
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -27,7 +27,7 @@ static_assert(sizeof(Struct32) == 32, "Struct32 has wrong size");
27class IJitEnvironment final : public ServiceFramework<IJitEnvironment> { 27class IJitEnvironment final : public ServiceFramework<IJitEnvironment> {
28public: 28public:
29 explicit IJitEnvironment(Core::System& system_, 29 explicit IJitEnvironment(Core::System& system_,
30 Kernel::KScopedAutoObject<Kernel::KProcess>&& process_, 30 Kernel::KScopedAutoObject<Kernel::KProcess> process_,
31 CodeMemory&& user_rx_, CodeMemory&& user_ro_) 31 CodeMemory&& user_rx_, CodeMemory&& user_ro_)
32 : ServiceFramework{system_, "IJitEnvironment"}, process{std::move(process_)}, 32 : ServiceFramework{system_, "IJitEnvironment"}, process{std::move(process_)},
33 user_rx{std::move(user_rx_)}, user_ro{std::move(user_ro_)}, 33 user_rx{std::move(user_rx_)}, user_ro{std::move(user_ro_)},
@@ -129,7 +129,7 @@ public:
129 Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory>& tmem, 129 Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory>& tmem,
130 InBuffer<BufferAttr_HipcMapAlias> nrr, 130 InBuffer<BufferAttr_HipcMapAlias> nrr,
131 InBuffer<BufferAttr_HipcMapAlias> nro) { 131 InBuffer<BufferAttr_HipcMapAlias> nro) {
132 if (tmem.IsNull()) { 132 if (!tmem) {
133 LOG_ERROR(Service_JIT, "Invalid transfer memory handle!"); 133 LOG_ERROR(Service_JIT, "Invalid transfer memory handle!");
134 R_THROW(ResultUnknown); 134 R_THROW(ResultUnknown);
135 } 135 }
@@ -271,15 +271,15 @@ private:
271 u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess>& process, 271 u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess>& process,
272 InCopyHandle<Kernel::KCodeMemory>& rx_mem, 272 InCopyHandle<Kernel::KCodeMemory>& rx_mem,
273 InCopyHandle<Kernel::KCodeMemory>& ro_mem) { 273 InCopyHandle<Kernel::KCodeMemory>& ro_mem) {
274 if (process.IsNull()) { 274 if (!process) {
275 LOG_ERROR(Service_JIT, "process is null"); 275 LOG_ERROR(Service_JIT, "process is null");
276 R_THROW(ResultUnknown); 276 R_THROW(ResultUnknown);
277 } 277 }
278 if (rx_mem.IsNull()) { 278 if (!rx_mem) {
279 LOG_ERROR(Service_JIT, "rx_mem is null"); 279 LOG_ERROR(Service_JIT, "rx_mem is null");
280 R_THROW(ResultUnknown); 280 R_THROW(ResultUnknown);
281 } 281 }
282 if (rx_mem.IsNull()) { 282 if (!ro_mem) {
283 LOG_ERROR(Service_JIT, "ro_mem is null"); 283 LOG_ERROR(Service_JIT, "ro_mem is null");
284 R_THROW(ResultUnknown); 284 R_THROW(ResultUnknown);
285 } 285 }
@@ -291,8 +291,8 @@ private:
291 R_TRY(ro.Initialize(*process, *ro_mem, ro_size, Kernel::Svc::MemoryPermission::Read, 291 R_TRY(ro.Initialize(*process, *ro_mem, ro_size, Kernel::Svc::MemoryPermission::Read,
292 generate_random)); 292 generate_random));
293 293
294 *out_jit_environment = std::make_shared<IJitEnvironment>(system, std::move(process), 294 *out_jit_environment =
295 std::move(rx), std::move(ro)); 295 std::make_shared<IJitEnvironment>(system, process.Get(), std::move(rx), std::move(ro));
296 R_SUCCEED(); 296 R_SUCCEED();
297 } 297 }
298 298
diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp
index ae62c430e..51196170a 100644
--- a/src/core/hle/service/ro/ro.cpp
+++ b/src/core/hle/service/ro/ro.cpp
@@ -551,8 +551,7 @@ public:
551 Result RegisterProcessHandle(ClientProcessId client_pid, 551 Result RegisterProcessHandle(ClientProcessId client_pid,
552 InCopyHandle<Kernel::KProcess>& process) { 552 InCopyHandle<Kernel::KProcess>& process) {
553 // Register the process. 553 // Register the process.
554 R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.GetPointerUnsafe(), 554 R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.Get(), *client_pid));
555 *client_pid));
556 } 555 }
557 556
558 Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size, 557 Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size,