Files
NobetaSource/Cpp2IL/Assembly-CSharp/SteamPlatform.cs
2023-09-06 22:19:13 +02:00

453 lines
16 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Cpp2IlInjected;
using MarsSDK;
using Newtonsoft.Json;
using Steamworks;
using UnityEngine;
// Token: 0x0200017E RID: 382
[Token(Token = "0x200017E")]
public class SteamPlatform : IGamePlatform
{
// Token: 0x1700008E RID: 142
// (get) Token: 0x060012C4 RID: 4804 RVA: 0x0002AA34 File Offset: 0x00028C34
[Token(Token = "0x1700008E")]
public SystemLanguage DefaultLanguage
{
[Token(Token = "0x60012C4")]
[Address(RVA = "0x9890A0", Offset = "0x9880A0", VA = "0x1809890A0")]
get
{
return Application.systemLanguage;
}
}
// Token: 0x1700008F RID: 143
// (get) Token: 0x060012C5 RID: 4805 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x1700008F")]
public ControllerDevice DefaultController
{
[Token(Token = "0x60012C5")]
[Address(RVA = "0x2FF2E0", Offset = "0x2FE2E0", VA = "0x1802FF2E0", Slot = "4")]
get
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
}
// Token: 0x17000090 RID: 144
// (get) Token: 0x060012C6 RID: 4806 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x17000090")]
public IFileSystem FileSystem
{
[Token(Token = "0x60012C6")]
[Address(RVA = "0x32FD80", Offset = "0x32ED80", VA = "0x18032FD80", Slot = "5")]
get
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
}
// Token: 0x17000091 RID: 145
// (get) Token: 0x060012C7 RID: 4807 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x17000091")]
public bool IsConsolePlatform
{
[Token(Token = "0x60012C7")]
[Address(RVA = "0x29A960", Offset = "0x299960", VA = "0x18029A960", Slot = "6")]
get
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
}
// Token: 0x17000092 RID: 146
// (get) Token: 0x060012C8 RID: 4808 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x17000092")]
public bool UseAsiaController
{
[Token(Token = "0x60012C8")]
[Address(RVA = "0x29A960", Offset = "0x299960", VA = "0x18029A960", Slot = "7")]
get
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
}
// Token: 0x17000093 RID: 147
// (get) Token: 0x060012C9 RID: 4809 RVA: 0x0002AA48 File Offset: 0x00028C48
[Token(Token = "0x17000093")]
public bool UseAchievement
{
[Token(Token = "0x60012C9")]
[Address(RVA = "0x4990D0", Offset = "0x4980D0", VA = "0x1804990D0", Slot = "8")]
get
{
return true;
}
}
// Token: 0x17000094 RID: 148
// (get) Token: 0x060012CA RID: 4810 RVA: 0x0002AA58 File Offset: 0x00028C58
[Token(Token = "0x17000094")]
public bool ShowQuitButton
{
[Token(Token = "0x60012CA")]
[Address(RVA = "0x4990D0", Offset = "0x4980D0", VA = "0x1804990D0", Slot = "9")]
get
{
return true;
}
}
// Token: 0x17000095 RID: 149
// (get) Token: 0x060012CB RID: 4811 RVA: 0x0002AA68 File Offset: 0x00028C68
[Token(Token = "0x17000095")]
public bool ShowDepthOfFieldSetting
{
[Token(Token = "0x60012CB")]
[Address(RVA = "0x4990D0", Offset = "0x4980D0", VA = "0x1804990D0", Slot = "10")]
get
{
return true;
}
}
// Token: 0x17000096 RID: 150
// (get) Token: 0x060012CC RID: 4812 RVA: 0x0002AA78 File Offset: 0x00028C78
[Token(Token = "0x17000096")]
public bool IncludeChineseVideos
{
[Token(Token = "0x60012CC")]
[Address(RVA = "0x4990D0", Offset = "0x4980D0", VA = "0x1804990D0", Slot = "11")]
get
{
return true;
}
}
// Token: 0x060012CD RID: 4813 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012CD")]
[Address(RVA = "0x987790", Offset = "0x986790", VA = "0x180987790")]
public SteamPlatform()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012CE RID: 4814 RVA: 0x0002AA88 File Offset: 0x00028C88
[Token(Token = "0x60012CE")]
[Address(RVA = "0x987000", Offset = "0x986000", VA = "0x180987000", Slot = "12")]
public void Setup(Action nextAction)
{
this.UpgradeOldGameSaveFiles();
this.VerifyCollectionData();
if (nextAction != 0)
{
nextAction();
}
}
// Token: 0x060012CF RID: 4815 RVA: 0x0002AAAC File Offset: 0x00028CAC
[Token(Token = "0x60012CF")]
[Address(RVA = "0x986C80", Offset = "0x985C80", VA = "0x180986C80", Slot = "13")]
public void InitDlc()
{
int num = 0;
int dlccount = SteamApps.GetDLCCount();
List<GameDlc> list = new List();
if (dlccount > 0)
{
ulong num2;
if (SteamApps.BGetDLCDataByIndex(num, num, num, num, (int)num2) && (num != 2152390 || SteamApps.BIsSubscribedApp(num)) && (num != 2242530 || SteamApps.BIsSubscribedApp(num)) && num == 2465440 && SteamApps.BIsSubscribedApp(num))
{
list.Add((uint)1003);
}
num++;
}
Game.DLC.SetupDlc(list);
}
// Token: 0x060012D0 RID: 4816 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012D0")]
[Address(RVA = "0x986A20", Offset = "0x985A20", VA = "0x180986A20", Slot = "14")]
public GameConfig GetConfig()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012D1 RID: 4817 RVA: 0x0002AB34 File Offset: 0x00028D34
[Token(Token = "0x60012D1")]
[Address(RVA = "0x986F90", Offset = "0x985F90", VA = "0x180986F90", Slot = "15")]
public void SaveConfig(GameConfig config)
{
string text = JsonConvert.SerializeObject(config);
PlayerPrefs.SetString("Config", text);
}
// Token: 0x060012D2 RID: 4818 RVA: 0x0002AB54 File Offset: 0x00028D54
[Token(Token = "0x60012D2")]
[Address(RVA = "0x986960", Offset = "0x985960", VA = "0x180986960")]
private GameConfig CreateConfig()
{
GameConfig gameConfig = new GameConfig();
gameConfig.configVersion = (int)((ulong)21L);
string text = JsonConvert.SerializeObject(gameConfig);
PlayerPrefs.SetString("Config", text);
return gameConfig;
}
// Token: 0x060012D3 RID: 4819 RVA: 0x0002AB8C File Offset: 0x00028D8C
[Token(Token = "0x60012D3")]
[Address(RVA = "0x987040", Offset = "0x986040", VA = "0x180987040", Slot = "16")]
public void ShowNoSpaceDialogue(Action nextAction)
{
/*
An exception occurred when decompiling this method (060012D3)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void SteamPlatform::ShowNoSpaceDialogue(System.Action)
---> System.Exception: Basic block has to end with unconditional control flow.
{; Block_0:; stloc:Exception(var_0_0A, newobj:Exception(Exception::.ctor, ldstr:string("This is ps4 only feature, if see the log, check save file flow."))); };
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1810
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 344
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
}
// Token: 0x060012D4 RID: 4820 RVA: 0x0002ABA4 File Offset: 0x00028DA4
[Token(Token = "0x60012D4")]
[Address(RVA = "0x986B40", Offset = "0x985B40", VA = "0x180986B40", Slot = "17")]
public GameSkin[] GetPlatformSkins()
{
GameSkin[] array = EnumUtils.AllValues<GameSkin>();
GameSkin[] array2 = new GameSkin[2];
int length = array2.Length;
array2[0] = (GameSkin)((ulong)1L);
array2[0] = (GameSkin)((ulong)2L);
return Enumerable.ToArray<GameSkin>(Enumerable.Except<GameSkin>(array, array2));
}
// Token: 0x060012D5 RID: 4821 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012D5")]
[Address(RVA = "0x986C20", Offset = "0x985C20", VA = "0x180986C20", Slot = "18")]
public bool HasAchievementUnlocked(int index)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012D6 RID: 4822 RVA: 0x0002ABEC File Offset: 0x00028DEC
[Token(Token = "0x60012D6")]
[Address(RVA = "0x987090", Offset = "0x986090", VA = "0x180987090", Slot = "19")]
public void UnlockAchievement(int index)
{
bool flag = SteamUserStats.SetAchievement(this.achievementSystem.achievementKeys[index]);
bool flag2 = SteamUserStats.StoreStats();
}
// Token: 0x060012D7 RID: 4823 RVA: 0x0002AC20 File Offset: 0x00028E20
[Token(Token = "0x60012D7")]
[Address(RVA = "0x986E10", Offset = "0x985E10", VA = "0x180986E10", Slot = "20")]
public void ResetAllAchievements(Action onCompleted)
{
SteamAchievementSystem steamAchievementSystem = this.achievementSystem;
string[] achievementKeys = steamAchievementSystem.achievementKeys;
int num = 0;
if (num < achievementKeys.Length)
{
string text = steamAchievementSystem.achievementKeys[num];
if (!SteamUserStats.ClearAchievement(text))
{
Debug.LogError("Clear steam achievement failed: " + text);
}
string[] achievementKeys2 = steamAchievementSystem.achievementKeys;
num++;
}
if (!SteamUserStats.StoreStats())
{
Debug.LogError("Store all steam achievements failed.");
}
if (onCompleted != 0)
{
onCompleted();
}
}
// Token: 0x060012D8 RID: 4824 RVA: 0x0002ACA0 File Offset: 0x00028EA0
[Token(Token = "0x60012D8")]
[Address(RVA = "0x9870E0", Offset = "0x9860E0", VA = "0x1809870E0", Slot = "21")]
public void UpdateStatsData(GameCollection collectionData)
{
string[] array = this.statsKeys;
int speedSpellcasting = collectionData.speedSpellcasting;
bool flag = SteamUserStats.SetStat(array[0], speedSpellcasting);
string[] array2 = this.statsKeys;
int meleeSpellcasting = collectionData.meleeSpellcasting;
bool flag2 = SteamUserStats.SetStat(array2[1], meleeSpellcasting);
string[] array3 = this.statsKeys;
int manaAbsorbed = collectionData.manaAbsorbed;
bool flag3 = SteamUserStats.SetStat(array3[2], manaAbsorbed);
string[] array4 = this.statsKeys;
int soulAcquired = collectionData.soulAcquired;
bool flag4 = SteamUserStats.SetStat(array4[3], soulAcquired);
string[] array5 = this.statsKeys;
int enemiesDefeated = collectionData.enemiesDefeated;
bool flag5 = SteamUserStats.SetStat(array5[4], enemiesDefeated);
if (!SteamUserStats.StoreStats())
{
Debug.LogError("Update steam stats failed.");
}
}
// Token: 0x060012D9 RID: 4825 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012D9")]
[Address(RVA = "0x29E8B0", Offset = "0x29D8B0", VA = "0x18029E8B0", Slot = "23")]
public void MountDLCPoint(GameSkin skin)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012DA RID: 4826 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012DA")]
[Address(RVA = "0x29E8B0", Offset = "0x29D8B0", VA = "0x18029E8B0", Slot = "24")]
public void UnmountDLCPoints()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012DB RID: 4827 RVA: 0x0002AD68 File Offset: 0x00028F68
[Token(Token = "0x60012DB")]
[Address(RVA = "0x4BD7A0", Offset = "0x4BC7A0", VA = "0x1804BD7A0", Slot = "22")]
public void Quit()
{
Application.Quit();
}
// Token: 0x060012DC RID: 4828 RVA: 0x000020D3 File Offset: 0x000002D3
[Token(Token = "0x60012DC")]
[Address(RVA = "0x9874C0", Offset = "0x9864C0", VA = "0x1809874C0")]
private void VerifyCollectionData(string statsKey, ref int data, ref bool flag)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x060012DD RID: 4829 RVA: 0x0002AD7C File Offset: 0x00028F7C
[Token(Token = "0x60012DD")]
[Address(RVA = "0x987270", Offset = "0x986270", VA = "0x180987270")]
private void UpdateStatsData(string statsKey, int value)
{
bool flag = SteamUserStats.SetStat(statsKey, value);
}
// Token: 0x060012DE RID: 4830 RVA: 0x0002AD94 File Offset: 0x00028F94
[Token(Token = "0x60012DE")]
[Address(RVA = "0x987280", Offset = "0x986280", VA = "0x180987280")]
private void UpgradeOldGameSaveFiles()
{
FileInfo[] files = new DirectoryInfo(Path.Combine(Application.dataPath, "Save")).GetFiles();
int num = 0;
int length = files.Length;
if (num < length)
{
FileInfo fileInfo = files[num];
string name = fileInfo.Name;
if (name.StartsWith("Save") && string.Equals(Path.GetExtension(name), ".dat"))
{
GameSaveLegacy gameSaveLegacy = new GameSaveLegacy();
string fullName = fileInfo.FullName;
WriteFileResult writeFileResult = Game.WriteGameSave(gameSaveLegacy.Convert(fullName));
fileInfo.Delete();
}
num++;
}
}
// Token: 0x060012DF RID: 4831 RVA: 0x0002AE30 File Offset: 0x00029030
[Token(Token = "0x60012DF")]
[Address(RVA = "0x987500", Offset = "0x986500", VA = "0x180987500")]
private void VerifyCollectionData()
{
string text = this.statsKeys[0];
GameCollection collection = Game.Collection;
int num = 0;
bool stat = SteamUserStats.GetStat(text, num);
if (collection.speedSpellcasting < num)
{
collection.speedSpellcasting = num;
}
string text2 = this.statsKeys[1];
GameCollection collection2 = Game.Collection;
bool stat2 = SteamUserStats.GetStat(text2, num);
if (collection2.meleeSpellcasting < num)
{
collection2.meleeSpellcasting = num;
}
string text3 = this.statsKeys[2];
GameCollection collection3 = Game.Collection;
bool stat3 = SteamUserStats.GetStat(text3, num);
if (collection3.manaAbsorbed < num)
{
collection3.manaAbsorbed = num;
}
string text4 = this.statsKeys[3];
GameCollection collection4 = Game.Collection;
bool stat4 = SteamUserStats.GetStat(text4, num);
if (collection4.soulAcquired < num)
{
collection4.soulAcquired = num;
}
string text5 = this.statsKeys[4];
GameCollection collection5 = Game.Collection;
bool stat5 = SteamUserStats.GetStat(text5, num);
if (collection5.enemiesDefeated < num)
{
collection5.enemiesDefeated = num;
}
if ((ulong)1L != 0UL)
{
WriteFileResult writeFileResult = Game.WriteSystemData();
}
}
// Token: 0x060012E0 RID: 4832 RVA: 0x0002AF54 File Offset: 0x00029154
[Token(Token = "0x60012E0")]
[Address(RVA = "0x986C80", Offset = "0x985C80", VA = "0x180986C80")]
private void UpdateDlcData()
{
int num = 0;
int dlccount = SteamApps.GetDLCCount();
List<GameDlc> list = new List();
if (dlccount > 0)
{
ulong num2;
if (SteamApps.BGetDLCDataByIndex(num, num, num, num, (int)num2) && (num != 2152390 || SteamApps.BIsSubscribedApp(num)) && (num != 2242530 || SteamApps.BIsSubscribedApp(num)) && num == 2465440 && SteamApps.BIsSubscribedApp(num))
{
list.Add((uint)1003);
}
num++;
}
Game.DLC.SetupDlc(list);
}
// Token: 0x04001CBD RID: 7357
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4001CBD")]
private StandaloneFileSystem fileSystem;
// Token: 0x04001CBE RID: 7358
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4001CBE")]
private SteamAchievementSystem achievementSystem;
// Token: 0x04001CBF RID: 7359
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4001CBF")]
private string[] statsKeys;
}