Skip to content

Commit

Permalink
Optimization pass
Browse files Browse the repository at this point in the history
Runs about 10x faster now if you're using minimal features.
  • Loading branch information
Owlchemist committed Apr 29, 2023
1 parent 63500a6 commit dfc1c88
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 149 deletions.
Binary file modified 1.4/Assemblies/CameraPlus.dll
Binary file not shown.
Binary file removed 1.4/Assemblies/CrossPromotion.dll
Binary file not shown.
104 changes: 27 additions & 77 deletions Source/CameraPlus.csproj
Original file line number Diff line number Diff line change
@@ -1,90 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{AC5EE7A1-16EA-498D-B21A-83ACF78F0E5A}</ProjectGuid>
<RootNamespace>CameraPlus</RootNamespace>
<AssemblyName>CameraPlus</AssemblyName>
<TargetFramework>net472</TargetFramework>
<LangVersion>8.0</LangVersion>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\1.4\Assemblies\</OutputPath>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Product>CameraPlus</Product>
<AssemblyVersion>2.5.3</AssemblyVersion>
<Version>1.4</Version>
<Copyright>$([System.DateTime]::Now.ToString('yyyy'))</Copyright>
<Company>avilmask</Company>
<TargetFramework>net48</TargetFramework>
<LangVersion>preview</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.5.2.0</Version>
<Copyright>Copyright Andreas Pardeike</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\..\..\..\workshop\content\294100\867467808\1.4\Assemblies</OutputPath>
<DefineConstants>TRACE;NDEBUG</DefineConstants>
<WarningLevel>4</WarningLevel>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>None</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>RW12;RW13;TRACE;DEBUG</DefineConstants>
<Optimize>false</Optimize>
<DebugType>portable</DebugType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>..\..\..\..\..\workshop\content\294100\867467808\1.4\Assemblies</OutputPath>
<DefineConstants>TRACE;DEBUG;NETFRAMEWORK;NET48;</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Brrainz.RimWorld.CrossPromotion" Version="1.0.0" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.3542" GeneratePathProperty="true" />
<PackageReference Include="Lib.Harmony" Version="2.2.2" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3">
<PackageReference Include="Krafs.Publicizer">
<Version>2.2.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Lib.Harmony" Version="2.*" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="TaskPubliciser" Version="1.0.3" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.*" />
</ItemGroup>

<Target Name="MyCode" BeforeTargets="UpdateReferences">
<PropertyGroup>
<AssemblyCSharp>$(PkgKrafs_Rimworld_Ref)\ref\net472\Assembly-CSharp.dll</AssemblyCSharp>
<PubliciseOutputPath>$(PkgKrafs_Rimworld_Ref)\ref\net472\</PubliciseOutputPath>
<AssemblyCSharp_Publicised>$(PubliciseOutputPath)Assembly-CSharp_publicised.dll</AssemblyCSharp_Publicised>
</PropertyGroup>
<Message Importance="High" Text="Publicising Rimworld Assembly ..." />
<Publicise TargetAssemblyPath="$(AssemblyCSharp)" OutputPath="$(PubliciseOutputPath)" Condition="Exists('$(AssemblyCSharp)')" />
<Message Importance="High" Text="Replacing reference to un-publicised assemblies with publicised equivalents ..." />
<ItemGroup>
<Reference Include="$(AssemblyCSharp_Publicised)">
<SpecificVersion>false</SpecificVersion>
<HintPath>$(AssemblyCSharp_Publicised)</HintPath>
<Implicit>true</Implicit>
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>

<Target Name="UpdateReferences" AfterTargets="ResolveLockFileReferences">
<Message Importance="High" Text="Remove References ..." />
<ItemGroup>
<Reference Remove="$(PkgKrafs_Rimworld_Ref)\ref\net472\Assembly-CSharp.dll" />
</ItemGroup>
</Target>

<PropertyGroup>
<PostBuildEvent>
echo Postprocessing
where ModBuilder 2&gt; nul | find /i "ModBuilder.exe"
if not errorlevel 1 (
ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll" -save "$(MSBuildProjectName)-version"
ModBuilder XMLPut -file "$(MSBuildProjectDirectory)\..\About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}"
)
if defined INSTALL_MOD (
"%INSTALL_MOD%" "$(Configuration)" "$(MSBuildProjectDirectory)\..\" "$(MSBuildProjectName)" "1.1 1.2 1.3 1.4 About Assemblies Defs Languages Sounds Textures" "LoadFolders.xml"
)
</PostBuildEvent>
<Company>Brrainz</Company>
<Authors>Andreas Pardeike</Authors>
<Description></Description>
<PackageProjectUrl>https://github.com/pardeike/CameraPlus</PackageProjectUrl>
<RepositoryUrl>https://github.com/pardeike/CameraPlus</RepositoryUrl>
<Product>Camera+</Product>
</PropertyGroup>

</Project>
<ItemGroup>
<Publicize Include="Assembly-CSharp" IncludeVirtualMembers="false" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/Dialog_AskForKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Dialog_AskForKey : Window
public Action<KeyCode> callback;

public override Vector2 InitialSize => new Vector2(400f, 200f);
public override float Margin => 0f;
protected override float Margin => 0f;

public Dialog_AskForKey(Action<KeyCode> callback)
{
Expand Down
14 changes: 14 additions & 0 deletions Source/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,19 @@ public static float HorizontalSlider(Rect rect, ref float value, float leftValue
value = Mathf.RoundToInt(value / roundTo) * roundTo;
return 4f + label != null ? 18f : 0f;
}

public static double FastPow(double num, int exp)
{
double result = 1.0;
while (exp > 0)
{
if (exp % 2 == 1)
result *= num;
exp >>= 1;
num *= num;
}

return result;
}
}
}
Loading

0 comments on commit dfc1c88

Please sign in to comment.