//------------------------------------------------------------------------------------------------------------------------
    //														ARKANOID
    //------------------------------------------------------------------------------------------------------------------------
    private void LoadArkanoidMenu()
    {
        GXPEngine.OpenGL.GL.glfwSetWindowTitle("The Homebox Arcade - Arkanoid");
        Console.WriteLine("Loading Arkanoid");
        if (_mainHub != null)
        {
            _mainHub.LateDestroy();
            _mainHub = null;
            _backgroundMusicChannel.Stop();
        }

        if (_aDeathScreen != null)
        {
            _aDeathScreen.LateDestroy();
            _aDeathScreen = null;
        }

        if (_aLevelOne != null)
        {
            _aLevelOne.LateDestroy();
            _aLevelOne = null;
        }

        if (_aWinScreen != null)
        {
            _aWinScreen.LateDestroy();
            _aWinScreen = null;
        }

        _arkanoid = new MainMenuScreenArkanoid(this);
        LateAddChild(_arkanoid);
        Console.WriteLine("Arkanoid Loaded!");
    }
Beispiel #2
0
        public ModuleHubWrapper(string id, MainHub parentHub)
        {
            ConnectionId = id;
            MainHub.UpdatedMachineInfo += ParentHub_UpdatedMachineInfo;
            MainHub.UpdateMachineLoad  += ParentHub_UpdateMachineLoad;

            TargedModule = new Module(id);
            Load         = new MachineLoad();
        }
Beispiel #3
0
        /// <summary>
        /// Returns a list of currently alive opponents to caller
        /// </summary>
        /// <returns></returns>
        public List <LeaderboardEntryData> GetLeaderBoard()
        {
            List <LeaderboardEntryData> leaderBoard = new List <LeaderboardEntryData>();

            foreach (PlayerDTO currentPlayer in MainHub.getLeaderBoard())
            {
                leaderBoard.Add(new LeaderboardEntryData()
                {
                    score = currentPlayer.Wallet.ToString(), userName = currentPlayer.Name
                });
            }
            return(leaderBoard);
        }
    //------------------------------------------------------------------------------------------------------------------------
    //														LoadMain()
    //------------------------------------------------------------------------------------------------------------------------
    private void LoadMain()
    {
        GXPEngine.OpenGL.GL.glfwSetWindowTitle("The Homebox Arcade - Main Hub");
        Console.WriteLine("Loading Main Hub");

        RemoveInstancesForMain();

        _mainMenu = null;

        _mainHub = new MainHub(this);
        LateAddChild(_mainHub);

        Sound backgroundMusic = new Sound("Sounds/MainHub.mp3", true, true);

        _backgroundMusicChannel        = backgroundMusic.Play();
        _backgroundMusicChannel.Volume = 1f;

        Console.WriteLine("Main Hub Loaded!");
    }
    //------------------------------------------------------------------------------------------------------------------------
    //														LoadBar()
    //------------------------------------------------------------------------------------------------------------------------
    private void LoadBar()
    {
        GXPEngine.OpenGL.GL.glfwSetWindowTitle("The Homebox Arcade - Multiplayer Hub");
        Console.WriteLine("Loading Bar");
        if (_mainHub != null)
        {
            _mainHub.LateDestroy();
            _mainHub = null;
            _backgroundMusicChannel.Stop();
        }

        _barHub = new BarHub(this);
        LateAddChild(_barHub);

        Sound backgroundMusic = new Sound("Sounds/MultiplayerHub.mp3", true, true);

        _backgroundMusicChannel        = backgroundMusic.Play();
        _backgroundMusicChannel.Volume = 1f;

        Console.WriteLine("Bar Loaded!");
    }
    //------------------------------------------------------------------------------------------------------------------------
    //														ROAD RACER
    //------------------------------------------------------------------------------------------------------------------------
    private void LoadRoadRaceMenu()
    {
        GXPEngine.OpenGL.GL.glfwSetWindowTitle("The Homebox Arcade - Road Racer");
        Console.WriteLine("Loading Race");
        if (_mainHub != null)
        {
            _mainHub.LateDestroy();
            _mainHub = null;
            _backgroundMusicChannel.Stop();
        }

        if (_rDeathScreen != null)
        {
            _rDeathScreen.LateDestroy();
            _rDeathScreen = null;
        }

        _roadRacer = new MainMenuRoadRacer(this);
        LateAddChild(_roadRacer);
        Console.WriteLine("Race Loaded!");
    }
