aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-19 13:47:51 -0500
committerMichael <[email protected]>2017-02-19 13:47:51 -0500
commit762bd11cdf023e5340197b1a1438b5212f360a7d (patch)
tree32ec50ece5f3279bd6c4672814e5de7a262ebb67 /ShiftOS_TheReturn
parentb5a9b4caf2ae6e9d1712c65cbc1017ecbdad9ce4 (diff)
downloadshiftos_thereturn-762bd11cdf023e5340197b1a1438b5212f360a7d.tar.gz
shiftos_thereturn-762bd11cdf023e5340197b1a1438b5212f360a7d.tar.bz2
shiftos_thereturn-762bd11cdf023e5340197b1a1438b5212f360a7d.zip
Kill experience shifter.
Now all we need is a Lua->SFT compiler (not that hard) and then we can generate 0:/system/kernel.sft and have whatever's in there run at startup.
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Desktop.cs8
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs4
-rw-r--r--ShiftOS_TheReturn/Scripting.cs18
3 files changed, 30 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs
index 86d2099..256ab09 100644
--- a/ShiftOS_TheReturn/Desktop.cs
+++ b/ShiftOS_TheReturn/Desktop.cs
@@ -100,6 +100,14 @@ namespace ShiftOS.Engine
}
}
+ public static IDesktop CurrentDesktop
+ {
+ get
+ {
+ return _desktop;
+ }
+ }
+
public static void Init(IDesktop desk, bool show = false)
{
IDesktop deskToClose = null;
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 90504bb..ec3c3b3 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -172,6 +172,10 @@ namespace ShiftOS.Engine
TerminalBackend.InStory = false;
TerminalBackend.PrefixEnabled = true;
Shiftorium.LogOrphanedUpgrades = true;
+ Desktop.InvokeOnWorkerThread(new Action(() =>
+ {
+ ShiftOS.Engine.Scripting.LuaInterpreter.RunSft(Paths.GetPath("kernel.sft"));
+ }));
Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher()));
if (CurrentSave.StoryPosition == 1)
{
diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs
index 7215fbf..eca94fc 100644
--- a/ShiftOS_TheReturn/Scripting.cs
+++ b/ShiftOS_TheReturn/Scripting.cs
@@ -43,6 +43,24 @@ namespace ShiftOS.Engine.Scripting
public dynamic Lua = new DynamicLua.DynamicLua();
public bool Running = true;
+ public static void RunSft(string sft)
+ {
+ if (Utils.FileExists(sft))
+ {
+ try
+ {
+ string b64 = Utils.ReadAllText(sft);
+ byte[] bytes = Convert.FromBase64String(b64);
+ string lua = Encoding.UTF8.GetString(bytes);
+ new LuaInterpreter().Execute(lua);
+ }
+ catch
+ {
+ Infobox.Show("Invalid binary.", "This file is not a valid ShiftOS binary executable.");
+ }
+ }
+ }
+
public LuaInterpreter()
{
Lua(@"function totable(clrlist)