Skip to content

Commit 1295719

Browse files
committed
perf: use rpkg-cli's interactive mode instead
1 parent 3859276 commit 1295719

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

G2WwiseDataTool/MetaFiles.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,31 @@ public static void GenerateWWEMMetaFile(string wemNameHash, string outputPath)
134134
System.IO.File.WriteAllText(outputPath, wwemMetaData);
135135
}
136136

137-
public static void ConvertToMeta(string rpkgPath, string inputPath)
137+
public List<string> inputMetas = new List<string>();
138+
139+
public void ConvertToMeta(string rpkgPath)
138140
{
139-
var processStartInfo = new ProcessStartInfo(rpkgPath, " -json_to_hash_meta " + "\"" + inputPath + "\"")
141+
//var processStartInfo = new ProcessStartInfo(rpkgPath, " -json_to_hash_meta " + "\"" + inputPath + "\"")
142+
var processStartInfo = new ProcessStartInfo(rpkgPath, "-i")
140143
{
144+
RedirectStandardInput = true,
141145
RedirectStandardOutput = true,
142146
RedirectStandardError = true,
143147
UseShellExecute = false,
144148
CreateNoWindow = true
145149
};
146150

147151
var process = Process.Start(processStartInfo);
152+
153+
foreach (string inputMeta in inputMetas)
154+
{
155+
process.StandardInput.WriteLine("-json_to_hash_meta " + "\"" + inputMeta + "\"");
156+
}
157+
158+
process.StandardInput.WriteLine("q");
159+
160+
process.StandardOutput.ReadToEnd();
161+
148162
process.WaitForExit();
149163
}
150164
}

G2WwiseDataTool/SoundbanksInfoParser.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
1919

2020
string directoryPath = Path.GetDirectoryName(inputPath);
2121

22+
var metaFiles = new MetaFiles();
23+
2224
try
2325
{
2426
XmlDocument xmlDoc = new XmlDocument();
@@ -156,7 +158,7 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
156158

157159
if (rpkgPath != null)
158160
{
159-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(finalOutputPath + ".wwiseevent.meta.json"));
161+
metaFiles.inputMetas.Add(Path.GetFullPath(finalOutputPath + ".wwiseevent.meta.json"));
160162
}
161163

162164
foreach (EventWriter.Event.Entry entry in wwev.entries)
@@ -175,7 +177,7 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
175177

176178
if (rpkgPath != null)
177179
{
178-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(finalOutputPathWem + ".meta.json"));
180+
metaFiles.inputMetas.Add(Path.GetFullPath(finalOutputPathWem + ".meta.json"));
179181
}
180182
}
181183
}
@@ -190,7 +192,7 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
190192

191193
if (rpkgPath != null)
192194
{
193-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(outputPath + wwev.eventNameHash + ".WWEV.meta.json"));
195+
metaFiles.inputMetas.Add(Path.GetFullPath(outputPath + wwev.eventNameHash + ".WWEV.meta.json"));
194196
}
195197

196198
foreach (EventWriter.Event.Entry entry in wwev.entries)
@@ -202,7 +204,7 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
202204

203205
if (rpkgPath != null)
204206
{
205-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(outputPath + entry.wemNameHash + ".WWEM.meta.json"));
207+
metaFiles.inputMetas.Add(Path.GetFullPath(outputPath + entry.wemNameHash + ".WWEM.meta.json"));
206208
}
207209

208210
}
@@ -227,7 +229,7 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
227229

228230
if (rpkgPath != null)
229231
{
230-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(finalOutputPath + ".wwisesoundbank.meta.json"));
232+
metaFiles.inputMetas.Add(Path.GetFullPath(finalOutputPath + ".wwisesoundbank.meta.json"));
231233
}
232234

233235
}
@@ -238,14 +240,17 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
238240

239241
if (rpkgPath != null)
240242
{
241-
MetaFiles.ConvertToMeta(rpkgPath, Path.Combine(outputPath + soundBankHash + ".WBNK.meta.json"));
243+
metaFiles.inputMetas.Add(Path.GetFullPath(outputPath + soundBankHash + ".WBNK.meta.json"));
242244
}
243245

244246
}
245247
}
246248
}
249+
metaFiles.ConvertToMeta(rpkgPath);
247250
}
248-
catch(XmlException ex)
251+
252+
253+
catch (XmlException ex)
249254
{
250255
Trace.TraceError("Error parsing XML document: {0} The file may be corrupted, please regenerate SoundBanks in your Wwise project.", ex.ToString);
251256
}

0 commit comments

Comments
 (0)