Пример #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            GPUData gd = new GPUData();

            gd.Update();
        }
Пример #2
0
        private static void GetGPUs()
        {
            try
            {
                ManagementObjectSearcher myVideoObject = new ManagementObjectSearcher("select * from Win32_VideoController");

                foreach (ManagementObject obj in myVideoObject.Get())
                {
                    Console.WriteLine("Name  -  " + obj["Name"]);
                    Console.WriteLine("AdapterRAM  -  " + obj["AdapterRAM"]);
                    Console.WriteLine("InstalledDisplayDrivers  -  " + obj["InstalledDisplayDrivers"]);
                    Console.WriteLine("DriverVersion  -  " + obj["DriverVersion"]);

                    var data = new GPUData()
                    {
                        Name          = obj["Name"].ToString(),
                        AdapterRAM    = obj["AdapterRAM"].ToString(),
                        DriverVersion = obj["DriverVersion"].ToString()
                    };

                    _AssetDataService.CreateGPUData(_MachineData.Id, data);
                }
            }
            catch (Exception e)
            {
                _AssetDataService.CreateError(_MachineData.Id, "GetGPUs", e);
            }
        }
        public void CreateGPUData(int probeDataId, GPUData data)
        {
            data.ProbeDataId = probeDataId;
            data.CreatedOn   = DateTime.UtcNow;

            _Context.GPUData.Add(data);
            _Context.SaveChanges();
        }
Пример #4
0
        public static void DebugReport(GPUData data)
        {
            double now  = Serilization.ConvertFrom2019();
            double diff = now - data.serverTime;

            Debug.LogFormat("Server time is {0:0.000000}, with delta {1:0.000000}", data.serverTime, data.deltaTime);
            Debug.LogFormat("Client time is {0:0.000000}", now);
            Debug.LogFormat("Diff is {0:0.000000}", diff);
        }
Пример #5
0
        IEnumerator Broadcast()
        {
            var socket  = SocketData.Make("localhost", 12345);
            var socket1 = SocketData.Make("localhost", 12346);
            //socket.endPoint.Address = IPAddress.Broadcast;
            //this.socket.Setup(UDPSocket<GPUData>.SocketRole.Broadcast);
            var data = new GPUData();

            while (true)
            {
                data.deltaTime  = Time.deltaTime;
                data.serverTime = Serilization.ConvertFrom2019();
                //this.socket.Send(socket, data);
                //this.socket.Send(socket1, data);
                this.socket.Broadcast(data, 12347);
                this.socket.Broadcast(data, 12348);
                yield return(new WaitForEndOfFrame());
            }
        }
Пример #6
0
        /// <summary>
        /// Generates a random GPU item.
        /// </summary>
        /// <returns></returns>
        public GPU LoadSingleItem()
        {
            CommonData commonData        = new CommonData();
            GPUData    gpuData           = new GPUData();
            int        chipsetMakerIndex = Faker.Number.RandomNumber(0, gpuData.ChipsetMakers.Count);

            GPU gpu = new GPU();

            gpu.Brand        = gpuData.Brands[Faker.Number.RandomNumber(0, gpuData.Brands.Count)];
            gpu.ChipsetMaker = gpuData.ChipsetMakers[chipsetMakerIndex];
            gpu.Name         = gpuData.Names[chipsetMakerIndex][Faker.Number.RandomNumber(0, gpuData.Names[chipsetMakerIndex].Count)];
            gpu.Description  = "Some GPU description";
            gpu.Condition    = commonData.Conditions[Faker.Number.RandomNumber(0, commonData.Conditions.Length)];
            gpu.Stock        = Faker.Number.RandomNumber(0, 51);
            gpu.Price        = Faker.Number.RandomNumber(60, 1020);
            gpu.MemoryAmount = gpuData.MemoryAmount[Faker.Number.RandomNumber(0, gpuData.MemoryAmount.Length)];
            gpu.VrReady      = Faker.Number.Bool();

            return(gpu);
        }
