diff --git a/Steamless.Unpacker.Variant20.x86/Main.cs b/Steamless.Unpacker.Variant20.x86/Main.cs index 35ae77e..7beb148 100644 --- a/Steamless.Unpacker.Variant20.x86/Main.cs +++ b/Steamless.Unpacker.Variant20.x86/Main.cs @@ -223,8 +223,13 @@ namespace Steamless.Unpacker.Variant20.x86 // Determine the code section RVA.. var codeSectionRVA = this.File.NtHeaders.OptionalHeader.BaseOfCode; - if (this.StubHeader.CodeSectionVirtualAddress != 0) - codeSectionRVA = this.File.GetRvaFromVa(this.StubHeader.CodeSectionVirtualAddress); + + // TODO: This is not really ideal to do but for now this breaks support for other variants of this version.. + if (this.Options.UseExperimentalFeatures) + { + if (this.StubHeader.CodeSectionVirtualAddress != 0) + codeSectionRVA = this.File.GetRvaFromVa(this.StubHeader.CodeSectionVirtualAddress); + } // Get the code section.. var codeSection = this.File.GetOwnerSection(codeSectionRVA); diff --git a/Steamless.Unpacker.Variant20.x86/Properties/AssemblyInfo.cs b/Steamless.Unpacker.Variant20.x86/Properties/AssemblyInfo.cs index 388d0c9..e0701c0 100644 --- a/Steamless.Unpacker.Variant20.x86/Properties/AssemblyInfo.cs +++ b/Steamless.Unpacker.Variant20.x86/Properties/AssemblyInfo.cs @@ -36,5 +36,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("4f11f26d-2946-467f-a4e9-9e2a619a1fd3")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] \ No newline at end of file diff --git a/Steamless/Model/AutomaticPlugin.cs b/Steamless/Model/AutomaticPlugin.cs index 44f06da..c2c5793 100644 --- a/Steamless/Model/AutomaticPlugin.cs +++ b/Steamless/Model/AutomaticPlugin.cs @@ -27,7 +27,10 @@ namespace Steamless.Model { using API; using API.Model; + using API.PE32; + using API.PE64; using API.Services; + using Steamless.API.Events; using System; using System.Linq; using System.Windows; @@ -36,6 +39,11 @@ namespace Steamless.Model [SteamlessApiVersion(1, 0)] internal class AutomaticPlugin : SteamlessPlugin { + /// + /// Internal logging service instance. + /// + private LoggingService m_LoggingService; + /// /// Gets the author of this plugin. /// @@ -56,6 +64,16 @@ namespace Steamless.Model /// public override Version Version => new Version(1, 0, 0, 0); + /// + /// Internal wrapper to log a message. + /// + /// + /// + private void Log(string msg, LogMessageType type) + { + this.m_LoggingService.OnAddLogMessage(this, new LogMessageEventArgs(msg, type)); + } + /// /// Initialize function called when this plugin is first loaded. /// @@ -63,6 +81,7 @@ namespace Steamless.Model /// public override bool Initialize(LoggingService logService) { + this.m_LoggingService = logService; return true; } @@ -94,7 +113,43 @@ namespace Steamless.Model return false; // Query the plugin list for a plugin to process the file.. - return (from p in plugins where p != this where p.CanProcessFile(file) select p.ProcessFile(file, options)).FirstOrDefault(); + var ret = (from p in plugins where p != this where p.CanProcessFile(file) select p.ProcessFile(file, options)).FirstOrDefault(); + if (ret) + return ret; + + // Determine if the file was not packed with SteamStub.. + try + { + // First attempt to read the file as 32bit.. + dynamic f = new Pe32File(file); + + if (f.Parse()) + { + // Check if the file is 64bit.. + if (f.IsFile64Bit()) + { + f = new Pe64File(file); + if (!f.Parse()) + return false; + } + + // Ensure the file had a .bind section.. + if (!f.HasSection(".bind")) + { + this.Log("", LogMessageType.Error); + this.Log("This file does not appear to be packed with SteamStub!", LogMessageType.Error); + this.Log("File missing expected '.bind' section!", LogMessageType.Error); + this.Log("", LogMessageType.Error); + return false; + } + } + } + catch + { + return false; + } + + return false; } } } \ No newline at end of file diff --git a/Steamless/Model/Tasks/LoadPluginsTask.cs b/Steamless/Model/Tasks/LoadPluginsTask.cs index f7e56b7..abd2c72 100644 --- a/Steamless/Model/Tasks/LoadPluginsTask.cs +++ b/Steamless/Model/Tasks/LoadPluginsTask.cs @@ -73,7 +73,9 @@ namespace Steamless.Model.Tasks }); // Add the automatic plugin at the start of the list.. - sorted.Insert(0, new AutomaticPlugin()); + var auto = new AutomaticPlugin(); + auto.Initialize(vml.LoggingService); + sorted.Insert(0, auto); // Set the plugins.. vml.MainWindow.Plugins = new ObservableCollection(sorted); diff --git a/Steamless/Properties/AssemblyInfo.cs b/Steamless/Properties/AssemblyInfo.cs index 129ecfa..3e4cd6a 100644 --- a/Steamless/Properties/AssemblyInfo.cs +++ b/Steamless/Properties/AssemblyInfo.cs @@ -37,5 +37,5 @@ using System.Windows; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] -[assembly: AssemblyVersion("3.1.0.0")] -[assembly: AssemblyFileVersion("3.1.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("3.1.0.1")] +[assembly: AssemblyFileVersion("3.1.0.1")] \ No newline at end of file