|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using UnityEngine; |
|
|
|
@ -26,6 +27,9 @@ public class UniQuake: MonoBehaviour |
|
|
|
private bool initialized = false; |
|
|
|
private double startTime; |
|
|
|
|
|
|
|
public MissionPack BaseGame { get; set; } |
|
|
|
public string ModDirectory { get; set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Time since startup for this particular instance of Quake
|
|
|
|
/// </summary>
|
|
|
|
@ -38,21 +42,40 @@ public class UniQuake: MonoBehaviour |
|
|
|
|
|
|
|
LoadLibrary(); |
|
|
|
|
|
|
|
string[] arguments = |
|
|
|
List<string> arguments = new List<string> |
|
|
|
{ |
|
|
|
"", |
|
|
|
"-window", |
|
|
|
"-width", "1440", |
|
|
|
"-height", "1080", |
|
|
|
"+developer", "1", |
|
|
|
}; |
|
|
|
|
|
|
|
switch (BaseGame) |
|
|
|
{ |
|
|
|
case MissionPack.Hipnotic: |
|
|
|
arguments.Add("-hipnotic"); |
|
|
|
break; |
|
|
|
case MissionPack.Rogue: |
|
|
|
arguments.Add("-rogue"); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ModDirectory)) |
|
|
|
{ |
|
|
|
arguments.AddRange(new[] { "-game", ModDirectory }); |
|
|
|
} |
|
|
|
|
|
|
|
if (Debug.isDebugBuild) |
|
|
|
{ |
|
|
|
arguments.AddRange(new[] { "+developer", "1" }); |
|
|
|
} |
|
|
|
|
|
|
|
quakeParms = new QuakeParms |
|
|
|
{ |
|
|
|
baseDir = Application.persistentDataPath, |
|
|
|
cacheDir = null, |
|
|
|
}; |
|
|
|
quakeParms.SetArguments(arguments); |
|
|
|
quakeParms.SetArguments(arguments.ToArray()); |
|
|
|
quakeParms.AllocateMemory(MemSize); |
|
|
|
|
|
|
|
startTime = Time.timeAsDouble; |
|
|
|
@ -177,6 +200,13 @@ public class UniQuake: MonoBehaviour |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public enum MissionPack |
|
|
|
{ |
|
|
|
Quake, // Vanilla Quake
|
|
|
|
Hipnotic, // Scourge of Armagon
|
|
|
|
Rogue, // Dissolution of Eternity
|
|
|
|
} |
|
|
|
|
|
|
|
public class QuakeException: Exception |
|
|
|
{ |
|
|
|
public int ExitCode { get; } |
|
|
|
|