Пример #7
0
        public override void PrepareGPU(GraphicsDevice gd)
        {
            if (GPUData != null)
            {
                GPUData.Dispose();
            }
            if (VertGPUData != null)
            {
                VertGPUData.Dispose();
            }

            GenerateGeometry();

            GPUData = new IndexBuffer(gd, IndexElementSize.ThirtyTwoBits, Indices.Length, BufferUsage.None);
            GPUData.SetData(Indices);

            VertGPUData = new VertexBuffer(gd, typeof(TerrainParallaxVertex), Vertices.Length, BufferUsage.None);
            VertGPUData.SetData(Vertices);

            PrimitiveCount = Indices.Length / 3;
        }
Пример #8
0
    public void reset4()
    {
        for (int n = 160; n < data.Length; n += 161)
        {
            data[n] = "\n"[0];
        }

        update();

        _curline    = 0;
        _curscan    = 0;
        _linemode   = 2;
        _modeclocks = 0;
        _yscrl      = 0;
        _xscrl      = 0;
        _raster     = 0;

        _lcdon          = false;
        _bgon           = false;
        _winTransparent = true;


        _objsize = 8;
        for (int i = 0; i < 160; i++)
        {
            _scanrow[i] = 0;
        }

        for (int i = 0; i < 40; i++)
        {
            _objdata[i] = new GPUData(i);
        }

        // Set to values expected by BIOS, to start
        _bgtilebase = 0x0000;
        _bgmapbase  = 0x1800;

        //    Echo("GPU: Reset.");
    }
