mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-17 08:29:27 -04:00
android: Manual kotlin formatting corrections
This commit is contained in:
parent
1afa24387f
commit
d70099278a
34 changed files with 208 additions and 167 deletions
|
|
@ -79,7 +79,8 @@ android {
|
|||
"-DENABLE_QT=0", // Don't use QT
|
||||
"-DENABLE_SDL2=0", // Don't use SDL
|
||||
"-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
|
||||
)
|
||||
}
|
||||
|
|
@ -125,7 +126,8 @@ android {
|
|||
applicationIdSuffix = ".debug"
|
||||
versionNameSuffix = "-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
|
||||
isJniDebuggable = true
|
||||
proguardFiles(
|
||||
|
|
@ -136,8 +138,10 @@ android {
|
|||
}
|
||||
|
||||
// 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.
|
||||
// We should fix those bugs eventually, but for now this exists as a workaround to allow other work to be done.
|
||||
// Primarily exists to allow development on hardened_malloc systems (e.g. GrapheneOS)
|
||||
// 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") {
|
||||
initWith(getByName("relWithDebInfo"))
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ object NativeLibrary {
|
|||
/**
|
||||
* Default touchscreen device
|
||||
*/
|
||||
const val TouchScreenDevice = "Touchscreen"
|
||||
const val TOUCHSCREEN_DEVICE = "Touchscreen"
|
||||
|
||||
@JvmField
|
||||
var sEmulationActivity = WeakReference<EmulationActivity?>(null)
|
||||
|
|
@ -461,16 +461,18 @@ object NativeLibrary {
|
|||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
emulationActivity = requireActivity() as EmulationActivity
|
||||
|
||||
var coreError = CoreError.fromInt(requireArguments().getInt(RESULT_CODE))
|
||||
val coreError = CoreError.fromInt(requireArguments().getInt(RESULT_CODE))
|
||||
val title: String
|
||||
val message: String
|
||||
when (coreError) {
|
||||
CoreError.ErrorGetLoader, CoreError.ErrorLoader_ErrorInvalidFormat, CoreError.ErrorSystemMode -> {
|
||||
CoreError.ErrorGetLoader,
|
||||
CoreError.ErrorLoaderErrorInvalidFormat,
|
||||
CoreError.ErrorSystemMode -> {
|
||||
title = getString(R.string.loader_error_invalid_format)
|
||||
message = getString(R.string.loader_error_invalid_format_description)
|
||||
}
|
||||
|
||||
CoreError.ErrorLoader_ErrorEncrypted -> {
|
||||
CoreError.ErrorLoaderErrorEncrypted -> {
|
||||
title = getString(R.string.loader_error_encrypted)
|
||||
message = getString(R.string.loader_error_encrypted_description)
|
||||
}
|
||||
|
|
@ -485,12 +487,12 @@ object NativeLibrary {
|
|||
message = getString(R.string.loader_error_invalid_system_mode_description)
|
||||
}
|
||||
|
||||
CoreError.ErrorLoader_ErrorPatches -> {
|
||||
CoreError.ErrorLoaderErrorPatches -> {
|
||||
title = getString(R.string.loader_error_applying_patches)
|
||||
message = getString(R.string.loader_error_applying_patches_description)
|
||||
}
|
||||
|
||||
CoreError.ErrorLoader_ErrorPatchesInvalidTitle -> {
|
||||
CoreError.ErrorLoaderErrorPatchesInvalidTitle -> {
|
||||
title = getString(R.string.loader_error_applying_patches)
|
||||
message = getString(R.string.loader_error_patch_wrong_application)
|
||||
}
|
||||
|
|
@ -878,11 +880,11 @@ object NativeLibrary {
|
|||
ErrorGetLoader(2, R.string.core_error_get_loader),
|
||||
ErrorSystemMode(3, R.string.core_error_system_mode),
|
||||
ErrorLoader(4, R.string.core_error_loader),
|
||||
ErrorLoader_ErrorEncrypted(5, R.string.core_error_loader_encrypted),
|
||||
ErrorLoader_ErrorInvalidFormat(6, R.string.core_error_loader_invalid_format),
|
||||
ErrorLoader_ErrorGBATitle(7, R.string.core_error_loader_gba_title),
|
||||
ErrorLoader_ErrorPatches(8, R.string.core_error_loader_error_patches),
|
||||
ErrorLoader_ErrorPatchesInvalidTitle(9, R.string.core_error_loader_patches_invalid_title),
|
||||
ErrorLoaderErrorEncrypted(5, R.string.core_error_loader_encrypted),
|
||||
ErrorLoaderErrorInvalidFormat(6, R.string.core_error_loader_invalid_format),
|
||||
ErrorLoaderErrorGBATitle(7, R.string.core_error_loader_gba_title),
|
||||
ErrorLoaderErrorPatches(8, R.string.core_error_loader_error_patches),
|
||||
ErrorLoaderErrorPatchesInvalidTitle(9, R.string.core_error_loader_patches_invalid_title),
|
||||
ErrorSystemFiles(10, R.string.core_error_system_files),
|
||||
ErrorSavestate(11, R.string.core_error_savestate),
|
||||
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.NativeLibrary
|
||||
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.databinding.ActivityEmulationBinding
|
||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||
|
|
@ -398,7 +398,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
// Axis is unmapped
|
||||
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
|
||||
value = 0f
|
||||
}
|
||||
|
|
@ -456,7 +456,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
// Triggers L/R and ZL/ZR
|
||||
if (isTriggerPressedLMapped) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.TRIGGER_L,
|
||||
if (isTriggerPressedL) {
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
|
|
@ -467,7 +467,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
}
|
||||
if (isTriggerPressedRMapped) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.TRIGGER_R,
|
||||
if (isTriggerPressedR) {
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
|
|
@ -478,7 +478,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
}
|
||||
if (isTriggerPressedZLMapped) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.BUTTON_ZL,
|
||||
if (isTriggerPressedZL) {
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
|
|
@ -489,7 +489,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
}
|
||||
if (isTriggerPressedZRMapped) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.BUTTON_ZR,
|
||||
if (isTriggerPressedZR) {
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
|
|
@ -502,72 +502,72 @@ class EmulationActivity : AppCompatActivity() {
|
|||
// Work-around to allow D-pad axis to be bound to emulated buttons
|
||||
if (axisValuesDPad[0] == 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
}
|
||||
if (axisValuesDPad[0] < 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
}
|
||||
if (axisValuesDPad[0] > 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_LEFT,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_RIGHT,
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
)
|
||||
}
|
||||
if (axisValuesDPad[1] == 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_UP,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
}
|
||||
if (axisValuesDPad[1] < 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_UP,
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
}
|
||||
if (axisValuesDPad[1] > 0f) {
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_UP,
|
||||
NativeLibrary.ButtonState.RELEASED
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
NativeLibrary.ButtonType.DPAD_DOWN,
|
||||
NativeLibrary.ButtonState.PRESSED
|
||||
)
|
||||
|
|
@ -598,7 +598,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
return@registerForActivityResult
|
||||
}
|
||||
|
||||
OnFilePickerResult(result.toString())
|
||||
onFilePickerResult(result.toString())
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ class GameAdapter(
|
|||
val extraDir: String
|
||||
)
|
||||
private fun getGameDirectories(game: Game): GameDirectories {
|
||||
val basePath = "sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000"
|
||||
val basePath =
|
||||
"sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000"
|
||||
return GameDirectories(
|
||||
gameDir = game.path.substringBeforeLast("/"),
|
||||
saveDir =
|
||||
|
|
@ -556,7 +557,8 @@ class GameAdapter(
|
|||
).show()
|
||||
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)
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ object MiiSelector {
|
|||
lateinit var data: MiiSelectorData
|
||||
val finishLock = Object()
|
||||
|
||||
private fun ExecuteImpl(config: MiiSelectorConfig) {
|
||||
private fun executeImpl(config: MiiSelectorConfig) {
|
||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||
data = MiiSelectorData(0, 0)
|
||||
val fragment = MiiSelectorDialogFragment.newInstance(config)
|
||||
|
|
@ -22,8 +22,8 @@ object MiiSelector {
|
|||
}
|
||||
|
||||
@JvmStatic
|
||||
fun Execute(config: MiiSelectorConfig): MiiSelectorData {
|
||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { ExecuteImpl(config) }
|
||||
fun execute(config: MiiSelectorConfig): MiiSelectorData {
|
||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { executeImpl(config) }
|
||||
synchronized(finishLock) {
|
||||
try {
|
||||
finishLock.wait()
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ object SoftwareKeyboard {
|
|||
lateinit var data: KeyboardData
|
||||
val finishLock = Object()
|
||||
|
||||
private fun ExecuteImpl(config: KeyboardConfig) {
|
||||
private fun executeImpl(config: KeyboardConfig) {
|
||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||
data = KeyboardData(0, "")
|
||||
KeyboardDialogFragment.newInstance(config)
|
||||
.show(emulationActivity!!.supportFragmentManager, KeyboardDialogFragment.TAG)
|
||||
}
|
||||
|
||||
fun HandleValidationError(config: KeyboardConfig, error: ValidationError) {
|
||||
fun handleValidationError(config: KeyboardConfig, error: ValidationError) {
|
||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()!!
|
||||
val message: String = when (error) {
|
||||
ValidationError.FixedLengthRequired -> emulationActivity.getString(
|
||||
|
|
@ -54,12 +54,12 @@ object SoftwareKeyboard {
|
|||
}
|
||||
|
||||
@JvmStatic
|
||||
fun Execute(config: KeyboardConfig): KeyboardData {
|
||||
if (config.buttonConfig == ButtonConfig.None) {
|
||||
fun execute(config: KeyboardConfig): KeyboardData {
|
||||
if (config.buttonConfig == ButtonConfig.NONE) {
|
||||
Log.error("Unexpected button config None")
|
||||
return KeyboardData(0, "")
|
||||
}
|
||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { ExecuteImpl(config) }
|
||||
NativeLibrary.sEmulationActivity.get()!!.runOnUiThread { executeImpl(config) }
|
||||
synchronized(finishLock) {
|
||||
try {
|
||||
finishLock.wait()
|
||||
|
|
@ -69,8 +69,9 @@ object SoftwareKeyboard {
|
|||
return data
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
fun ShowError(error: String) {
|
||||
fun showError(error: String) {
|
||||
NativeLibrary.displayAlertMsg(
|
||||
appContext.resources.getString(R.string.software_keyboard),
|
||||
error,
|
||||
|
|
@ -78,16 +79,19 @@ object SoftwareKeyboard {
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("FunctionName")
|
||||
private external fun ValidateFilters(text: String): ValidationError
|
||||
|
||||
@Suppress("FunctionName")
|
||||
external fun ValidateInput(text: String): ValidationError
|
||||
|
||||
// / Corresponds to Frontend::ButtonConfig
|
||||
interface ButtonConfig {
|
||||
companion object {
|
||||
const val Single = 0 // / Ok button
|
||||
const val Dual = 1 // / Cancel | 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 SINGLE = 0 // / Ok button
|
||||
const val DUAL = 1 // / Cancel | Ok buttons
|
||||
const val TRIPLE = 2 // / Cancel | I Forgot | Ok buttons
|
||||
const val NONE = 3 // / No button (returned by swkbdInputText in special cases)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@ object StillImageCameraHelper {
|
|||
private var filePickerPath: String? = null
|
||||
|
||||
// Opens file picker for camera.
|
||||
@Suppress("unused")
|
||||
@Keep
|
||||
@JvmStatic
|
||||
fun OpenFilePicker(): String? {
|
||||
fun openFilePicker(): String? {
|
||||
val emulationActivity = NativeLibrary.sEmulationActivity.get()
|
||||
|
||||
// At this point, we are assuming that we already have permissions as they are
|
||||
|
|
@ -44,15 +45,16 @@ object StillImageCameraHelper {
|
|||
|
||||
// Called from EmulationActivity.
|
||||
@JvmStatic
|
||||
fun OnFilePickerResult(result: String) {
|
||||
fun onFilePickerResult(result: String) {
|
||||
filePickerPath = result
|
||||
synchronized(filePickerLock) { filePickerLock.notifyAll() }
|
||||
}
|
||||
|
||||
// Blocking call. Load image from file and crop/resize it to fit in width x height.
|
||||
@Suppress("unused")
|
||||
@Keep
|
||||
@JvmStatic
|
||||
fun LoadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? {
|
||||
fun loadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? {
|
||||
val context = CitraApplication.appContext
|
||||
val request = ImageRequest.Builder(context)
|
||||
.data(uri)
|
||||
|
|
|
|||
|
|
@ -159,12 +159,15 @@ class CheatsFragment :
|
|||
}
|
||||
|
||||
private fun onSelectedCheatChanged(selectedCheat: Cheat?) {
|
||||
val cheatSelected = selectedCheat != null || cheatsViewModel.isEditing.value!!
|
||||
val cheatSelected = selectedCheat != null || cheatsViewModel.isEditing.value
|
||||
if (!cheatSelected && binding.slidingPaneLayout.isOpen) {
|
||||
binding.slidingPaneLayout.close()
|
||||
}
|
||||
binding.slidingPaneLayout.lockMode =
|
||||
if (cheatSelected) SlidingPaneLayout.LOCK_MODE_UNLOCKED else SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
binding.slidingPaneLayout.lockMode = if (cheatSelected) {
|
||||
SlidingPaneLayout.LOCK_MODE_UNLOCKED
|
||||
} else {
|
||||
SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
}
|
||||
}
|
||||
|
||||
fun onListViewFocusChange(hasFocus: Boolean) {
|
||||
|
|
@ -205,7 +208,8 @@ class CheatsFragment :
|
|||
val keyboardInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
|
||||
// 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 (keyboardInsets.bottom > 0) {
|
||||
mlpDetails.bottomMargin = keyboardInsets.bottom
|
||||
|
|
@ -233,7 +237,8 @@ class CheatsFragment :
|
|||
runningAnimations: List<WindowInsetsAnimationCompat>
|
||||
): WindowInsetsCompat {
|
||||
val mlpDetails =
|
||||
binding.cheatDetailsContainer.layoutParams as ViewGroup.MarginLayoutParams
|
||||
binding.cheatDetailsContainer.layoutParams
|
||||
as ViewGroup.MarginLayoutParams
|
||||
keyboardInsets = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
|
||||
barInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
|
||||
mlpDetails.bottomMargin = keyboardInsets.coerceAtLeast(barInsets)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class Settings {
|
|||
const val HOTKEY_CLOSE_GAME = "hotkey_close_game"
|
||||
const val HOTKEY_PAUSE_OR_RESUME = "hotkey_pause_or_resume_game"
|
||||
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"
|
||||
|
||||
val buttonKeys = listOf(
|
||||
|
|
@ -208,7 +208,7 @@ class Settings {
|
|||
HOTKEY_CLOSE_GAME,
|
||||
HOTKEY_PAUSE_OR_RESUME,
|
||||
HOTKEY_QUICKSAVE,
|
||||
HOTKEY_QUICKlOAD,
|
||||
HOTKEY_QUICKLOAD,
|
||||
HOTKEY_TURBO_LIMIT
|
||||
)
|
||||
val hotkeyTitles = listOf(
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class InputBindingSetting(val abstractSetting: AbstractSetting, titleId: Int) :
|
|||
Settings.HOTKEY_CLOSE_GAME -> Hotkey.CLOSE_GAME.button
|
||||
Settings.HOTKEY_PAUSE_OR_RESUME -> Hotkey.PAUSE_OR_RESUME.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
|
||||
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)
|
||||
*/
|
||||
fun applyAutoMapBindings(isNintendoLayout: Boolean, useAxisDpad: Boolean) {
|
||||
val faceButtons = if (isNintendoLayout) nintendoFaceButtonMappings else xboxFaceButtonMappings
|
||||
val faceButtons = if (isNintendoLayout) {
|
||||
nintendoFaceButtonMappings
|
||||
} else {
|
||||
xboxFaceButtonMappings
|
||||
}
|
||||
val buttonMappings = if (useAxisDpad) {
|
||||
faceButtons + commonButtonMappings
|
||||
} else {
|
||||
|
|
@ -657,7 +661,9 @@ class InputBindingSetting(val abstractSetting: AbstractSetting, titleId: Int) :
|
|||
editor.putBoolean(getInputAxisInvertedKey(mapping.hostAxis), mapping.inverted)
|
||||
val dir = if (mapping.orientation == 0) '+' else '-'
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.citra.citra_emu.utils.FileUtil
|
|||
import org.citra.citra_emu.utils.PermissionsHandler
|
||||
import org.citra.citra_emu.viewmodel.HomeViewModel
|
||||
|
||||
class CopyDirProgressDialog : DialogFragment() {
|
||||
class CopyDirProgressDialogFragment : DialogFragment() {
|
||||
private var _binding: DialogCopyDirBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ class CopyDirProgressDialog : DialogFragment() {
|
|||
previous: Uri,
|
||||
path: Uri,
|
||||
callback: SetupCallback? = null
|
||||
): CopyDirProgressDialog? {
|
||||
): CopyDirProgressDialogFragment? {
|
||||
val viewModel = ViewModelProvider(activity)[HomeViewModel::class.java]
|
||||
if (viewModel.copyInProgress) {
|
||||
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) {
|
||||
val SYSTEM_FPS = 0
|
||||
val FPS = 1
|
||||
val SPEED = 2
|
||||
val FRAMETIME = 3
|
||||
val TIME_SVC = 4
|
||||
val TIME_IPC = 5
|
||||
val TIME_GPU = 6
|
||||
val TIME_SWAP = 7
|
||||
val TIME_REM = 8
|
||||
@Suppress("UnusedVariable")
|
||||
val systemFps = 0
|
||||
val fps = 1
|
||||
val speed = 2
|
||||
val frametime = 3
|
||||
val timeSvc = 4
|
||||
val timeIpc = 5
|
||||
val timeGpu = 6
|
||||
val timeSwap = 7
|
||||
val timeRem = 8
|
||||
perfStatsUpdater = Runnable {
|
||||
val sb = StringBuilder()
|
||||
val perfStats = NativeLibrary.getPerfStats()
|
||||
val dividerString = "\u00A0\u2502 "
|
||||
if (perfStats[FPS] > 0) {
|
||||
if (perfStats[fps] > 0) {
|
||||
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) {
|
||||
|
|
@ -1483,12 +1484,12 @@ class EmulationFragment :
|
|||
sb.append(
|
||||
String.format(
|
||||
"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[TIME_GPU] * 1000.0f).toFloat(),
|
||||
(perfStats[TIME_SWAP] * 1000.0f).toFloat(),
|
||||
(perfStats[TIME_IPC] * 1000.0f).toFloat(),
|
||||
(perfStats[TIME_SVC] * 1000.0f).toFloat(),
|
||||
(perfStats[TIME_REM] * 1000.0f).toFloat()
|
||||
(perfStats[frametime] * 1000.0f).toFloat(),
|
||||
(perfStats[timeGpu] * 1000.0f).toFloat(),
|
||||
(perfStats[timeSwap] * 1000.0f).toFloat(),
|
||||
(perfStats[timeIpc] * 1000.0f).toFloat(),
|
||||
(perfStats[timeSvc] * 1000.0f).toFloat(),
|
||||
(perfStats[timeRem] * 1000.0f).toFloat()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -1498,7 +1499,7 @@ class EmulationFragment :
|
|||
sb.append(
|
||||
String.format(
|
||||
"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 {
|
||||
dialog.dismiss()
|
||||
@Suppress("ktlint:standard:max-line-length")
|
||||
val resId = when (status) {
|
||||
NativeLibrary.CompressStatus.SUCCESS -> if (shouldCompress) R.string.compress_success else R.string.decompress_success
|
||||
NativeLibrary.CompressStatus.COMPRESS_UNSUPPORTED -> R.string.compress_unsupported
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||
isCancelable = false
|
||||
|
||||
when (config.buttonConfig) {
|
||||
SoftwareKeyboard.ButtonConfig.Triple -> {
|
||||
SoftwareKeyboard.ButtonConfig.TRIPLE -> {
|
||||
val negativeText =
|
||||
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
||||
val neutralText = config.buttonText[1].ifEmpty { getString(R.string.i_forgot) }
|
||||
|
|
@ -50,7 +50,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||
.setPositiveButton(positiveText, null)
|
||||
}
|
||||
|
||||
SoftwareKeyboard.ButtonConfig.Dual -> {
|
||||
SoftwareKeyboard.ButtonConfig.DUAL -> {
|
||||
val negativeText =
|
||||
config.buttonText[0].ifEmpty { getString(android.R.string.cancel) }
|
||||
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
||||
|
|
@ -58,7 +58,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||
.setPositiveButton(positiveText, null)
|
||||
}
|
||||
|
||||
SoftwareKeyboard.ButtonConfig.Single -> {
|
||||
SoftwareKeyboard.ButtonConfig.SINGLE -> {
|
||||
val positiveText = config.buttonText[2].ifEmpty { getString(android.R.string.ok) }
|
||||
builder.setPositiveButton(positiveText, null)
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ class KeyboardDialogFragment : DialogFragment() {
|
|||
SoftwareKeyboard.data.text = binding.editTextInput.text.toString()
|
||||
val error = SoftwareKeyboard.ValidateInput(SoftwareKeyboard.data.text)
|
||||
if (error != SoftwareKeyboard.ValidationError.None) {
|
||||
SoftwareKeyboard.HandleValidationError(config, error)
|
||||
SoftwareKeyboard.handleValidationError(config, error)
|
||||
return@setOnClickListener
|
||||
}
|
||||
dismiss()
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ class SetupFragment : Fragment() {
|
|||
pageButtonCallback = it
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
manageExternalStoragePermissionLauncher.launch(
|
||||
@Suppress("ktlint:standard:max-line-length")
|
||||
Intent(
|
||||
android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
|
||||
Uri.fromParts(
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class SystemFilesFragment : Fragment() {
|
|||
private val homeViewModel: HomeViewModel 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 var setupStateCached: BooleanArray? = null
|
||||
|
|
@ -85,7 +85,7 @@ class SystemFilesFragment : Fragment() {
|
|||
reloadUi()
|
||||
if (savedInstanceState != null) {
|
||||
binding.dropdownSystemRegionStart
|
||||
.setText(savedInstanceState.getString(REGION_START), false)
|
||||
.setText(savedInstanceState.getString(regionStartSring), false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -309,9 +309,10 @@ class SystemFilesFragment : Fragment() {
|
|||
setupStateCached = null
|
||||
progressDialog2?.dismiss()
|
||||
val action =
|
||||
HomeNavigationDirections.actionGlobalEmulationActivity(
|
||||
menu
|
||||
)
|
||||
HomeNavigationDirections
|
||||
.actionGlobalEmulationActivity(
|
||||
menu
|
||||
)
|
||||
binding.root.findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||
}
|
||||
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
button.id,
|
||||
button.status
|
||||
)
|
||||
|
|
@ -211,22 +211,22 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||
anyOverlayStateChanged = true
|
||||
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
dpad.upId,
|
||||
dpad.upStatus
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
dpad.downId,
|
||||
dpad.downStatus
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
dpad.leftId,
|
||||
dpad.leftStatus
|
||||
)
|
||||
NativeLibrary.onGamePadEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
dpad.rightId,
|
||||
dpad.rightStatus
|
||||
)
|
||||
|
|
@ -250,7 +250,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) :
|
|||
|
||||
val axisID = joystick.joystickId
|
||||
NativeLibrary.onGamePadMoveEvent(
|
||||
NativeLibrary.TouchScreenDevice,
|
||||
NativeLibrary.TOUCHSCREEN_DEVICE,
|
||||
axisID,
|
||||
joystick.xAxis,
|
||||
joystick.yAxis
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ class InputOverlayDrawableButton(
|
|||
) {
|
||||
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 previousTouchY = 0
|
||||
|
|
@ -194,7 +195,11 @@ class InputOverlayDrawableButton(
|
|||
}
|
||||
|
||||
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
|
||||
get() = defaultStateBitmap.bounds
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,8 +176,10 @@ class InputOverlayDrawableJoystick(
|
|||
this.yAxis = sin(angle.toDouble()).toFloat() * radius
|
||||
setInnerBounds()
|
||||
|
||||
if (kotlin.math.abs(oldRadius - radius) > .34f ||
|
||||
radius > .5f && kotlin.math.abs(oldAngle - angle) > kotlin.math.PI / 8
|
||||
if ((
|
||||
(kotlin.math.abs(oldRadius - radius) > .34f) ||
|
||||
(radius > .5f)
|
||||
) && (kotlin.math.abs(oldAngle - angle) > kotlin.math.PI / 8)
|
||||
) {
|
||||
this.radius = radius
|
||||
this.angle = angle
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class MainActivity :
|
|||
settingsViewModel.settings.loadSettings()
|
||||
}
|
||||
|
||||
ThemeUtil.ThemeChangeListener(this)
|
||||
ThemeUtil.themeChangeListener(this)
|
||||
ThemeUtil.setTheme(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ package org.citra.citra_emu.utils
|
|||
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.net.toUri
|
||||
|
|
@ -19,11 +18,11 @@ import org.citra.citra_emu.R
|
|||
import org.citra.citra_emu.utils.FileUtil.getFilename
|
||||
|
||||
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 val SUMMARY_NOTIFICATION_ID = 0xC1A0000
|
||||
private val PROGRESS_NOTIFICATION_ID = SUMMARY_NOTIFICATION_ID + 1
|
||||
private var statusNotificationId = SUMMARY_NOTIFICATION_ID + 2
|
||||
private val summaryNotificationId = 0xC1A0000
|
||||
private val progressNotificationId = summaryNotificationId + 1
|
||||
private var statusNotificationId = summaryNotificationId + 2
|
||||
|
||||
private val notificationManager = context.getSystemService(NotificationManager::class.java)
|
||||
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))
|
||||
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
||||
.setGroup(GROUP_KEY_CIA_INSTALL_STATUS)
|
||||
.setGroup(groupKeyCiaInstallStatus)
|
||||
private val summaryNotification = NotificationCompat.Builder(
|
||||
context,
|
||||
context.getString(R.string.cia_install_notification_channel_id)
|
||||
)
|
||||
.setContentTitle(context.getString(R.string.install_cia_title))
|
||||
.setSmallIcon(R.drawable.ic_stat_notification_logo)
|
||||
.setGroup(GROUP_KEY_CIA_INSTALL_STATUS)
|
||||
.setGroup(groupKeyCiaInstallStatus)
|
||||
.setGroupSummary(true)
|
||||
.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,
|
||||
// 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())
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +148,7 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||
val res = installCIA(fileFinal)
|
||||
notifyInstallStatus(filename, res)
|
||||
}
|
||||
notificationManager.cancel(PROGRESS_NOTIFICATION_ID)
|
||||
notificationManager.cancel(progressNotificationId)
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
|
|
@ -164,11 +163,11 @@ class CiaInstallWorker(val context: Context, params: WorkerParameters) : Worker(
|
|||
}
|
||||
lastNotifiedTime = currentTime
|
||||
installProgressBuilder.setProgress(max, progress, false)
|
||||
notificationManager.notify(PROGRESS_NOTIFICATION_ID, installProgressBuilder.build())
|
||||
notificationManager.notify(progressNotificationId, installProgressBuilder.build())
|
||||
}
|
||||
|
||||
override fun getForegroundInfo(): ForegroundInfo =
|
||||
ForegroundInfo(PROGRESS_NOTIFICATION_ID, installProgressBuilder.build())
|
||||
ForegroundInfo(progressNotificationId, installProgressBuilder.build())
|
||||
|
||||
private external fun installCIA(path: String): InstallStatus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import android.net.Uri
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
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.viewmodel.HomeViewModel
|
||||
|
||||
|
|
@ -51,8 +51,16 @@ class CitraDirectoryHelper(
|
|||
}
|
||||
|
||||
// If user check move data, show copy progress dialog.
|
||||
CopyDirProgressDialog.newInstance(fragmentActivity, previous, path, callback)
|
||||
?.show(fragmentActivity.supportFragmentManager, CopyDirProgressDialog.TAG)
|
||||
CopyDirProgressDialogFragment.newInstance(
|
||||
fragmentActivity,
|
||||
previous,
|
||||
path,
|
||||
callback
|
||||
)
|
||||
?.show(
|
||||
fragmentActivity.supportFragmentManager,
|
||||
CopyDirProgressDialogFragment.TAG
|
||||
)
|
||||
}
|
||||
)
|
||||
citraDirectoryDialog.show(
|
||||
|
|
|
|||
|
|
@ -252,7 +252,8 @@ class DocumentsTree {
|
|||
val newName = Paths.get(destinationPath).fileName.toString()
|
||||
val parentPath = Paths.get(destinationPath).parent.toString()
|
||||
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) {
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ object MemoryUtil {
|
|||
private val Float.hundredths: String
|
||||
get() = String.format(Locale.ROOT, "%.2f", this)
|
||||
|
||||
const val Kb: Float = 1024F
|
||||
const val Mb = Kb * 1024
|
||||
const val Gb = Mb * 1024
|
||||
const val Tb = Gb * 1024
|
||||
const val Pb = Tb * 1024
|
||||
const val Eb = Pb * 1024
|
||||
const val KB: Float = 1024F
|
||||
const val MB = KB * 1024
|
||||
const val GB = MB * 1024
|
||||
const val TB = GB * 1024
|
||||
const val PB = TB * 1024
|
||||
const val EB = PB * 1024
|
||||
|
||||
fun bytesToSizeUnit(size: Float, roundUp: Boolean = false): String = when {
|
||||
size < Kb -> {
|
||||
size < KB -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
size.hundredths,
|
||||
|
|
@ -33,42 +33,42 @@ object MemoryUtil {
|
|||
)
|
||||
}
|
||||
|
||||
size < Mb -> {
|
||||
size < MB -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
size < Gb -> {
|
||||
size < GB -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
size < Tb -> {
|
||||
size < TB -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
size < Pb -> {
|
||||
size < PB -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
size < Eb -> {
|
||||
size < EB -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ object MemoryUtil {
|
|||
else -> {
|
||||
context.getString(
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
|
@ -97,13 +97,13 @@ object MemoryUtil {
|
|||
}
|
||||
|
||||
fun isLessThan(minimum: Int, size: Float): Boolean = when (size) {
|
||||
Kb -> totalMemory < Mb && totalMemory < minimum
|
||||
Mb -> totalMemory < Gb && (totalMemory / Mb) < minimum
|
||||
Gb -> totalMemory < Tb && (totalMemory / Gb) < minimum
|
||||
Tb -> totalMemory < Pb && (totalMemory / Tb) < minimum
|
||||
Pb -> totalMemory < Eb && (totalMemory / Pb) < minimum
|
||||
Eb -> totalMemory / Eb < minimum
|
||||
else -> totalMemory < Kb && totalMemory < minimum
|
||||
KB -> totalMemory < MB && totalMemory < minimum
|
||||
MB -> totalMemory < GB && (totalMemory / MB) < minimum
|
||||
GB -> totalMemory < TB && (totalMemory / GB) < minimum
|
||||
TB -> totalMemory < PB && (totalMemory / TB) < minimum
|
||||
PB -> totalMemory < EB && (totalMemory / PB) < minimum
|
||||
EB -> totalMemory / EB < 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
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlin.math.roundToInt
|
||||
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
|
||||
private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null
|
||||
|
||||
fun ThemeChangeListener(activity: AppCompatActivity) {
|
||||
fun themeChangeListener(activity: AppCompatActivity) {
|
||||
listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||
val relevantKeys =
|
||||
listOf(
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ void AndroidMiiSelector::Setup(const Frontend::MiiSelectorConfig& config) {
|
|||
java_config,
|
||||
env->GetFieldID(s_mii_selector_config_class, "miiNames", "[Ljava/lang/String;"), array);
|
||||
|
||||
// Invoke backend Execute method
|
||||
// Invoke backend execute method
|
||||
jobject data =
|
||||
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")));
|
||||
|
||||
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/"
|
||||
"citra/citra_emu/applets/MiiSelector$MiiSelectorData;");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ void InitJNI(JNIEnv* env) {
|
|||
env->FindClass("org/citra/citra_emu/applets/SoftwareKeyboard$ValidationError")));
|
||||
|
||||
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/"
|
||||
"applets/SoftwareKeyboard$KeyboardData;");
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ namespace Camera::StillImage {
|
|||
void InitJNI(JNIEnv* env) {
|
||||
s_still_image_camera_helper_class = reinterpret_cast<jclass>(
|
||||
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;");
|
||||
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;");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -919,7 +919,7 @@ static int clz(unsigned int x) {
|
|||
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) {
|
||||
MICROPROFILE_SCOPE(DynCom_Execute);
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ enum : u32 {
|
|||
enum {
|
||||
STOP = 0, // Stop
|
||||
CHANGEMODE = 1, // Change mode
|
||||
ONCE = 2, // Execute just one iteration
|
||||
ONCE = 2, // execute just one iteration
|
||||
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);
|
||||
break;
|
||||
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; });
|
||||
break;
|
||||
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; });
|
||||
break;
|
||||
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,
|
||||
[&line](u32 val) -> bool { return line.value == val; });
|
||||
break;
|
||||
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,
|
||||
[&line](u32 val) -> bool { return line.value != val; });
|
||||
break;
|
||||
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 {
|
||||
return static_cast<u16>(line.value) > (static_cast<u16>(~line.value >> 16) & val);
|
||||
});
|
||||
break;
|
||||
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 {
|
||||
return static_cast<u16>(line.value) < (static_cast<u16>(~line.value >> 16) & val);
|
||||
});
|
||||
break;
|
||||
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 {
|
||||
return static_cast<u16>(line.value) == (static_cast<u16>(~line.value >> 16) & val);
|
||||
});
|
||||
break;
|
||||
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 {
|
||||
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;
|
||||
|
||||
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);
|
||||
} else {
|
||||
// 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;
|
||||
|
||||
auto VerifyPermissions = [](MemoryPermission permission) {
|
||||
// SharedMemory blocks can not be created with Execute permissions
|
||||
// SharedMemory blocks can not be created with execute permissions
|
||||
switch (permission) {
|
||||
case MemoryPermission::None:
|
||||
case MemoryPermission::Read:
|
||||
|
|
|
|||
|
|
@ -663,14 +663,14 @@ static void RunInterpreter(const ShaderSetup& setup, ShaderUnit& state,
|
|||
|
||||
case OpCode::Id::EMIT: {
|
||||
auto* emitter = state.emitter_ptr;
|
||||
ASSERT_MSG(emitter, "Execute EMIT on VS");
|
||||
ASSERT_MSG(emitter, "execute EMIT on VS");
|
||||
emitter->Emit(state.output);
|
||||
break;
|
||||
}
|
||||
|
||||
case OpCode::Id::SETEMIT: {
|
||||
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.prim_emit = instr.setemit.prim_emit != 0;
|
||||
emitter->emit_state.winding = instr.setemit.winding != 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue