Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Jun 22, 2022
1 parent 3588866 commit c314cd5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
25 changes: 12 additions & 13 deletions LoadOrderIPatch/Patches/CMPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public class CMPatch : IPatch {
private string workingPath_;

public AssemblyDefinition Execute(
AssemblyDefinition assemblyDefinition,
ILogger logger,
AssemblyDefinition assemblyDefinition,
ILogger logger,
string patcherWorkingPath,
IPaths gamePaths) {
logger_ = logger;
workingPath_ = patcherWorkingPath;

bool noReporters = Environment.GetCommandLineArgs().Any(_arg => _arg == "-cold-reload");
if(noReporters)
if (noReporters)
NoReportersPatch(assemblyDefinition);

if (!poke && Config.SoftDLLDependancy) {
Expand All @@ -47,7 +47,7 @@ public class CMPatch : IPatch {
#if DEBUG
//assemblyDefinition = InsertPrintStackTrace(assemblyDefinition);
#endif

EnsureIncludedExcludedPackagePatch(assemblyDefinition);

bool noAssets = Environment.GetCommandLineArgs().Any(_arg => _arg == "-noAssets");
Expand Down Expand Up @@ -170,7 +170,7 @@ public class CMPatch : IPatch {
var callExistingAssembly = Instruction.Create(OpCodes.Call, mrInjection);
var storeResult = Instruction.Create(OpCodes.Stloc_0);
var returnResult = instructions.Last(
c => c.OpCode == OpCodes.Ldloc_0 &&
c => c.OpCode == OpCodes.Ldloc_0 &&
c.Next?.OpCode == OpCodes.Ret);
var GotoToReturnResultIfNotNull = Instruction.Create(OpCodes.Brfalse, returnResult);

Expand Down Expand Up @@ -231,9 +231,9 @@ public class CMPatch : IPatch {

// find return null;
Instruction ldnull = null;
for(int i=0; i < instructions.Count; ++i) {
if(instructions[i].OpCode == OpCodes.Ldnull &&
instructions[i+1].OpCode == OpCodes.Ret) {
for (int i = 0; i < instructions.Count; ++i) {
if (instructions[i].OpCode == OpCodes.Ldnull &&
instructions[i + 1].OpCode == OpCodes.Ret) {
ldnull = instructions[i];
}
}
Expand Down Expand Up @@ -272,8 +272,8 @@ public class CMPatch : IPatch {

ilProcessor.InsertBefore(first, callInjection);
ilProcessor.InsertBefore(callInjection, ldAsm);
}
}

if (breadthFirst) {
Log.Info("breadthFirst");
var callAdd = instructions.First(_c => _c.Calls("Add"));
Expand Down Expand Up @@ -304,7 +304,7 @@ public class CMPatch : IPatch {
Log.Successful();
}
public static void LogExceptionInLOM(Exception ex) {
Injections.KianCommons.Log.Exception(ex, showInPanel:true);
Injections.KianCommons.Log.Exception(ex, showInPanel: true);
}

public void LoadCloudPackagesPatch(AssemblyDefinition CM) {
Expand All @@ -323,8 +323,7 @@ public class CMPatch : IPatch {
Log.Successful();
}

public static bool IsCloudEnabled() =>
ColossalFramework.PlatformServices.PlatformService.cloud?.enabled ?? false;
public static bool IsCloudEnabled() => SteamUtilities.IsCloudEnabled();

public AssemblyDefinition NoCustomAssetsPatch(AssemblyDefinition CM)
{
Expand Down
9 changes: 9 additions & 0 deletions LoadOrderInjections/Injections/SubscriptionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,15 @@ public static class SteamUtilities {
SteamInitialized = true;
}

public static bool IsCloudEnabled() {
var ret = PlatformService.cloud?.enabled ?? false;
Log.Info("Cloud.enabled=" + ret);
if (!ret) {
Log.Info("Skipping cloud packages.");
}
return ret;
}

/// <summary>
/// returns a list of items that are subscribed but not downloaded (excluding deleted items).
/// </summary>
Expand Down

0 comments on commit c314cd5

Please sign in to comment.