diff --git a/.gulp/tasks/launch.js b/.gulp/tasks/launch.js index 88b9c237..0bcd8788 100755 --- a/.gulp/tasks/launch.js +++ b/.gulp/tasks/launch.js @@ -4,7 +4,7 @@ let {run} = require('gulp-dotnet-cli'); gulp.task('build-run', ()=>{ return gulp.src(process.env.PROJECT, {read: false}) .pipe(run({ - additionalArgs: ['Disks/PixelVisionOS/'], + additionalArgs: ['Disks/PixelVisionOS/', 'Disks/APIExamples/'], // ['-d', 'Disks/PixelVisionOS/', '-disk', 'Disks/APIExamples/'] echo: true })); }); diff --git a/Program.cs b/Program.cs index 80b5cfd3..bdd48bee 100755 --- a/Program.cs +++ b/Program.cs @@ -9,13 +9,13 @@ public static class Program [STAThread] public static void Main(string[] args) { - var root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content"); - - using (var game = new DesktopRunner(root, args.Length > 0 ? args[0] : null)) + var root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content"); + + using (var game = new DesktopRunner(root, args)) { game.Run(); - } - + } + } } } \ No newline at end of file diff --git a/SDK/Engine/Chips/Game/GameChipLite.cs b/SDK/Engine/Chips/Game/GameChipLite.cs index 23162eee..0d91f570 100755 --- a/SDK/Engine/Chips/Game/GameChipLite.cs +++ b/SDK/Engine/Chips/Game/GameChipLite.cs @@ -343,13 +343,13 @@ public void Clear() /// the overscan value set on the display chip. To calculate the exact overscan in pixels, you must subtract /// the full size from the visible size. Simply supply false as an argument to get the full display dimensions. /// - public Point Display(bool visible = true) + public Point Display() { // offsetX = visible ? DisplayChip.OverscanXPixels : 0; // offsetY = visible ? DisplayChip.OverscanYPixels : 0; - // display.X = display.X;// - offsetX; - // display.Y = display.Y;// - offsetY; + display.X = DisplayChip.Width;// - offsetX; + display.Y = DisplayChip.Height;// - offsetY; return display; } diff --git a/SDK/Lua/Chips/Game/LuaGameChip.cs b/SDK/Lua/Chips/Game/LuaGameChip.cs index 6f30939f..d77bedfd 100755 --- a/SDK/Lua/Chips/Game/LuaGameChip.cs +++ b/SDK/Lua/Chips/Game/LuaGameChip.cs @@ -73,7 +73,7 @@ protected virtual void RegisterLuaServices() #region Display APIs LuaScript.Globals["Clear"] = new Action(Clear); - LuaScript.Globals["Display"] = new Func(Display); + LuaScript.Globals["Display"] = new Func(Display); LuaScript.Globals["DrawPixels"] = new Action(DrawPixels); LuaScript.Globals["DrawSprite"] = diff --git a/SDK/Runner/DesktopRunner.cs b/SDK/Runner/DesktopRunner.cs index 94488b4d..87cc1e8c 100755 --- a/SDK/Runner/DesktopRunner.cs +++ b/SDK/Runner/DesktopRunner.cs @@ -114,7 +114,7 @@ public class DesktopRunner : GameRunner public IServiceLocator ServiceManager { get; } protected RunnerMode mode; protected bool displayProgress; - private string bootDisk; + private List bootDisks = new List(); protected override bool RunnerActive { @@ -127,7 +127,7 @@ protected override bool RunnerActive } // Default path to where PV8 workspaces will go - public DesktopRunner(string rootPath, string bootDisk = null) + public DesktopRunner(string rootPath, string[] args = null) { // Fix a bug related to parsing numbers in Europe, among other things CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; @@ -139,10 +139,58 @@ public DesktopRunner(string rootPath, string bootDisk = null) server = new MoonSharpVsCodeDebugServer(1985); server.Start(); - if (bootDisk != null && bootDisk.EndsWith(".pv8") ? File.Exists(bootDisk) : Directory.Exists(bootDisk)) + if(args != null) + ParseArguments(args); + + } + + private void ParseArguments(string[] args) + { + + if(args.Length == 0) + return; + + if(args.Length == 1 && args[0].EndsWith(".pv8") ? File.Exists(args[0]) : Directory.Exists(args[0])) { - this.bootDisk = bootDisk; + bootDisks.Add(args[0]); } + + var pairs = args.Length / 2; + + for (int i = 0; i < pairs; i++) + { + try + { + var param = args[i * 2]; + var val = args[i * 2 + 1]; + + switch(param){ + + case "-d": case "-disk": + + bootDisks.Add(val); + + break; + default: + + for (int j = 0; j < args.Length; j++) + { + bootDisks.Add(args[j]); + } + + break; + + } + + } + catch (System.Exception error) + { + Console.WriteLine("Issue with command line argumes"); + throw; + } + + } + } protected MoonSharpVsCodeDebugServer server; @@ -808,17 +856,26 @@ public void BootDone(bool safeMode = false) } } - if (bootDisk == null) + if (bootDisks.Count == 0) { AutoLoadDefaultGame(); } else { - // Force runner to auto run disk - autoRunEnabled = true; - // Mount the disk - MountDisk(bootDisk); + for (int i = 0; i < bootDisks.Count; i++) + { + + // Force runner to auto run disk + autoRunEnabled = i == 0; + + // Mount the disk + MountDisk(bootDisks[i]); + + autoRunEnabled = true; + + } + } } diff --git a/SDK/Runner/Services/LoadService.cs b/SDK/Runner/Services/LoadService.cs index 568ac68c..5ca67304 100755 --- a/SDK/Runner/Services/LoadService.cs +++ b/SDK/Runner/Services/LoadService.cs @@ -89,8 +89,6 @@ public virtual void ParseFiles(string[] files, IEngine engine, SaveFlags saveFla { Reset(); - Console.WriteLine("Font Test " + _fileLoadHelper.Exists("/PixelVisionOS/Tools/Fonts/large.font.png")); - // Save the engine so we can work with it during loading targetEngine = engine;