using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using QuestGraphicsSettings;
using Unity.XR.Oculus;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "QuestGraphicsSettings", "1.3.3", "jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QuestGraphicsSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d328a38d759a5c37727efb7ba3c85048c5567583")]
[assembly: AssemblyProduct("QuestGraphicsSettings")]
[assembly: AssemblyTitle("QuestGraphicsSettings")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace QuestGraphicsSettings
{
public class Core : MelonMod
{
private MelonPreferences_Category category;
private MelonPreferences_Entry<int> FPSEntry;
private MelonPreferences_Entry<float> RenderScaleEntry;
private MelonPreferences_Entry<float> RenderDistanceEntry;
private MelonPreferences_Entry<float> LODBiasEntry;
private MelonPreferences_Entry<float> TextureStreamingBudgetEntry;
private MelonPreferences_Entry<bool> FogEntry;
private MelonPreferences_Entry<bool> TextureStreamingEntry;
private MelonPreferences_Entry<bool> DebugInfoEntry;
private MelonPreferences_Entry<bool> FFRAutoEntry;
private MelonPreferences_Entry<int> FFRLevelEntry;
private Camera playerCamera;
private GameObject fogObject;
private bool PresetFFRAuto;
private int PresetFFRLevel;
private bool AutoPresetState;
private string Preset;
private float PresetRenderScale;
private float PresetRenderDistance;
private float PresetLODBias;
private float PresetTextureStreamingBudget;
private bool PresetFog;
private bool PresetTextureStreaming;
private int PerformanceDrops;
private float presetdelay = 5f;
private float lastpresettime = 0f;
private float[] frameTimeSamples = new float[30];
private int frameIndex = 0;
public override void OnInitializeMelon()
{
SetupMelonPreferences();
SetupBoneMenu();
Preset = "Custom";
}
private void SetupBoneMenu()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("Jorink", Color.magenta, 0, true).CreatePage("QuestGraphicsSettings", Color.yellow, 0, true);
Page val2 = val.CreatePage("Settings (Custom)", Color.cyan, 0, true);
val2.CreateFloat("Render Scale", Color.yellow, RenderScaleEntry.Value, 0.05f, 0.5f, 2f, (Action<float>)delegate(float a)
{
RenderScaleEntry.Value = a;
SetRenderScale();
});
val2.CreateFloat("Render Distance", Color.green, RenderDistanceEntry.Value, 5f, 5f, 300f, (Action<float>)delegate(float a)
{
RenderDistanceEntry.Value = a;
SetRenderDistance();
});
val2.CreateFloat("LOD Bias", Color.yellow, LODBiasEntry.Value, 0.05f, 0.5f, 2f, (Action<float>)delegate(float a)
{
LODBiasEntry.Value = a;
SetLODBias();
});
val2.CreateFloat("Texture Streaming Budget", Color.yellow, TextureStreamingBudgetEntry.Value, 128f, 128f, 1024f, (Action<float>)delegate(float a)
{
TextureStreamingBudgetEntry.Value = a;
SetTextureStreaming();
});
val2.CreateBool("Fog", Color.green, FogEntry.Value, (Action<bool>)delegate(bool a)
{
FogEntry.Value = a;
SetFog();
});
val2.CreateInt("FFR Level", Color.green, FFRLevelEntry.Value, 1, 0, 3, (Action<int>)delegate(int a)
{
FFRLevelEntry.Value = a;
if (!FFRAutoEntry.Value)
{
SetFFR();
}
});
val2.CreateFunction("Save Settings", Color.cyan, (Action)delegate
{
MelonPreferences.Save();
});
val2.CreateFunction("Enable Custom Preset", Color.cyan, (Action)delegate
{
CustomPreset();
ApplySettings();
});
Page val3 = val.CreatePage("Presets", Color.blue, 0, true);
val3.CreateFunction("No Preset (Custom)", Color.cyan, (Action)delegate
{
CustomPreset();
ApplySettings();
});
val3.CreateFunction("Jorink's Preset", Color.magenta, (Action)delegate
{
JorinksPreset();
ApplySettings();
});
val3.CreateFunction("Default", Color.blue, (Action)delegate
{
DefaultPreset();
ApplySettings();
});
val3.CreateFunction("High", Color.red, (Action)delegate
{
HighPreset();
ApplySettings();
});
val3.CreateFunction("Medium", Color.yellow, (Action)delegate
{
MediumPreset();
ApplySettings();
});
val3.CreateFunction("Low", Color.green, (Action)delegate
{
LowPreset();
ApplySettings();
});
val3.CreateFunction("Very Low", Color.green, (Action)delegate
{
VeryLowPreset();
ApplySettings();
});
val3.CreateFunction("Show Current Preset", Color.cyan, (Action)delegate
{
CurrentPreset();
});
Page val4 = val.CreatePage("Auto Preset (WIP)", Color.magenta, 0, true);
val4.CreateFunction("Toggle Auto Preset", Color.cyan, (Action)delegate
{
ToggleAutoPreset();
});
val4.CreateInt("Target FPS", Color.green, FPSEntry.Value, 10, 60, 90, (Action<int>)delegate(int a)
{
FPSEntry.Value = a;
});
val4.CreateFunction("Show Current Preset", Color.cyan, (Action)delegate
{
CurrentPreset();
});
Page val5 = val2.CreatePage("Advanced Settings", Color.red, 0, true);
val5.CreateFunction("PRESS ME", Color.red, (Action)delegate
{
AdvancedWarning();
});
val5.CreateBool("Texture Streaming (!)", Color.red, TextureStreamingEntry.Value, (Action<bool>)delegate(bool a)
{
TextureStreamingEntry.Value = a;
SetTextureStreaming();
});
val5.CreateBool("Dynamic FFR", Color.green, FFRAutoEntry.Value, (Action<bool>)delegate(bool a)
{
FFRAutoEntry.Value = a;
SetFFR();
});
val5.CreateBool("Debug Info", Color.magenta, DebugInfoEntry.Value, (Action<bool>)delegate(bool a)
{
DebugInfoEntry.Value = a;
DebugInfo();
});
}
private void SetupMelonPreferences()
{
category = MelonPreferences.CreateCategory("QuestGraphicsSettings");
FogEntry = category.CreateEntry<bool>("Fog Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
RenderScaleEntry = category.CreateEntry<float>("Render Scale", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
TextureStreamingEntry = category.CreateEntry<bool>("Texture Streaming Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
TextureStreamingBudgetEntry = category.CreateEntry<float>("Texture Streaming Budget", 512f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
LODBiasEntry = category.CreateEntry<float>("LOD Bias", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
RenderDistanceEntry = category.CreateEntry<float>("Render Distance", 100f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
FPSEntry = category.CreateEntry<int>("Target FPS", 90, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
FFRAutoEntry = category.CreateEntry<bool>("Dynamic FFR", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
FFRLevelEntry = category.CreateEntry<int>("FFR Level", 3, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
DebugInfoEntry = category.CreateEntry<bool>("Debug Info", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences.Save();
category.SaveToFile(true);
}
private void AdvancedWarning()
{
Menu.DisplayDialog("WARNING", "These settings are experimental and minimally tested, and may cause bugs or crashes. Proceed with caution!", (Texture2D)null, (Action)null, (Action)null);
}
private void DebugInfo()
{
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
if (DebugInfoEntry.Value)
{
if (Preset == "Custom")
{
Notification val = new Notification();
val.Title = NotificationText.op_Implicit("Debug Info");
val.Message = NotificationText.op_Implicit("Preset: " + Preset + "\nRender Scale: " + RenderScaleEntry.Value + "\nRender Distance: " + RenderDistanceEntry.Value + "\nLOD Bias: " + LODBiasEntry.Value + "\nTexture Streaming Budget: " + TextureStreamingBudgetEntry.Value + " MB\nFog: " + (FogEntry.Value ? "Enabled" : "Disabled") + "\nFFR: " + (FFRAutoEntry.Value ? "Auto" : ("Level " + FFRLevelEntry.Value)));
val.Type = (NotificationType)3;
val.PopupLength = 4f;
val.ShowTitleOnPopup = true;
Notification val2 = val;
Notifier.Send(val2);
}
else
{
Notification val = new Notification();
val.Title = NotificationText.op_Implicit("Debug Info");
val.Message = NotificationText.op_Implicit("Preset: " + Preset + "\nRender Scale: " + PresetRenderScale + "\nRender Distance: " + PresetRenderDistance + "\nLOD Bias: " + PresetLODBias + "\nTexture Streaming Budget: " + PresetTextureStreamingBudget + " MB\nFog: " + (PresetFog ? "Enabled" : "Disabled") + "\nFFR: " + (PresetFFRAuto ? "Auto" : ("Level " + PresetFFRLevel)));
val.Type = (NotificationType)3;
val.PopupLength = 4f;
val.ShowTitleOnPopup = true;
Notification val3 = val;
Notifier.Send(val3);
}
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
if (AutoPresetState)
{
HighPreset();
ApplySettings();
}
else
{
ApplySettings();
}
}
private void ApplySettings()
{
SetTextureStreaming();
SetRenderScale();
SetRenderDistance();
SetLODBias();
SetFog();
SetFFR();
DebugInfo();
}
public override void OnUpdate()
{
((MelonBase)this).OnUpdate();
frameTimeSamples[frameIndex] = Time.unscaledDeltaTime;
frameIndex = (frameIndex + 1) % frameTimeSamples.Length;
AutoPreset();
}
private void VeryLowPreset()
{
Preset = "VeryLow";
PresetFog = false;
PresetRenderScale = 0.5f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 128f;
PresetLODBias = 0.5f;
PresetRenderDistance = 50f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void LowPreset()
{
Preset = "Low";
PresetFog = false;
PresetRenderScale = 0.85f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 128f;
PresetLODBias = 0.7f;
PresetRenderDistance = 70f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void MediumPreset()
{
Preset = "Medium";
PresetFog = false;
PresetRenderScale = 1.25f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 256f;
PresetLODBias = 0.85f;
PresetRenderDistance = 85f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void HighPreset()
{
Preset = "High";
PresetFog = false;
PresetRenderScale = 1.5f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 512f;
PresetLODBias = 1.25f;
PresetRenderDistance = 100f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void JorinksPreset()
{
Preset = "Jorink";
PresetFog = false;
PresetRenderScale = 1f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 256f;
PresetLODBias = 0.85f;
PresetRenderDistance = 85f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void DefaultPreset()
{
Preset = "Default";
PresetFog = true;
PresetRenderScale = 1f;
PresetTextureStreaming = true;
PresetTextureStreamingBudget = 512f;
PresetLODBias = 1f;
PresetRenderDistance = 90f;
PresetFFRAuto = false;
PresetFFRLevel = 3;
}
private void CustomPreset()
{
Preset = "Custom";
}
private void CurrentPreset()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
Notification val = new Notification
{
Title = NotificationText.op_Implicit("Current Preset"),
Message = NotificationText.op_Implicit(Preset),
Type = (NotificationType)3,
PopupLength = 1.25f,
ShowTitleOnPopup = true
};
Notifier.Send(val);
}
private void ToggleAutoPreset()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
AutoPresetState = !AutoPresetState;
if (AutoPresetState)
{
HighPreset();
ApplySettings();
}
Notification val = new Notification
{
Title = NotificationText.op_Implicit("Auto Preset"),
Message = NotificationText.op_Implicit(AutoPresetState ? "Enabled" : "Disabled"),
Type = (NotificationType)((!AutoPresetState) ? 1 : 3),
PopupLength = 1.25f,
ShowTitleOnPopup = true
};
Notifier.Send(val);
}
private void AutoPreset()
{
if (!AutoPresetState || Time.time - lastpresettime < presetdelay)
{
return;
}
float averageFPS = GetAverageFPS();
lastpresettime = Time.time;
if (!(averageFPS < (float)(FPSEntry.Value - 10)))
{
return;
}
PerformanceDrops++;
MelonLogger.Msg("Performance drop detected " + PerformanceDrops + "/3");
MelonLogger.Msg("Performance drop FPS:" + averageFPS + "|" + FPSEntry.Value);
if (PerformanceDrops < 3)
{
return;
}
PerformanceDrops = 0;
if (!(Preset == "VeryLow"))
{
if (Preset == "Low")
{
VeryLowPreset();
ApplySettings();
}
else if (Preset == "Medium")
{
LowPreset();
ApplySettings();
}
else if (Preset == "High")
{
MediumPreset();
ApplySettings();
}
else
{
HighPreset();
ApplySettings();
}
}
}
private void SetTextureStreaming()
{
if (Preset == "Custom")
{
QualitySettings.streamingMipmapsActive = TextureStreamingEntry.Value;
QualitySettings.streamingMipmapsMemoryBudget = TextureStreamingBudgetEntry.Value;
}
else
{
QualitySettings.streamingMipmapsActive = PresetTextureStreaming;
QualitySettings.streamingMipmapsMemoryBudget = PresetTextureStreamingBudget;
}
}
private void SetLODBias()
{
if (Preset == "Custom")
{
QualitySettings.lodBias = LODBiasEntry.Value;
}
else
{
QualitySettings.lodBias = PresetLODBias;
}
}
private void SetFog()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)fogObject == (Object)null)
{
fogObject = GameObject.Find("Volumetrics");
}
if ((Object)(object)fogObject == (Object)null)
{
fogObject = GameObject.Find("Fog");
}
Scene activeScene;
if ((Object)(object)fogObject == (Object)null)
{
activeScene = SceneManager.GetActiveScene();
MelonLogger.Msg("No fog object found in scene: " + ((Scene)(ref activeScene)).name);
}
if ((Object)(object)fogObject != (Object)null)
{
string name = ((Object)fogObject).name;
activeScene = SceneManager.GetActiveScene();
MelonLogger.Msg("Fog Object Found: " + name + " Scene:" + ((Scene)(ref activeScene)).name);
if (Preset == "Custom")
{
fogObject.SetActive(FogEntry.Value);
}
else
{
fogObject.SetActive(PresetFog);
}
}
}
private void SetRenderDistance()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
if ((Object)playerCamera == (Object)null)
{
playerCamera = Object.FindObjectOfType<Camera>();
}
if ((Object)playerCamera != (Object)null)
{
if (Preset == "Custom")
{
playerCamera.farClipPlane = RenderDistanceEntry.Value;
}
else
{
playerCamera.farClipPlane = PresetRenderDistance;
}
}
playerCamera.useOcclusionCulling = true;
}
private void SetRenderScale()
{
UniversalRenderPipelineAsset asset = UniversalRenderPipeline.asset;
if (Preset == "Custom")
{
asset.renderScale = RenderScaleEntry.Value;
}
else
{
asset.renderScale = PresetRenderScale;
}
}
private void SetFFR()
{
try
{
bool flag;
int num;
if (Preset == "Custom")
{
flag = FFRAutoEntry.Value;
num = FFRLevelEntry.Value;
}
else
{
flag = PresetFFRAuto;
num = PresetFFRLevel;
}
if (flag)
{
Utils.useDynamicFoveatedRendering = true;
MelonLogger.Msg("FFR: Automatic/Dynamic mode enabled");
return;
}
Utils.useDynamicFoveatedRendering = false;
Utils.foveatedRenderingLevel = num;
switch (num)
{
case 0:
MelonLogger.Msg("FFR: Level 0 (Off)");
break;
case 1:
MelonLogger.Msg("FFR: Level 1 (Low)");
break;
case 2:
MelonLogger.Msg("FFR: Level 2 (Medium)");
break;
case 3:
MelonLogger.Msg("FFR: Level 3 (High)");
break;
}
}
catch (Exception ex)
{
MelonLogger.Warning("FFR error: " + ex.Message);
}
}
private float GetAverageFPS()
{
float num = 0f;
for (int i = 0; i < frameTimeSamples.Length; i++)
{
num += frameTimeSamples[i];
}
float num2 = num / (float)frameTimeSamples.Length;
return (num2 > 0f) ? (1f / num2) : 0f;
}
}
}