diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index f8b2c1f5..19a29969 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -11,7 +11,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -fno-stack-protector -Wno-unused-command-line-argument -DNDEBUG")
-set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
# {fmt}
add_subdirectory("libraries/fmt")
diff --git a/app/build.gradle b/app/build.gradle
index 866e442e..4f45740e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,13 +6,13 @@ plugins {
}
android {
- compileSdkVersion 30
- buildToolsVersion '30.0.3'
+ compileSdkVersion 31
+ buildToolsVersion '31.0.0'
defaultConfig {
applicationId "skyline.emu"
minSdkVersion 29
- targetSdkVersion 30
+ targetSdkVersion 31
versionCode 3
versionName "0.0.3"
@@ -50,19 +50,10 @@ android {
debuggable true
minifyEnabled false
shrinkResources false
-
- /* Vulkan Validation Layers */
- sourceSets {
- main {
- jniLibs {
- srcDir "$buildDir/generated/vulkan_layers"
- }
- }
- }
}
}
+
buildFeatures {
- prefab true
viewBinding true
}
@@ -72,7 +63,7 @@ android {
}
/* NDK */
- ndkVersion '22.1.7171670'
+ ndkVersion '23.0.7599858'
externalNativeBuild {
cmake {
version '3.18.1+'
@@ -84,41 +75,29 @@ android {
aaptOptions {
ignoreAssetsPattern "*.md"
}
-}
-/**
- * We just want VK_LAYER_KHRONOS_validation in the APK while NDK contains several other legacy layers
- * This task copies shared objects associated with that layer into a folder from where JNI can use it
- */
-task setupValidationLayer(type: Copy) {
- doFirst {
- def folder = new File("$buildDir/generated/vulkan_layers")
- if (!folder.exists()) {
- folder.mkdirs() // We need to recursively create all directories as the copy requires the output directory to exist
+ /* Vulkan Validation Layers */
+ sourceSets {
+ debug {
+ jniLibs {
+ srcDir "libraries/vklayers"
+ }
}
}
- from("${android.ndkDirectory}/sources/third_party/vulkan/src/build-android/jniLibs") {
- include "*/libVkLayer_khronos_validation.so"
- }
- into "$buildDir/generated/vulkan_layers"
-}
-
-afterEvaluate {
- preDebugBuild.dependsOn setupValidationLayer
}
dependencies {
/* Google */
implementation "androidx.core:core-ktx:1.6.0"
- implementation 'androidx.appcompat:appcompat:1.3.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+ implementation 'androidx.appcompat:appcompat:1.3.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
- implementation 'androidx.fragment:fragment-ktx:1.3.5'
+ implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'com.google.android:flexbox:2.0.1'
@@ -129,3 +108,7 @@ dependencies {
/* Other Java */
implementation 'info.debatty:java-string-similarity:2.0.0'
}
+
+kapt {
+ correctErrorTypes true
+}
diff --git a/app/libraries/boost b/app/libraries/boost
index 42379669..e32407f2 160000
--- a/app/libraries/boost
+++ b/app/libraries/boost
@@ -1 +1 @@
-Subproject commit 4237966924d69ea5c875d5c2072fc0804f15b4b5
+Subproject commit e32407f2b4cac7f0d739f10821d7f7e0c81e8436
diff --git a/app/libraries/fmt b/app/libraries/fmt
index 9e8b86fd..dcd282bb 160000
--- a/app/libraries/fmt
+++ b/app/libraries/fmt
@@ -1 +1 @@
-Subproject commit 9e8b86fd2d9806672cc73133d21780dd182bfd24
+Subproject commit dcd282bb268a0766f6d273b6e41a3a96719bbbfb
diff --git a/app/libraries/frozen b/app/libraries/frozen
index 96ac3481..7264ab0e 160000
--- a/app/libraries/frozen
+++ b/app/libraries/frozen
@@ -1 +1 @@
-Subproject commit 96ac3481a9e9543f44b4de8e65af9ad2b040241c
+Subproject commit 7264ab0eae2a072afa55d617d5e9e11bcb464aae
diff --git a/app/libraries/oboe b/app/libraries/oboe
index f126f79f..855ea841 160000
--- a/app/libraries/oboe
+++ b/app/libraries/oboe
@@ -1 +1 @@
-Subproject commit f126f79fd3d9cbfac78f6e8d8e8bc1cd9f4db849
+Subproject commit 855ea841a93bf304065e5152909983b1b85ffabb
diff --git a/app/libraries/pugixml b/app/libraries/pugixml
index 08b34331..9e382f98 160000
--- a/app/libraries/pugixml
+++ b/app/libraries/pugixml
@@ -1 +1 @@
-Subproject commit 08b3433180727ea2f78fe02e860a08471db1e03c
+Subproject commit 9e382f98076e57581fcc61323728443374889646
diff --git a/app/libraries/vkhpp b/app/libraries/vkhpp
index 8c7a248a..4bcd3010 160000
--- a/app/libraries/vkhpp
+++ b/app/libraries/vkhpp
@@ -1 +1 @@
-Subproject commit 8c7a248a72c685ce28cbc63f6c40e6a2ea786346
+Subproject commit 4bcd301070d7d4a3d6ca191da96430025d708a6a
diff --git a/app/libraries/vklayers/arm64-v8a/libVkLayer_khronos_validation.so b/app/libraries/vklayers/arm64-v8a/libVkLayer_khronos_validation.so
new file mode 100755
index 00000000..868e6646
Binary files /dev/null and b/app/libraries/vklayers/arm64-v8a/libVkLayer_khronos_validation.so differ
diff --git a/app/libraries/vkma b/app/libraries/vkma
index 0790b5f0..895b080a 160000
--- a/app/libraries/vkma
+++ b/app/libraries/vkma
@@ -1 +1 @@
-Subproject commit 0790b5f0a9b96cd79fe75e4f458fc6b468dd9ec3
+Subproject commit 895b080a3c2189feaea0919af8982e9a248ff7d6
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9104301e..3759216f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -22,12 +22,15 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
-
+
+
+
@@ -44,6 +48,7 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="emu.skyline.SettingsActivity" />
+
+
diff --git a/app/src/main/cpp/skyline/common.h b/app/src/main/cpp/skyline/common.h
index 2294c060..1d044059 100644
--- a/app/src/main/cpp/skyline/common.h
+++ b/app/src/main/cpp/skyline/common.h
@@ -149,7 +149,7 @@ namespace skyline {
*/
template
auto Format(S formatString, Args &&... args) {
- return fmt::format(formatString, FmtCast(args)...);
+ return fmt::format(fmt::runtime(formatString), FmtCast(args)...);
}
}
@@ -159,7 +159,7 @@ namespace skyline {
class exception : public std::runtime_error {
public:
template
- exception(const S &formatStr, Args &&... args) : runtime_error(fmt::format(formatStr, util::FmtCast(args)...)) {}
+ exception(const S &formatStr, Args &&... args) : runtime_error(fmt::format(fmt::runtime(formatStr), util::FmtCast(args)...)) {}
};
namespace util {
@@ -364,7 +364,6 @@ namespace skyline {
template requires (std::is_integral_v)
void FillRandomBytes(std::span in) {
std::independent_bits_engine::digits, T> gen(detail::generator);
-
std::generate(in.begin(), in.end(), gen);
}
@@ -577,7 +576,7 @@ namespace skyline {
S string;
const char *function;
- FunctionString(S string, const char *function = __builtin_FUNCTION()) : string(std::move(string)), function(function) {}
+ constexpr FunctionString(S string, const char *function = __builtin_FUNCTION()) : string(std::move(string)), function(function) {}
std::string operator*() {
return std::string(function) + ": " + std::string(string);
@@ -587,91 +586,91 @@ namespace skyline {
template
void Error(FunctionString formatString, Args &&... args) {
if (LogLevel::Error <= configLevel)
- Write(LogLevel::Error, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Error, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void Error(FunctionString formatString, Args &&... args) {
if (LogLevel::Error <= configLevel)
- Write(LogLevel::Error, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Error, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void ErrorNoPrefix(S formatString, Args &&... args) {
if (LogLevel::Error <= configLevel)
- Write(LogLevel::Error, fmt::format(formatString, util::FmtCast(args)...));
+ Write(LogLevel::Error, fmt::format(fmt::runtime(formatString), util::FmtCast(args)...));
}
template
void Warn(FunctionString formatString, Args &&... args) {
if (LogLevel::Warn <= configLevel)
- Write(LogLevel::Warn, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Warn, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void Warn(FunctionString formatString, Args &&... args) {
if (LogLevel::Warn <= configLevel)
- Write(LogLevel::Warn, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Warn, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void WarnNoPrefix(S formatString, Args &&... args) {
if (LogLevel::Warn <= configLevel)
- Write(LogLevel::Warn, fmt::format(formatString, util::FmtCast(args)...));
+ Write(LogLevel::Warn, fmt::format(fmt::runtime(formatString), util::FmtCast(args)...));
}
template
void Info(FunctionString formatString, Args &&... args) {
if (LogLevel::Info <= configLevel)
- Write(LogLevel::Info, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Info, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void Info(FunctionString formatString, Args &&... args) {
if (LogLevel::Info <= configLevel)
- Write(LogLevel::Info, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Info, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void InfoNoPrefix(S formatString, Args &&... args) {
if (LogLevel::Info <= configLevel)
- Write(LogLevel::Info, fmt::format(formatString, util::FmtCast(args)...));
+ Write(LogLevel::Info, fmt::format(fmt::runtime(formatString), util::FmtCast(args)...));
}
template
void Debug(FunctionString formatString, Args &&... args) {
if (LogLevel::Debug <= configLevel)
- Write(LogLevel::Debug, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Debug, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void Debug(FunctionString formatString, Args &&... args) {
if (LogLevel::Debug <= configLevel)
- Write(LogLevel::Debug, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Debug, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void DebugNoPrefix(S formatString, Args &&... args) {
if (LogLevel::Debug <= configLevel)
- Write(LogLevel::Debug, fmt::format(formatString, util::FmtCast(args)...));
+ Write(LogLevel::Debug, fmt::format(fmt::runtime(formatString), util::FmtCast(args)...));
}
template
void Verbose(FunctionString formatString, Args &&... args) {
if (LogLevel::Verbose <= configLevel)
- Write(LogLevel::Verbose, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Verbose, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void Verbose(FunctionString formatString, Args &&... args) {
if (LogLevel::Verbose <= configLevel)
- Write(LogLevel::Verbose, fmt::format(*formatString, util::FmtCast(args)...));
+ Write(LogLevel::Verbose, fmt::format(fmt::runtime(*formatString), util::FmtCast(args)...));
}
template
void VerboseNoPrefix(S formatString, Args &&... args) {
if (LogLevel::Verbose <= configLevel)
- Write(LogLevel::Verbose, fmt::format(formatString, util::FmtCast(args)...));
+ Write(LogLevel::Verbose, fmt::format(fmt::runtime(formatString), util::FmtCast(args)...));
}
};
diff --git a/app/src/main/cpp/skyline/common/signal.cpp b/app/src/main/cpp/skyline/common/signal.cpp
index c3695144..58da88f3 100644
--- a/app/src/main/cpp/skyline/common/signal.cpp
+++ b/app/src/main/cpp/skyline/common/signal.cpp
@@ -4,6 +4,7 @@
#include
#include
#include
+#include
#include "signal.h"
namespace skyline::signal {
@@ -172,19 +173,21 @@ namespace skyline::signal {
void SetSignalHandler(std::initializer_list signals, SignalHandler function, bool syscallRestart) {
static std::array signalHandlerOnce{};
- stack_t stack;
- sigaltstack(nullptr, &stack);
struct sigaction action{
.sa_sigaction = reinterpret_cast(ThreadSignalHandler),
- .sa_flags = (syscallRestart ? SA_RESTART : 0) | SA_SIGINFO | (stack.ss_sp && stack.ss_size ? SA_ONSTACK : 0),
+ .sa_flags = SA_SIGINFO | SA_EXPOSE_TAGBITS | (syscallRestart ? SA_RESTART : 0) | SA_ONSTACK,
};
for (int signal : signals) {
std::call_once(signalHandlerOnce[signal], [signal, &action]() {
struct sigaction oldAction;
Sigaction(signal, &action, &oldAction);
- if (oldAction.sa_flags && oldAction.sa_flags != action.sa_flags)
- throw exception("Old sigaction flags aren't equivalent to the replaced signal: {:#b} | {:#b}", oldAction.sa_flags, action.sa_flags);
+ if (oldAction.sa_flags) {
+ oldAction.sa_flags &= ~SA_UNSUPPORTED; // Mask out kernel not supporting old sigaction() bits
+ oldAction.sa_flags |= SA_SIGINFO | SA_EXPOSE_TAGBITS | SA_RESTART | SA_ONSTACK; // Intentionally ignore these flags for the comparison
+ if (oldAction.sa_flags != (action.sa_flags | SA_RESTART))
+ throw exception("Old sigaction flags aren't equivalent to the replaced signal: {:#b} | {:#b}", oldAction.sa_flags, action.sa_flags);
+ }
DefaultSignalHandlers.at(signal).function = (oldAction.sa_flags & SA_SIGINFO) ? oldAction.sa_sigaction : reinterpret_cast(oldAction.sa_handler);
});
diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt
index 19ba92c1..8e9586be 100644
--- a/app/src/main/java/emu/skyline/EmulationActivity.kt
+++ b/app/src/main/java/emu/skyline/EmulationActivity.kt
@@ -10,7 +10,6 @@ import android.content.Context
import android.content.Intent
import android.content.res.AssetManager
import android.graphics.PointF
-import android.net.Uri
import android.os.*
import android.util.Log
import android.view.*
@@ -434,15 +433,25 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
} else {
inputManager.controllers[index]!!.rumbleDeviceDescriptor?.let {
if (it == "builtin") {
- val vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
+ val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ val vibratorManager = getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
+ vibratorManager.defaultVibrator
+ } else {
+ @Suppress("DEPRECATION")
+ getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
+ }
vibrators[index] = vibrator
vibrator
} else {
for (id in InputDevice.getDeviceIds()) {
val device = InputDevice.getDevice(id)
if (device.descriptor == inputManager.controllers[index]!!.rumbleDeviceDescriptor) {
- vibrators[index] = device.vibrator
- device.vibrator
+ vibrators[index] = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ device.vibratorManager.defaultVibrator
+ } else {
+ @Suppress("DEPRECATION")
+ device.vibrator
+ }
}
}
}
diff --git a/app/src/main/java/emu/skyline/MainActivity.kt b/app/src/main/java/emu/skyline/MainActivity.kt
index ae78f8cb..7bcfb4a0 100644
--- a/app/src/main/java/emu/skyline/MainActivity.kt
+++ b/app/src/main/java/emu/skyline/MainActivity.kt
@@ -36,10 +36,9 @@ import emu.skyline.loader.AppEntry
import emu.skyline.loader.LoaderResult
import emu.skyline.loader.RomFormat
import emu.skyline.utils.Settings
-import emu.skyline.utils.toFile
import javax.inject.Inject
import kotlin.math.ceil
-import kotlin.math.roundToInt
+
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
diff --git a/app/src/main/java/emu/skyline/RomProvider.kt b/app/src/main/java/emu/skyline/RomProvider.kt
index 7e451ec7..590ebaf5 100644
--- a/app/src/main/java/emu/skyline/RomProvider.kt
+++ b/app/src/main/java/emu/skyline/RomProvider.kt
@@ -23,7 +23,7 @@ class RomProvider @Inject constructor(@ApplicationContext private val context :
if (file.isDirectory) {
addEntries(fileFormats, file, entries, systemLanguage)
} else {
- fileFormats[file.name?.substringAfterLast(".")?.toLowerCase()]?.let { romFormat->
+ fileFormats[file.name?.substringAfterLast(".")?.lowercase()]?.let { romFormat->
entries.getOrPut(romFormat, { arrayListOf() }).add(RomFile(context, romFormat, file.uri, systemLanguage).appEntry)
}
}
diff --git a/app/src/main/java/emu/skyline/SettingsActivity.kt b/app/src/main/java/emu/skyline/SettingsActivity.kt
index 3eced58a..060cdf8b 100644
--- a/app/src/main/java/emu/skyline/SettingsActivity.kt
+++ b/app/src/main/java/emu/skyline/SettingsActivity.kt
@@ -64,9 +64,10 @@ class SettingsActivity : AppCompatActivity() {
if (parentFragmentManager.findFragmentByTag(DIALOG_FRAGMENT_TAG) != null)
return
- val f = IntegerListPreference.IntegerListPreferenceDialogFragmentCompat.newInstance(preference.getKey())
- f.setTargetFragment(this, 0)
- f.show(parentFragmentManager, DIALOG_FRAGMENT_TAG)
+ val dialogFragment = IntegerListPreference.IntegerListPreferenceDialogFragmentCompat.newInstance(preference.getKey())
+ @Suppress("DEPRECATION")
+ dialogFragment.setTargetFragment(this, 0) // androidx.preference.PreferenceDialogFragmentCompat depends on the target fragment being set correctly even though it's deprecated
+ dialogFragment.show(parentFragmentManager, DIALOG_FRAGMENT_TAG)
} else {
super.onDisplayPreferenceDialog(preference)
}
diff --git a/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt b/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt
index 7745affc..d3a3aec7 100644
--- a/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt
+++ b/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt
@@ -90,7 +90,7 @@ class GenericAdapter : RecyclerView.Adapter>(), F
* This sorts the items in [allItems] in relation to how similar they are to [currentSearchTerm]
*/
fun extractSorted() = allItems.mapNotNull { item ->
- item.key().toLowerCase(Locale.getDefault()).let {
+ item.key().lowercase(Locale.getDefault()).let {
val similarity = (jw.similarity(currentSearchTerm, it) + cos.similarity(currentSearchTerm, it)) / 2
if (similarity != 0.0) ScoredItem(similarity, item) else null
}
@@ -99,7 +99,7 @@ class GenericAdapter : RecyclerView.Adapter>(), F
/**
* This performs filtering on the items in [allItems] based on similarity to [term]
*/
- override fun performFiltering(term : CharSequence) = (term as String).toLowerCase(Locale.getDefault()).let { lowerCaseTerm ->
+ override fun performFiltering(term : CharSequence) = (term as String).lowercase(Locale.getDefault()).let { lowerCaseTerm ->
currentSearchTerm = lowerCaseTerm
with(if (term.isEmpty()) {
@@ -108,7 +108,7 @@ class GenericAdapter : RecyclerView.Adapter>(), F
val filterData = mutableListOf>()
val topResults = extractSorted()
- val avgScore = topResults.sumByDouble { it.score } / topResults.size
+ val avgScore = topResults.sumOf { it.score } / topResults.size
for (result in topResults)
if (result.score >= avgScore) filterData.add(result.item)
@@ -131,4 +131,4 @@ class GenericAdapter : RecyclerView.Adapter>(), F
onFilterPublishedListener?.invoke()
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/emu/skyline/adapter/controller/ControllerCheckBoxViewItem.kt b/app/src/main/java/emu/skyline/adapter/controller/ControllerCheckBoxViewItem.kt
index f3d2d957..6be4d020 100644
--- a/app/src/main/java/emu/skyline/adapter/controller/ControllerCheckBoxViewItem.kt
+++ b/app/src/main/java/emu/skyline/adapter/controller/ControllerCheckBoxViewItem.kt
@@ -8,7 +8,6 @@ package emu.skyline.adapter.controller
import android.view.ViewGroup
import androidx.core.view.isGone
import emu.skyline.adapter.GenericListItem
-import emu.skyline.adapter.GenericViewHolder
import emu.skyline.adapter.ViewBindingFactory
import emu.skyline.adapter.inflater
import emu.skyline.databinding.ControllerCheckboxItemBinding
diff --git a/app/src/main/java/emu/skyline/adapter/controller/ControllerViewItem.kt b/app/src/main/java/emu/skyline/adapter/controller/ControllerViewItem.kt
index 6fc0909c..541eb1b4 100644
--- a/app/src/main/java/emu/skyline/adapter/controller/ControllerViewItem.kt
+++ b/app/src/main/java/emu/skyline/adapter/controller/ControllerViewItem.kt
@@ -8,11 +8,9 @@ package emu.skyline.adapter.controller
import android.view.ViewGroup
import androidx.core.view.isGone
import emu.skyline.adapter.GenericListItem
-import emu.skyline.adapter.GenericViewHolder
import emu.skyline.adapter.ViewBindingFactory
import emu.skyline.adapter.inflater
import emu.skyline.databinding.ControllerItemBinding
-import emu.skyline.input.InputManager
object ControllerBindingFactory : ViewBindingFactory {
override fun createBinding(parent : ViewGroup) = ControllerItemBinding.inflate(parent.inflater(), parent, false)
diff --git a/app/src/main/java/emu/skyline/input/dialog/RumbleDialog.kt b/app/src/main/java/emu/skyline/input/dialog/RumbleDialog.kt
index 49a54825..cb43d89c 100644
--- a/app/src/main/java/emu/skyline/input/dialog/RumbleDialog.kt
+++ b/app/src/main/java/emu/skyline/input/dialog/RumbleDialog.kt
@@ -7,9 +7,7 @@ package emu.skyline.input.dialog
import android.animation.LayoutTransition
import android.content.Context
-import android.os.Bundle
-import android.os.VibrationEffect
-import android.os.Vibrator
+import android.os.*
import android.view.*
import android.view.animation.LinearInterpolator
import com.google.android.material.bottomsheet.BottomSheetBehavior
@@ -64,7 +62,15 @@ class RumbleDialog @JvmOverloads constructor(val item : ControllerGeneralViewIte
if (context.id == 0) {
binding.rumbleBuiltin.visibility = View.VISIBLE
- if (!(context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator).hasVibrator())
+ val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ val vibratorManager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
+ vibratorManager.defaultVibrator
+ } else {
+ @Suppress("DEPRECATION")
+ context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
+ }
+
+ if (!vibrator.hasVibrator())
binding.rumbleBuiltin.isEnabled = false
binding.rumbleBuiltin.setOnClickListener {
controller.rumbleDeviceDescriptor = "builtin"
@@ -85,7 +91,12 @@ class RumbleDialog @JvmOverloads constructor(val item : ControllerGeneralViewIte
// We want all input events from Joysticks and game pads
if (event.isFromSource(InputDevice.SOURCE_GAMEPAD) || event.isFromSource(InputDevice.SOURCE_JOYSTICK)) {
if (event.repeatCount == 0 && event.action == KeyEvent.ACTION_DOWN) {
- val vibrator = event.device.vibrator
+ val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ event.device.vibratorManager.defaultVibrator
+ } else {
+ @Suppress("DEPRECATION")
+ event.device.vibrator
+ }
when {
// If the device doesn't match the currently selected device then update the UI accordingly and set [deviceId] to the current device
diff --git a/app/src/main/java/emu/skyline/loader/RomFile.kt b/app/src/main/java/emu/skyline/loader/RomFile.kt
index 4192b8d4..44aac9d3 100644
--- a/app/src/main/java/emu/skyline/loader/RomFile.kt
+++ b/app/src/main/java/emu/skyline/loader/RomFile.kt
@@ -41,7 +41,7 @@ fun getRomFormat(uri : Uri, contentResolver : ContentResolver) : RomFormat {
cursor.moveToFirst()
uriStr = cursor.getString(nameIndex)
}
- return RomFormat.valueOf(uriStr.substring(uriStr.lastIndexOf(".") + 1).toUpperCase(Locale.ROOT))
+ return RomFormat.valueOf(uriStr.substring(uriStr.lastIndexOf(".") + 1).uppercase(Locale.ROOT))
}
/**
@@ -150,4 +150,4 @@ internal class RomFile(context : Context, format : RomFormat, uri : Uri, systemL
* @return A pointer to the newly allocated object, or 0 if the ROM is invalid
*/
private external fun populate(format : Int, romFd : Int, appFilesPath : String, systemLanguage : Int) : Int
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/emu/skyline/preference/IntegerListPreference.kt b/app/src/main/java/emu/skyline/preference/IntegerListPreference.kt
index cdb59267..0cc3686e 100644
--- a/app/src/main/java/emu/skyline/preference/IntegerListPreference.kt
+++ b/app/src/main/java/emu/skyline/preference/IntegerListPreference.kt
@@ -5,24 +5,23 @@
package emu.skyline.preference
+import android.annotation.SuppressLint
+import android.content.Context
+import android.content.DialogInterface
+import android.content.res.Resources
+import android.content.res.TypedArray
import android.os.Bundle
import android.os.Parcel
import android.os.Parcelable
-import android.os.Parcelable.Creator
import android.util.AttributeSet
-import android.content.Context
-import android.content.res.Resources
-import android.content.res.TypedArray
-import android.content.DialogInterface
-import android.annotation.SuppressLint
import androidx.annotation.ArrayRes
import androidx.appcompat.app.AlertDialog
import androidx.core.content.res.TypedArrayUtils
-import androidx.preference.R
import androidx.preference.DialogPreference
import androidx.preference.PreferenceDialogFragmentCompat
-import emu.skyline.R as sR
+import androidx.preference.R
import emu.skyline.di.getSettings
+import emu.skyline.R as sR
/**
* A Preference that displays a list of strings in a dialog and saves an integer that corresponds to the selected entry (as specified by entryValues or the index of the selected entry)
@@ -177,19 +176,6 @@ class IntegerListPreference @JvmOverloads constructor(
super.writeToParcel(dest, flags)
dest.writeSerializable(value)
}
-
- companion object {
- @JvmField
- val CREATOR : Creator = object : Creator {
- override fun createFromParcel(input : Parcel) : SavedState? {
- return SavedState(input)
- }
-
- override fun newArray(size : Int) : Array {
- return arrayOfNulls(size)
- }
- }
- }
}
/**
@@ -286,4 +272,4 @@ class IntegerListPreference @JvmOverloads constructor(
}
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/emu/skyline/utils/SharedPreferencesDelegate.kt b/app/src/main/java/emu/skyline/utils/SharedPreferencesDelegate.kt
index 0360c851..75ed334a 100644
--- a/app/src/main/java/emu/skyline/utils/SharedPreferencesDelegate.kt
+++ b/app/src/main/java/emu/skyline/utils/SharedPreferencesDelegate.kt
@@ -44,7 +44,7 @@ class SharedPreferencesDelegate(context : Context, private val clazz : Class<
private fun camelToSnakeCase(text : String) = StringBuilder().apply {
text.forEachIndexed { index, c ->
if (index != 0 && c.isUpperCase()) append('_')
- append(c.toLowerCase())
+ append(c.lowercase())
}.toString()
}
}
diff --git a/build.gradle b/build.gradle
index 9f7d8824..f467a68e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,19 +2,18 @@
buildscript {
ext {
- kotlin_version = '1.4.30'
+ kotlin_version = '1.5.31'
lifecycle_version = '2.3.1'
- hilt_version = '2.33-beta'
+ hilt_version = '2.39.1'
lifecycle_version = '2.3.1'
}
repositories {
google()
mavenCentral()
- jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
@@ -28,7 +27,6 @@ allprojects {
google()
mavenCentral()
maven { url "https://google.bintray.com/flexbox-layout" }
- jcenter()
}
}
diff --git a/gradle.properties b/gradle.properties
index c35dbe61..533c6589 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -21,3 +21,5 @@ android.useAndroidX=true
android.enableJetifier=true
# Android NDK verbose build output
android.native.buildOutput=verbose
+# Gradle Configuration Cache
+org.gradle.unsafe.configuration-cache=true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 94af0f10..bdfed383 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Feb 08 07:42:45 GMT 2021
+#Mon Oct 11 06:23:28 GMT 2021
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-milestone-1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME