|
|
@ -111,19 +111,23 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_settings -> {
|
|
|
|
R.id.menu_settings -> {
|
|
|
|
SettingsActivity.launch(requireContext(), SettingsFile.FILE_NAME_CONFIG, "")
|
|
|
|
SettingsActivity.launch(requireContext(), SettingsFile.FILE_NAME_CONFIG, "")
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_overlay_controls -> {
|
|
|
|
R.id.menu_overlay_controls -> {
|
|
|
|
showOverlayOptions()
|
|
|
|
showOverlayOptions()
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_exit -> {
|
|
|
|
R.id.menu_exit -> {
|
|
|
|
requireActivity().finish()
|
|
|
|
requireActivity().finish()
|
|
|
|
emulationState.stop()
|
|
|
|
emulationState.stop()
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else -> true
|
|
|
|
else -> true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -224,6 +228,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
popup.menuInflater.inflate(R.menu.menu_overlay_options, popup.menu)
|
|
|
|
popup.menuInflater.inflate(R.menu.menu_overlay_options, popup.menu)
|
|
|
|
|
|
|
|
|
|
|
|
popup.menu.apply {
|
|
|
|
popup.menu.apply {
|
|
|
|
|
|
|
|
findItem(R.id.menu_toggle_fps).isChecked = EmulationMenuSettings.showFps
|
|
|
|
findItem(R.id.menu_rel_stick_center).isChecked = EmulationMenuSettings.joystickRelCenter
|
|
|
|
findItem(R.id.menu_rel_stick_center).isChecked = EmulationMenuSettings.joystickRelCenter
|
|
|
|
findItem(R.id.menu_dpad_slide).isChecked = EmulationMenuSettings.dpadSlide
|
|
|
|
findItem(R.id.menu_dpad_slide).isChecked = EmulationMenuSettings.dpadSlide
|
|
|
|
findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
|
|
|
|
findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
|
|
|
@ -232,12 +237,20 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
|
|
|
|
|
|
|
|
popup.setOnMenuItemClickListener {
|
|
|
|
popup.setOnMenuItemClickListener {
|
|
|
|
when (it.itemId) {
|
|
|
|
when (it.itemId) {
|
|
|
|
|
|
|
|
R.id.menu_toggle_fps -> {
|
|
|
|
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
|
|
|
|
EmulationMenuSettings.showFps = it.isChecked
|
|
|
|
|
|
|
|
updateShowFpsOverlay()
|
|
|
|
|
|
|
|
true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_edit_overlay -> {
|
|
|
|
R.id.menu_edit_overlay -> {
|
|
|
|
binding.drawerLayout.close()
|
|
|
|
binding.drawerLayout.close()
|
|
|
|
binding.surfaceInputOverlay.requestFocus()
|
|
|
|
binding.surfaceInputOverlay.requestFocus()
|
|
|
|
startConfiguringControls()
|
|
|
|
startConfiguringControls()
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_toggle_controls -> {
|
|
|
|
R.id.menu_toggle_controls -> {
|
|
|
|
val preferences =
|
|
|
|
val preferences =
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
|
|
@ -276,32 +289,38 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_show_overlay -> {
|
|
|
|
R.id.menu_show_overlay -> {
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
EmulationMenuSettings.showOverlay = it.isChecked
|
|
|
|
EmulationMenuSettings.showOverlay = it.isChecked
|
|
|
|
refreshInputOverlay()
|
|
|
|
refreshInputOverlay()
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_rel_stick_center -> {
|
|
|
|
R.id.menu_rel_stick_center -> {
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
EmulationMenuSettings.joystickRelCenter = it.isChecked
|
|
|
|
EmulationMenuSettings.joystickRelCenter = it.isChecked
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_dpad_slide -> {
|
|
|
|
R.id.menu_dpad_slide -> {
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
EmulationMenuSettings.dpadSlide = it.isChecked
|
|
|
|
EmulationMenuSettings.dpadSlide = it.isChecked
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_haptics -> {
|
|
|
|
R.id.menu_haptics -> {
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
it.isChecked = !it.isChecked
|
|
|
|
EmulationMenuSettings.hapticFeedback = it.isChecked
|
|
|
|
EmulationMenuSettings.hapticFeedback = it.isChecked
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
R.id.menu_reset_overlay -> {
|
|
|
|
R.id.menu_reset_overlay -> {
|
|
|
|
binding.drawerLayout.close()
|
|
|
|
binding.drawerLayout.close()
|
|
|
|
resetInputOverlay()
|
|
|
|
resetInputOverlay()
|
|
|
|
true
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else -> true
|
|
|
|
else -> true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -333,12 +352,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
right = cutInsets.right
|
|
|
|
right = cutInsets.right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Don't use padding if the navigation bar isn't in the way
|
|
|
|
|
|
|
|
if (InsetsHelper.getBottomPaddingRequired(requireActivity()) > 0) {
|
|
|
|
|
|
|
|
v.setPadding(left, cutInsets.top, right, 0)
|
|
|
|
v.setPadding(left, cutInsets.top, right, 0)
|
|
|
|
} else {
|
|
|
|
|
|
|
|
v.setPadding(left, cutInsets.top, right, 0)
|
|
|
|
binding.showFpsText.setPadding(
|
|
|
|
}
|
|
|
|
cutInsets.left,
|
|
|
|
|
|
|
|
cutInsets.top,
|
|
|
|
|
|
|
|
cutInsets.right,
|
|
|
|
|
|
|
|
cutInsets.bottom
|
|
|
|
|
|
|
|
)
|
|
|
|
windowInsets
|
|
|
|
windowInsets
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -431,6 +452,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
NativeLibrary.surfaceDestroyed()
|
|
|
|
NativeLibrary.surfaceDestroyed()
|
|
|
|
state = State.PAUSED
|
|
|
|
state = State.PAUSED
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
State.PAUSED -> Log.warning("[EmulationFragment] Surface cleared while emulation paused.")
|
|
|
|
State.PAUSED -> Log.warning("[EmulationFragment] Surface cleared while emulation paused.")
|
|
|
|
else -> Log.warning("[EmulationFragment] Surface cleared while emulation stopped.")
|
|
|
|
else -> Log.warning("[EmulationFragment] Surface cleared while emulation stopped.")
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -448,11 +470,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
}, "NativeEmulation")
|
|
|
|
}, "NativeEmulation")
|
|
|
|
mEmulationThread.start()
|
|
|
|
mEmulationThread.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
State.PAUSED -> {
|
|
|
|
State.PAUSED -> {
|
|
|
|
Log.debug("[EmulationFragment] Resuming emulation.")
|
|
|
|
Log.debug("[EmulationFragment] Resuming emulation.")
|
|
|
|
NativeLibrary.surfaceChanged(surface)
|
|
|
|
NativeLibrary.surfaceChanged(surface)
|
|
|
|
NativeLibrary.unPauseEmulation()
|
|
|
|
NativeLibrary.unPauseEmulation()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else -> Log.debug("[EmulationFragment] Bug, run called while already running.")
|
|
|
|
else -> Log.debug("[EmulationFragment] Bug, run called while already running.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
state = State.RUNNING
|
|
|
|
state = State.RUNNING
|
|
|
|