Skip to content

Commit

Permalink
feat: base assembly path argument instead of construction folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Notexe committed Feb 9, 2024
1 parent 1555a9f commit 7998779
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
3 changes: 3 additions & 0 deletions G2GFxDataTool/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class Options
[Option('o', "output", SetName = "export", Required = false, HelpText = "Path to output the files (defaults to the current working directory).")]
public string outputPath { get; set; } = Path.Combine(Directory.GetCurrentDirectory(), "output");

[Option('b', "base-assembly-path", SetName = "export", Required = false, HelpText = "Base assembly path (defaults to /ui/controls/).")]
public string baseAssemblyPath { get; set; } = "/ui/controls/";

[Option('g', "gfxexport", SetName = "export", Required = false, HelpText = "Path to gfxexport.exe (defaults to \"gfxexport.exe\").")]
public string gfxexportPath { get; set; } = "gfxexport.exe";

Expand Down
12 changes: 6 additions & 6 deletions G2GFxDataTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ static void Main(string[] args)
string ext = Path.GetExtension(file).ToLower();
if (ext == ".swf")
{
ScaleformGFxWriter.WriteScaleformGfX(file, options.outputPath, options.gfxexportPath, options.verbose);
UIControlWriter.WriteUIControl(file, options.outputPath, options.verbose);
ScaleformGFxWriter.WriteScaleformGfX(file, options.outputPath, options.gfxexportPath, options.baseAssemblyPath, options.verbose);
UIControlWriter.WriteUIControl(file, options.outputPath, options.baseAssemblyPath, options.verbose);
}
if (ext == ".gfx")
{
UIControlWriter.WriteUIControl(file, options.outputPath, options.verbose);
UIControlWriter.WriteUIControl(file, options.outputPath, options.baseAssemblyPath, options.verbose);
}
}
}
Expand All @@ -47,12 +47,12 @@ static void Main(string[] args)
string ext = Path.GetExtension(options.inputPath);
if (ext == ".swf")
{
ScaleformGFxWriter.WriteScaleformGfX(options.inputPath, options.outputPath, options.gfxexportPath, options.verbose);
UIControlWriter.WriteUIControl(options.inputPath, options.outputPath, options.verbose);
ScaleformGFxWriter.WriteScaleformGfX(options.inputPath, options.outputPath, options.gfxexportPath, options.baseAssemblyPath, options.verbose);
UIControlWriter.WriteUIControl(options.inputPath, options.outputPath, options.baseAssemblyPath, options.verbose);
}
if (ext == ".gfx")
{
UIControlWriter.WriteUIControl(options.inputPath, options.outputPath, options.verbose);
UIControlWriter.WriteUIControl(options.inputPath, options.outputPath, options.baseAssemblyPath, options.verbose);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions G2GFxDataTool/ScaleformGFxWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace G2GFxDataTool
{
internal class ScaleformGFxWriter
{
internal static void WriteScaleformGfX(string inputPath, string outputPath, string gfxexportPath, bool verbose)
internal static void WriteScaleformGfX(string inputPath, string outputPath, string gfxexportPath, string baseAssemblyPath, bool verbose)
{
string gfxFileName = Path.GetFileNameWithoutExtension(inputPath);
string tempFolderPath = Path.GetTempPath();
Expand Down Expand Up @@ -72,7 +72,8 @@ internal static void WriteScaleformGfX(string inputPath, string outputPath, stri
var s_Generator = new ResourceLib.ResourceGenerator("GFXF", ResourceLib.Game.Hitman3);
var s_ResourceMem = s_Generator.FromJsonStringToResourceMem(gfxfJSON);

string assemblyPath = Helpers.AssemblyPathDeriver(inputPath, "swf");
//string assemblyPath = Helpers.AssemblyPathDeriver(inputPath, "swf");
string assemblyPath = "[assembly:" + baseAssemblyPath + Path.GetFileNameWithoutExtension(inputPath) + ".swf" + "].pc_swf";
string assemblyPathHash = Helpers.ConvertStringtoMD5(assemblyPath);

Program.logScaleformGFxPaths.Add(assemblyPathHash + ".GFXF," + assemblyPath);
Expand Down
8 changes: 5 additions & 3 deletions G2GFxDataTool/UIControlWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class Property
public int m_nPropertyId { get; set; } = 0;
}

internal static void WriteUIControl(string inputPath, string outputPath, bool verbose)
internal static void WriteUIControl(string inputPath, string outputPath, string baseAssemblyPath, bool verbose)
{
var definitions = ParseSWF.ParseAS(inputPath);

Expand Down Expand Up @@ -108,8 +108,10 @@ internal static void WriteUIControl(string inputPath, string outputPath, bool ve
data.m_aProperties.Add(properties);
}

string uictAssemblyPath = Helpers.UIControlPathDeriver(inputPath, definition.className) + "entitytype";
string uicbAssemblyPath = Helpers.UIControlPathDeriver(inputPath, definition.className) + "entityblueprint";
//string uictAssemblyPath = Helpers.UIControlPathDeriver(inputPath, definition.className) + "entitytype";
//string uicbAssemblyPath = Helpers.UIControlPathDeriver(inputPath, definition.className) + "entityblueprint";
string uictAssemblyPath = "[assembly:" + baseAssemblyPath + Path.GetFileNameWithoutExtension(inputPath) + ".swf?/" + definition.className + ".uic].pc_entitytype";
string uicbAssemblyPath = "[assembly:" + baseAssemblyPath + Path.GetFileNameWithoutExtension(inputPath) + ".swf?/" + definition.className + ".uic].pc_entityblueprint";

string uictAssemblyPathHash = Helpers.ConvertStringtoMD5(uictAssemblyPath);
string uicbAssemblyPathHash = Helpers.ConvertStringtoMD5(uicbAssemblyPath);
Expand Down

0 comments on commit 7998779

Please sign in to comment.