mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-07-09 17:24:49 -06:00
android: Manual kotlin formatting corrections
This commit is contained in:
parent
1afa24387f
commit
d70099278a
@ -79,7 +79,8 @@ android {
|
|||||||
"-DENABLE_QT=0", // Don't use QT
|
"-DENABLE_QT=0", // Don't use QT
|
||||||
"-DENABLE_SDL2=0", // Don't use SDL
|
"-DENABLE_SDL2=0", // Don't use SDL
|
||||||
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
|
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
|
||||||
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", // Support Android 15 16KiB page sizes
|
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", // Support Android 15 16KiB page
|
||||||
|
// sizes
|
||||||
"-DENABLE_GDBSTUB=OFF" // Disable GDB stub
|
"-DENABLE_GDBSTUB=OFF" // Disable GDB stub
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -125,7 +126,8 @@ android {
|
|||||||
applicationIdSuffix = ".debug"
|
applicationIdSuffix = ".debug"
|
||||||
versionNameSuffix = "-debug"
|
versionNameSuffix = "-debug"
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
isShrinkResources = true // TODO: Does this actually do anything when isDebuggable is enabled? -OS
|
isShrinkResources = true
|
||||||
|
// TODO: ^- Does this actually do anything when isDebuggable is enabled? -OS
|
||||||
isDebuggable = true
|
isDebuggable = true
|
||||||
isJniDebuggable = true
|
isJniDebuggable = true
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
@ -136,8 +138,10 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Same as above, but with isDebuggable disabled.
|
// Same as above, but with isDebuggable disabled.
|
||||||
// Primarily exists to allow development on hardened_malloc systems (e.g. GrapheneOS) without constantly tripping over years-old and seemingly harmless memory bugs.
|
// Primarily exists to allow development on hardened_malloc systems (e.g. GrapheneOS)
|
||||||
// We should fix those bugs eventually, but for now this exists as a workaround to allow other work to be done.
|
// without constantly tripping over years-old and seemingly harmless memory bugs.
|
||||||
|
// We should fix those bugs eventually, but for now this exists as a workaround to
|
||||||
|
// allow other work to be done on these devices.
|
||||||
register("relWithDebInfoLite") {
|
register("relWithDebInfoLite") {
|
||||||
initWith(getByName("relWithDebInfo"))
|
initWith(getByName("relWithDebInfo"))
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
|
|||||||
@ -43,7 +43,7 @@ object NativeLibrary {
|
|||||||
/**
|
/**
|
||||||
* Default touchscreen device
|
* Default touchscreen device
|
||||||
*/
|
*/
|
||||||
const val TouchScreenDevice = "Touchscreen"
|
const val TOUCHSCREEN_DEVICE = "Touchscreen"
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var sEmulationActivity = WeakReference<EmulationActivity?>(null)
|
var sEmulationActivity = WeakReference<EmulationActivity?>(null)
|
||||||
@ -461,16 +461,18 @@ object NativeLibrary {
|
|||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
emulationActivity = requireActivity() as EmulationActivity
|
emulationActivity = requireActivity() as EmulationActivity
|
||||||
|
|
||||||
var coreError = CoreError.fromInt(requireArguments().getInt(RESULT_CODE))
|
val coreError = CoreError.fromInt(requireArguments().getInt(RESULT_CODE))
|
||||||
val title: String
|
val title: String
|
||||||
val message: String
|
val message: String
|
||||||
when (coreError) {
|
when (coreError) {
|
||||||
CoreError.ErrorGetLoader, CoreError.ErrorLoader_ErrorInvalidFormat, CoreError.ErrorSystemMode -> {
|
CoreError.ErrorGetLoader,
|
||||||
|
CoreError.ErrorLoaderErrorInvalidFormat,
|
||||||
|
CoreError.ErrorSystemMode -> {
|
||||||
title = getString(R.string.loader_error_invalid_format)
|
title = getString(R.string.loader_error_invalid_format)
|
||||||
message = getString(R.string.loader_error_invalid_format_description)
|
message = getString(R.string.loader_error_invalid_format_description)
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreError.ErrorLoader_ErrorEncrypted -> {
|
CoreError.ErrorLoaderErrorEncrypted -> {
|
||||||
title = getString(R.string.loader_error_encrypted)
|
title = getString(R.string.loader_error_encrypted)
|
||||||
message = getString(R.string.loader_error_encrypted_description)
|
message = getString(R.string.loader_error_encrypted_description)
|
||||||
}
|
}
|
||||||
@ -485,12 +487,12 @@ object NativeLibrary {
|
|||||||
message = getString(R.string.loader_error_invalid_system_mode_description)
|
message = getString(R.string.loader_error_invalid_system_mode_description)
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreError.ErrorLoader_ErrorPatches -> {
|
CoreError.ErrorLoaderErrorPatches -> {
|
||||||
title = getString(R.string.loader_error_applying_patches)
|
title = getString(R.string.loader_error_applying_patches)
|
||||||
message = getString(R.string.loader_error_applying_patches_description)
|
message = getString(R.string.loader_error_applying_patches_description)
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreError.ErrorLoader_ErrorPatchesInvalidTitle -> {
|
CoreError.ErrorLoaderErrorPatchesInvalidTitle -> {
|
||||||
title = getString(R.string.loader_error_applying_patches)
|
title = getString(R.string.loader_error_applying_patches)
|
||||||
message = getString(R.string.loader_error_patch_wrong_application)
|
message = getString(R.string.loader_error_patch_wrong_application)
|
||||||
}
|
}
|
||||||
@ -878,11 +880,11 @@ object NativeLibrary {
|
|||||||
ErrorGetLoader(2, R.string.core_error_get_loader),
|
ErrorGetLoader(2, R.string.core_error_get_loader),
|
||||||
ErrorSystemMode(3, R.string.core_error_system_mode),
|
ErrorSystemMode(3, R.string.core_error_system_mode),
|
||||||
ErrorLoader(4, R.string.core_error_loader),
|
ErrorLoader(4, R.string.core_error_loader),
|
||||||
ErrorLoader_ErrorEncrypted(5, R.string.core_error_loader_encrypted),
|
ErrorLoaderErrorEncrypted(5, R.string.core_error_loader_encrypted),
|
||||||
ErrorLoader_ErrorInvalidFormat(6, R.string.core_error_loader_invalid_format),
|
ErrorLoaderErrorInvalidFormat(6, R.string.core_error_loader_invalid_format),
|
||||||
ErrorLoader_ErrorGBATitle(7, R.string.core_error_loader_gba_title),
|
ErrorLoaderErrorGBATitle(7, R.string.core_error_loader_gba_title),
|
||||||
ErrorLoader_ErrorPatches(8, R.string.core_error_loader_error_patches),
|
ErrorLoaderErrorPatches(8, R.string.core_error_loader_error_patches),
|
||||||
ErrorLoader_ErrorPatchesInvalidTitle(9, R.string.core_error_loader_patches_invalid_title),
|
ErrorLoaderErrorPatchesInvalidTitle(9, R.string.core_error_loader_patches_invalid_title),
|
||||||
ErrorSystemFiles(10, R.string.core_error_system_files),
|
ErrorSystemFiles(10, R.string.core_error_system_files),
|
||||||
ErrorSavestate(11, R.string.core_error_savestate),
|
ErrorSavestate(11, R.string.core_error_savestate),
|
||||||
ErrorArticDisconnected(12, R.string.core_error_artic_disconnected),
|
ErrorArticDisconnected(12, R.string.core_error_artic_disconnected),
|
||||||
|
|||||||
@ -31,7 +31,7 @@ import androidx.preference.PreferenceManager
|
|||||||
import org.citra.citra_emu.CitraApplication
|
import org.citra.citra_emu.CitraApplication
|
||||||
import org.citra.citra_emu.NativeLibrary
|
import org.citra.citra_emu.NativeLibrary
|
||||||
import org.citra.citra_emu.R
|
import org.citra.citra_emu.R
|
||||||
import org.citra.citra_emu.camera.StillImageCameraHelper.OnFilePickerResult
|
import org.citra.citra_emu.camera.StillImageCameraHelper.onFilePickerResult
|
||||||
import org.citra.citra_emu.contracts.OpenFileResultContract
|
import org.citra.citra_emu.contracts.OpenFileResultContract
|
||||||
import org.citra.citra_emu.databinding.ActivityEmulationBinding
|
import org.citra.citra_emu.databinding.ActivityEmulationBinding
|
||||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||||
@ -398,7 +398,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
// Axis is unmapped
|
// Axis is unmapped
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (value > 0f && value < 0.1f || value < 0f && value > -0.1f) {
|
if ((value > 0f && value < 0.1f) || (value < 0f && value > -0.1f)) {
|
||||||
// Skip joystick wobble
|
// Skip joystick wobble
|
||||||
value = 0f
|
value = 0f
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
// Triggers L/R and ZL/ZR
|
// Triggers L/R and ZL/ZR
|
||||||
if (isTriggerPressedLMapped) {
|
if (isTriggerPressedLMapped) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.TRIGGER_L,
|
NativeLibrary.ButtonType.TRIGGER_L,
|
||||||
if (isTriggerPressedL) {
|
if (isTriggerPressedL) {
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
@ -467,7 +467,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
if (isTriggerPressedRMapped) {
|
if (isTriggerPressedRMapped) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.TRIGGER_R,
|
NativeLibrary.ButtonType.TRIGGER_R,
|
||||||
if (isTriggerPressedR) {
|
if (isTriggerPressedR) {
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
@ -478,7 +478,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
if (isTriggerPressedZLMapped) {
|
if (isTriggerPressedZLMapped) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.BUTTON_ZL,
|
NativeLibrary.ButtonType.BUTTON_ZL,
|
||||||
if (isTriggerPressedZL) {
|
if (isTriggerPressedZL) {
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
@ -489,7 +489,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
if (isTriggerPressedZRMapped) {
|
if (isTriggerPressedZRMapped) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.BUTTON_ZR,
|
NativeLibrary.ButtonType.BUTTON_ZR,
|
||||||
if (isTriggerPressedZR) {
|
if (isTriggerPressedZR) {
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
@ -502,72 +502,72 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
// Work-around to allow D-pad axis to be bound to emulated buttons
|
// Work-around to allow D-pad axis to be bound to emulated buttons
|
||||||
if (axisValuesDPad[0] == 0f) {
|
if (axisValuesDPad[0] == 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (axisValuesDPad[0] < 0f) {
|
if (axisValuesDPad[0] < 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (axisValuesDPad[0] > 0f) {
|
if (axisValuesDPad[0] > 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (axisValuesDPad[1] == 0f) {
|
if (axisValuesDPad[1] == 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_UP,
|
NativeLibrary.ButtonType.DPAD_UP,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (axisValuesDPad[1] < 0f) {
|
if (axisValuesDPad[1] < 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_UP,
|
NativeLibrary.ButtonType.DPAD_UP,
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (axisValuesDPad[1] > 0f) {
|
if (axisValuesDPad[1] > 0f) {
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_UP,
|
NativeLibrary.ButtonType.DPAD_UP,
|
||||||
NativeLibrary.ButtonState.RELEASED
|
NativeLibrary.ButtonState.RELEASED
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||||
NativeLibrary.ButtonState.PRESSED
|
NativeLibrary.ButtonState.PRESSED
|
||||||
)
|
)
|
||||||
@ -598,7 +598,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
}
|
}
|
||||||
|
|
||||||
OnFilePickerResult(result.toString())
|
onFilePickerResult(result.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@ -265,7 +265,8 @@ class GameAdapter(
|
|||||||
val extraDir: String
|
val extraDir: String
|
||||||
)
|
)
|
||||||
private fun getGameDirectories(game: Game): GameDirectories {
|
private fun getGameDirectories(game: Game): GameDirectories {
|
||||||
val basePath = "sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000"
|
val basePath =
|
||||||
|
"sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000"
|
||||||
return GameDirectories(
|
return GameDirectories(
|
||||||
gameDir = game.path.substringBeforeLast("/"),
|
gameDir = game.path.substringBeforeLast("/"),
|
||||||
saveDir =
|
saveDir =
|
||||||
@ -556,7 +557,8 @@ class GameAdapter(
|
|||||||
).show()
|
).show()
|
||||||
return@setPositiveButton
|
return@setPositiveButton
|
||||||
}
|
}
|
||||||
val iconBitmap = (dialogShortcutBinding!!.shortcutIcon.drawable as BitmapDrawable).bitmap
|
val iconBitmap =
|
||||||
|
(dialogShortcutBinding!!.shortcutIcon.drawable as BitmapDrawable).bitmap
|
||||||
val shortcutManager = activity.getSystemService(ShortcutManager::class.java)
|
val shortcutManager = activity.getSystemService(ShortcutManager::class.java)
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ object MiiSelector {
|
|||||||
lateinit var data: MiiSelectorData
|
lateinit var data: MiiSelectorData
|
||||||
val finishLock = Object()
|
val finishLock = Object()
|
||||||
|
|
||||||
private fun ExecuteImpl(config: MiiSelectorConfig) {
|
private fun executeImpl(config: MiiSelectorConfig) {
|
||||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||||
data = MiiSelectorData(0, 0)
|
data = MiiSelectorData(0, 0)
|
||||||
val fragment = MiiSelectorDialogFragment.newInstance(config)
|
val fragment = MiiSelectorDialogFragment.newInstance(config)
|
||||||
@ -22,8 +22,8 @@ object MiiSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun Execute(config: MiiSelectorConfig): MiiSelectorData {
|
fun execute(config: MiiSelectorConfig): MiiSelectorData {
|
||||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { ExecuteImpl(config) }
|
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { executeImpl(config) }
|
||||||
synchronized(finishLock) {
|
synchronized(finishLock) {
|
||||||
try {
|
try {
|
||||||
finishLock.wait()
|
finishLock.wait()
|
||||||
|
|||||||
@ -20,14 +20,14 @@ object SoftwareKeyboard {
|
|||||||
lateinit var data: KeyboardData
|
lateinit var data: KeyboardData
|
||||||
val finishLock = Object()
|
val finishLock = Object()
|
||||||
|
|
||||||
private fun ExecuteImpl(config: KeyboardConfig) {
|
private fun executeImpl(config: KeyboardConfig) {
|
||||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||||
data = KeyboardData(0, "")
|
data = KeyboardData(0, "")
|
||||||
KeyboardDialogFragment.newInstance(config)
|
KeyboardDialogFragment.newInstance(config)
|
||||||
.show(emulationActivity!!.supportFragmentManager, KeyboardDialogFragment.TAG)
|
.show(emulationActivity!!.supportFragmentManager, KeyboardDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun HandleValidationError(config: KeyboardConfig, error: ValidationError) {
|
fun handleValidationError(config: KeyboardConfig, error: ValidationError) {
|
||||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()!!
|
val emulationActivity = NativeLibrary.sEmulationActivity.get()!!
|
||||||
val message: String = when (error) {
|
val message: String = when (error) {
|
||||||
ValidationError.FixedLengthRequired -> emulationActivity.getString(
|
ValidationError.FixedLengthRequired -> emulationActivity.getString(
|
||||||
@ -54,12 +54,12 @@ object SoftwareKeyboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun Execute(config: KeyboardConfig): KeyboardData {
|
fun execute(config: KeyboardConfig): KeyboardData {
|
||||||
if (config.buttonConfig == ButtonConfig.None) {
|
if (config.buttonConfig == ButtonConfig.NONE) {
|
||||||
Log.error("Unexpected button config None")
|
Log.error("Unexpected button config None")
|
||||||
return KeyboardData(0, "")
|
return KeyboardData(0, "")
|
||||||
}
|
}
|
||||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { ExecuteImpl(config) }
|
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { executeImpl(config) }
|
||||||
synchronized(finishLock) {
|
synchronized(finishLock) {
|
||||||
try {
|
try {
|
||||||
finishLock.wait()
|
finishLock.wait()
|
||||||
@ -69,8 +69,9 @@ object SoftwareKeyboard {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun ShowError(error: String) {
|
fun showError(error: String) {
|
||||||
NativeLibrary.displayAlertMsg(
|
NativeLibrary.displayAlertMsg(
|
||||||
appContext.resources.getString(R.string.software_keyboard),
|
appContext.resources.getString(R.string.software_keyboard),
|
||||||
error,
|
error,
|
||||||
@ -78,16 +79,19 @@ object SoftwareKeyboard {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("FunctionName")
|
||||||
private external fun ValidateFilters(text: String): ValidationError
|
private external fun ValidateFilters(text: String): ValidationError
|
||||||
|
|
||||||
|
@Suppress("FunctionName")
|
||||||
external fun ValidateInput(text: String): ValidationError
|
external fun ValidateInput(text: String): ValidationError
|
||||||
|
|
||||||
// / Corresponds to Frontend::ButtonConfig
|
// / Corresponds to Frontend::ButtonConfig
|
||||||
interface ButtonConfig {
|
interface ButtonConfig {
|
||||||
companion object {
|
companion object {
|
||||||
const val Single = 0 // / Ok button
|
const val SINGLE = 0 // / Ok button
|
||||||
const val Dual = 1 // / Cancel | Ok buttons
|
const val DUAL = 1 // / Cancel | Ok buttons
|
||||||
const val Triple = 2 // / Cancel | I Forgot | Ok buttons
|
const val TRIPLE = 2 // / Cancel | I Forgot | Ok buttons
|
||||||
const val None = 3 // / No button (returned by swkbdInputText in special cases)
|
const val NONE = 3 // / No button (returned by swkbdInputText in special cases)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,9 +21,10 @@ object StillImageCameraHelper {
|
|||||||
private var filePickerPath: String? = null
|
private var filePickerPath: String? = null
|
||||||
|
|
||||||
// Opens file picker for camera.
|
// Opens file picker for camera.
|
||||||
|
@Suppress("unused")
|
||||||
@Keep
|
@Keep
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun OpenFilePicker(): String? {
|
fun openFilePicker(): String? {
|
||||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||||
|
|
||||||
// At this point, we are assuming that we already have permissions as they are
|
// At this point, we are assuming that we already have permissions as they are
|
||||||
@ -44,15 +45,16 @@ object StillImageCameraHelper {
|
|||||||
|
|
||||||
// Called from EmulationActivity.
|
// Called from EmulationActivity.
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun OnFilePickerResult(result: String) {
|
fun onFilePickerResult(result: String) {
|
||||||
filePickerPath = result
|
filePickerPath = result
|
||||||
synchronized(filePickerLock) { filePickerLock.notifyAll() }
|
synchronized(filePickerLock) { filePickerLock.notifyAll() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blocking call. Load image from file and crop/resize it to fit in width x height.
|
// Blocking call. Load image from file and crop/resize it to fit in width x height.
|
||||||
|
@Suppress("unused")
|
||||||
@Keep
|
@Keep
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun LoadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? {
|
fun loadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? {
|
||||||
val context = CitraApplication.appContext
|
val context = CitraApplication.appContext
|
||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
.data(uri)
|
.data(uri)
|
||||||
|
|||||||
@ -159,12 +159,15 @@ class CheatsFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onSelectedCheatChanged(selectedCheat: Cheat?) {
|
private fun onSelectedCheatChanged(selectedCheat: Cheat?) {
|
||||||
val cheatSelected = selectedCheat != null || cheatsViewModel.isEditing.value!!
|
val cheatSelected = selectedCheat != null || cheatsViewModel.isEditing.value
|
||||||
if (!cheatSelected && binding.slidingPaneLayout.isOpen) {
|
if (!cheatSelected && binding.slidingPaneLayout.isOpen) {
|
||||||
binding.slidingPaneLayout.close()
|
binding.slidingPaneLayout.close()
|
||||||
}
|
}
|
||||||
binding.slidingPaneLayout.lockMode =
|
binding.slidingPaneLayout.lockMode = if (cheatSelected) {
|
||||||
if (cheatSelected) SlidingPaneLayout.LOCK_MODE_UNLOCKED else SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED
|
SlidingPaneLayout.LOCK_MODE_UNLOCKED
|
||||||
|
} else {
|
||||||
|
SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onListViewFocusChange(hasFocus: Boolean) {
|
fun onListViewFocusChange(hasFocus: Boolean) {
|
||||||
@ -205,7 +208,8 @@ class CheatsFragment :
|
|||||||
val keyboardInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
val keyboardInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||||
|
|
||||||
// Set keyboard insets if the system supports smooth keyboard animations
|
// Set keyboard insets if the system supports smooth keyboard animations
|
||||||
val mlpDetails = binding.cheatDetailsContainer.layoutParams as ViewGroup.MarginLayoutParams
|
val mlpDetails = binding.cheatDetailsContainer.layoutParams
|
||||||
|
as ViewGroup.MarginLayoutParams
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||||
if (keyboardInsets.bottom > 0) {
|
if (keyboardInsets.bottom > 0) {
|
||||||
mlpDetails.bottomMargin = keyboardInsets.bottom
|
mlpDetails.bottomMargin = keyboardInsets.bottom
|
||||||
@ -233,7 +237,8 @@ class CheatsFragment :
|
|||||||
runningAnimations: List<WindowInsetsAnimationCompat>
|
runningAnimations: List<WindowInsetsAnimationCompat>
|
||||||
): WindowInsetsCompat {
|
): WindowInsetsCompat {
|
||||||
val mlpDetails =
|
val mlpDetails =
|
||||||
binding.cheatDetailsContainer.layoutParams as ViewGroup.MarginLayoutParams
|
binding.cheatDetailsContainer.layoutParams
|
||||||
|
as ViewGroup.MarginLayoutParams
|
||||||
keyboardInsets = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
|
keyboardInsets = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
|
||||||
barInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
|
barInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
|
||||||
mlpDetails.bottomMargin = keyboardInsets.coerceAtLeast(barInsets)
|
mlpDetails.bottomMargin = keyboardInsets.coerceAtLeast(barInsets)
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class Settings {
|
|||||||
const val HOTKEY_CLOSE_GAME = "hotkey_close_game"
|
const val HOTKEY_CLOSE_GAME = "hotkey_close_game"
|
||||||
const val HOTKEY_PAUSE_OR_RESUME = "hotkey_pause_or_resume_game"
|
const val HOTKEY_PAUSE_OR_RESUME = "hotkey_pause_or_resume_game"
|
||||||
const val HOTKEY_QUICKSAVE = "hotkey_quickload"
|
const val HOTKEY_QUICKSAVE = "hotkey_quickload"
|
||||||
const val HOTKEY_QUICKlOAD = "hotkey_quickpause"
|
const val HOTKEY_QUICKLOAD = "hotkey_quickpause"
|
||||||
const val HOTKEY_TURBO_LIMIT = "hotkey_turbo_limit"
|
const val HOTKEY_TURBO_LIMIT = "hotkey_turbo_limit"
|
||||||
|
|
||||||
val buttonKeys = listOf(
|
val buttonKeys = listOf(
|
||||||
@ -208,7 +208,7 @@ class Settings {
|
|||||||
HOTKEY_CLOSE_GAME,
|
HOTKEY_CLOSE_GAME,
|
||||||
HOTKEY_PAUSE_OR_RESUME,
|
HOTKEY_PAUSE_OR_RESUME,
|
||||||
HOTKEY_QUICKSAVE,
|
HOTKEY_QUICKSAVE,
|
||||||
HOTKEY_QUICKlOAD,
|
HOTKEY_QUICKLOAD,
|
||||||
HOTKEY_TURBO_LIMIT
|
HOTKEY_TURBO_LIMIT
|
||||||
)
|
)
|
||||||
val hotkeyTitles = listOf(
|
val hotkeyTitles = listOf(
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class InputBindingSetting(val abstractSetting: AbstractSetting, titleId: Int) :
|
|||||||
Settings.HOTKEY_CLOSE_GAME -> Hotkey.CLOSE_GAME.button
|
Settings.HOTKEY_CLOSE_GAME -> Hotkey.CLOSE_GAME.button
|
||||||
Settings.HOTKEY_PAUSE_OR_RESUME -> Hotkey.PAUSE_OR_RESUME.button
|
Settings.HOTKEY_PAUSE_OR_RESUME -> Hotkey.PAUSE_OR_RESUME.button
|
||||||
Settings.HOTKEY_QUICKSAVE -> Hotkey.QUICKSAVE.button
|
Settings.HOTKEY_QUICKSAVE -> Hotkey.QUICKSAVE.button
|
||||||
Settings.HOTKEY_QUICKlOAD -> Hotkey.QUICKLOAD.button
|
Settings.HOTKEY_QUICKLOAD -> Hotkey.QUICKLOAD.button
|
||||||
Settings.HOTKEY_TURBO_LIMIT -> Hotkey.TURBO_LIMIT.button
|
Settings.HOTKEY_TURBO_LIMIT -> Hotkey.TURBO_LIMIT.button
|
||||||
else -> -1
|
else -> -1
|
||||||
}
|
}
|
||||||
@ -620,7 +620,11 @@ class InputBindingSetting(val abstractSetting: AbstractSetting, titleId: Int) :
|
|||||||
* false if it should be mapped as individual button keycodes (DPAD_UP/DOWN/LEFT/RIGHT)
|
* false if it should be mapped as individual button keycodes (DPAD_UP/DOWN/LEFT/RIGHT)
|
||||||
*/
|
*/
|
||||||
fun applyAutoMapBindings(isNintendoLayout: Boolean, useAxisDpad: Boolean) {
|
fun applyAutoMapBindings(isNintendoLayout: Boolean, useAxisDpad: Boolean) {
|
||||||
val faceButtons = if (isNintendoLayout) nintendoFaceButtonMappings else xboxFaceButtonMappings
|
val faceButtons = if (isNintendoLayout) {
|
||||||
|
nintendoFaceButtonMappings
|
||||||
|
} else {
|
||||||
|
xboxFaceButtonMappings
|
||||||
|
}
|
||||||
val buttonMappings = if (useAxisDpad) {
|
val buttonMappings = if (useAxisDpad) {
|
||||||
faceButtons + commonButtonMappings
|
faceButtons + commonButtonMappings
|
||||||
} else {
|
} else {
|
||||||
@ -657,7 +661,9 @@ class InputBindingSetting(val abstractSetting: AbstractSetting, titleId: Int) :
|
|||||||
editor.putBoolean(getInputAxisInvertedKey(mapping.hostAxis), mapping.inverted)
|
editor.putBoolean(getInputAxisInvertedKey(mapping.hostAxis), mapping.inverted)
|
||||||
val dir = if (mapping.orientation == 0) '+' else '-'
|
val dir = if (mapping.orientation == 0) '+' else '-'
|
||||||
editor.putString(mapping.settingKey, "Axis ${mapping.hostAxis}$dir")
|
editor.putString(mapping.settingKey, "Axis ${mapping.hostAxis}$dir")
|
||||||
val reverseKey = "${INPUT_MAPPING_PREFIX}_ReverseMapping_${mapping.settingKey}_${mapping.orientation}"
|
@Suppress("ktlint:standard:max-line-length")
|
||||||
|
val reverseKey =
|
||||||
|
"${INPUT_MAPPING_PREFIX}_ReverseMapping_${mapping.settingKey}_${mapping.orientation}"
|
||||||
editor.putString(reverseKey, axisKey)
|
editor.putString(reverseKey, axisKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import org.citra.citra_emu.utils.FileUtil
|
|||||||
import org.citra.citra_emu.utils.PermissionsHandler
|
import org.citra.citra_emu.utils.PermissionsHandler
|
||||||
import org.citra.citra_emu.viewmodel.HomeViewModel
|
import org.citra.citra_emu.viewmodel.HomeViewModel
|
||||||
|
|
||||||
class CopyDirProgressDialog : DialogFragment() {
|
class CopyDirProgressDialogFragment : DialogFragment() {
|
||||||
private var _binding: DialogCopyDirBinding? = null
|
private var _binding: DialogCopyDirBinding? = null
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class CopyDirProgressDialog : DialogFragment() {
|
|||||||
previous: Uri,
|
previous: Uri,
|
||||||
path: Uri,
|
path: Uri,
|
||||||
callback: SetupCallback? = null
|
callback: SetupCallback? = null
|
||||||
): CopyDirProgressDialog? {
|
): CopyDirProgressDialogFragment? {
|
||||||
val viewModel = ViewModelProvider(activity)[HomeViewModel::class.java]
|
val viewModel = ViewModelProvider(activity)[HomeViewModel::class.java]
|
||||||
if (viewModel.copyInProgress) {
|
if (viewModel.copyInProgress) {
|
||||||
return null
|
return null
|
||||||
@ -146,7 +146,7 @@ class CopyDirProgressDialog : DialogFragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CopyDirProgressDialog()
|
return CopyDirProgressDialogFragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1460,22 +1460,23 @@ class EmulationFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BooleanSetting.PERF_OVERLAY_ENABLE.boolean) {
|
if (BooleanSetting.PERF_OVERLAY_ENABLE.boolean) {
|
||||||
val SYSTEM_FPS = 0
|
@Suppress("UnusedVariable")
|
||||||
val FPS = 1
|
val systemFps = 0
|
||||||
val SPEED = 2
|
val fps = 1
|
||||||
val FRAMETIME = 3
|
val speed = 2
|
||||||
val TIME_SVC = 4
|
val frametime = 3
|
||||||
val TIME_IPC = 5
|
val timeSvc = 4
|
||||||
val TIME_GPU = 6
|
val timeIpc = 5
|
||||||
val TIME_SWAP = 7
|
val timeGpu = 6
|
||||||
val TIME_REM = 8
|
val timeSwap = 7
|
||||||
|
val timeRem = 8
|
||||||
perfStatsUpdater = Runnable {
|
perfStatsUpdater = Runnable {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
val perfStats = NativeLibrary.getPerfStats()
|
val perfStats = NativeLibrary.getPerfStats()
|
||||||
val dividerString = "\u00A0\u2502 "
|
val dividerString = "\u00A0\u2502 "
|
||||||
if (perfStats[FPS] > 0) {
|
if (perfStats[fps] > 0) {
|
||||||
if (BooleanSetting.PERF_OVERLAY_SHOW_FPS.boolean) {
|
if (BooleanSetting.PERF_OVERLAY_SHOW_FPS.boolean) {
|
||||||
sb.append(String.format("FPS:\u00A0%d", (perfStats[FPS] + 0.5).toInt()))
|
sb.append(String.format("FPS:\u00A0%d", (perfStats[fps] + 0.5).toInt()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME.boolean) {
|
if (BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME.boolean) {
|
||||||
@ -1483,12 +1484,12 @@ class EmulationFragment :
|
|||||||
sb.append(
|
sb.append(
|
||||||
String.format(
|
String.format(
|
||||||
"Frame:\u00A0%.1fms (GPU: [CMD:\u00A0%.1fms SWP:\u00A0%.1fms] IPC:\u00A0%.1fms SVC:\u00A0%.1fms Rem:\u00A0%.1fms)",
|
"Frame:\u00A0%.1fms (GPU: [CMD:\u00A0%.1fms SWP:\u00A0%.1fms] IPC:\u00A0%.1fms SVC:\u00A0%.1fms Rem:\u00A0%.1fms)",
|
||||||
(perfStats[FRAMETIME] * 1000.0f).toFloat(),
|
(perfStats[frametime] * 1000.0f).toFloat(),
|
||||||
(perfStats[TIME_GPU] * 1000.0f).toFloat(),
|
(perfStats[timeGpu] * 1000.0f).toFloat(),
|
||||||
(perfStats[TIME_SWAP] * 1000.0f).toFloat(),
|
(perfStats[timeSwap] * 1000.0f).toFloat(),
|
||||||
(perfStats[TIME_IPC] * 1000.0f).toFloat(),
|
(perfStats[timeIpc] * 1000.0f).toFloat(),
|
||||||
(perfStats[TIME_SVC] * 1000.0f).toFloat(),
|
(perfStats[timeSvc] * 1000.0f).toFloat(),
|
||||||
(perfStats[TIME_REM] * 1000.0f).toFloat()
|
(perfStats[timeRem] * 1000.0f).toFloat()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -1498,7 +1499,7 @@ class EmulationFragment :
|
|||||||
sb.append(
|
sb.append(
|
||||||
String.format(
|
String.format(
|
||||||
"Speed:\u00A0%d%%",
|
"Speed:\u00A0%d%%",
|
||||||
(perfStats[SPEED] * 100.0 + 0.5).toInt()
|
(perfStats[speed] * 100.0 + 0.5).toInt()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,6 +89,7 @@ class GamesFragment : Fragment() {
|
|||||||
|
|
||||||
fragment.requireActivity().runOnUiThread {
|
fragment.requireActivity().runOnUiThread {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
@Suppress("ktlint:standard:max-line-length")
|
||||||
val resId = when (status) {
|
val resId = when (status) {
|
||||||
NativeLibrary.CompressStatus.SUCCESS -> if (shouldCompress) R.string.compress_success else R.string.decompress_success
|
NativeLibrary.CompressStatus.SUCCESS -> if (shouldCompress) R.string.compress_success else R.string.decompress_success
|
||||||
NativeLibrary.CompressStatus.COMPRESS_UNSUPPORTED -> R.string.compress_unsupported
|
NativeLibrary.CompressStatus.COMPRESS_UNSUPPORTED -> R.string.compress_unsupported
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||||||
isCancelable = false
|
isCancelable = false
|
||||||
|
|
||||||
when (config.buttonConfig) {
|
when (config.buttonConfig) {
|
||||||
SoftwareKeyboard.ButtonConfig.Triple -> {
|
SoftwareKeyboard.ButtonConfig.TRIPLE -> {
|
||||||
val negativeText =
|
val negativeText =
|
||||||
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
||||||
val neutralText = config.buttonText[1].ifEmpty { getString(R.string.i_forgot) }
|
val neutralText = config.buttonText[1].ifEmpty { getString(R.string.i_forgot) }
|
||||||
@ -50,7 +50,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||||||
.setPositiveButton(positiveText, null)
|
.setPositiveButton(positiveText, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
SoftwareKeyboard.ButtonConfig.Dual -> {
|
SoftwareKeyboard.ButtonConfig.DUAL -> {
|
||||||
val negativeText =
|
val negativeText =
|
||||||
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
||||||
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
||||||
@ -58,7 +58,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||||||
.setPositiveButton(positiveText, null)
|
.setPositiveButton(positiveText, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
SoftwareKeyboard.ButtonConfig.Single -> {
|
SoftwareKeyboard.ButtonConfig.SINGLE -> {
|
||||||
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
||||||
builder.setPositiveButton(positiveText, null)
|
builder.setPositiveButton(positiveText, null)
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||||||
SoftwareKeyboard.data.text = binding.editTextInput.text.toString()
|
SoftwareKeyboard.data.text = binding.editTextInput.text.toString()
|
||||||
val error = SoftwareKeyboard.ValidateInput(SoftwareKeyboard.data.text)
|
val error = SoftwareKeyboard.ValidateInput(SoftwareKeyboard.data.text)
|
||||||
if (error != SoftwareKeyboard.ValidationError.None) {
|
if (error != SoftwareKeyboard.ValidationError.None) {
|
||||||
SoftwareKeyboard.HandleValidationError(config, error)
|
SoftwareKeyboard.handleValidationError(config, error)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|||||||
@ -152,6 +152,7 @@ class SetupFragment : Fragment() {
|
|||||||
pageButtonCallback = it
|
pageButtonCallback = it
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
manageExternalStoragePermissionLauncher.launch(
|
manageExternalStoragePermissionLauncher.launch(
|
||||||
|
@Suppress("ktlint:standard:max-line-length")
|
||||||
Intent(
|
Intent(
|
||||||
android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
|
android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
|
||||||
Uri.fromParts(
|
Uri.fromParts(
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class SystemFilesFragment : Fragment() {
|
|||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
private val gamesViewModel: GamesViewModel by activityViewModels()
|
private val gamesViewModel: GamesViewModel by activityViewModels()
|
||||||
|
|
||||||
private val REGION_START = "RegionStart"
|
private val regionStartSring = "RegionStart"
|
||||||
|
|
||||||
private val homeMenuMap: MutableMap<String, String> = mutableMapOf()
|
private val homeMenuMap: MutableMap<String, String> = mutableMapOf()
|
||||||
private var setupStateCached: BooleanArray? = null
|
private var setupStateCached: BooleanArray? = null
|
||||||
@ -85,7 +85,7 @@ class SystemFilesFragment : Fragment() {
|
|||||||
reloadUi()
|
reloadUi()
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
binding.dropdownSystemRegionStart
|
binding.dropdownSystemRegionStart
|
||||||
.setText(savedInstanceState.getString(REGION_START), false)
|
.setText(savedInstanceState.getString(regionStartSring), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,9 +309,10 @@ class SystemFilesFragment : Fragment() {
|
|||||||
setupStateCached = null
|
setupStateCached = null
|
||||||
progressDialog2?.dismiss()
|
progressDialog2?.dismiss()
|
||||||
val action =
|
val action =
|
||||||
HomeNavigationDirections.actionGlobalEmulationActivity(
|
HomeNavigationDirections
|
||||||
menu
|
.actionGlobalEmulationActivity(
|
||||||
)
|
menu
|
||||||
|
)
|
||||||
binding.root.findNavController().navigate(action)
|
binding.root.findNavController().navigate(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,7 +187,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
button.id,
|
button.id,
|
||||||
button.status
|
button.status
|
||||||
)
|
)
|
||||||
@ -211,22 +211,22 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||||||
anyOverlayStateChanged = true
|
anyOverlayStateChanged = true
|
||||||
|
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
dpad.upId,
|
dpad.upId,
|
||||||
dpad.upStatus
|
dpad.upStatus
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
dpad.downId,
|
dpad.downId,
|
||||||
dpad.downStatus
|
dpad.downStatus
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
dpad.leftId,
|
dpad.leftId,
|
||||||
dpad.leftStatus
|
dpad.leftStatus
|
||||||
)
|
)
|
||||||
NativeLibrary.onGamePadEvent(
|
NativeLibrary.onGamePadEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
dpad.rightId,
|
dpad.rightId,
|
||||||
dpad.rightStatus
|
dpad.rightStatus
|
||||||
)
|
)
|
||||||
@ -250,7 +250,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||||||
|
|
||||||
val axisID = joystick.joystickId
|
val axisID = joystick.joystickId
|
||||||
NativeLibrary.onGamePadMoveEvent(
|
NativeLibrary.onGamePadMoveEvent(
|
||||||
NativeLibrary.TouchScreenDevice,
|
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||||
axisID,
|
axisID,
|
||||||
joystick.xAxis,
|
joystick.xAxis,
|
||||||
joystick.yAxis
|
joystick.yAxis
|
||||||
|
|||||||
@ -45,7 +45,8 @@ class InputOverlayDrawableButton(
|
|||||||
) {
|
) {
|
||||||
var trackId: Int
|
var trackId: Int
|
||||||
|
|
||||||
private var isMotionFirstButton = false // mark the first activated button with the current motion
|
private var isMotionFirstButton = false
|
||||||
|
// ^- mark the first activated button with the current motion
|
||||||
|
|
||||||
private var previousTouchX = 0
|
private var previousTouchX = 0
|
||||||
private var previousTouchY = 0
|
private var previousTouchY = 0
|
||||||
@ -194,7 +195,11 @@ class InputOverlayDrawableButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val status: Int
|
val status: Int
|
||||||
get() = if (pressedState) NativeLibrary.ButtonState.PRESSED else NativeLibrary.ButtonState.RELEASED
|
get() = if (pressedState) {
|
||||||
|
NativeLibrary.ButtonState.PRESSED
|
||||||
|
} else {
|
||||||
|
NativeLibrary.ButtonState.RELEASED
|
||||||
|
}
|
||||||
val bounds: Rect
|
val bounds: Rect
|
||||||
get() = defaultStateBitmap.bounds
|
get() = defaultStateBitmap.bounds
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,8 +176,10 @@ class InputOverlayDrawableJoystick(
|
|||||||
this.yAxis = sin(angle.toDouble()).toFloat() * radius
|
this.yAxis = sin(angle.toDouble()).toFloat() * radius
|
||||||
setInnerBounds()
|
setInnerBounds()
|
||||||
|
|
||||||
if (kotlin.math.abs(oldRadius - radius) > .34f ||
|
if ((
|
||||||
radius > .5f && kotlin.math.abs(oldAngle - angle) > kotlin.math.PI / 8
|
(kotlin.math.abs(oldRadius - radius) > .34f) ||
|
||||||
|
(radius > .5f)
|
||||||
|
) && (kotlin.math.abs(oldAngle - angle) > kotlin.math.PI / 8)
|
||||||
) {
|
) {
|
||||||
this.radius = radius
|
this.radius = radius
|
||||||
this.angle = angle
|
this.angle = angle
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class MainActivity :
|
|||||||
settingsViewModel.settings.loadSettings()
|
settingsViewModel.settings.loadSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeUtil.ThemeChangeListener(this)
|
ThemeUtil.themeChangeListener(this)
|
||||||
ThemeUtil.setTheme(this)
|
ThemeUtil.setTheme(this)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ package org.citra.citra_emu.utils
|
|||||||
|
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
@ -19,11 +18,11 @@ import org.citra.citra_emu.R
|
|||||||
import org.citra.citra_emu.utils.FileUtil.getFilename
|
import org.citra.citra_emu.utils.FileUtil.getFilename
|
||||||
|
|
||||||
class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(context, params) {
|
class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(context, params) {
|
||||||
private val GROUP_KEY_CIA_INSTALL_STATUS = "org.citra.citra_emu.CIA_INSTALL_STATUS"
|
private val groupKeyCiaInstallStatus = "org.citra.citra_emu.CIA_INSTALL_STATUS"
|
||||||
private var lastNotifiedTime: Long = 0
|
private var lastNotifiedTime: Long = 0
|
||||||
private val SUMMARY_NOTIFICATION_ID = 0xC1A0000
|
private val summaryNotificationId = 0xC1A0000
|
||||||
private val PROGRESS_NOTIFICATION_ID = SUMMARY_NOTIFICATION_ID + 1
|
private val progressNotificationId = summaryNotificationId + 1
|
||||||
private var statusNotificationId = SUMMARY_NOTIFICATION_ID + 2
|
private var statusNotificationId = summaryNotificationId + 2
|
||||||
|
|
||||||
private val notificationManager = context.getSystemService(NotificationManager::class.java)
|
private val notificationManager = context.getSystemService(NotificationManager::class.java)
|
||||||
private val installProgressBuilder = NotificationCompat.Builder(
|
private val installProgressBuilder = NotificationCompat.Builder(
|
||||||
@ -38,14 +37,14 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||||||
)
|
)
|
||||||
.setContentTitle(context.getString(R.string.install_cia_title))
|
.setContentTitle(context.getString(R.string.install_cia_title))
|
||||||
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
||||||
.setGroup(GROUP_KEY_CIA_INSTALL_STATUS)
|
.setGroup(groupKeyCiaInstallStatus)
|
||||||
private val summaryNotification = NotificationCompat.Builder(
|
private val summaryNotification = NotificationCompat.Builder(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.cia_install_notification_channel_id)
|
context.getString(R.string.cia_install_notification_channel_id)
|
||||||
)
|
)
|
||||||
.setContentTitle(context.getString(R.string.install_cia_title))
|
.setContentTitle(context.getString(R.string.install_cia_title))
|
||||||
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
||||||
.setGroup(GROUP_KEY_CIA_INSTALL_STATUS)
|
.setGroup(groupKeyCiaInstallStatus)
|
||||||
.setGroupSummary(true)
|
.setGroupSummary(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||||||
|
|
||||||
// Even if newer versions of Android don't show the group summary text that you design,
|
// Even if newer versions of Android don't show the group summary text that you design,
|
||||||
// you always need to manually set a summary to enable grouped notifications.
|
// you always need to manually set a summary to enable grouped notifications.
|
||||||
notificationManager.notify(SUMMARY_NOTIFICATION_ID, summaryNotification)
|
notificationManager.notify(summaryNotificationId, summaryNotification)
|
||||||
notificationManager.notify(statusNotificationId++, installStatusBuilder.build())
|
notificationManager.notify(statusNotificationId++, installStatusBuilder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +148,7 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||||||
val res = installCIA(fileFinal)
|
val res = installCIA(fileFinal)
|
||||||
notifyInstallStatus(filename, res)
|
notifyInstallStatus(filename, res)
|
||||||
}
|
}
|
||||||
notificationManager.cancel(PROGRESS_NOTIFICATION_ID)
|
notificationManager.cancel(progressNotificationId)
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,11 +163,11 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||||||
}
|
}
|
||||||
lastNotifiedTime = currentTime
|
lastNotifiedTime = currentTime
|
||||||
installProgressBuilder.setProgress(max, progress, false)
|
installProgressBuilder.setProgress(max, progress, false)
|
||||||
notificationManager.notify(PROGRESS_NOTIFICATION_ID, installProgressBuilder.build())
|
notificationManager.notify(progressNotificationId, installProgressBuilder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getForegroundInfo(): ForegroundInfo =
|
override fun getForegroundInfo(): ForegroundInfo =
|
||||||
ForegroundInfo(PROGRESS_NOTIFICATION_ID, installProgressBuilder.build())
|
ForegroundInfo(progressNotificationId, installProgressBuilder.build())
|
||||||
|
|
||||||
private external fun installCIA(path: String): InstallStatus
|
private external fun installCIA(path: String): InstallStatus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import android.net.Uri
|
|||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import org.citra.citra_emu.fragments.CitraDirectoryDialogFragment
|
import org.citra.citra_emu.fragments.CitraDirectoryDialogFragment
|
||||||
import org.citra.citra_emu.fragments.CopyDirProgressDialog
|
import org.citra.citra_emu.fragments.CopyDirProgressDialogFragment
|
||||||
import org.citra.citra_emu.model.SetupCallback
|
import org.citra.citra_emu.model.SetupCallback
|
||||||
import org.citra.citra_emu.viewmodel.HomeViewModel
|
import org.citra.citra_emu.viewmodel.HomeViewModel
|
||||||
|
|
||||||
@ -51,8 +51,16 @@ class CitraDirectoryHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If user check move data, show copy progress dialog.
|
// If user check move data, show copy progress dialog.
|
||||||
CopyDirProgressDialog.newInstance(fragmentActivity, previous, path, callback)
|
CopyDirProgressDialogFragment.newInstance(
|
||||||
?.show(fragmentActivity.supportFragmentManager, CopyDirProgressDialog.TAG)
|
fragmentActivity,
|
||||||
|
previous,
|
||||||
|
path,
|
||||||
|
callback
|
||||||
|
)
|
||||||
|
?.show(
|
||||||
|
fragmentActivity.supportFragmentManager,
|
||||||
|
CopyDirProgressDialogFragment.TAG
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
citraDirectoryDialog.show(
|
citraDirectoryDialog.show(
|
||||||
|
|||||||
@ -252,7 +252,8 @@ class DocumentsTree {
|
|||||||
val newName = Paths.get(destinationPath).fileName.toString()
|
val newName = Paths.get(destinationPath).fileName.toString()
|
||||||
val parentPath = Paths.get(destinationPath).parent.toString()
|
val parentPath = Paths.get(destinationPath).parent.toString()
|
||||||
val newParent = resolvePath(parentPath)
|
val newParent = resolvePath(parentPath)
|
||||||
val newUri = (getUri(parentPath).toString() + "%2F$newName").toUri() // <- Is there a better way?
|
val newUri = (getUri(parentPath).toString() + "%2F$newName").toUri()
|
||||||
|
// ^- Is there a better way?
|
||||||
|
|
||||||
if (sourceNode == null || newParent == null) {
|
if (sourceNode == null || newParent == null) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -17,15 +17,15 @@ object MemoryUtil {
|
|||||||
private val Float.hundredths: String
|
private val Float.hundredths: String
|
||||||
get() = String.format(Locale.ROOT, "%.2f", this)
|
get() = String.format(Locale.ROOT, "%.2f", this)
|
||||||
|
|
||||||
const val Kb: Float = 1024F
|
const val KB: Float = 1024F
|
||||||
const val Mb = Kb * 1024
|
const val MB = KB * 1024
|
||||||
const val Gb = Mb * 1024
|
const val GB = MB * 1024
|
||||||
const val Tb = Gb * 1024
|
const val TB = GB * 1024
|
||||||
const val Pb = Tb * 1024
|
const val PB = TB * 1024
|
||||||
const val Eb = Pb * 1024
|
const val EB = PB * 1024
|
||||||
|
|
||||||
fun bytesToSizeUnit(size: Float, roundUp: Boolean = false): String = when {
|
fun bytesToSizeUnit(size: Float, roundUp: Boolean = false): String = when {
|
||||||
size < Kb -> {
|
size < KB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
size.hundredths,
|
size.hundredths,
|
||||||
@ -33,42 +33,42 @@ object MemoryUtil {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
size < Mb -> {
|
size < MB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Kb) else (size / Kb).hundredths,
|
if (roundUp) ceil(size / KB) else (size / KB).hundredths,
|
||||||
context.getString(R.string.memory_kilobyte)
|
context.getString(R.string.memory_kilobyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
size < Gb -> {
|
size < GB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Mb) else (size / Mb).hundredths,
|
if (roundUp) ceil(size / MB) else (size / MB).hundredths,
|
||||||
context.getString(R.string.memory_megabyte)
|
context.getString(R.string.memory_megabyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
size < Tb -> {
|
size < TB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Gb) else (size / Gb).hundredths,
|
if (roundUp) ceil(size / GB) else (size / GB).hundredths,
|
||||||
context.getString(R.string.memory_gigabyte)
|
context.getString(R.string.memory_gigabyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
size < Pb -> {
|
size < PB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Tb) else (size / Tb).hundredths,
|
if (roundUp) ceil(size / TB) else (size / TB).hundredths,
|
||||||
context.getString(R.string.memory_terabyte)
|
context.getString(R.string.memory_terabyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
size < Eb -> {
|
size < EB -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Pb) else (size / Pb).hundredths,
|
if (roundUp) ceil(size / PB) else (size / PB).hundredths,
|
||||||
context.getString(R.string.memory_petabyte)
|
context.getString(R.string.memory_petabyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ object MemoryUtil {
|
|||||||
else -> {
|
else -> {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.memory_formatted,
|
R.string.memory_formatted,
|
||||||
if (roundUp) ceil(size / Eb) else (size / Eb).hundredths,
|
if (roundUp) ceil(size / EB) else (size / EB).hundredths,
|
||||||
context.getString(R.string.memory_exabyte)
|
context.getString(R.string.memory_exabyte)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -97,13 +97,13 @@ object MemoryUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isLessThan(minimum: Int, size: Float): Boolean = when (size) {
|
fun isLessThan(minimum: Int, size: Float): Boolean = when (size) {
|
||||||
Kb -> totalMemory < Mb && totalMemory < minimum
|
KB -> totalMemory < MB && totalMemory < minimum
|
||||||
Mb -> totalMemory < Gb && (totalMemory / Mb) < minimum
|
MB -> totalMemory < GB && (totalMemory / MB) < minimum
|
||||||
Gb -> totalMemory < Tb && (totalMemory / Gb) < minimum
|
GB -> totalMemory < TB && (totalMemory / GB) < minimum
|
||||||
Tb -> totalMemory < Pb && (totalMemory / Tb) < minimum
|
TB -> totalMemory < PB && (totalMemory / TB) < minimum
|
||||||
Pb -> totalMemory < Eb && (totalMemory / Pb) < minimum
|
PB -> totalMemory < EB && (totalMemory / PB) < minimum
|
||||||
Eb -> totalMemory / Eb < minimum
|
EB -> totalMemory / EB < minimum
|
||||||
else -> totalMemory < Kb && totalMemory < minimum
|
else -> totalMemory < KB && totalMemory < minimum
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devices are unlikely to have 0.5GB increments of memory so we'll just round up to account for
|
// Devices are unlikely to have 0.5GB increments of memory so we'll just round up to account for
|
||||||
|
|||||||
@ -12,9 +12,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver
|
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import org.citra.citra_emu.CitraApplication
|
import org.citra.citra_emu.CitraApplication
|
||||||
@ -118,7 +115,7 @@ object ThemeUtil {
|
|||||||
// Listener that detects if the theme keys are being changed from the setting menu and recreates the activity
|
// Listener that detects if the theme keys are being changed from the setting menu and recreates the activity
|
||||||
private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null
|
private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null
|
||||||
|
|
||||||
fun ThemeChangeListener(activity: AppCompatActivity) {
|
fun themeChangeListener(activity: AppCompatActivity) {
|
||||||
listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||||
val relevantKeys =
|
val relevantKeys =
|
||||||
listOf(
|
listOf(
|
||||||
|
|||||||
@ -45,7 +45,7 @@ void AndroidMiiSelector::Setup(const Frontend::MiiSelectorConfig& config) {
|
|||||||
java_config,
|
java_config,
|
||||||
env->GetFieldID(s_mii_selector_config_class, "miiNames", "[Ljava/lang/String;"), array);
|
env->GetFieldID(s_mii_selector_config_class, "miiNames", "[Ljava/lang/String;"), array);
|
||||||
|
|
||||||
// Invoke backend Execute method
|
// Invoke backend execute method
|
||||||
jobject data =
|
jobject data =
|
||||||
env->CallStaticObjectMethod(s_mii_selector_class, s_mii_selector_execute, java_config);
|
env->CallStaticObjectMethod(s_mii_selector_class, s_mii_selector_execute, java_config);
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void InitJNI(JNIEnv* env) {
|
|||||||
env->FindClass("org/citra/citra_emu/applets/MiiSelector$MiiSelectorData")));
|
env->FindClass("org/citra/citra_emu/applets/MiiSelector$MiiSelectorData")));
|
||||||
|
|
||||||
s_mii_selector_execute =
|
s_mii_selector_execute =
|
||||||
env->GetStaticMethodID(s_mii_selector_class, "Execute",
|
env->GetStaticMethodID(s_mii_selector_class, "execute",
|
||||||
"(Lorg/citra/citra_emu/applets/MiiSelector$MiiSelectorConfig;)Lorg/"
|
"(Lorg/citra/citra_emu/applets/MiiSelector$MiiSelectorConfig;)Lorg/"
|
||||||
"citra/citra_emu/applets/MiiSelector$MiiSelectorData;");
|
"citra/citra_emu/applets/MiiSelector$MiiSelectorData;");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,11 +84,11 @@ void InitJNI(JNIEnv* env) {
|
|||||||
env->FindClass("org/citra/citra_emu/applets/SoftwareKeyboard$ValidationError")));
|
env->FindClass("org/citra/citra_emu/applets/SoftwareKeyboard$ValidationError")));
|
||||||
|
|
||||||
s_swkbd_execute = env->GetStaticMethodID(
|
s_swkbd_execute = env->GetStaticMethodID(
|
||||||
s_software_keyboard_class, "Execute",
|
s_software_keyboard_class, "execute",
|
||||||
"(Lorg/citra/citra_emu/applets/SoftwareKeyboard$KeyboardConfig;)Lorg/citra/citra_emu/"
|
"(Lorg/citra/citra_emu/applets/SoftwareKeyboard$KeyboardConfig;)Lorg/citra/citra_emu/"
|
||||||
"applets/SoftwareKeyboard$KeyboardData;");
|
"applets/SoftwareKeyboard$KeyboardData;");
|
||||||
s_swkbd_show_error =
|
s_swkbd_show_error =
|
||||||
env->GetStaticMethodID(s_software_keyboard_class, "ShowError", "(Ljava/lang/String;)V");
|
env->GetStaticMethodID(s_software_keyboard_class, "showError", "(Ljava/lang/String;)V");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanupJNI(JNIEnv* env) {
|
void CleanupJNI(JNIEnv* env) {
|
||||||
|
|||||||
@ -17,10 +17,10 @@ namespace Camera::StillImage {
|
|||||||
void InitJNI(JNIEnv* env) {
|
void InitJNI(JNIEnv* env) {
|
||||||
s_still_image_camera_helper_class = reinterpret_cast<jclass>(
|
s_still_image_camera_helper_class = reinterpret_cast<jclass>(
|
||||||
env->NewGlobalRef(env->FindClass("org/citra/citra_emu/camera/StillImageCameraHelper")));
|
env->NewGlobalRef(env->FindClass("org/citra/citra_emu/camera/StillImageCameraHelper")));
|
||||||
s_open_file_picker = env->GetStaticMethodID(s_still_image_camera_helper_class, "OpenFilePicker",
|
s_open_file_picker = env->GetStaticMethodID(s_still_image_camera_helper_class, "openFilePicker",
|
||||||
"()Ljava/lang/String;");
|
"()Ljava/lang/String;");
|
||||||
s_load_image_from_file =
|
s_load_image_from_file =
|
||||||
env->GetStaticMethodID(s_still_image_camera_helper_class, "LoadImageFromFile",
|
env->GetStaticMethodID(s_still_image_camera_helper_class, "loadImageFromFile",
|
||||||
"(Ljava/lang/String;II)Landroid/graphics/Bitmap;");
|
"(Ljava/lang/String;II)Landroid/graphics/Bitmap;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -919,7 +919,7 @@ static int clz(unsigned int x) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
MICROPROFILE_DEFINE(DynCom_Execute, "DynCom", "Execute", MP_RGB(255, 0, 0));
|
MICROPROFILE_DEFINE(DynCom_Execute, "DynCom", "execute", MP_RGB(255, 0, 0));
|
||||||
|
|
||||||
unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
MICROPROFILE_SCOPE(DynCom_Execute);
|
MICROPROFILE_SCOPE(DynCom_Execute);
|
||||||
|
|||||||
@ -147,7 +147,7 @@ enum : u32 {
|
|||||||
enum {
|
enum {
|
||||||
STOP = 0, // Stop
|
STOP = 0, // Stop
|
||||||
CHANGEMODE = 1, // Change mode
|
CHANGEMODE = 1, // Change mode
|
||||||
ONCE = 2, // Execute just one iteration
|
ONCE = 2, // execute just one iteration
|
||||||
RUN = 3 // Continuous execution
|
RUN = 3 // Continuous execution
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -305,43 +305,43 @@ void GatewayCheat::Execute(Core::System& system, u32 process_id) const {
|
|||||||
WriteOp<u8>(line, state, Read8, Write8, system);
|
WriteOp<u8>(line, state, Read8, Write8, system);
|
||||||
break;
|
break;
|
||||||
case CheatType::GreaterThan32:
|
case CheatType::GreaterThan32:
|
||||||
// 3XXXXXXX YYYYYYYY - Execute next block IF YYYYYYYY > word[XXXXXXX] ;unsigned
|
// 3XXXXXXX YYYYYYYY - execute next block IF YYYYYYYY > word[XXXXXXX] ;unsigned
|
||||||
CompOp<u32>(line, state, Read32, [&line](u32 val) -> bool { return line.value > val; });
|
CompOp<u32>(line, state, Read32, [&line](u32 val) -> bool { return line.value > val; });
|
||||||
break;
|
break;
|
||||||
case CheatType::LessThan32:
|
case CheatType::LessThan32:
|
||||||
// 4XXXXXXX YYYYYYYY - Execute next block IF YYYYYYYY < word[XXXXXXX] ;unsigned
|
// 4XXXXXXX YYYYYYYY - execute next block IF YYYYYYYY < word[XXXXXXX] ;unsigned
|
||||||
CompOp<u32>(line, state, Read32, [&line](u32 val) -> bool { return line.value < val; });
|
CompOp<u32>(line, state, Read32, [&line](u32 val) -> bool { return line.value < val; });
|
||||||
break;
|
break;
|
||||||
case CheatType::EqualTo32:
|
case CheatType::EqualTo32:
|
||||||
// 5XXXXXXX YYYYYYYY - Execute next block IF YYYYYYYY == word[XXXXXXX] ;unsigned
|
// 5XXXXXXX YYYYYYYY - execute next block IF YYYYYYYY == word[XXXXXXX] ;unsigned
|
||||||
CompOp<u32>(line, state, Read32,
|
CompOp<u32>(line, state, Read32,
|
||||||
[&line](u32 val) -> bool { return line.value == val; });
|
[&line](u32 val) -> bool { return line.value == val; });
|
||||||
break;
|
break;
|
||||||
case CheatType::NotEqualTo32:
|
case CheatType::NotEqualTo32:
|
||||||
// 6XXXXXXX YYYYYYYY - Execute next block IF YYYYYYYY != word[XXXXXXX] ;unsigned
|
// 6XXXXXXX YYYYYYYY - execute next block IF YYYYYYYY != word[XXXXXXX] ;unsigned
|
||||||
CompOp<u32>(line, state, Read32,
|
CompOp<u32>(line, state, Read32,
|
||||||
[&line](u32 val) -> bool { return line.value != val; });
|
[&line](u32 val) -> bool { return line.value != val; });
|
||||||
break;
|
break;
|
||||||
case CheatType::GreaterThan16WithMask:
|
case CheatType::GreaterThan16WithMask:
|
||||||
// 7XXXXXXX ZZZZYYYY - Execute next block IF YYYY > ((not ZZZZ) AND half[XXXXXXX])
|
// 7XXXXXXX ZZZZYYYY - execute next block IF YYYY > ((not ZZZZ) AND half[XXXXXXX])
|
||||||
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
||||||
return static_cast<u16>(line.value) > (static_cast<u16>(~line.value >> 16) & val);
|
return static_cast<u16>(line.value) > (static_cast<u16>(~line.value >> 16) & val);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case CheatType::LessThan16WithMask:
|
case CheatType::LessThan16WithMask:
|
||||||
// 8XXXXXXX ZZZZYYYY - Execute next block IF YYYY < ((not ZZZZ) AND half[XXXXXXX])
|
// 8XXXXXXX ZZZZYYYY - execute next block IF YYYY < ((not ZZZZ) AND half[XXXXXXX])
|
||||||
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
||||||
return static_cast<u16>(line.value) < (static_cast<u16>(~line.value >> 16) & val);
|
return static_cast<u16>(line.value) < (static_cast<u16>(~line.value >> 16) & val);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case CheatType::EqualTo16WithMask:
|
case CheatType::EqualTo16WithMask:
|
||||||
// 9XXXXXXX ZZZZYYYY - Execute next block IF YYYY = ((not ZZZZ) AND half[XXXXXXX])
|
// 9XXXXXXX ZZZZYYYY - execute next block IF YYYY = ((not ZZZZ) AND half[XXXXXXX])
|
||||||
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
||||||
return static_cast<u16>(line.value) == (static_cast<u16>(~line.value >> 16) & val);
|
return static_cast<u16>(line.value) == (static_cast<u16>(~line.value >> 16) & val);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case CheatType::NotEqualTo16WithMask:
|
case CheatType::NotEqualTo16WithMask:
|
||||||
// AXXXXXXX ZZZZYYYY - Execute next block IF YYYY <> ((not ZZZZ) AND half[XXXXXXX])
|
// AXXXXXXX ZZZZYYYY - execute next block IF YYYY <> ((not ZZZZ) AND half[XXXXXXX])
|
||||||
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
CompOp<u16>(line, state, Read16, [&line](u16 val) -> bool {
|
||||||
return static_cast<u16>(line.value) != (static_cast<u16>(~line.value >> 16) & val);
|
return static_cast<u16>(line.value) != (static_cast<u16>(~line.value >> 16) & val);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -592,7 +592,7 @@ bool CheckBreakpoint(VAddr addr, u32 access_len, BreakpointType type) {
|
|||||||
bool hit = false;
|
bool hit = false;
|
||||||
|
|
||||||
if (type == BreakpointType::Execute) {
|
if (type == BreakpointType::Execute) {
|
||||||
// Execute breakpoints should only trigger on exact PC match.
|
// execute breakpoints should only trigger on exact PC match.
|
||||||
hit = (addr == bp.addr);
|
hit = (addr == bp.addr);
|
||||||
} else {
|
} else {
|
||||||
// Range overlap test:
|
// Range overlap test:
|
||||||
|
|||||||
@ -1701,7 +1701,7 @@ Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_per
|
|||||||
std::shared_ptr<SharedMemory> shared_memory = nullptr;
|
std::shared_ptr<SharedMemory> shared_memory = nullptr;
|
||||||
|
|
||||||
auto VerifyPermissions = [](MemoryPermission permission) {
|
auto VerifyPermissions = [](MemoryPermission permission) {
|
||||||
// SharedMemory blocks can not be created with Execute permissions
|
// SharedMemory blocks can not be created with execute permissions
|
||||||
switch (permission) {
|
switch (permission) {
|
||||||
case MemoryPermission::None:
|
case MemoryPermission::None:
|
||||||
case MemoryPermission::Read:
|
case MemoryPermission::Read:
|
||||||
|
|||||||
@ -663,14 +663,14 @@ static void RunInterpreter(const ShaderSetup& setup, ShaderUnit& state,
|
|||||||
|
|
||||||
case OpCode::Id::EMIT: {
|
case OpCode::Id::EMIT: {
|
||||||
auto* emitter = state.emitter_ptr;
|
auto* emitter = state.emitter_ptr;
|
||||||
ASSERT_MSG(emitter, "Execute EMIT on VS");
|
ASSERT_MSG(emitter, "execute EMIT on VS");
|
||||||
emitter->Emit(state.output);
|
emitter->Emit(state.output);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OpCode::Id::SETEMIT: {
|
case OpCode::Id::SETEMIT: {
|
||||||
auto* emitter = state.emitter_ptr;
|
auto* emitter = state.emitter_ptr;
|
||||||
ASSERT_MSG(emitter, "Execute SETEMIT on VS");
|
ASSERT_MSG(emitter, "execute SETEMIT on VS");
|
||||||
emitter->emit_state.vertex_id = instr.setemit.vertex_id;
|
emitter->emit_state.vertex_id = instr.setemit.vertex_id;
|
||||||
emitter->emit_state.prim_emit = instr.setemit.prim_emit != 0;
|
emitter->emit_state.prim_emit = instr.setemit.prim_emit != 0;
|
||||||
emitter->emit_state.winding = instr.setemit.winding != 0;
|
emitter->emit_state.winding = instr.setemit.winding != 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user