Пример #9
0
    public void checkline()
    {
        if (!this.draw && !this.startDraw && !this.ready)
        {
            return;
        }
        _modeclocks += z80.r.m;
        switch (_linemode)
        {
        case 0:                 // In hblank
        {
            if (_modeclocks >= 51)
            {
                // End of hblank for last scanline; render screen
                if (_curline == 143)
                {
                    _linemode = 1;
                    if (this.draw)
                    {
                        this.draw  = false;
                        this.ready = true;
                    }
                    else if (this.startDraw)
                    {
                        this.startDraw = false;
                        this.draw      = true;
                    }
//							mMU._if |= 1;
                }
                else
                {
                    _linemode = 2;
                }
                _curline++;
                _curscan   += 161;
                _modeclocks = 0;
            }
            break;
        }

        case 1:                 // In vblank
        {
            if (_modeclocks >= 114)
            {
                _modeclocks = 0;
                _curline++;
                if (_curline > 153)
                {
                    _curline  = 0;
                    _curscan  = 0;
                    _linemode = 2;
                }
            }
            break;
        }

        case 2:                 // In OAM-read mode
        {
            if (_modeclocks >= 20)
            {
                _modeclocks = 0;
                _linemode   = 3;
            }
            break;
        }

        case 3:                 // In VRAM-read mode
        {
            // Render scanline at end of allotted time
            if (_modeclocks >= 43)
            {
                _modeclocks = 0;
                _linemode   = 0;
                if (_lcdon)
                {
                    if (_bgon)
                    {
                        linebase = _curscan;
                        mapbase  = _bgmapbase + ((((_curline + _yscrl) & 0xFF) >> 0x03) << 0x05);
                        y        = (_curline + _yscrl) & 7;
                        x        = _xscrl & 7;
                        t        = (_xscrl >> 3) & 31;

                        if (_bgtilebase != 0)
                        {
                            tile = _vram [mapbase + t];
                            if (tile < 128)
                            {
                                tile = (256 + tile);
                            }
                            tilerow = _tilemap [tile] [y];
                            for (wpixel = 160; wpixel > 0; wpixel--)
                            {
                                _scanrow [159 - x] = tilerow [x];
                                data [linebase]    = bgPalette [tilerow [x]];
                                x++;
                                if (x == 8)
                                {
                                    t    = (t + 1) & 31;
                                    x    = 0;
                                    tile = _vram [mapbase + t];
                                    if (tile < 128)
                                    {
                                        tile = (256 + tile);
                                    }
                                    tilerow = _tilemap [tile] [y];
                                }
                                linebase++;
                            }
                        }
                        else
                        {
                            tilerow = _tilemap [_vram [mapbase + t]] [y];
                            for (wpixel = 160; wpixel > 0; wpixel--)
                            {
                                _scanrow [159 - x] = tilerow [x];
                                data [linebase]    = bgPalette [tilerow [x]];
                                x++;
                                if (x == 8)
                                {
                                    t       = (t + 1) & 31;
                                    x       = 0;
                                    tilerow = _tilemap [_vram [mapbase + t]] [y];
                                }
                                linebase++;
                            }
                        }
                    }
                    if (_winon && false)           // windows disabled for now until they are fixed
                    {
                        linebase = _curscan;
                        mapbase  = _winbase + ((((_curline + winy) & 0xFF) >> 0x03) << 0x05);
                        y        = (_curline + winy) & 7;
                        x        = winx & 7;
                        t        = (winx >> 3) & 31;

                        if (_winbase != 0)
                        {
                            tile = _vram [mapbase + t];
                            if (tile < 128)
                            {
                                tile = (256 + tile);
                            }
                            tilerow = _tilemap [tile] [y];
                            for (wpixel = 160; wpixel > 0; wpixel--)
                            {
                                _scanrow [159 - x] = tilerow [x];
                                if (!_winTransparent || bgPalette [tilerow [x]] != '\uE00F')
                                {
                                    data [linebase] = bgPalette [tilerow [x]];
                                }
                                x++;
                                if (x == 8)
                                {
                                    t    = (t + 1) & 31;
                                    x    = 0;
                                    tile = _vram [mapbase + t];
                                    if (tile < 128)
                                    {
                                        tile = (256 + tile);
                                    }
                                    tilerow = _tilemap [tile] [y];
                                }
                                linebase++;
                            }
                        }
                        else
                        {
                            tilerow = _tilemap [_vram [mapbase + t]] [y];
                            for (wpixel = 160; wpixel > 0; wpixel--)
                            {
                                _scanrow [159 - x] = tilerow [x];
                                if (!_winTransparent || bgPalette [tilerow [x]] != '\uE00F')
                                {
                                    data [linebase] = bgPalette [tilerow [x]];
                                }
                                x++;
                                if (x == 8)
                                {
                                    t       = (t + 1) & 31;
                                    x       = 0;
                                    tilerow = _tilemap [_vram [mapbase + t]] [y];
                                }
                                linebase++;
                            }
                        }
                    }
                    //if (_objon)
                    {
                        //		cnt = 0;
                        linebase   = _curscan;
                        curline161 = _curline * 161;
                        for (i = 0; i < 40; i++)
                        {
                            obj = _objdata [i];
                            if (obj.y <= _curline && (obj.y + _objsize) > _curline)
                            {
                                if (obj.yflip > 0)
                                {
                                    tilerow = _tilemap [obj.tile + ((((_objsize - 1 - (_curline - obj.y))) > 7)?1:0)] [(_objsize - 1 - (_curline - obj.y)) % 8];
                                }
                                else
                                {
                                    tilerow = _tilemap [obj.tile + (((_curline - obj.y) > 7)?1:0)] [(_curline - obj.y) % 8];
                                }


                                if (obj.palette > 0)
                                {
                                    pal = obj1Palette;
                                }
                                else
                                {
                                    pal = obj0Palette;
                                }

                                linebase = (curline161 + obj.x);
                                if (obj.xflip > 0)
                                {
                                    for (x = 0; x < 8; x++)
                                    {
                                        if (obj.x + x >= 0 && obj.x + x < 160)
                                        {
                                            if (tilerow [7 - x] > 0 && (obj.prio > 0 || !(_scanrow [x] > 0)))
                                            {
                                                data [linebase] = pal [tilerow [7 - x]];
                                            }
                                        }
                                        linebase++;
                                    }
                                }
                                else
                                {
                                    for (x = 0; x < 8; x++)
                                    {
                                        if (obj.x + x >= 0 && obj.x + x < 160)
                                        {
                                            if (tilerow [x] > 0 && (obj.prio > 0 || !(_scanrow [x] > 0)))
                                            {
                                                data [linebase] = pal [tilerow [x]];
                                            }
                                        }
                                        linebase++;
                                    }
                                }
                                //      cnt++;
                                //   if (cnt > 10)
                                //       break;
                            }
                        }
                    }
                }
            }
            break;
        }
        }
    }