Skip to content

Commit

Permalink
Fix porting bug for hair randomizer, add some debug methods for prope…
Browse files Browse the repository at this point in the history
…rty checking
  • Loading branch information
Mgamerz committed Mar 25, 2021
1 parent 0c6e876 commit caba575
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ALOTInstaller
Submodule ALOTInstaller updated 1 files
+1 −1 ME3ExplorerLib
2 changes: 1 addition & 1 deletion ME2Randomizer/Classes/Randomizers/ME2/Misc/NPCHair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static bool ForcedRun(ExportEntry hairMeshExport)
var newHair = isfemaleHair ? HairListFemale.RandomElement() : HairListMale.RandomElement();
if (newHair.ObjectName.Name == entry.ObjectName.Name)
return false; // We are not changing this
Debug.WriteLine($"Changing hair mesh: {entry.ObjectName} -> {newHair.ObjectName}, object {hairMeshExport.FullPath}, class {entry.ClassName}");
MERLog.Information($"{Path.GetFileName(hairMeshExport.FileRef.FilePath)} Changing hair mesh: {entry.ObjectName} -> {newHair.ObjectName}, object {hairMeshExport.FullPath}, class {entry.ClassName}");
var newHairMdl = PackageTools.PortExportIntoPackage(hairMeshExport.FileRef, newHair);
var mdlBin = ObjectBinary.From<SkeletalMesh>(newHairMdl);
obj.Value = newHairMdl.UIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static bool RandomizeMovementSpeed(ExportEntry export, RandomizationOptio
// Generate a newized movement speed. This will result in some duplicate data (since some may already exist in the local file)
// But it will be way less complicated to just add new ones

MERLog.Information($@"Randomizing movement speed for {export.UIndex}");
//MERLog.Information($@"Randomizing movement speed for {export.UIndex}");
movementInfo.Value = AddNewRandomizedMovementSpeed(export);
export.WriteProperty(movementInfo);
}
Expand Down
2 changes: 1 addition & 1 deletion ME2Randomizer/Classes/Randomizers/ME2/Misc/RHolograms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void RandomizeVIMaterial(ExportEntry exp)
var data = exp.Data;
//RandomizeRGBA(data, 0x70C, false);
RandomizeRGBA(data, 0x72C, false);
MERLog.Information(@"Randomized VI material");
MERLog.Information($@"Randomized VI material {exp.InstancedFullPath} in {exp.FileRef.FilePath}");
exp.Data = data;
}

Expand Down
14 changes: 7 additions & 7 deletions ME2Randomizer/Classes/Randomizers/Randomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ private void PerformRandomization(object sender, DoWorkEventArgs e)
mainWindow.CurrentOperationText = $"Randomizing game files [{currentFileNumber}/{files.Count()}]";

#if DEBUG
if (true
//&& !file.Contains("OmgHub", StringComparison.InvariantCultureIgnoreCase)
//&& !file.Contains("SFXGame", StringComparison.InvariantCultureIgnoreCase)
&& !file.Contains("HorCr1", StringComparison.InvariantCultureIgnoreCase)
//&& !file.Contains("ProFre", StringComparison.InvariantCultureIgnoreCase)
)
return;
//if (true
////&& !file.Contains("OmgHub", StringComparison.InvariantCultureIgnoreCase)
////&& !file.Contains("SFXGame", StringComparison.InvariantCultureIgnoreCase)
//&& !file.Contains("Hub", StringComparison.InvariantCultureIgnoreCase)
////&& !file.Contains("ProFre", StringComparison.InvariantCultureIgnoreCase)
//)
// return;
#endif
try
{
Expand Down
3 changes: 3 additions & 0 deletions ME2Randomizer/DebugTools/DebugWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<Button DockPanel.Dock="Right" Click="CheckImports_Click" Padding="20,0,20,0" Visibility="Visible">
<fonts:OutlinedTextBlock Text="Check imports in DLC mod" Fill="#f3fbfe" Stroke="Black" FontFamily="{StaticResource AeroLight}" FontSize="12" StrokeThickness="2" />
</Button>
<Button DockPanel.Dock="Right" Click="CheckProperties_Click" Padding="20,0,20,0" Visibility="Visible">
<fonts:OutlinedTextBlock Text="Check properties in DLC mod" Fill="#f3fbfe" Stroke="Black" FontFamily="{StaticResource AeroLight}" FontSize="12" StrokeThickness="2" />
</Button>
<Button DockPanel.Dock="Right" Click="BuildStartupFile_Click" Padding="20,0,20,0" Visibility="Visible">
<fonts:OutlinedTextBlock Text="Build startup file" Fill="#f3fbfe" Stroke="Black" FontFamily="{StaticResource AeroLight}" FontSize="12" StrokeThickness="2" />
</Button>
Expand Down
5 changes: 5 additions & 0 deletions ME2Randomizer/DebugTools/DebugWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ private void DataFinder_Click(object sender, RoutedEventArgs e)
DataFinder df = new DataFinder(mw);
}

private void CheckProperties_Click(object sender, RoutedEventArgs e)
{
ME2Debug.TestPropertiesInMERFS();
}

private void CheckImports_Click(object sender, RoutedEventArgs e)
{
ME2Debug.TestAllImportsInMERFS();
Expand Down
9 changes: 8 additions & 1 deletion ME2Randomizer/DebugTools/ME2Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ public static void GetExportsInPersistentThatAreAlsoInSub()

var sameExports = subExports.Intersect(newExports).ToList();

foreach(var v in sameExports)
foreach (var v in sameExports)
{
Debug.WriteLine(v);
}
}

public static void TestPropertiesInMERFS()
{
var dlcModPath = Path.Combine(MEDirectories.GetDefaultGamePath(MERFileSystem.Game), "BioGame", "DLC", $"DLC_MOD_{MERFileSystem.Game}Randomizer", "CookedPC");
ReferenceCheckPackage rcp = new ReferenceCheckPackage();
bool checkCanceled = false;
EntryChecker.CheckReferences(rcp, dlcModPath, ref checkCanceled, EntryChecker.NonLocalizedStringConveter, x => Debug.WriteLine(x));
}

public static void TestAllImportsInMERFS()
{
Expand Down
2 changes: 1 addition & 1 deletion ME2Randomizer/ME2Randomizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Product>Mass Effect 2 Randomizer</Product>
<Description>Randomizer for Mass Effect 2</Description>
<Copyright>2019-2021 ME3Tweaks</Copyright>
<Version>0.9.16</Version>
<Version>0.9.17</Version>
<Authors>ME3Tweaks</Authors>
</PropertyGroup>

Expand Down

0 comments on commit caba575

Please sign in to comment.