From 2147e5d13dae3170bd14b4de3fc1258186b0110e Mon Sep 17 00:00:00 2001 From: reubengann Date: Sat, 28 Jan 2023 22:24:14 -0500 Subject: [PATCH 1/2] Open next-gen files --- GwentDiscovery/App.config | 6 +-- GwentDiscovery/GwentDiscovery.csproj | 3 +- .../Properties/Resources.Designer.cs | 44 ++++++++----------- .../Properties/Settings.Designer.cs | 22 ++++------ SaveExtractor/App.config | 6 +-- .../Properties/Resources.Designer.cs | 44 ++++++++----------- SaveExtractor/Properties/Settings.Designer.cs | 22 ++++------ SaveExtractor/SaveExtractor.csproj | 3 +- Witcher3MapViewer/App.config | 12 ++--- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Settings.Designer.cs | 3 +- Witcher3MapViewer/Witcher3MapViewer.csproj | 3 +- Witcher3MapViewer/Witcher3SaveFile.cs | 32 +++++++------- 13 files changed, 91 insertions(+), 111 deletions(-) diff --git a/GwentDiscovery/App.config b/GwentDiscovery/App.config index 88fa402..4bfa005 100644 --- a/GwentDiscovery/App.config +++ b/GwentDiscovery/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/GwentDiscovery/GwentDiscovery.csproj b/GwentDiscovery/GwentDiscovery.csproj index acf5217..8d7a1fd 100644 --- a/GwentDiscovery/GwentDiscovery.csproj +++ b/GwentDiscovery/GwentDiscovery.csproj @@ -9,11 +9,12 @@ Properties GwentDiscovery GwentDiscovery - v4.5.2 + v4.8 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + x64 diff --git a/GwentDiscovery/Properties/Resources.Designer.cs b/GwentDiscovery/Properties/Resources.Designer.cs index 55b63ed..5e8df1c 100644 --- a/GwentDiscovery/Properties/Resources.Designer.cs +++ b/GwentDiscovery/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace GwentDiscovery.Properties -{ - - +namespace GwentDiscovery.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace GwentDiscovery.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GwentDiscovery.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/GwentDiscovery/Properties/Settings.Designer.cs b/GwentDiscovery/Properties/Settings.Designer.cs index b1ca503..69f8565 100644 --- a/GwentDiscovery/Properties/Settings.Designer.cs +++ b/GwentDiscovery/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace GwentDiscovery.Properties -{ - - +namespace GwentDiscovery.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/SaveExtractor/App.config b/SaveExtractor/App.config index 731f6de..4bfa005 100644 --- a/SaveExtractor/App.config +++ b/SaveExtractor/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/SaveExtractor/Properties/Resources.Designer.cs b/SaveExtractor/Properties/Resources.Designer.cs index 8b311db..21e743e 100644 --- a/SaveExtractor/Properties/Resources.Designer.cs +++ b/SaveExtractor/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace SaveExtractor.Properties -{ - - +namespace SaveExtractor.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace SaveExtractor.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SaveExtractor.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/SaveExtractor/Properties/Settings.Designer.cs b/SaveExtractor/Properties/Settings.Designer.cs index 38787c0..28570d0 100644 --- a/SaveExtractor/Properties/Settings.Designer.cs +++ b/SaveExtractor/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace SaveExtractor.Properties -{ - - +namespace SaveExtractor.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/SaveExtractor/SaveExtractor.csproj b/SaveExtractor/SaveExtractor.csproj index af0fbb3..847d60b 100644 --- a/SaveExtractor/SaveExtractor.csproj +++ b/SaveExtractor/SaveExtractor.csproj @@ -8,11 +8,12 @@ WinExe SaveExtractor SaveExtractor - v4.6.1 + v4.8 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + AnyCPU diff --git a/Witcher3MapViewer/App.config b/Witcher3MapViewer/App.config index 39099a3..d4b4327 100644 --- a/Witcher3MapViewer/App.config +++ b/Witcher3MapViewer/App.config @@ -1,17 +1,17 @@ - + - -
+ +
- + - + True @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/Witcher3MapViewer/Properties/Resources.Designer.cs b/Witcher3MapViewer/Properties/Resources.Designer.cs index dc7d218..9f2d4ef 100644 --- a/Witcher3MapViewer/Properties/Resources.Designer.cs +++ b/Witcher3MapViewer/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Witcher3MapViewer.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Witcher3MapViewer/Properties/Settings.Designer.cs b/Witcher3MapViewer/Properties/Settings.Designer.cs index cf2ead4..ed69a8f 100644 --- a/Witcher3MapViewer/Properties/Settings.Designer.cs +++ b/Witcher3MapViewer/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Witcher3MapViewer.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -109,7 +109,6 @@ public bool FirstRun { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.SettingsSerializeAs(global::System.Configuration.SettingsSerializeAs.Binary)] public global::System.Collections.Specialized.StringDictionary MarkersState { get { return ((global::System.Collections.Specialized.StringDictionary)(this["MarkersState"])); diff --git a/Witcher3MapViewer/Witcher3MapViewer.csproj b/Witcher3MapViewer/Witcher3MapViewer.csproj index 4a03f5f..e5d509e 100644 --- a/Witcher3MapViewer/Witcher3MapViewer.csproj +++ b/Witcher3MapViewer/Witcher3MapViewer.csproj @@ -9,7 +9,7 @@ Properties Witcher3MapViewer Witcher3MapViewer - v4.5.2 + v4.8 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -31,6 +31,7 @@ 0.2.0.%2a false true + AnyCPU diff --git a/Witcher3MapViewer/Witcher3SaveFile.cs b/Witcher3MapViewer/Witcher3SaveFile.cs index 49ddd5f..46554c4 100644 --- a/Witcher3MapViewer/Witcher3SaveFile.cs +++ b/Witcher3MapViewer/Witcher3SaveFile.cs @@ -1,5 +1,5 @@ -using System.IO; -using System.Collections.Generic; +using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -7,6 +7,8 @@ namespace Witcher3MapViewer { public class Witcher3SaveFile { + static List validVersions = new List { 18, 19, 23 }; + int VariableTableOffset; int StringTableFooterOffset; int StringTableOffset; @@ -63,7 +65,7 @@ public Witcher3SaveFile(string filename, Witcher3ReadLevel ReadLevel) } private void LoadSaveQuick(string filename) - { + { //Load the CJournalManager, Gwent Manager, and levelManager only using (FileStream compressedStream = File.OpenRead(filename)) using (Stream decompressedStream = ChunkedLz4File.Decompress(compressedStream)) @@ -121,7 +123,7 @@ private void LoadSaveQuick(string filename) bytesread += 2; string SpecificType = StringTable[f.ReadInt16()]; bytesread += 2; - if (Name == "levelManager") + if (Name == "levelManager") { if (SpecificType == "handle:W3LevelManager") { @@ -131,7 +133,7 @@ private void LoadSaveQuick(string filename) GetLevel(LevelData); found = true; } - } + } } else { //PO but not PORP, just a coincidence @@ -142,7 +144,7 @@ private void LoadSaveQuick(string filename) { //no PORP here, keep looking f.SeekRelative(1); } - } + } } //TimeToFindXP = stopwatch.ElapsedMilliseconds - temp; @@ -166,7 +168,7 @@ private void LoadSaveQuick(string filename) } CJournalManager = new Witcher3CJournal(FindInHierarchy("CJournalManager")); - GwentManager = new Witcher3GwentManager(FindInHierarchy("CR4GwintManager")); + GwentManager = new Witcher3GwentManager(FindInHierarchy("CR4GwintManager")); } private void LoadSaveFromFile(string filename) @@ -210,7 +212,7 @@ private void LoadTopLevelBS(BinaryReader f, string name) VariableIndexEntry ScanForMainVariableByName(BinaryReader f, string query) { - foreach(VariableIndexEntry vie in MainVariableIndex) + foreach (VariableIndexEntry vie in MainVariableIndex) { f.Seek(vie.Offset); Witcher3BS member = ReadVariable(f, vie.Size) as Witcher3BS; @@ -223,7 +225,7 @@ VariableIndexEntry ScanForMainVariableByName(BinaryReader f, string query) int LocateVariableOffsetInIndex(VariableIndexEntry query) { int i = 0; - while(i < VariableIndex.Count) + while (i < VariableIndex.Count) { if (VariableIndex[i].Offset == query.Offset) return i; @@ -1489,11 +1491,11 @@ void VerifyTypecodes(BinaryReader f) throw new InvalidDataException("Typecode failure"); } int code2 = f.ReadInt32(); - if(code2 != 18 && code2 != 19) + if (!validVersions.Contains(code2)) { throw new InvalidDataException("Typecode failure"); } - if(f.ReadInt32() != 163) + if (f.ReadInt32() != 163) { throw new InvalidDataException("Typecode failure"); } @@ -1580,7 +1582,7 @@ void GetLevel(Witcher3HandleData LevelData) } } } - + } @@ -1640,7 +1642,7 @@ public ArrayStringResult Process(string TypeName) return result; } - + } public class Witcher3CJournal @@ -1714,7 +1716,7 @@ QuestStatusState ParseStatusStateFromString(string statusstring) return QuestStatusState.NotFound; } } - } + } public class Witcher3JournalEntryStatus { @@ -1750,7 +1752,7 @@ public Witcher3GwentCard() public Witcher3GwentCard(Witcher3BS SBCollectionCard) { - foreach(Witcher3GenericVariable v in SBCollectionCard.Members) + foreach (Witcher3GenericVariable v in SBCollectionCard.Members) { Witcher3VL val = v as Witcher3VL; if (val.Name == "cardIndex") From 8a805828277535c4a7f5d1d834e240affc11daa7 Mon Sep 17 00:00:00 2001 From: reubengann Date: Sat, 11 Feb 2023 11:56:44 -0500 Subject: [PATCH 2/2] Handle file version 24 --- Witcher3MapViewer/Witcher3SaveFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Witcher3MapViewer/Witcher3SaveFile.cs b/Witcher3MapViewer/Witcher3SaveFile.cs index 46554c4..30b3270 100644 --- a/Witcher3MapViewer/Witcher3SaveFile.cs +++ b/Witcher3MapViewer/Witcher3SaveFile.cs @@ -7,7 +7,7 @@ namespace Witcher3MapViewer { public class Witcher3SaveFile { - static List validVersions = new List { 18, 19, 23 }; + static List validVersions = new List { 18, 19, 23, 24 }; int VariableTableOffset; int StringTableFooterOffset;