Beispiel #7
0
        public unsafe void int_10()
        {
            const int vga_vmemsize = 0x200000;

            switch (ah.UInt16)
            {
            case 0x0f:
                ah = 0x50;  // width in char
                al = 0x3;   // video mode
                bh = 0;     // page
                break;

            case 0x4f:     // VESA Calls
                switch (al.UInt16)
                {
                case 0x01:         // Get SVGA Mode Information
                {
                    if (cx != 0x101)
                    {
                        throw new NotImplementedException();
                    }

                    al = 0x4f;
                    ah = 0;         // success

                    {
                        var page_size = 640 * 480;
                        page_size = page_size & (~15);

                        ushort mode_attr = 0x9b;

                        var span = Memory.GetFixSize(es, di, Marshal.SizeOf <mode_info>());
                        span.Clear();

                        ref var mi = ref Memory.Ref <mode_info>(es[di]);

                        mi.BytesPerScanLine = 640;
                        mi.NumberOfPlanes   = 1;
                        mi.BitsPerPixel     = 8;
                        mi.MemoryModel      = 4;
                        mi.WinAAttributes   = 7;

                        if (vga_vmemsize < page_size)
                        {
                            throw new NotImplementedException();
                        }
                        else
                        {
                            mi.ModeAttributes     = mode_attr;
                            mi.NumberOfImagePages = (byte)((vga_vmemsize / page_size) - 1);
                        }

                        mi.WinGranularity = 64;
                        mi.WinSize        = 64;
                        mi.WinASegment    = 0xa000;
                        mi.XResolution    = 640;
                        mi.YResolution    = 480;

                        if (added_callback_setwindow == false)
                        {
                            RawProgramMain.AddInternalDynamicMethod(callback_setwindow, 16, 0xf0001320);
                            added_callback_setwindow = true;
                        }

                        mi.WinFuncPtr    = 0xf0001320;
                        mi.NumberOfBanks = 1;
                        mi.Reserved_page = 1;
                        mi.XCharSize     = 8;
                        mi.YCharSize     = 16;
                        mi.PhysBasePtr   = 0;
                    }

                    break;
                }

                case 0x02:         // Set videomode
                {
                    if (bx != 0x101)
                    {
                        throw new NotImplementedException();
                    }

                    al = 0x4f;
                    ah = 0;         // success

                    // /* mode  ,type     ,sw  ,sh  ,tw ,th ,cw,ch ,pt,pstart  ,plength,htot,vtot,hde,vde special flags */
                    //{ 0x101  ,M_LIN8   ,640 ,480 ,80 ,30 ,8 ,16 ,1 ,0xa0000 ,0x10000,100 ,525 ,80 ,480 ,0    },

                    break;
                }

                case 0x05:
                {
                    if (bh != 0)
                    {
                        throw new NotImplementedException();
                    }

                    // ah = SetCPUWindow(bl, dl); (window, address)

                    if (bl != 0)
                    {
                        ah = 1;
                    }
                    else
                    {
                        if (dl.Int32 * 0x10000 < vga_vmemsize)
                        {
                            ah = 0;
                            // out(0x3d4, 0x6a)
                            // out(0x3d5, dl)
                            // std::cerr << static_cast<uint>(dl) << std::endl;


                            var curr_bank = ((Memory)Memory)
                                            .mem_phys_raw(0xa0000, 0x10000)
                                            .Slice(0, 0x10000);


                            var offset = 3 * curr_bank_num * 0x10000;
                            for (var i = 0; i < 0x10000; i++)
                            {
                                if (img_data.Length <= offset + 3 * i + 2)
                                {
                                    break;
                                }

                                var c = curr_bank[i];

#if false
                                img_data[offset + 3 * i + 0] = c;
                                img_data[offset + 3 * i + 1] = c;
                                img_data[offset + 3 * i + 2] = c;
#else
                                img_data[offset + 3 * i + 2] = pal[c].rgb[2];
                                img_data[offset + 3 * i + 1] = pal[c].rgb[1];
                                img_data[offset + 3 * i + 0] = pal[c].rgb[0];
#endif
                            }

                            //if (dl == 0)
                            {
                                //var width = 640;
                                //var height = 480;

                                var ms         = new MemoryStream();
                                var nimg       = Image.LoadPixelData <Rgb24>(img_data, buf_width, buf_height);
                                var pngEncoder = new PngEncoder();
                                pngEncoder.CompressionLevel = 1;
                                pngEncoder.Encode(nimg, ms);
                                PngBytes = ms.ToArray();

                                var forgot = MainHub.SendClientUpdateImage(RawProgramMain.ServiceProvider);

                                fileNum++;
                                if (!string.IsNullOrEmpty(RawProgramMain.Configuration.Dos.PngOutput))
                                {
                                    var pngOutput = RawProgramMain.Configuration.Dos.PngOutput;
                                    var filePath  = Path.Combine(pngOutput, $"img-{fileNum:D4}.png");
                                    File.WriteAllBytes(filePath, PngBytes);
                                }

                                var time = DateTime.Now.TimeOfDay;
                                time = new TimeSpan(0, time.Hours, time.Minutes, time.Seconds, time.Milliseconds / 10 * 10);
                                NonBlockingConsole.WriteLine($"    Screen. Time: {time:hh\\:mm\\:ss\\.ff}, Number: {fileNum}.");
                            }


                            var need_cpy = (curr_bank_num * 0x10000 < all_banks.Length);

                            if (need_cpy)
                            {
                                curr_bank.CopyTo(all_banks.AsSpan(curr_bank_num * 0x10000));
                            }

                            curr_bank_num = dl.UInt16;

                            if (need_cpy)
                            {
                                all_banks.AsSpan().Slice(curr_bank_num * 0x10000, 0x10000).CopyTo(curr_bank);
                            }
                        }
                        else
                        {
                            ah = 1;
                        }
                    }

                    al = 0x4f;
                    break;
                }

                default:
                    throw new NotImplementedException();
                }

                break;
 private void testbutton2_Click(object sender, RoutedEventArgs e)
 {
     MainHub.ScrollToSection(HS2);
 }
Beispiel #9
0
    public ConversationBox(string file, MainHub _tempHub)
    {
        _mainHub = _tempHub;

        InitializeBox(file);
    }
Beispiel #10
0
 private void Button1_Click(object sender, RoutedEventArgs e)
 {
     MainHub.ScrollToSection(Hub2);
 }
Beispiel #11
0
 public UserController(IUserRepository user, IMessageRepository message)
 {
     _user       = user;
     _message    = message;
     _hubContext = new MainHub();
 }
Beispiel #12
0
        public async Task SelectTargetModule(DNet_DataContracts.Processing.Task task, MainHub hubInstance)
        {
            var modules = MainHub.Modules
                          .Where(x => task.ModuleType.Contains(x.TargedModule.ModuleType))                    //determine comparible module types
                          .OrderByDescending(x => x.TargedModule.ModulesHostSpecs.PerformancePoint).ToList(); //sort by performance points

            //var oldModuleInfo = modules.Where(x => (DateTime.Now - x.LastLoadUpdate).TotalSeconds > 30); //detect old info modules

            //await hubInstance.RequestLoadUpdate(oldModuleInfo); //Collect all load from potential modules

            //await _taskEvaluationAlghoritm.EvaluateTask(task, modules);

            //foreach(var oldModule in oldModuleInfo)
            //{
            //    oldModule.WaitTillGetNewLoadInfo();
            //}

            //modules = modules.OrderBy(x => x.Load.CPULoad).ToList();

            var module = modules.First();

            task.Executor = module.TargedModule;
            await hubInstance.SendTask(module.ConnectionId, task);
        }
 public static object CreateMainHub(IUnityContainer container)
 {
     var hub = new MainHub(HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>());
     return hub;
 }