Skip to content

Commit 0ce6f75

Browse files
committed
* fix non-parallel encoding
* update allowed symbols for ndmuploader * add latest nfklib and try-catch for demo parsing
1 parent c20c8d5 commit 0ce6f75

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

externals/nfklib.dll

512 Bytes
Binary file not shown.

ndm2video/ExternalVideoTool.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public void ExternalToolStart(string infile, int roundNumber)
5959
_process.ProcessorAffinity = (IntPtr)affinity;
6060
_process.PriorityClass = (ProcessPriorityClass)Config.Data.ExternalToolRoundTrip[roundNumber].ProcessorPriority;
6161
}
62+
63+
// only when ParallelEncoding is disabled
64+
if (roundNumber > 0)
65+
return;
6266

6367
// start auto-exit timer with interval of game duration
6468
externalToolTimer = new System.Timers.Timer() { Interval = (Config.DemoDuration + Config.Data.ExtraTime) * 1000 };
@@ -92,8 +96,8 @@ private void externalToolTimer_Elapsed(object sender, System.Timers.ElapsedEvent
9296
private void externalToolProcess_Exited(object sender, EventArgs e)
9397
{
9498
// last round
95-
if (Config.Data.ParallelEncoding)
96-
if (this.roundNumber == Config.Data.ExternalToolRoundTrip.Length - 1)
99+
if (!Config.Data.ParallelEncoding)
100+
if (this.roundNumber >= Config.Data.ExternalToolRoundTrip.Length - 1)
97101
{
98102
Program.endMovieCreation();
99103
}

ndm2video/Program.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ writeconfig pid.cfg
8989
File.WriteAllText(autoexecFile, sb.ToString());
9090

9191

92-
Log.Info("Starting nfk process: ");
92+
Log.Info("Starting game process: " + Config.Data.GameExeFile);
9393
if (!File.Exists(Config.Data.GameExeFile))
9494
{
9595
Log.Error("Exe file does not exist");
@@ -205,9 +205,13 @@ private static void OnImageCreated(object sender, FileSystemEventArgs e)
205205

206206
if (Config.PlayerNumber > 0)
207207
{
208+
// I don't know why but it should be this!
209+
int startPlayerNumber = (Config.Data.ParallelEncoding) ? 0 : 1;
208210
// switch player camera
209-
for (int i = 0; i < Config.PlayerNumber; i++)
211+
for (int i = startPlayerNumber; i < Config.PlayerNumber; i++)
212+
{
210213
NfkSendKey("n");
214+
}
211215
}
212216
Thread.Sleep(1000);
213217

@@ -341,12 +345,20 @@ internal static void KillNFK()
341345
if (ex != null)
342346
ex.Dispose();
343347

344-
Common.freeHangProcesses();
348+
if (Config.Data.ParallelEncoding)
349+
Common.freeHangProcesses();
345350
}
346351
catch(Exception e)
347352
{
348353
Log.Error(e.Message);
349354
}
350355
}
356+
357+
internal static bool IsNFKRunning()
358+
{
359+
if (nfkProcess != null && !nfkProcess.HasExited)
360+
return true;
361+
return false;
362+
}
351363
}
352364
}

ndmscheduler/Form1.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ public Form1()
7171

7272
// read map width/height and set followplayer
7373
var ndm = new nfklib.NDemo.NFKDemo();
74-
var dem = ndm.Read(demoFile);
74+
nfklib.NDemo.DemoItem dem = null;
75+
try
76+
{
77+
dem = ndm.Read(demoFile);
78+
}
79+
catch { }
7580
if (dem == null)
7681
{
7782
Log.Error("Bad nfk demo");

ndmuploader/Form1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private static string FormatDemoInfo(string template, DemoItem demo, int pindex)
257257
return replaceBadString(output);
258258
}
259259

260-
static string goodChars = "\n\r абвгдеежзиклмнопрстуфхцчшщъюьэюяАБВГДЕЕЖЗИКЛМНОПРСТУФХЦЧШЩЪЮЬЭЮЯabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*()_+`-=/?.>,<\\|'\";:]}[{";
260+
static string goodChars = "\n\r абвгдеёжзийклмнопрстуфхцчшщъыюьэюяАБВГДЕЕЖЗИКЛМНОПРСТУФХЦЧШЩЪЮЬЭЮЯabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*()_+`-=/?.>,<\\|'\";:]}[{";
261261

262262
private static string replaceBadString(string input)
263263
{

0 commit comments

Comments
 (0)