コード例 #1
0
ファイル: Program.cs プロジェクト: arakis/abanu
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            MessageManager.OnMessageReceived = MessageReceived;

            var targetProcID = SysCalls.GetProcessIDForCommand(SysCallTarget.GetProcessByName);

            GetProcessByNameBuffer = SysCalls.RequestMessageBuffer(4096, targetProcID);

            SysCalls.RegisterService(SysCallTarget.HostCommunication_CreateProcess);
            SysCalls.RegisterService(SysCallTarget.TmpDebug);

            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            try
            {
                SetupDrivers();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            while (true)
            {
                //Serial.Write(port, (byte)'M');
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            AppLogger.Info("Logger attached");

            ThemeManager.EnableDefaultThemeLoading      = false;
            ThemeManager.EnableDPICorrection            = true;
            ApplicationThemeHelper.ApplicationThemeName = ThemeConstants.DevExpressThemeName;

            AppDomain.CurrentDomain.UnhandledException += this.CurrentDomainOnUnhandledException;
            //AppDomain.CurrentDomain.FirstChanceException += this.CurrentDomainOnFirstChanceException;

            DispatcherUnhandledException          += this.HandleDispatcherException;
            TaskScheduler.UnobservedTaskException += this.HandleUnobservedTaskException;

            var serviceContainer = ServiceContainerBuilder.CreateDependencyInjectionContainer();

            this._currentApplication = new ApplicationRuntime(Current, serviceContainer);

            this._bootstrapper = new Bootstrapper(this._currentApplication, serviceContainer);
            this._bootstrapper.Run();

            var shellController = this.CreateShellController(serviceContainer);
            var shell           = new Shell(shellController.ViewModel);

            this._currentApplication.AttachShell(shellController, shell);
            this._currentApplication.ShowUi();
        }
コード例 #3
0
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            Files     = new List <VfsFile>();
            OpenFiles = new List <OpenFile>();

            KeyBoardFifo = new VfsFile {
                Path = "/dev/keyboard", Buffer = new FifoFile()
            };
            Files.Add(KeyBoardFifo);
            Files.Add(new VfsFile {
                Path = "/dev/screen", Buffer = new FifoFile()
            });

            MessageManager.OnMessageReceived = MessageReceived;
            MessageManager.OnDispatchError   = OnDispatchError;

            SysCalls.RegisterService(SysCallTarget.OpenFile);
            SysCalls.RegisterService(SysCallTarget.CreateFifo);
            SysCalls.RegisterService(SysCallTarget.ReadFile);
            SysCalls.RegisterService(SysCallTarget.WriteFile);

            SysCalls.RegisterInterrupt(33);

            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            while (true)
            {
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile);
            var buf             = SysCalls.RequestMessageBuffer(4096, targetProcessId);
            var conHandle       = SysCalls.OpenFile(buf, "/dev/console");

            var con = new ConsoleServer();

            con.Write("ConsoleServer Started");

            // TODO: Create dev /dev/console, other processes can check their existence
            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            while (true)
            {
                SysCalls.ThreadSleep(0); // TODO: Signal

                var gotBytes = SysCalls.ReadFile(conHandle, buf);
                if (gotBytes > 0)
                {
                    for (var byteIdx = 0; byteIdx < gotBytes; byteIdx++)
                    {
                        var bufPtr = (byte *)buf.Start;
                        var key    = bufPtr[byteIdx];
                        con.Write(key);
                    }
                }
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: abanu-org/app-guidemo
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();
            MessageManager.OnDispatchError   = OnDispatchError;
            MessageManager.OnMessageReceived = MessageReceived;

            Console.WriteLine("Gui Demo starting");

            var targetProcessID = SysCalls.GetProcessIDForCommand(SysCallTarget.Tmp_DisplayServer_CreateWindow);
            var windowData      = (CreateWindowResult *)SysCalls.RequestMessageBuffer((uint)sizeof(CreateWindowResult), targetProcessID).Start;

            SysCalls.Tmp_DisplayServer_CreateWindow(ApplicationRuntime.CurrentProcessID, windowData, 200, 100);
            sur = new MemorySurface(windowData->Addr, windowData->Width, windowData->Height, windowData->Pitch, windowData->Depth);
            gfx = new GraphicsAdapter(sur);

            gfx.SetSource(0x0000FF00);
            gfx.Rectangle(0, 0, sur.Width, sur.Height);
            gfx.Fill();

            SysCalls.Tmp_DisplayServer_FlushWindow();

            Console.WriteLine("Gui Demo ready");

            var direction = 1;
            var pos       = 128;

            gfx.MoveTo(10, 10);
            gfx.LineTo(50, 70);

            while (true)
            {
                uint color    = 0x0000FF00;
                uint mask     = (uint)pos;
                uint newColor = color | mask;

                gfx.SetSource(newColor);
                gfx.Rectangle(0, 0, sur.Width, sur.Height);
                gfx.Fill();

                gfx.SetSource(0x00FF0000);
                gfx.Stroke();

                pos += direction;
                if (pos >= 255)
                {
                    direction = -1;
                }
                else
                {
                    if (pos <= 0)
                    {
                        direction = 1;
                    }
                }

                SysCalls.Tmp_DisplayServer_FlushWindow();

                //SysCalls.ThreadSleep(0);
            }
        }
コード例 #6
0
        public static void Main()
        {
            ApplicationRuntime.Init();
            MessageManager.OnDispatchError   = OnDispatchError;
            MessageManager.OnMessageReceived = MessageReceived;

            fb = CreateFrameBuffer();
            if (fb == null)
            {
                Console.WriteLine("No Framebuffer found");
                ApplicationRuntime.Exit(0);
            }
            sur = new FramebufferSurface(fb);
            gfx = new GraphicsAdapter(sur);
            gfx.SetSource(0x00115F9F);
            gfx.Rectangle(0, 0, sur.Width, sur.Height);
            gfx.Fill();

            SysCalls.RegisterService(SysCallTarget.Tmp_DisplayServer_CreateWindow);
            SysCalls.RegisterService(SysCallTarget.Tmp_DisplayServer_FlushWindow);
            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            Console.WriteLine("DisplayServer ready");

            while (true)
            {
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: Eye-Soft/HSDK
        private static void CopyDebugToRuntimePath()
        {
            var runtimePath = ApplicationRuntime.RuntimePath("EyeSoft", "NavigationDemo");
            var debugPath   = ApplicationRuntime.DebugPath(@"Internal\Windows\Docs\Navigation\Windows\");

            Storage.Directory(runtimePath).Create();
            Storage.GetFiles(debugPath, "*.*").ToList().ForEach(f => f.CopyTo(Path.Combine(runtimePath, f.Name), true));
        }
コード例 #8
0
        internal FileStream(FileHandle handle)
        {
            Handle = handle;
            // TODO: Store Target in FileHandle
            var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile);

            ReadBuffer  = ApplicationRuntime.RequestMessageBuffer(4096, targetProcessId);
            WriteBuffer = ApplicationRuntime.RequestMessageBuffer(4096, targetProcessId);
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static void Main()
        {
            ApplicationRuntime.Init();

            MessageManager.OnMessageReceived = MessageReceived;

            while (true)
            {
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        private static void StartProc(string name)
        {
            var fileServiceProc = SysCalls.GetProcessIDForCommand(SysCallTarget.GetFileLength);
            var nameBuf         = SysCalls.RequestMessageBuffer(4096, fileServiceProc);
            var length          = SysCalls.GetFileLength(nameBuf, name);

            if (length < 0)
            {
                return;
            }

            Console.WriteLine("Loading App: " + name);
            Console.WriteLine("Length: " + length.ToString());

            var targetProcessStartProc = SysCalls.GetProcessIDForCommand(SysCallTarget.CreateMemoryProcess);
            var fileBuf = ApplicationRuntime.RequestMessageBuffer(length, targetProcessStartProc);

            var transferBuf = new byte[4096];

            using (var handle = File.Open(name))
            {
                int pos = 0;

                SysCalls.SetThreadPriority(30);
                while (true)
                {
                    var gotBytes = handle.Read(transferBuf, 0, transferBuf.Length);

                    if (gotBytes <= 0)
                    {
                        break;
                    }

                    fileBuf.Write(transferBuf, 0, pos, gotBytes);
                    pos += gotBytes;

                    //for (var i = 0; i < gotBytes; i++)
                    //{
                    //    fileBuf.SetByte(pos++, transferBuf[i]);
                    //}
                }
                SysCalls.SetThreadPriority(0);

                Console.WriteLine("CreateProc...");
                var procId = SysCalls.CreateMemoryProcess(fileBuf.Region, (uint)length);
                var cmdProcId_SetStandartInputOutput = SysCalls.GetProcessIDForCommand(SysCallTarget.SetStandartInputOutput);
                var buf2 = SysCalls.RequestMessageBuffer(4096, cmdProcId_SetStandartInputOutput);
                SysCalls.SetStandartInputOutput(procId, FileHandle.StandaradInput, "/tmp/tmp_fifo", buf2);

                SysCalls.StartProcess(procId);
            }
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static void Main()
        {
            ApplicationRuntime.Init();

            //MessageManager.OnMessageReceived = MessageReceived;

            //SysCalls.SetServiceStatus(ServiceStatus.Ready);

            while (true)
            {
                //Serial.Write(port, (byte)'M');
                Thread.Sleep(0);
            }
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static void Main()
        {
            ApplicationRuntime.Init();

            MessageManager.OnMessageReceived = MessageReceived;

            HostCommunicator.Init();

            //RuntimeMemory.Free(fileBuf);
            SysCalls.WriteDebugChar('+');
            while (true)
            {
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static void Main()
        {
            ApplicationRuntime.Init();

            Service.Setup();

            MessageManager.OnMessageReceived = MessageReceived;
            MessageManager.OnDispatchError   = OnDispatchError;

            SysCalls.RegisterService(SysCallTarget.OpenFile);
            SysCalls.RegisterService(SysCallTarget.CreateFifo);
            SysCalls.RegisterService(SysCallTarget.ReadFile);
            SysCalls.RegisterService(SysCallTarget.WriteFile);
            SysCalls.RegisterService(SysCallTarget.GetFileLength);
            SysCalls.RegisterService(SysCallTarget.FStat);
            SysCalls.RegisterService(SysCallTarget.CreateStandartInputOutput);
            SysCalls.RegisterService(SysCallTarget.SetStandartInputOutput);

            var targetProcID = SysCalls.GetProcessIDForCommand(SysCallTarget.GetProcessByName);

            GetProcessByNameBuffer = SysCalls.RequestMessageBuffer(4096, targetProcID);

            SysCalls.RegisterService(SysCallTarget.HostCommunication_CreateProcess); // TODO: Obsolete? Consider rename TmpDebug to HostCommunication_CreateProcess
            SysCalls.RegisterService(SysCallTarget.TmpDebug);

            try
            {
                InitHAL.SetupDrivers();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            SysCalls.RegisterInterrupt(33);

            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            while (true)
            {
                SysCalls.ThreadSleep(0);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Eye-Soft/HSDK
        public static void Main()
        {
            try
            {
                var application = new Application {
                    ShutdownMode = ShutdownMode.OnMainWindowClose
                };

                using (var applicationMutex = application.ApplicationMutex())
                {
                    if (applicationMutex.IsAlreadyRunning)
                    {
                        return;
                    }

                    ExceptionlessClient.Default.Register();

                    application.InstallExceptionHandler();

                    ////SystemInspector.Debugger.SetAsDetached();

                    var debugOrInstalledPath =
                        ApplicationRuntime.DebugOrRuntimePath(
                            "EyeSoft",
                            "NavigationDemo",
                            @"Internal\Windows\Docs\Navigation\Windows\");

                    CopyDebugToRuntimePath();

                    application.Start(debugOrInstalledPath, "EyeSoft.Demo.Navigation.Windows.Presentation");
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString(), "Error on the application");
            }
        }
コード例 #15
0
 public GameBootstrap(ApplicationRuntime runtime)
 {
     _runtime = runtime;
 }
コード例 #16
0
ファイル: Program.cs プロジェクト: djlw78/abanu
        public static void Main()
        {
            try
            {
                ApplicationRuntime.Init();

                //var result = MessageManager.Send(SysCallTarget.ServiceFunc1, 55);

                SysCalls.WriteDebugChar('=');
                SysCalls.WriteDebugChar('/');
                SysCalls.WriteDebugChar('*');

                var conStream = File.Open("/dev/console");

                var con = new ConsoleClient(conStream);

                con.Reset();
                con.SetForegroundColor(7);
                con.SetBackgroundColor(0);
                con.ApplyDefaultColor();
                con.Clear();
                con.SetCursor(0, 0);
                con.Write("kl\n");

                //for (int i = 0; i < ApplicationRuntime.ElfSections.Count; i++)
                //    con.WriteLine(ApplicationRuntime.ElfSections[i].Name);

                var cmdProcId_CreateFifo = SysCalls.GetProcessIDForCommand(SysCallTarget.CreateFifo);
                var buf3 = SysCalls.RequestMessageBuffer(4096, cmdProcId_CreateFifo);
                SysCalls.CreateFifo(buf3, "/tmp/tmp_fifo");
#pragma warning disable CA2000 // Dispose objects before losing scope
                var kbStream2 = File.Open("/tmp/tmp_fifo");
#pragma warning restore CA2000 // Dispose objects before losing scope

                using (var kbStream = File.Open("/dev/keyboard"))
                {
                    while (true)
                    {
                        SysCalls.ThreadSleep(0);

                        var num = kbStream.ReadByte();
                        if (num >= 0)
                        {
                            var key = (byte)num;

                            // F8
                            if (key == 0x42)
                            {
                                StartProc("CHELLO.BIN");
                                continue;
                            }

                            // F9
                            if (key == 0x43)
                            {
                                StartProc("DSPSRV.BIN");
                                continue;
                            }

                            // F10
                            if (key == 0x44)
                            {
                                StartProc("GUIDEMO.BIN");
                                continue;
                            }

                            var s = key.ToString("x");
                            //for (var i = 0; i < s.Length; i++)
                            //    SysCalls.WriteDebugChar(s[i]);
                            //SysCalls.WriteDebugChar(' ');
                            for (var i = 0; i < s.Length; i++)
                            {
                                con.Write(s[i]);
                                kbStream2.WriteByte(64);
                            }
                            con.Write(' ');
                        }
                        //SysCalls.WriteDebugChar('?');
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: arakis/abanu
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            //var result = MessageManager.Send(SysCallTarget.ServiceFunc1, 55);

            SysCalls.WriteDebugChar('=');
            SysCalls.WriteDebugChar('/');
            SysCalls.WriteDebugChar('*');

            var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile);
            var buf             = SysCalls.RequestMessageBuffer(4096, targetProcessId);
            var kb = SysCalls.OpenFile(buf, "/dev/keyboard");

            var con = new ConsoleClient();

            con.Init();
            //con.Write("\x001B[37;42m\x001B[8]");
            //con.Write("abc\x001B[2Jgh\x001B[37;42mjk");

            con.Reset();
            con.SetForegroundColor(7);
            con.SetBackgroundColor(0);
            con.ApplyDefaultColor();
            con.Clear();
            con.SetCursor(0, 0);
            con.Write("kl\n");

            for (uint i = 0; i < ApplicationRuntime.ElfSections.SectionHeaderCount; i++)
            {
                var section = ApplicationRuntime.ElfSections.GetSectionHeader(i);
                var name    = ApplicationRuntime.ElfSections.GeSectionName(section);
                con.WriteLine(name);
            }

            while (true)
            {
                SysCalls.ThreadSleep(0);

                //SysCalls.WriteDebugChar('~');
                var gotBytes = SysCalls.ReadFile(kb, buf);
                if (gotBytes > 0)
                {
                    for (var byteIdx = 0; byteIdx < gotBytes; byteIdx++)
                    {
                        var bufPtr = (byte *)buf.Start;
                        var key    = bufPtr[byteIdx];
                        var s      = key.ToString("x");
                        //for (var i = 0; i < s.Length; i++)
                        //    SysCalls.WriteDebugChar(s[i]);
                        //SysCalls.WriteDebugChar(' ');
                        for (var i = 0; i < s.Length; i++)
                        {
                            con.Write(s[i]);
                        }
                        con.Write(' ');
                    }
                }
                //SysCalls.WriteDebugChar('?');
            }
        }
コード例 #18
0
 public CommandBootstrap(ApplicationRuntime runtime)
 {
     _runtime = runtime;
 }