Bladeren bron

UI: RPC: Small change to how values are passed to hopefully detect the player pos better

Evan Husted 1 jaar geleden
bovenliggende
commit
a0edc5c2b0
1 gewijzigde bestanden met toevoegingen van 12 en 18 verwijderingen
  1. 12 18
      src/Ryujinx/Utilities/PlayReport.cs

+ 12 - 18
src/Ryujinx/Utilities/PlayReport.cs

@@ -40,22 +40,13 @@ namespace Ryujinx.Ava.Utilities
         private static PlayReportFormattedValue BreathOfTheWild_MasterMode(ref PlayReportValue value)
             => value.BoxedValue is 1 ? "Playing Master Mode" : PlayReportFormattedValue.ForceReset;
 
-        private static PlayReportFormattedValue TearsOfTheKingdom_CurrentField(ref PlayReportValue value)
-        {
-            try
-            {
-                return (double)value.BoxedValue switch
-                {
-                    > 800d => "Exploring the Sky Islands",
-                    < -201d => "Exploring the Depths",
-                    _ => "Roaming Hyrule"
-                };
-            }
-            catch
+        private static PlayReportFormattedValue TearsOfTheKingdom_CurrentField(ref PlayReportValue value) =>
+            value.PackedValue.AsDouble() switch
             {
-                return PlayReportFormattedValue.ForceReset;
-            }
-        }
+                > 800d => "Exploring the Sky Islands",
+                < -201d => "Exploring the Depths",
+                _ => "Roaming Hyrule"
+            };
 
         private static PlayReportFormattedValue SuperMarioOdyssey_AssistMode(ref PlayReportValue value)
             => value.BoxedValue is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode";
@@ -141,7 +132,7 @@ namespace Ryujinx.Ava.Utilities
                 PlayReportValue value = new()
                 {
                     Application = appMeta, 
-                    BoxedValue = valuePackObject.ToObject()
+                    PackedValue = valuePackObject
                 };
 
                 return formatSpec.ValueFormatter(ref value);
@@ -180,10 +171,13 @@ namespace Ryujinx.Ava.Utilities
         }
     }
 
-    public struct PlayReportValue
+    public readonly struct PlayReportValue
     {
         public ApplicationMetadata Application { get; init; }
-        public object BoxedValue { get; init; }
+        
+        public MessagePackObject PackedValue { get; init; }
+
+        public object BoxedValue => PackedValue.ToObject();
     }
 
     public struct PlayReportFormattedValue