diff --git a/Samples/CustomConfigure/Packages/manifest.json b/Samples/CustomConfigure/Packages/manifest.json index 0f9b14b..7f3dbb9 100644 --- a/Samples/CustomConfigure/Packages/manifest.json +++ b/Samples/CustomConfigure/Packages/manifest.json @@ -1,8 +1,7 @@ { "dependencies": { - "com.code-philosophy.obfuz": "https://gitee.com/focus-creative-games/obfuz.git?path=Obfuz/Packages/com.code-philosophy.obfuz", + "com.code-philosophy.obfuz": "https://github.com/focus-creative-games/obfuz.git?path=com.code-philosophy.obfuz", "com.unity.ide.visualstudio": "2.0.23", - "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0", diff --git a/Samples/CustomConfigure/ProjectSettings/ProjectVersion.txt b/Samples/CustomConfigure/ProjectSettings/ProjectVersion.txt index 37f39b7..7a6f40b 100644 --- a/Samples/CustomConfigure/ProjectSettings/ProjectVersion.txt +++ b/Samples/CustomConfigure/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.3.11f1 -m_EditorVersionWithRevision: 2022.3.11f1 (d00248457e15) +m_EditorVersion: 2022.3.62f1 +m_EditorVersionWithRevision: 2022.3.62f1 (4af31df58517) diff --git a/Samples/MultiObfuscatedAssemblies/Packages/manifest.json b/Samples/MultiObfuscatedAssemblies/Packages/manifest.json index 0f9b14b..a72d1dc 100644 --- a/Samples/MultiObfuscatedAssemblies/Packages/manifest.json +++ b/Samples/MultiObfuscatedAssemblies/Packages/manifest.json @@ -1,6 +1,6 @@ { "dependencies": { - "com.code-philosophy.obfuz": "https://gitee.com/focus-creative-games/obfuz.git?path=Obfuz/Packages/com.code-philosophy.obfuz", + "com.code-philosophy.obfuz": "https://github.com/focus-creative-games/obfuz.git?path=com.code-philosophy.obfuz", "com.unity.ide.visualstudio": "2.0.23", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10", "com.unity.modules.assetbundle": "1.0.0", diff --git a/Samples/MultiObfuscatedAssemblies/ProjectSettings/ProjectVersion.txt b/Samples/MultiObfuscatedAssemblies/ProjectSettings/ProjectVersion.txt index 37f39b7..7a6f40b 100644 --- a/Samples/MultiObfuscatedAssemblies/ProjectSettings/ProjectVersion.txt +++ b/Samples/MultiObfuscatedAssemblies/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.3.11f1 -m_EditorVersionWithRevision: 2022.3.11f1 (d00248457e15) +m_EditorVersion: 2022.3.62f1 +m_EditorVersionWithRevision: 2022.3.62f1 (4af31df58517) diff --git a/Samples/MultiObfuscatedAssemblies/ProjectSettings/boot.config b/Samples/MultiObfuscatedAssemblies/ProjectSettings/boot.config deleted file mode 100644 index e69de29..0000000 diff --git a/Samples/QuickStart/Assets/Obfuz/SymbolObfus/symbol-mapping.xml b/Samples/QuickStart/Assets/Obfuz/SymbolObfus/symbol-mapping.xml index 93d5b5c..8a8e1b4 100644 --- a/Samples/QuickStart/Assets/Obfuz/SymbolObfus/symbol-mapping.xml +++ b/Samples/QuickStart/Assets/Obfuz/SymbolObfus/symbol-mapping.xml @@ -1,10 +1,7 @@ - - - - + @@ -12,16 +9,8 @@ - - - - - - - - - - + + @@ -34,70 +23,32 @@ - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + + + + + + + + + + + + + @@ -105,367 +56,89 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - \ No newline at end of file diff --git a/Samples/QuickStart/ProjectSettings/ProjectSettings.asset b/Samples/QuickStart/ProjectSettings/ProjectSettings.asset index c24e165..9398732 100644 --- a/Samples/QuickStart/ProjectSettings/ProjectSettings.asset +++ b/Samples/QuickStart/ProjectSettings/ProjectSettings.asset @@ -874,7 +874,7 @@ PlayerSettings: platformArchitecture: {} scriptingBackend: Android: 1 - Standalone: 0 + Standalone: 1 il2cppCompilerConfiguration: Android: 0 Standalone: 0 diff --git a/Samples/QuickStart/ProjectSettings/ProjectVersion.txt b/Samples/QuickStart/ProjectSettings/ProjectVersion.txt index 37f39b7..7a6f40b 100644 --- a/Samples/QuickStart/ProjectSettings/ProjectVersion.txt +++ b/Samples/QuickStart/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.3.11f1 -m_EditorVersionWithRevision: 2022.3.11f1 (d00248457e15) +m_EditorVersion: 2022.3.62f1 +m_EditorVersionWithRevision: 2022.3.62f1 (4af31df58517) diff --git a/Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs b/Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs new file mode 100644 index 0000000..6b9e378 --- /dev/null +++ b/Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs @@ -0,0 +1,28 @@ +using HybridCLR.Editor; +using Obfuz4HybridCLR; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; + +public static class BuildCommand +{ + [MenuItem("Build/CompileAndObfuscateAndCopyToStreamingAssets")] + public static void CompileAndObfuscateAndCopyToStreamingAssets() + { + BuildTarget target = EditorUserBuildSettings.activeBuildTarget; + ObfuscateUtil.CompileAndObfuscateHotUpdateAssemblies(target); + + Directory.CreateDirectory(Application.streamingAssetsPath); + + string hotUpdateDllPath = $"{SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target)}"; + foreach (string assName in SettingsUtil.HotUpdateAssemblyNamesIncludePreserved) + { + string srcFile = $"{hotUpdateDllPath}/{assName}.dll"; + string dstFile = $"{Application.streamingAssetsPath}/{assName}.dll.bytes"; + File.Copy(srcFile, dstFile, true); + Debug.Log($"[CompileAndObfuscate] Copy {srcFile} to {dstFile}"); + } + } +} diff --git a/Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs.meta b/Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs.meta similarity index 83% rename from Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs.meta rename to Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs.meta index 2bcd1c7..5b56e51 100644 --- a/Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs.meta +++ b/Samples/WorkWithHybridCLR/Assets/Editor/BuildCommand.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: afc965e1afdfc8e47b8a70be7a93cf25 +guid: fd4b0e23f5090224eb49f190bb597c4b MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs b/Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs deleted file mode 100644 index c6cb646..0000000 --- a/Samples/WorkWithHybridCLR/Assets/Editor/BuildTool.cs +++ /dev/null @@ -1,91 +0,0 @@ -using HybridCLR.Editor.Commands; -using HybridCLR.Editor; -using Obfuz.Settings; -using Obfuz; -using System.Collections; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; -using System.Reflection; -using System; -using System.IO; -using HybridCLR.Editor.Link; -using HybridCLR.Editor.Meta; - -public class BuildTool : MonoBehaviour -{ - [MenuItem("Obfuz/GenerateLinkXmlForHybridCLR")] - public static void GenerateLinkXml() - { - CompileDllCommand.CompileDllActiveBuildTarget(); - BuildTarget target = EditorUserBuildSettings.activeBuildTarget; - var obfuzSettings = ObfuzSettings.Instance; - - var assemblySearchDirs = new List - { - SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target), - }; - ObfuscatorBuilder builder = ObfuscatorBuilder.FromObfuzSettings(obfuzSettings, target, true); - builder.InsertTopPriorityAssemblySearchPaths(assemblySearchDirs); - - Obfuscator obfuz = builder.Build(); - obfuz.Run(); - - - List hotfixAssemblies = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved; - - var analyzer = new Analyzer(new PathAssemblyResolver(builder.ObfuscatedAssemblyOutputPath)); - var refTypes = analyzer.CollectRefs(hotfixAssemblies); - - // HyridCLRÖÐ LinkXmlWritter²»ÊÇpublicµÄ£¬ÔÚÆäËû³ÌÐò¼¯ÎÞ·¨·ÃÎÊ£¬Ö»ÄÜͨ¹ý·´Éä²Ù×÷ - var linkXmlWriter = typeof(SettingsUtil).Assembly.GetType("HybridCLR.Editor.Link.LinkXmlWriter"); - var writeMethod = linkXmlWriter.GetMethod("Write", BindingFlags.Public | BindingFlags.Instance); - var instance = Activator.CreateInstance(linkXmlWriter); - string linkXmlOutputPath = $"{Application.dataPath}/Obfuz/link.xml"; - writeMethod.Invoke(instance, new object[] { linkXmlOutputPath, refTypes }); - Debug.Log($"[GenerateLinkXmlForObfuscatedAssembly] output:{linkXmlOutputPath}"); - AssetDatabase.Refresh(); - } - - [MenuItem("Obfuz/CompileAndObfuscateAndCopyToStreamingAssets")] - public static void CompileAndObfuscateAndCopyToStreamingAssets() - { - BuildTarget target = EditorUserBuildSettings.activeBuildTarget; - string outputPath = ObfuzSettings.Instance.GetObfuscatedAssemblyOutputPath(target); - CompileAndObfuscate(target, outputPath); - - Directory.CreateDirectory(Application.streamingAssetsPath); - - foreach (string assName in SettingsUtil.HotUpdateAssemblyNamesIncludePreserved) - { - string srcFile = $"{outputPath}/{assName}.dll"; - string dstFile = $"{Application.streamingAssetsPath}/{assName}.dll.bytes"; - File.Copy(srcFile, dstFile, true); - Debug.Log($"[CompileAndObfuscate] Copy {srcFile} to {dstFile}"); - } - } - - - public static void CompileAndObfuscate(BuildTarget target, string outputPath) - { - CompileDllCommand.CompileDll(EditorUserBuildSettings.activeBuildTarget, EditorUserBuildSettings.development); - var assemblySearchPaths = new List - { - SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target), - }; - CustomObfuscate(target, assemblySearchPaths, outputPath); - } - - public static void CustomObfuscate(BuildTarget target, List assemblySearchPaths, string outputPath) - { - var obfuzSettings = ObfuzSettings.Instance; - - var assemblySearchDirs = assemblySearchPaths; - ObfuscatorBuilder builder = ObfuscatorBuilder.FromObfuzSettings(obfuzSettings, target, true); - builder.InsertTopPriorityAssemblySearchPaths(assemblySearchDirs); - builder.ObfuscatedAssemblyOutputPath = outputPath; - - Obfuscator obfuz = builder.Build(); - obfuz.Run(); - } -} diff --git a/Samples/WorkWithHybridCLR/Assets/HybridCLRGenerate/link.xml b/Samples/WorkWithHybridCLR/Assets/HybridCLRGenerate/link.xml index 7800393..4051a8d 100644 --- a/Samples/WorkWithHybridCLR/Assets/HybridCLRGenerate/link.xml +++ b/Samples/WorkWithHybridCLR/Assets/HybridCLRGenerate/link.xml @@ -1,5 +1,9 @@  + + + + diff --git a/Samples/WorkWithHybridCLR/Assets/Main/AOTGenericReferences.cs b/Samples/WorkWithHybridCLR/Assets/Main/AOTGenericReferences.cs index 63774a6..679d6c2 100644 --- a/Samples/WorkWithHybridCLR/Assets/Main/AOTGenericReferences.cs +++ b/Samples/WorkWithHybridCLR/Assets/Main/AOTGenericReferences.cs @@ -5,6 +5,7 @@ public class AOTGenericReferences : UnityEngine.MonoBehaviour // {{ AOT assemblies public static readonly IReadOnlyList PatchedAOTAssemblyList = new List { + "Obfuz.Runtime.dll", }; // }} @@ -12,6 +13,7 @@ public class AOTGenericReferences : UnityEngine.MonoBehaviour // }} // {{ AOT generic types + // Obfuz.EncryptionService // }} public void RefMethods() diff --git a/Samples/WorkWithHybridCLR/Assets/Obfuz/SymbolObfus/symbol-mapping.xml b/Samples/WorkWithHybridCLR/Assets/Obfuz/SymbolObfus/symbol-mapping.xml index 7020b0a..02ed222 100644 --- a/Samples/WorkWithHybridCLR/Assets/Obfuz/SymbolObfus/symbol-mapping.xml +++ b/Samples/WorkWithHybridCLR/Assets/Obfuz/SymbolObfus/symbol-mapping.xml @@ -10,16 +10,8 @@ - - - - - - - - - - + + @@ -27,95 +19,59 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + + + + + + + + + + + + + @@ -123,367 +79,89 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - \ No newline at end of file diff --git a/Samples/WorkWithHybridCLR/Assets/StreamingAssets/HotUpdate.dll.bytes b/Samples/WorkWithHybridCLR/Assets/StreamingAssets/HotUpdate.dll.bytes index fccbfbc..3c26a54 100644 Binary files a/Samples/WorkWithHybridCLR/Assets/StreamingAssets/HotUpdate.dll.bytes and b/Samples/WorkWithHybridCLR/Assets/StreamingAssets/HotUpdate.dll.bytes differ diff --git a/Samples/WorkWithHybridCLR/Packages/manifest.json b/Samples/WorkWithHybridCLR/Packages/manifest.json index ecae1ad..b48bf01 100644 --- a/Samples/WorkWithHybridCLR/Packages/manifest.json +++ b/Samples/WorkWithHybridCLR/Packages/manifest.json @@ -1,9 +1,9 @@ { "dependencies": { "com.code-philosophy.hybridclr": "https://github.com/focus-creative-games/hybridclr_unity.git", - "com.code-philosophy.obfuz": "https://gitee.com/focus-creative-games/obfuz.git?path=Obfuz/Packages/com.code-philosophy.obfuz", + "com.code-philosophy.obfuz": "https://github.com/focus-creative-games/obfuz.git?path=com.code-philosophy.obfuz", + "com.code-philosophy.obfuz4hybridclr": "https://github.com/focus-creative-games/obfuz.git?path=com.code-philosophy.obfuz4hybridclr", "com.unity.ide.visualstudio": "2.0.23", - "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0", diff --git a/Samples/WorkWithHybridCLR/ProjectSettings/ProjectVersion.txt b/Samples/WorkWithHybridCLR/ProjectSettings/ProjectVersion.txt index 37f39b7..7a6f40b 100644 --- a/Samples/WorkWithHybridCLR/ProjectSettings/ProjectVersion.txt +++ b/Samples/WorkWithHybridCLR/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.3.11f1 -m_EditorVersionWithRevision: 2022.3.11f1 (d00248457e15) +m_EditorVersion: 2022.3.62f1 +m_EditorVersionWithRevision: 2022.3.62f1 (4af31df58517)