mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #14111 from Simonx22/android/native-library-kotlin
Android: Convert NativeLibrary to Kotlin
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@ import org.dolphinemu.dolphinemu.features.settings.model.NativeConfig
|
||||
class AlertMessage : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val emulationActivity: EmulationActivity = NativeLibrary.getEmulationActivity()
|
||||
?: throw IllegalStateException("EmulationActivity missing while showing alert")
|
||||
val args = requireArguments()
|
||||
val title = args.getString(ARG_TITLE).orEmpty()
|
||||
val message = args.getString(ARG_MESSAGE).orEmpty()
|
||||
|
||||
+13
-11
@@ -57,9 +57,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentEmulationBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
@@ -98,8 +96,9 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (NativeLibrary.IsGameMetadataValid())
|
||||
if (NativeLibrary.IsGameMetadataValid()) {
|
||||
inputOverlay?.refreshControls()
|
||||
}
|
||||
|
||||
AfterDirectoryInitializationRunner().runWithLifecycle(this) {
|
||||
run(emulationActivity!!.isActivityRecreated)
|
||||
@@ -126,8 +125,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
|
||||
fun toggleInputOverlayVisibility(settings: Settings?) {
|
||||
BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.setBoolean(
|
||||
settings!!,
|
||||
!BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.boolean
|
||||
settings!!, !BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.boolean
|
||||
)
|
||||
|
||||
inputOverlay?.refreshControls()
|
||||
@@ -208,14 +206,20 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
val emulationThread = Thread({
|
||||
if (loadPreviousTemporaryState) {
|
||||
Log.debug("[EmulationFragment] Starting emulation thread from previous state.")
|
||||
NativeLibrary.Run(gamePaths, riivolution, temporaryStateFilePath, true)
|
||||
val paths = requireNotNull(gamePaths) {
|
||||
"Cannot start emulation without any game paths"
|
||||
}
|
||||
NativeLibrary.Run(paths, riivolution, temporaryStateFilePath, true)
|
||||
}
|
||||
if (launchSystemMenu) {
|
||||
Log.debug("[EmulationFragment] Starting emulation thread for the Wii Menu.")
|
||||
NativeLibrary.RunSystemMenu()
|
||||
} else {
|
||||
Log.debug("[EmulationFragment] Starting emulation thread.")
|
||||
NativeLibrary.Run(gamePaths, riivolution)
|
||||
val paths = requireNotNull(gamePaths) {
|
||||
"Cannot start emulation without any game paths"
|
||||
}
|
||||
NativeLibrary.Run(paths, riivolution)
|
||||
}
|
||||
EmulationActivity.stopIgnoringLaunchRequests()
|
||||
}, "NativeEmulation")
|
||||
@@ -239,9 +243,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
private const val KEY_SYSTEM_MENU = "systemMenu"
|
||||
|
||||
fun newInstance(
|
||||
gamePaths: Array<String>?,
|
||||
riivolution: Boolean,
|
||||
systemMenu: Boolean
|
||||
gamePaths: Array<String>?, riivolution: Boolean, systemMenu: Boolean
|
||||
): EmulationFragment {
|
||||
val args = Bundle()
|
||||
args.apply {
|
||||
|
||||
Reference in New Issue
Block a user