aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRogueAI42 <[email protected]>2017-06-17 00:31:09 +1000
committerRogueAI42 <[email protected]>2017-06-17 00:31:09 +1000
commitbbbc00f204f77ca547340b010ec21662a62e3203 (patch)
tree0be6e17fd891c632cb1f1f758a49e2a1452b280d
parent9516d774aa7f670522fb354b6f4ca15aa8a5d796 (diff)
downloadshiftos_thereturn-bbbc00f204f77ca547340b010ec21662a62e3203.tar.gz
shiftos_thereturn-bbbc00f204f77ca547340b010ec21662a62e3203.tar.bz2
shiftos_thereturn-bbbc00f204f77ca547340b010ec21662a62e3203.zip
Fixed multiple compilations for the Python API
Previously, only one assembly could be compiled per startup. You could compile all of your mods by restarting the game over and over, loading the previously compiled mods from the cache. Now, that's not necessary. Oh yeah, also, more bugs in the Linux "port". Yippee. Whoops.
-rw-r--r--LinuxLauncher/README.md3
-rw-r--r--ShiftOS_TheReturn/PythonAPI.cs12
2 files changed, 9 insertions, 6 deletions
diff --git a/LinuxLauncher/README.md b/LinuxLauncher/README.md
index 7ee2a74..6b24dce 100644
--- a/LinuxLauncher/README.md
+++ b/LinuxLauncher/README.md
@@ -13,6 +13,9 @@ make an AUR package of this script if all goes to plan.
enable properly
* text input boxes are white on white
* the terminal puts an extra newline after displaying the prompt
+* Aiden Nirh's cutscene has weird overlapping text
+* ShiftLetters seems to have no available word lists. Clicking Play
+crashes the game.
* the ShiftOS desktop can go in front of applications
* there is a blue border from the Wine desktop (I want to change that
to black, but I also don't want it showing through while the game is
diff --git a/ShiftOS_TheReturn/PythonAPI.cs b/ShiftOS_TheReturn/PythonAPI.cs
index 49baa04..cc3798c 100644
--- a/ShiftOS_TheReturn/PythonAPI.cs
+++ b/ShiftOS_TheReturn/PythonAPI.cs
@@ -167,11 +167,7 @@ namespace ShiftOS.Engine
scopes = new Dictionary<string, ScriptScope>();
var resman = new System.Resources.ResourceManager("ShiftOS.Engine.Properties.Resources", typeof(Properties.Resources).Assembly);
var provider = new CSharpCodeProvider();
- var parameters = new CompilerParameters();
- parameters.ReferencedAssemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies().Select(f => f.Location).ToArray());
- parameters.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
- parameters.GenerateInMemory = false; // We need to keep the temporary file around long enough to copy it to the cache.
- parameters.GenerateExecutable = false;
+ var refs = AppDomain.CurrentDomain.GetAssemblies().Select(f => f.Location).Concat(new string[] { "Microsoft.CSharp.dll" }).ToArray();
var types = new List<Type>();
var sha = new SHA512Managed();
var oldcache = new Dictionary<string, AsmCacheEntry>();
@@ -203,6 +199,7 @@ namespace ShiftOS.Engine
{
Console.WriteLine("[dev] Failed to execute Python script " + fname);
Console.WriteLine(ex.ToString());
+ continue;
}
if (oldcache.ContainsKey(fname))
{
@@ -229,6 +226,10 @@ namespace ShiftOS.Engine
int pos = 0;
var entry = new AsmCacheEntry();
entry.checksum = checksum;
+ var parameters = new CompilerParameters();
+ parameters.ReferencedAssemblies.AddRange(refs);
+ parameters.GenerateInMemory = false; // We need to keep the temporary file around long enough to copy it to the cache.
+ parameters.GenerateExecutable = false;
try
{
while (pos < scriptlines.Length)
@@ -264,7 +265,6 @@ namespace ShiftOS.Engine
}
types.AddRange(results.CompiledAssembly.GetTypes()); // We did it!
entry.asms.Add(File.ReadAllBytes(results.PathToAssembly));
- File.Delete(results.PathToAssembly);
pos++; // keep scanning the file for more classes
}
}