diff --git a/README.md b/README.md
index 96e695fb6..4d1bf4cd3 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
yuzu emulator early access
=============
-This is the source code for early-access 4082.
+This is the source code for early-access 4083.
## Legal Notice
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
index e26c2e0ab..b4f4d950f 100755
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
@@ -3,9 +3,6 @@
package org.yuzu.yuzu_emu.adapters
-import android.content.Intent
-import android.graphics.Bitmap
-import android.graphics.drawable.LayerDrawable
import android.net.Uri
import android.text.TextUtils
import android.view.LayoutInflater
@@ -15,10 +12,6 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
-import androidx.core.content.res.ResourcesCompat
-import androidx.core.graphics.drawable.IconCompat
-import androidx.core.graphics.drawable.toBitmap
-import androidx.core.graphics.drawable.toDrawable
import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
@@ -30,7 +23,6 @@ import kotlinx.coroutines.withContext
import org.yuzu.yuzu_emu.HomeNavigationDirections
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.YuzuApplication
-import org.yuzu.yuzu_emu.activities.EmulationActivity
import org.yuzu.yuzu_emu.databinding.CardGameBinding
import org.yuzu.yuzu_emu.model.Game
import org.yuzu.yuzu_emu.model.GamesViewModel
@@ -89,36 +81,13 @@ class GameAdapter(private val activity: AppCompatActivity) :
)
.apply()
- val openIntent =
- Intent(YuzuApplication.appContext, EmulationActivity::class.java).apply {
- action = Intent.ACTION_VIEW
- data = Uri.parse(game.path)
- }
-
activity.lifecycleScope.launch {
withContext(Dispatchers.IO) {
- val layerDrawable = ResourcesCompat.getDrawable(
- YuzuApplication.appContext.resources,
- R.drawable.shortcut,
- null
- ) as LayerDrawable
- layerDrawable.setDrawableByLayerId(
- R.id.shortcut_foreground,
- GameIconUtils.getGameIcon(activity, game)
- .toDrawable(YuzuApplication.appContext.resources)
- )
- val inset = YuzuApplication.appContext.resources
- .getDimensionPixelSize(R.dimen.icon_inset)
- layerDrawable.setLayerInset(1, inset, inset, inset, inset)
val shortcut =
ShortcutInfoCompat.Builder(YuzuApplication.appContext, game.path)
.setShortLabel(game.title)
- .setIcon(
- IconCompat.createWithAdaptiveBitmap(
- layerDrawable.toBitmap(config = Bitmap.Config.ARGB_8888)
- )
- )
- .setIntent(openIntent)
+ .setIcon(GameIconUtils.getShortcutIcon(activity, game))
+ .setIntent(game.launchIntent)
.build()
ShortcutManagerCompat.pushDynamicShortcut(YuzuApplication.appContext, shortcut)
}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
index 83a845434..582df0133 100755
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
@@ -4,6 +4,8 @@
package org.yuzu.yuzu_emu.fragments
import android.annotation.SuppressLint
+import android.content.pm.ShortcutInfo
+import android.content.pm.ShortcutManager
import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
@@ -84,6 +86,24 @@ class GamePropertiesFragment : Fragment() {
view.findNavController().popBackStack()
}
+ val shortcutManager = requireActivity().getSystemService(ShortcutManager::class.java)
+ binding.buttonShortcut.isEnabled = shortcutManager.isRequestPinShortcutSupported
+ binding.buttonShortcut.setOnClickListener {
+ viewLifecycleOwner.lifecycleScope.launch {
+ withContext(Dispatchers.IO) {
+ val shortcut = ShortcutInfo.Builder(requireContext(), args.game.title)
+ .setShortLabel(args.game.title)
+ .setIcon(
+ GameIconUtils.getShortcutIcon(requireActivity(), args.game)
+ .toIcon(requireContext())
+ )
+ .setIntent(args.game.launchIntent)
+ .build()
+ shortcutManager.requestPinShortcut(shortcut, null)
+ }
+ }
+ }
+
GameIconUtils.loadGameIcon(args.game, binding.imageGameScreen)
binding.title.text = args.game.title
binding.title.postDelayed(
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
index f1ea1e20f..c8a4a2d17 100755
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
@@ -3,6 +3,7 @@
package org.yuzu.yuzu_emu.model
+import android.content.Intent
import android.net.Uri
import android.os.Parcelable
import java.util.HashSet
@@ -11,6 +12,7 @@ import kotlinx.serialization.Serializable
import org.yuzu.yuzu_emu.NativeLibrary
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.YuzuApplication
+import org.yuzu.yuzu_emu.activities.EmulationActivity
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
import org.yuzu.yuzu_emu.utils.FileUtil
import java.time.LocalDateTime
@@ -61,6 +63,12 @@ class Game(
val addonDir: String
get() = DirectoryInitialization.userDirectory + "/load/" + programIdHex + "/"
+ val launchIntent: Intent
+ get() = Intent(YuzuApplication.appContext, EmulationActivity::class.java).apply {
+ action = Intent.ACTION_VIEW
+ data = Uri.parse(path)
+ }
+
override fun equals(other: Any?): Boolean {
if (other !is Game) {
return false
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconUtils.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconUtils.kt
index 2e9b0beb8..d05020560 100755
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconUtils.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconUtils.kt
@@ -5,7 +5,10 @@ package org.yuzu.yuzu_emu.utils
import android.graphics.Bitmap
import android.graphics.BitmapFactory
+import android.graphics.drawable.LayerDrawable
import android.widget.ImageView
+import androidx.core.content.res.ResourcesCompat
+import androidx.core.graphics.drawable.IconCompat
import androidx.core.graphics.drawable.toBitmap
import androidx.core.graphics.drawable.toDrawable
import androidx.lifecycle.LifecycleOwner
@@ -85,4 +88,22 @@ object GameIconUtils {
return imageLoader.execute(request)
.drawable!!.toBitmap(config = Bitmap.Config.ARGB_8888)
}
+
+ suspend fun getShortcutIcon(lifecycleOwner: LifecycleOwner, game: Game): IconCompat {
+ val layerDrawable = ResourcesCompat.getDrawable(
+ YuzuApplication.appContext.resources,
+ R.drawable.shortcut,
+ null
+ ) as LayerDrawable
+ layerDrawable.setDrawableByLayerId(
+ R.id.shortcut_foreground,
+ getGameIcon(lifecycleOwner, game).toDrawable(YuzuApplication.appContext.resources)
+ )
+ val inset = YuzuApplication.appContext.resources
+ .getDimensionPixelSize(R.dimen.icon_inset)
+ layerDrawable.setLayerInset(1, inset, inset, inset, inset)
+ return IconCompat.createWithAdaptiveBitmap(
+ layerDrawable.toBitmap(config = Bitmap.Config.ARGB_8888)
+ )
+ }
}
diff --git a/src/android/app/src/main/res/drawable/ic_shortcut.xml b/src/android/app/src/main/res/drawable/ic_shortcut.xml
new file mode 100755
index 000000000..06e1983b2
--- /dev/null
+++ b/src/android/app/src/main/res/drawable/ic_shortcut.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml b/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
index 0b9633855..551f255c0 100755
--- a/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
+++ b/src/android/app/src/main/res/layout-w600dp/fragment_game_properties.xml
@@ -43,16 +43,35 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ android:orientation="horizontal">
+
+
+
+
+
+
-
-
+ android:orientation="horizontal">
+
+
+
+
+
+
+ tools:src="@drawable/default_icon" />
diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp
index bfa81f365..60820aa9b 100755
--- a/src/core/hle/service/psc/time/service_manager.cpp
+++ b/src/core/hle/service/psc/time/service_manager.cpp
@@ -119,15 +119,21 @@ void ServiceManager::Handle_GetStaticServiceAsServiceManager(HLERequestContext&
void ServiceManager::Handle_SetupStandardSteadyClockCore(HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called.");
- IPC::RequestParser rp{ctx};
- auto clock_source_id{rp.PopRaw()};
- auto rtc_offset{rp.Pop()};
- auto internal_offset{rp.Pop()};
- auto test_offset{rp.Pop()};
- auto is_rtc_reset_detected{rp.Pop()};
+ struct Parameters {
+ bool reset_detected;
+ Common::UUID clock_source_id;
+ s64 rtc_offset;
+ s64 internal_offset;
+ s64 test_offset;
+ };
+ static_assert(sizeof(Parameters) == 0x30);
- auto res = SetupStandardSteadyClockCore(clock_source_id, rtc_offset, internal_offset,
- test_offset, is_rtc_reset_detected);
+ IPC::RequestParser rp{ctx};
+ auto params{rp.PopRaw()};
+
+ auto res = SetupStandardSteadyClockCore(params.clock_source_id, params.rtc_offset,
+ params.internal_offset, params.test_offset,
+ params.reset_detected);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(res);
@@ -162,11 +168,16 @@ void ServiceManager::Handle_SetupStandardNetworkSystemClockCore(HLERequestContex
void ServiceManager::Handle_SetupStandardUserSystemClockCore(HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called.");
- IPC::RequestParser rp{ctx};
- auto time_point{rp.PopRaw()};
- auto automatic_correction{rp.Pop()};
+ struct Parameters {
+ bool automatic_correction;
+ SteadyClockTimePoint time_point;
+ };
+ static_assert(sizeof(Parameters) == 0x20);
- auto res = SetupStandardUserSystemClockCore(time_point, automatic_correction);
+ IPC::RequestParser rp{ctx};
+ auto params{rp.PopRaw()};
+
+ auto res = SetupStandardUserSystemClockCore(params.time_point, params.automatic_correction);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(res);
@@ -175,16 +186,21 @@ void ServiceManager::Handle_SetupStandardUserSystemClockCore(HLERequestContext&
void ServiceManager::Handle_SetupTimeZoneServiceCore(HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called.");
+ struct Parameters {
+ u32 location_count;
+ LocationName name;
+ SteadyClockTimePoint time_point;
+ RuleVersion rule_version;
+ };
+ static_assert(sizeof(Parameters) == 0x50);
+
IPC::RequestParser rp{ctx};
- auto name{rp.PopRaw()};
- auto time_point{rp.PopRaw()};
- auto rule_version{rp.PopRaw()};
- auto location_count{rp.Pop()};
+ auto params{rp.PopRaw()};
auto rule_buffer{ctx.ReadBuffer()};
- auto res =
- SetupTimeZoneServiceCore(name, time_point, rule_version, location_count, rule_buffer);
+ auto res = SetupTimeZoneServiceCore(params.name, params.time_point, params.rule_version,
+ params.location_count, rule_buffer);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(res);
@@ -286,11 +302,22 @@ void ServiceManager::Handle_GetClosestAlarmInfo(HLERequestContext& ctx) {
s64 time{};
auto res = GetClosestAlarmInfo(is_valid, alarm_info, time);
- IPC::ResponseBuilder rb{ctx, 5 + sizeof(AlarmInfo) / sizeof(u32)};
+ struct OutParameters {
+ bool is_valid;
+ AlarmInfo alarm_info;
+ s64 time;
+ };
+ static_assert(sizeof(OutParameters) == 0x20);
+
+ OutParameters out_params{
+ .is_valid = is_valid,
+ .alarm_info = alarm_info,
+ .time = time,
+ };
+
+ IPC::ResponseBuilder rb{ctx, 2 + sizeof(OutParameters) / sizeof(u32)};
rb.Push(res);
- rb.PushRaw(alarm_info);
- rb.Push(is_valid);
- rb.Push(time);
+ rb.PushRaw(out_params);
}
// =============================== Implementations ===========================
diff --git a/src/core/hle/service/psc/time/steady_clock.cpp b/src/core/hle/service/psc/time/steady_clock.cpp
index a963051c6..1ed5c7679 100755
--- a/src/core/hle/service/psc/time/steady_clock.cpp
+++ b/src/core/hle/service/psc/time/steady_clock.cpp
@@ -15,12 +15,12 @@ SteadyClock::SteadyClock(Core::System& system_, std::shared_ptr man
// clang-format off
static const FunctionInfo functions[] = {
{0, &SteadyClock::Handle_GetCurrentTimePoint, "GetCurrentTimePoint"},
- {1, &SteadyClock::Handle_GetTestOffset, "GetTestOffset"},
- {2, &SteadyClock::Handle_SetTestOffset, "SetTestOffset"},
- {3, &SteadyClock::Handle_GetRtcValue, "GetRtcValue"},
- {4, &SteadyClock::Handle_IsRtcResetDetected, "IsRtcResetDetected"},
- {5, &SteadyClock::Handle_GetSetupResultValue, "GetSetupResultValue"},
- {6, &SteadyClock::Handle_GetInternalOffset, "GetInternalOffset"},
+ {2, &SteadyClock::Handle_GetTestOffset, "GetTestOffset"},
+ {3, &SteadyClock::Handle_SetTestOffset, "SetTestOffset"},
+ {100, &SteadyClock::Handle_GetRtcValue, "GetRtcValue"},
+ {101, &SteadyClock::Handle_IsRtcResetDetected, "IsRtcResetDetected"},
+ {102, &SteadyClock::Handle_GetSetupResultValue, "GetSetupResultValue"},
+ {200, &SteadyClock::Handle_GetInternalOffset, "GetInternalOffset"},
};
// clang-format on
RegisterHandlers(functions);