Exemple #1
0
        //public virtual ResourceForUpload[] GetResourcesForUpload(Display display,
        //    ResourceDescriptor[] resourceDescriptors,
        //    out bool isEnoughFreeSpace)
        //{
        //    isEnoughFreeSpace = true;
        //    return new ResourceForUpload[] { };
        //}

        public virtual ResourceDescriptor[] GetResourcesForUpload(DisplayType displayType,
                                                                  ResourceDescriptor[] resourceDescriptors,
                                                                  out bool isEnoughFreeSpace)
        {
            isEnoughFreeSpace = true;
            return new ResourceDescriptor[] { };
        }
Exemple #2
0
 public HexRender(DisplayType displayType, int height, Point worldCenter)
     : this()
 {
     this.worldCenter = worldCenter;
     this.DisplayType = displayType;
     this.height = height;
 }
        /// <summary>
        /// Constructs an authorize url.
        /// </summary>
        public static string BuildAuthorizeUrl(
            string clientId, 
            string redirectUrl, 
            IEnumerable<string> scopes, 
            ResponseType responseType,
            DisplayType display,
            ThemeType theme,
            string locale,
            string state)
        {
            Debug.Assert(!string.IsNullOrEmpty(clientId));
            Debug.Assert(!string.IsNullOrEmpty(redirectUrl));
            Debug.Assert(!string.IsNullOrEmpty(locale));

            IDictionary<string, string> options = new Dictionary<string, string>();
            options[AuthConstants.ClientId] = clientId;
            options[AuthConstants.Callback] = redirectUrl;
            options[AuthConstants.Scope] = BuildScopeString(scopes);
            options[AuthConstants.ResponseType] = responseType.ToString().ToLowerInvariant();
            options[AuthConstants.Display] = display.ToString().ToLowerInvariant();
            options[AuthConstants.Locale] = locale;
            options[AuthConstants.ClientState] = EncodeAppRequestState(state);

            if (theme != ThemeType.None)
            {
                options[AuthConstants.Theme] = theme.ToString().ToLowerInvariant();
            }

            return BuildAuthUrl(AuthEndpointsInfo.AuthorizePath, options);
        }
 protected internal CompatibilitySourceToDispPair(DisplayType disp, SourceType source,
                                                  Func<Mapping, SourceType, bool> linkPredicate,
                                                  Func<Mapping> createMappingFunc)
     : base(disp, source, linkPredicate, createMappingFunc)
 {
     _jupiterIn = null;
 }
        public SGLcd(string portName, DisplayType displayType)
        {
            // Defaults for SerialPort are the same as the settings for the LCD, but I'll set them explicitly
            _serialPort = new SerialPort(portName, 115200, Parity.None, 8, StopBits.One);

            _displayType = displayType;
        }
Exemple #6
0
 public CreatureList(int initialPage, DisplayType displayType, string sortedHeader, bool desc) {
     this.currentPage = initialPage;
     this.displayType = displayType;
     this.sortedHeader = sortedHeader;
     this.desc = desc;
     objects = null;
     InitializeComponent();
 }
 public DisplayedMolecule(string codeName, string realName, string val, DisplayType displayType = DisplayType.MOLECULELIST)
 {
   _updated = true;
   _codeName = codeName;
   _realName = realName;
   _val = val;
   _displayType = displayType;
 }
        public DisplayMatch(OrganizerViewModel ovm, ObservableMatch match, DisplayType displayType)
        {
            Match = match;
            MatchDisplayType = displayType;

            //Modify ViewModel state when an action is initiated
            Action startAction = () =>
            {
                ovm.ErrorMessage = null;
                ovm.IsBusy = true;
            };

            //Modify ViewModel state when an action is completed
            Action endAction = () =>
            {
                ovm.IsBusy = false;
            };

            //Modify ViewModel state when an action comes back with an exception
            Action<Exception> errorHandler = ex =>
            {
                if (ex.InnerException is ChallongeApiException)
                {
                    var cApiEx = (ChallongeApiException)ex.InnerException;

                    if (cApiEx.Errors != null) ovm.ErrorMessage = cApiEx.Errors.Aggregate((one, two) => one + "\r\n" + two);
                    else ovm.ErrorMessage = string.Format("Error with ResponseStatus \"{0}\" and StatusCode \"{1}\". {2}", cApiEx.RestResponse.ResponseStatus,
                        cApiEx.RestResponse.StatusCode, cApiEx.RestResponse.ErrorMessage);
                }
                else
                {
                    ovm.ErrorMessage = ex.NewLineDelimitedMessages();
                }

                ovm.IsBusy = false;
            };

            Player1Wins = Command.CreateAsync(() => true, () => Match.ReportPlayer1Victory(SetScore.Create(1, 0)), startAction, endAction, errorHandler);
            Player2Wins = Command.CreateAsync(() => true, () => Match.ReportPlayer2Victory(SetScore.Create(0, 1)), startAction, endAction, errorHandler);

            Player1WinsScored = Command.CreateAsync<SetScore[]>(_ => true, scores => Match.ReportPlayer1Victory(scores), _ => startAction(), _ => endAction(), (_, ex) => errorHandler(ex));
            Player2WinsScored = Command.CreateAsync<SetScore[]>(_ => true, scores => Match.ReportPlayer2Victory(scores), _ => startAction(), _ => endAction(), (_, ex) => errorHandler(ex));

            Player1ToggleMissing = Command.CreateAsync(() => true, () => Match.Player1.IsMissing = !Match.Player1.IsMissing, startAction, endAction, errorHandler);
            Player2ToggleMissing = Command.CreateAsync(() => true, () => Match.Player2.IsMissing = !Match.Player2.IsMissing, startAction, endAction, errorHandler);

            AssignStation = Command.CreateAsync<Station>(_ => true, s => Match.AssignPlayersToStation(s.Name), _ => startAction(), _ => endAction(), (_, ex) => errorHandler(ex));
            CallMatchAnywhere = Command.CreateAsync(() => true, () => Match.AssignPlayersToStation("Any"), startAction, endAction, errorHandler);
            CallMatch = Command.CreateAsync<Station>(_ => true, s =>
            {
                if (!match.IsMatchInProgress)
                {
                    if (s != null) Match.AssignPlayersToStation(s.Name);
                    else Match.AssignPlayersToStation("Any");
                }
            }, _ => startAction(), _ => endAction(), (_, ex) => errorHandler(ex));
            UncallMatch = Command.CreateAsync(() => true, () => Match.ClearStationAssignment(), startAction, endAction, errorHandler);
        }
 private void NotEnoughSpaceRequest(DisplayType displayType)
 {
     // запишем в лог - ответ продолжить
     _config.EventLog.WriteWarning(string.Format("На агенте {0} закончилось свободное место", displayType.Name));
     if (_showPreparator != null)
     {
         _showPreparator.ResponseForNotEnoughFreeSpaceRequest(displayType, AgentAction.Continue);
     }
 }
Exemple #10
0
 //Constructors
 public Laptop(int price, string model, string manufacturer, int displaySize, string processor, int ramMemory, string video, DisplayType type)
     : base(price, model, manufacturer)
 {
     this.displaySize = displaySize;
     this.processor = processor;
     this.ramMemory = ramMemory;
     this.video = video;
     this.typeOfLaptopDisplay = type;
 }
Exemple #11
0
        /// <summary>
        /// Initializes a new WPF window.
        /// </summary>
        /// <param name="displayType">Type of the message received from security API which is used to decide controls to be displayed on the screen.</param>
        public SecurityPortal(DisplayType displayType)
        {
            InitializeComponent();

            m_displayType = displayType;

            Closed += Window_Closed;
            MouseDown += Window_MouseDown;
            ButtonLogin.Click += ButtonLogin_Click;
            ButtonExit.Click += ButtonExit_Click;
            ButtonOK.Click += ButtonOK_Click;
            ButtonChange.Click += ButtonChange_Click;
            ButtonChangePasswordLink.Click += ButtonChangePasswordLink_Click;
            ButtonForgotPasswordLink.Click += ButtonForgotPasswordLink_Click;
            ButtonLoginLink.Click += ButtonLoginLink_Click;
            TextBoxUserName.TextChanged += TextBox_TextChanged;
            TextBoxPassword.PasswordChanged += PasswordBox_PasswordChanged;
            TextBoxChangePasswordUserName.TextChanged += TextBox_TextChanged;
            TextBoxOldPassword.PasswordChanged += PasswordBox_PasswordChanged;
            TextBoxNewPassword.PasswordChanged += PasswordBox_PasswordChanged;
            TextBoxConfirmPassword.PasswordChanged += PasswordBox_PasswordChanged;
            TextBoxUserName.GotFocus += TextBox_GotFocus;
            TextBoxPassword.GotFocus += TextBox_GotFocus;
            TextBoxChangePasswordUserName.GotFocus += TextBox_GotFocus;
            TextBoxOldPassword.GotFocus += TextBox_GotFocus;
            TextBoxNewPassword.GotFocus += TextBox_GotFocus;
            TextBoxConfirmPassword.GotFocus += TextBox_GotFocus;

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            ConfigurationFile config = ConfigurationFile.Current;
            CategorizedSettingsElementCollection settings = config.Settings[SecurityProviderBase.DefaultSettingsCategory];
            string setting = settings["ApplicationName"].Value;

            if (!string.IsNullOrWhiteSpace(setting))
            {
                TextBlockApplicationLogin.Text = setting + " :: Login";
                TextBlockAccessDenied.Text = setting + " :: Access Denied";
                TextBlockChangePassword.Text = setting + " :: Change Password";
            }

            // Load last user login ID setting
            settings.Add("LastLoginID", Thread.CurrentPrincipal.Identity.Name, "Last user login ID", false, SettingScope.User);
            setting = settings["LastLoginID"].Value;

            if (string.IsNullOrWhiteSpace(setting))
                setting = Thread.CurrentPrincipal.Identity.Name;

            TextBoxUserName.Text = setting;

            // Inititialize screen
            ClearErrorMessage();
            ManageScreenVisualization();

            // Open this window on top of all other windows
            Topmost = true;
        }
 protected internal CompatibilityDispToSourcePair(DisplayType disp, SourceType source,
                                                  Func<Mapping, SourceType, bool> linkPredicate,
                                                  Func<Mapping> createMappingFunc)
 {
     _linkPredicate = linkPredicate;
     _createMappingFunc = createMappingFunc;
     Source = source;
     _disp = disp;
     _Compatible = _disp.MappingList.Exists(m => _linkPredicate(m, Source));
 }
 /// <summary>
 /// Constructs an authorize url.
 /// </summary>
 public static string BuildWebAuthorizeUrl(
     string clientId,
     string redirectUrl,
     IEnumerable<string> scopes,
     DisplayType display,
     string locale,
     string state)
 {
     return BuildAuthorizeUrl(clientId, redirectUrl, scopes, ResponseType.Code, display, ThemeType.None, locale, state);
 }
Exemple #14
0
 protected Display2Field Display2Fields(DisplayType dT, params FieldType[] fT)
 {
     Display2Field field = new Display2Field();
     List<FieldType> list = new List<FieldType>();
     foreach (FieldType type in fT)
     {
         list.Add(type);
     }
     field.Display = dT;
     field.Fields = list;
     return field;
 }
Exemple #15
0
		public static string DisplayTypeToString(DisplayType type)
		{
			switch (type)
			{
				default:
					return type.ToString();
				case DisplayType.FixedPoint_12_4:
					return "Fixed Point 12.4";
				case DisplayType.FixedPoint_20_12:
					return "Fixed Point 20.12";
			}
		}
Exemple #16
0
        public bool Init(DisplayType display, TechnicalServices.Persistence.SystemPersistence.Presentation.Window window)
        {
            this.InitBorderTitle(window, panel1);
            ActiveWindow activeWindow = window as ActiveWindow;
            if (activeWindow != null)
            {
                _croppingBottom = activeWindow.CroppingBottom;
                _croppingLeft = activeWindow.CroppingLeft;
                _croppingRight = activeWindow.CroppingRight;
                _croppingTop = activeWindow.CroppingTop;
            }

            return true;
        }
Exemple #17
0
 public string GetAuthorizeUrl(string state, string scope = null, DisplayType display = DisplayType.Default, int gut = 1)
 {
     var config = new Dictionary<string, string>(){
                                                     {"response_type", "code"},
                                                     {"client_id", AppKey},
                                                     {"redirect_uri", CallbackUrl},
                                                     {"state", state ?? string.Empty},
                                                     {"scope", scope ?? string.Empty},
                                                     {"display", display.ToString().ToLower()},
                                                     {"g_ut", gut.ToString()}
                                                 };
     var builder = new UriBuilder(AuthorizeUrl) { Query = Utility.BuildQueryString(config) };
     return builder.ToString();
 }
Exemple #18
0
		/// <summary>
		/// Inialize a new instance of <see cref="WordWatch"/>
		/// </summary>
		/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
		/// <param name="address">The address you want to track</param>
		/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param>
		/// <param name="bigEndian">Specify the endianess. true for big endian</param>
		/// <param name="note">A custom note about the <see cref="Watch"/></param>
		/// <param name="value">Current value</param>
		/// <param name="previous">Previous value</param>
		/// <param name="changeCount">How many times value has changed</param>
		/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.Word"/></exception>
		internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount)
			: base(domain, address, WatchSize.Word, type, bigEndian, note)
		{
			if (value == 0)
			{
				this._value = GetWord();
			}
			else
			{
				this._value = value;
			}
			this._previous = previous;
			this._changecount = changeCount;
		}
Exemple #19
0
        public ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string notes)
        {
            _address = address;
            _domain = domain;
            _value = _previous = GetByte();
            if (AvailableTypes(WatchSize.Byte).Contains(type))
            {
                _type = type;
            }

            _bigEndian = bigEndian;
            if (notes != null)
            {
                Notes = notes;
            }
        }
 public SimulationContextMenuView(TreeNode node, OtherSubSysInterface subSys, UserInformationInMap userInfo, SimGroupManager groupManager, IApplicationContext appContext)
 {
     this.components = null;
     this.simGroupIndex = 0;
     this.isfirst = true;
     this.FT = FieldType.State;
     this.DT = DisplayType.DiscreteValues;
     this.calculatFlag = false;
     this.isFirstAddGroup = false;
     this.m_SubSysInterface = subSys;
     this.m_UserInfo = userInfo;
     this.m_SimGroupManager = groupManager;
     this.m_ParentNode = node;
     this.AppContext = appContext;
     this.InitializeComponent();
     this.Init();
 }
        public void DisplayCards(DisplayType dt)
        {
            RemoveAllControls();

            try
            {
                _trackCodeList.Clear();
                List<string> filename = DailyCard.ExistingFilesOnlyForFuture;

                string txt = "";
                for (int i = filename.Count - 1; i >= 0; --i)
                {
                    string s = filename[i];

                    if(FileHasDateInThePast(s))
                        continue;

                    var ofn = new OddsFilename(s);

                    if (dt == DisplayType.All)
                    {
                        txt = "Displaying All Available Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                    else if (dt == DisplayType.Today && ofn.IsTodaysCard)
                    {
                        txt = "Displaying Only Today's Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                    else if (dt == DisplayType.Future && ofn.IsFutureCard)
                    {
                        txt = "Displaying Future's Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                }

                _labelDisplayType.Text = string.Format("{0}        (Total Number of Races: {1})       ", txt, _totalNumberOfRacesInTheDataBase);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// Contains all options to run a portrait command.
        /// </summary>
        /// <param name="useDefaultSettings">Will use stage default times for animation and fade</param>
        public PortraitOptions(bool useDefaultSettings = true)
        {
            character = null;
            replacedCharacter = null;
            portrait = null;
            display = DisplayType.None;
            offset = PositionOffset.None;
            fromPosition = null;
            toPosition = null;
            facing = FacingDirection.None;
            shiftOffset = new Vector2(0, 0);
            move = false;
            shiftIntoPlace = false;
            waitUntilFinished = false;
            onComplete = null;

            // Special values that can be overridden
            fadeDuration = 0.5f;
            moveDuration = 1f;
            this.useDefaultSettings = useDefaultSettings;
        }
		public ForgeEditorDisplayObject(string info, DisplayType type, GUIStyle bold, GUIStyle regular)
		{
			DisplayInfoType = type;
			boldWhite = bold;
			regularWhite = regular;

			switch (DisplayInfoType)
			{
				case DisplayType.Header:
					DisplayInfo = info.Replace("<h1>", string.Empty).Replace("</h1>", string.Empty);
					break;
				case DisplayType.Paragraph:
					DisplayInfo = info.Replace("<p>", string.Empty).Replace("</p>", string.Empty);
					break;
				case DisplayType.Video:
					string videoTitle = info.Remove(0, "<video title=\"".Length);
					videoTitle = videoTitle.Remove(videoTitle.IndexOf("\">"), videoTitle.Length - videoTitle.IndexOf("\">"));
					string videoID = info.Remove(0, info.IndexOf("\">") + "\">".Length);
					videoID = videoID.Remove(videoID.IndexOf("</video>"), videoID.Length - videoID.IndexOf("</video>"));
					DisplayInfo = videoTitle;
					imageID = videoID;
					imageUrl = YOUTUBE_URL.Replace("<id>", videoID);
					HTTP imageRequest = new HTTP(YOUTUBE_THUMBNAIL_ENDPOINT.Replace("<id>", imageID));
					imageRequest.GetImage(RetreiveImageResponse);
					break;
				case DisplayType.AssetImage:
					string assetImage = info.Remove(0, "<asset image=\"".Length);
					assetImage = assetImage.Remove(assetImage.IndexOf("\">"), assetImage.Length - assetImage.IndexOf("\">"));
					string assetURL = info.Remove(0, info.IndexOf("\">") + "\">".Length);
					assetURL = assetURL.Remove(assetURL.IndexOf("</asset>"), assetURL.Length - assetURL.IndexOf("</asset>"));
					imageUrl = assetURL;
					//Debug.Log("Attempting to load: " + assetImage);
					HTTP assetRequest = new HTTP(assetImage);
					assetRequest.GetImage(RetreiveImageAssetResponse);
					break;
			}
		}
 public IntPtr ShowWindow(DisplayType display, Window window)
 {
     if (InvokeRequired)
     {
         return this.AsyncInvokeResult<DisplayType, Window, IntPtr>(ShowWindow, display, window);
     }
     else
     {
         try
         {
             bool needProcessing;
             Form form = _creator.CreateForm(display, window, out needProcessing);
             if (form == null) return IntPtr.Zero;
             form.FormClosed += ViewFormClosed;
             form.Top = window.Top;
             form.Left = window.Left;
             form.Width = window.Width;
             form.Height = window.Height;
             form.TopMost = true;
             if (window is ActiveWindow && needProcessing)
             {
                 ActiveWindow wnd = (ActiveWindow) window;
                 form.Text = wnd.TitleText;
                 form.FormBorderStyle = (wnd.BorderVisible) ? FormBorderStyle.FixedSingle : FormBorderStyle;
             }
             form.Show( /*this*/);
             _list.Add(form.Handle, form);
             return form.Handle;
         }
         catch(Exception ex)
         {
             WriteErrorToFile(ex);
             return IntPtr.Zero;
         }
     }
 }
        /// <summary>
        /// Use the Monitor.Log static function to attach information to a transform.
        /// </summary>
        /// <returns>The log.</returns>
        /// <param name="key">The name of the information you wish to Log.</param>
        /// <param name="value">The array of float you want to display.</param>
        /// <param name="displayType">The type of display.</param>
        /// <param name="target">The transform you want to attach the information to.
        /// </param>
        /// <param name="camera">Camera used to calculate GUI position relative to
        /// the target. If null, `Camera.main` will be used.</param>
        public static void Log(
            string key,
            float[] value,
            Transform target        = null,
            DisplayType displayType = DisplayType.Independent,
            Camera camera           = null
            )
        {
            if (!s_IsInstantiated)
            {
                InstantiateCanvas();
                s_IsInstantiated = true;
            }

            if (target == null)
            {
                target = s_Canvas.transform;
            }

            s_TransformCamera[target] = camera;

            if (!s_DisplayTransformValues.Keys.Contains(target))
            {
                s_DisplayTransformValues[target] = new Dictionary <string, DisplayValue>();
            }

            var displayValues = s_DisplayTransformValues[target];

            if (!displayValues.ContainsKey(key))
            {
                var dv = new DisplayValue();
                dv.time             = Time.timeSinceLevelLoad;
                dv.floatArrayValues = value;
                if (displayType == DisplayType.Independent)
                {
                    dv.valueType = DisplayValue.ValueType.FloatarrayIndependent;
                }
                else
                {
                    dv.valueType = DisplayValue.ValueType.FloatarrayProportion;
                }

                displayValues[key] = dv;
                while (displayValues.Count > 20)
                {
                    var max = (
                        displayValues.Aggregate((l, r) => l.Value.time < r.Value.time ? l : r).Key);
                    RemoveValue(target, max);
                }
            }
            else
            {
                var dv = displayValues[key];
                dv.floatArrayValues = value;
                if (displayType == DisplayType.Independent)
                {
                    dv.valueType = DisplayValue.ValueType.FloatarrayIndependent;
                }
                else
                {
                    dv.valueType = DisplayValue.ValueType.FloatarrayProportion;
                }

                displayValues[key] = dv;
            }
        }
Exemple #26
0
 public Display(DisplayType displayType, double inches, TouchScreenType screenType, int colors)
     : this(displayType, inches, colors)
 {
     this.TouchScreenType = screenType;
     this.screenTypeSet = true;
 }
Exemple #27
0
        public void HardReset()
        {
            cpu = new MOS6502X();
            cpu.SetCallbacks(ReadMemory, ReadMemory, PeekMemory, WriteMemory);

            cpu.BCD_Enabled = false;
            cpu.OnExecFetch = ExecFetch;
            ppu             = new PPU(this);
            ram             = new byte[0x800];
            CIRAM           = new byte[0x800];

            // wire controllers
            // todo: allow changing this
            ControllerDeck = ControllerSettings.Instantiate(ppu.LightGunCallback);
            // set controller definition first time only
            if (ControllerDefinition == null)
            {
                ControllerDefinition      = new ControllerDefinition(ControllerDeck.GetDefinition());
                ControllerDefinition.Name = "NES Controller";
                // controls other than the deck
                ControllerDefinition.BoolButtons.Add("Power");
                ControllerDefinition.BoolButtons.Add("Reset");
                if (Board is FDS)
                {
                    var b = Board as FDS;
                    ControllerDefinition.BoolButtons.Add("FDS Eject");
                    for (int i = 0; i < b.NumSides; i++)
                    {
                        ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
                    }
                }
            }

            // don't replace the magicSoundProvider on reset, as it's not needed
            // if (magicSoundProvider != null) magicSoundProvider.Dispose();

            // set up region
            switch (_display_type)
            {
            case Common.DisplayType.PAL:
                apu               = new APU(this, apu, true);
                ppu.region        = PPU.Region.PAL;
                CoreComm.VsyncNum = 50;
                CoreComm.VsyncDen = 1;
                cpuclockrate      = 1662607;
                cpu_sequence      = cpu_sequence_PAL;
                _display_type     = DisplayType.PAL;
                break;

            case Common.DisplayType.NTSC:
                apu               = new APU(this, apu, false);
                ppu.region        = PPU.Region.NTSC;
                CoreComm.VsyncNum = 39375000;
                CoreComm.VsyncDen = 655171;
                cpuclockrate      = 1789773;
                cpu_sequence      = cpu_sequence_NTSC;
                break;

            // this is in bootgod, but not used at all
            case Common.DisplayType.DENDY:
                apu               = new APU(this, apu, false);
                ppu.region        = PPU.Region.Dendy;
                CoreComm.VsyncNum = 50;
                CoreComm.VsyncDen = 1;
                cpuclockrate      = 1773448;
                cpu_sequence      = cpu_sequence_NTSC;
                _display_type     = DisplayType.DENDY;
                break;

            default:
                throw new Exception("Unknown displaytype!");
            }
            if (magicSoundProvider == null)
            {
                magicSoundProvider = new MagicSoundProvider(this, (uint)cpuclockrate);
            }

            BoardSystemHardReset();

            //check fceux's PowerNES and FCEU_MemoryRand function for more information:
            //relevant games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; Huang Di; and maybe mechanized attack
            for (int i = 0; i < 0x800; i++)
            {
                if ((i & 4) != 0)
                {
                    ram[i] = 0xFF;
                }
                else
                {
                    ram[i] = 0x00;
                }
            }

            SetupMemoryDomains();

            //in this emulator, reset takes place instantaneously
            cpu.PC = (ushort)(ReadMemory(0xFFFC) | (ReadMemory(0xFFFD) << 8));
            cpu.P  = 0x34;
            cpu.S  = 0xFD;
        }
Exemple #28
0
        /// <summary>
        /// This method retrieves a list of diplay items from the device server.
        /// </summary>
        /// <param name="eDisplayType">The type of display items to retrieve.</param>
        /// <param name="iDisplayCount">The number of display items to retrieve.</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------------
        //  10/10/08 jrf 9.50           Created.
        //
        private void GetDisplayItems(DisplayType eDisplayType, int iDisplayCount)
        {
            object              objQuantity        = null;
            object              objOccurenceType   = null;
            object              objPeakNum         = null;
            object              objTimeOfOccurence = null;
            object              objIDCode          = null;
            object              objValue           = null;
            OccurrenceType      eOccurenceType     = OccurrenceType.Current;
            DisplayItemSettings ItemSettings;
            DisplayScale        QuantityScale = DisplayScale.Units;
            string              strValue      = null;
            short sMaxStringLength            = 80;
            short sResponse        = DEVICE_SERVER_SUCCESS;
            short sDisplayProgress = 0;
            short sPeakNumber      = 0;
            short sIDCode          = 0;
            int   iQuantity        = 0;
            int   iOccurenceType   = 0;
            int   iIndex           = 0;
            Collection <DisplayItemSettings> colDisplayItemSettings = null;

            switch (eDisplayType)
            {
            case DisplayType.Normal:
            {
                colDisplayItemSettings = m_DisplaySchedule.NormalDisplay;
                break;
            }

            case DisplayType.Alternate:
            {
                colDisplayItemSettings = m_DisplaySchedule.AlternateDisplay;
                break;
            }

            default:
            {
                colDisplayItemSettings = m_DisplaySchedule.TestDisplay;
                break;
            }
            }

            //Find each display item's settings.
            for (int i = 1; i <= iDisplayCount; i++)
            {
                sResponse = VirtualDevice.GetDisplayItem((short)eDisplayType, (short)i, ref objQuantity,
                                                         ref objOccurenceType, ref objValue, ref strValue, sMaxStringLength,
                                                         ref objPeakNum, ref objTimeOfOccurence, ref objIDCode, sDisplayProgress);

                if (DEVICE_SERVER_SUCCESS == sResponse && null != objQuantity &&
                    null != objOccurenceType && null != objValue && null != strValue &&
                    null != objPeakNum && null != objTimeOfOccurence && null != objIDCode)
                {
                    iQuantity      = (int)Convert.ChangeType(objQuantity, typeof(int), CultureInfo.InvariantCulture);
                    iOccurenceType = (int)Convert.ChangeType(objOccurenceType, typeof(int), CultureInfo.InvariantCulture);
                    eOccurenceType = (OccurrenceType)iOccurenceType;
                    sPeakNumber    = (short)Convert.ChangeType(objPeakNum, typeof(short), CultureInfo.InvariantCulture);
                    sIDCode        = (short)Convert.ChangeType(objIDCode, typeof(short), CultureInfo.InvariantCulture);

                    //Extract the scale from the quantity code.
                    QuantityCode           Quantity           = QuantityCode.Create((uint)iQuantity);
                    ElectricalQuantityCode ElectricalQuantity = Quantity as ElectricalQuantityCode;

                    if (null != ElectricalQuantity)
                    {
                        if (ElectricalQuantityCode.ElectricalScale.Kilo == ElectricalQuantity.Scale)
                        {
                            QuantityScale = DisplayScale.Kilo;
                        }

                        //Now that we have the scale store the quantity in it's units value for the display schedule.
                        ElectricalQuantity.Scale = ElectricalQuantityCode.ElectricalScale.Units;
                        iQuantity = (int)ElectricalQuantity.Code;
                    }

                    ItemSettings = new DisplayItemSettings((uint)iQuantity, eOccurenceType);

                    ItemSettings.DisplayOrder = (uint)i;

                    ItemSettings.IDCode     = (uint)sIDCode;
                    ItemSettings.PeakNumber = (uint)sPeakNumber;

                    if (null != ElectricalQuantity && ElectricalQuantity.IsEnergyQuantity)
                    {
                        iIndex = ENERGY;
                    }
                    else if (null != ElectricalQuantity && ElectricalQuantity.IsDemandQuantity &&
                             false == ElectricalQuantity.IsCumulativeQuantity)
                    {
                        iIndex = DEMAND;
                    }
                    else if (null != ElectricalQuantity && ElectricalQuantity.IsCumulativeQuantity)
                    {
                        iIndex = CUMULATIVE;
                    }

                    ItemSettings.LeadingZeroesDisplayed = m_ablnDisplayLeadingZeroes[iIndex];
                    ItemSettings.FloatingDecimalEnabled = m_ablnDisplayFloatingDecimal[iIndex];
                    ItemSettings.DigitCount             = (uint)m_aiDisplayDigitCount[iIndex];
                    ItemSettings.DecimalDigitCount      = (uint)m_aiDisplayDecimalDigitCount[iIndex];

                    //Only set the following values if we have an
                    //energy or demand quantity
                    if (null != ElectricalQuantity)
                    {
                        //Only set the scale if we have an electrical quantity.
                        ItemSettings.Scale = QuantityScale;

                        if (strValue.Contains("-"))
                        {
                            //Since we have a date reset the scale and set the date.
                            //Scale and date are stored in the same location in the
                            //display schedule.  Resetting this value allows us to
                            //know which one to use.
                            ItemSettings.TOODateDisplayed = true;
                            ItemSettings.Scale            = DisplayScale.Units;
                            ItemSettings.DateDisplay      = m_eDisplayDateFormat;
                        }

                        if (strValue.Contains(":"))
                        {
                            ItemSettings.TOOTimeDisplayed = true;
                        }

                        ItemSettings.AnnunciatorEnabled = m_blnDisplayAnnunciatorEnabled;
                    }
                    else
                    {
                        //Only set the date if we don't have an electrical quantity
                        ItemSettings.DateDisplay = m_eDisplayDateFormat;
                    }

                    colDisplayItemSettings.Add(ItemSettings);
                }
            }
        }
Exemple #29
0
 public Display(DisplayType displayType, double inches)
     : base()
 {
     this.DisplayType = displayType;
     this.Inches = inches;
 }
        public override string GetStatValueText(int position, Competitor competitorType, DisplayType displayType)
        {
            switch (displayType)
            {
            case DisplayType.Value:
            {
                switch (competitorType)
                {
                case Competitor.Driver:
                    return(Convert.ToString(((ChampionshipDataElement)DriverStats[position]).Points));

                case Competitor.Team:
                    return(Convert.ToString(((ChampionshipDataElement)TeamStats[position]).Points));

                case Competitor.Comparison:
                    return(Convert.ToString(((ChampionshipDataElement)ComparisonStats[position]).Points));
                }
                ;
                break;
            }

            case DisplayType.Percentage:
            {
                switch (competitorType)
                {
                case Competitor.Driver:
                    return(Convert.ToString(((ChampionshipDataElement)DriverStats[position]).Percentage));

                case Competitor.Team:
                    return(Convert.ToString(((ChampionshipDataElement)TeamStats[position]).Points));

                case Competitor.Comparison:
                    return(Convert.ToString(((ChampionshipDataElement)ComparisonStats[position]).Percentage));
                }
                ;
                break;
            }
            }
            ;
            return("");
        }
 public ViewItems(User user, DisplayType type)
 {
     InitializeComponent();
     this.user = user;
     this.type = type;
 }
Exemple #32
0
        public void HardReset()
        {
            cpu = new MOS6502X <CpuLink>(new CpuLink(this))
            {
                BCD_Enabled = false
            };

            ppu   = new PPU(this);
            ram   = new byte[0x800];
            CIRAM = new byte[0x800];

            // wire controllers
            // todo: allow changing this
            ControllerDeck = ControllerSettings.Instantiate(ppu.LightGunCallback);
            // set controller definition first time only
            if (ControllerDefinition == null)
            {
                ControllerDefinition      = new ControllerDefinition(ControllerDeck.GetDefinition());
                ControllerDefinition.Name = "NES Controller";
                // controls other than the deck
                ControllerDefinition.BoolButtons.Add("Power");
                ControllerDefinition.BoolButtons.Add("Reset");
                if (Board is FDS)
                {
                    var b = Board as FDS;
                    ControllerDefinition.BoolButtons.Add("FDS Eject");
                    for (int i = 0; i < b.NumSides; i++)
                    {
                        ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
                    }
                }

                if (_isVS)
                {
                    ControllerDefinition.BoolButtons.Add("Insert Coin P1");
                    ControllerDefinition.BoolButtons.Add("Insert Coin P2");
                    ControllerDefinition.BoolButtons.Add("Service Switch");
                }
            }

            // don't replace the magicSoundProvider on reset, as it's not needed
            // if (magicSoundProvider != null) magicSoundProvider.Dispose();

            // set up region
            switch (_display_type)
            {
            case Common.DisplayType.PAL:
                apu           = new APU(this, apu, true);
                ppu.region    = PPU.Region.PAL;
                VsyncNum      = 50;
                VsyncDen      = 1;
                cpuclockrate  = 1662607;
                cpu_sequence  = cpu_sequence_PAL;
                _display_type = DisplayType.PAL;
                ClockRate     = 5320342.5;
                break;

            case Common.DisplayType.NTSC:
                apu          = new APU(this, apu, false);
                ppu.region   = PPU.Region.NTSC;
                VsyncNum     = 39375000;
                VsyncDen     = 655171;
                cpuclockrate = 1789773;
                cpu_sequence = cpu_sequence_NTSC;
                ClockRate    = 5369318.1818181818181818181818182;
                break;

            // this is in bootgod, but not used at all
            case Common.DisplayType.Dendy:
                apu           = new APU(this, apu, false);
                ppu.region    = PPU.Region.Dendy;
                VsyncNum      = 50;
                VsyncDen      = 1;
                cpuclockrate  = 1773448;
                cpu_sequence  = cpu_sequence_NTSC;
                _display_type = DisplayType.Dendy;
                ClockRate     = 5320342.5;
                break;

            default:
                throw new Exception("Unknown displaytype!");
            }
            if (magicSoundProvider == null)
            {
                magicSoundProvider = new MagicSoundProvider(this, (uint)cpuclockrate);
            }

            BoardSystemHardReset();

            // apu has some specific power up bahaviour that we will emulate here
            apu.NESHardReset();

            if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Any())
            {
                for (int i = 0; i < 0x800; i++)
                {
                    ram[i] = SyncSettings.InitialWRamStatePattern[i % SyncSettings.InitialWRamStatePattern.Count];
                }
            }
            else
            {
                // check fceux's PowerNES and FCEU_MemoryRand function for more information:
                // relevant games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; Huang Di; and maybe mechanized attack
                for (int i = 0; i < 0x800; i++)
                {
                    if ((i & 4) != 0)
                    {
                        ram[i] = 0xFF;
                    }
                    else
                    {
                        ram[i] = 0x00;
                    }
                }
            }

            SetupMemoryDomains();

            // some boards cannot have specific values in RAM upon initialization
            // Let's hard code those cases here
            // these will be defined through the gameDB exclusively for now.

            if (cart.DB_GameInfo != null)
            {
                if (cart.DB_GameInfo.Hash == "60FC5FA5B5ACCAF3AEFEBA73FC8BFFD3C4DAE558" ||              // Camerica Golden 5
                    cart.DB_GameInfo.Hash == "BAD382331C30B22A908DA4BFF2759C25113CC26A" ||                     // Camerica Golden 5
                    cart.DB_GameInfo.Hash == "40409FEC8249EFDB772E6FFB2DCD41860C6CCA23"                        // Camerica Pegasus 4-in-1
                    )
                {
                    ram[0x701] = 0xFF;
                }

                if (cart.DB_GameInfo.Hash == "68ABE1E49C9E9CCEA978A48232432C252E5912C0")                 // Dancing Blocks
                {
                    ram[0xEC] = 0;
                    ram[0xED] = 0;
                }

                if (cart.DB_GameInfo.Hash == "00C50062A2DECE99580063777590F26A253AAB6B")                 // Silva Saga
                {
                    for (int i = 0; i < Board.WRAM.Length; i++)
                    {
                        Board.WRAM[i] = 0xFF;
                    }
                }
            }
        }
        }       //	createFromColumn

        /// <summary>
        /// Create Print Format Item from Column
        /// </summary>
        /// <param name="format">parent</param>
        /// <param name="AD_Column_ID">column</param>
        /// <param name="seqNo">sequence of display if 0 it is not printed</param>
        /// <returns>Format Item</returns>
        public static MPrintFormatItem CreateFromColumn(MPrintFormat format, int AD_Column_ID, int AD_Field_ID, int seqNo, bool isMESeqDefined)
        {
            MPrintFormatItem pfi = new MPrintFormatItem(format.GetCtx(), 0, null);

            pfi.SetAD_PrintFormat_ID(format.GetAD_PrintFormat_ID());
            pfi.SetClientOrg(format);
            pfi.SetAD_Column_ID(AD_Column_ID);
            pfi.SetPrintFormatType(PRINTFORMATTYPE_Field);
            //SqlParameter[] param = null;

            //	translation is dome by trigger
            String sql = "SELECT c.ColumnName,e.Name,e.PrintName, "                                         //	1..3
                         + "c.AD_Reference_ID,c.IsKey,c.SeqNo,  f.MRSeqNo,  f.MRIsDisplayed,f.IsDisplayed " //	4..6
                         + "FROM AD_Column c, AD_Element e ,AD_Field f "
                         + "WHERE c.AD_Column_ID=" + AD_Column_ID + " AND f.AD_Field_ID=" + AD_Field_ID + ""
                         + " AND c.AD_Element_ID=e.AD_Element_ID";
            //	translate base entry if single language - trigger copies to trl tables

            //Boolean trl = !Env.IsMultiLingualDocument(format.GetCtx()) && !GlobalVariable.IsBaseLanguage();
            Boolean trl = !Env.IsMultiLingualDocument(format.GetCtx()) && !Language.IsBaseLanguage(Login.Language.GetBaseAD_Language());

            if (trl)
            {
                sql = "SELECT c.ColumnName,e.Name,e.PrintName, "                                         //	1..3
                      + "c.AD_Reference_ID,c.IsKey,c.SeqNo , f.MRSeqNo,  f.MRIsDisplayed,f.IsDisplayed " //	4..6
                      + "FROM AD_Column c, AD_Element_Trl e ,AD_Field f"
                      + "WHERE c.AD_Column_ID=" + AD_Column_ID + "  AND f.AD_Field_ID=" + AD_Field_ID + ""
                      + " AND c.AD_Element_ID=e.AD_Element_ID"
                      + " AND e.AD_Language='" + GlobalVariable.GetLanguageCode() + "'";
            }
            IDataReader dr = null;

            try
            {
                dr = SqlExec.ExecuteQuery.ExecuteReader(sql);
                if (dr.Read())
                {
                    String ColumnName = dr[0].ToString();
                    pfi.SetName(dr[1].ToString());
                    pfi.SetPrintName(dr[2].ToString());
                    int displayType = dr[3].ToString() != "" ? Utility.Util.GetValueOfInt(dr[3].ToString()) : 0;
                    if (DisplayType.IsNumeric(displayType))
                    {
                        pfi.SetFieldAlignmentType(FIELDALIGNMENTTYPE_TrailingRight);
                    }
                    else if (displayType == DisplayType.Text || displayType == DisplayType.Memo)
                    {
                        pfi.SetFieldAlignmentType(FIELDALIGNMENTTYPE_Block);
                    }
                    else
                    {
                        pfi.SetFieldAlignmentType(FIELDALIGNMENTTYPE_LeadingLeft);
                    }
                    Boolean isKey = "Y".Equals(dr[4].ToString());
                    //
                    if (isKey ||
                        ColumnName.StartsWith("Created") || ColumnName.StartsWith("Updated") ||
                        ColumnName.Equals("AD_Client_ID") || ColumnName.Equals("AD_Org_ID") ||
                        ColumnName.Equals("IsActive") || ColumnName.Equals("Export_ID") ||
                        displayType == DisplayType.Button || displayType == DisplayType.Binary ||
                        displayType == DisplayType.ID || displayType == DisplayType.Image ||
                        displayType == DisplayType.RowID ||
                        seqNo == 0)
                    {
                        pfi.SetIsPrinted(false);
                        pfi.SetSeqNo(0);
                    }
                    else if (isMESeqDefined)
                    {
                        if (dr[7].ToString() == "Y")
                        {
                            pfi.SetIsPrinted(true);
                        }
                        else
                        {
                            pfi.SetIsPrinted(false);
                        }
                        pfi.SetSeqNo(seqNo);
                    }
                    else
                    {
                        pfi.SetIsPrinted(true);
                        pfi.SetSeqNo(seqNo);
                    }


                    int idSeqNo = dr[5].ToString() != "" ? Utility.Util.GetValueOfInt(dr[5].ToString()) : 0;    //	IsIdentifier SortNo
                    if (idSeqNo > 0)
                    {
                        pfi.SetIsOrderBy(true);
                        pfi.SetSortNo(idSeqNo);
                    }
                }
                dr.Close();
            }
            catch (Exception e)
            {
                if (dr != null)
                {
                    dr.Close();
                }
                s_log.Severe(e.ToString());
            }
            if (!pfi.Save())
            {
                return(null);
            }
            //	pfi.dump();
            return(pfi);
        }       //	createFromColumn
Exemple #34
0
 /// <summary>
 /// Determines if the specified <see cref="DisplayType"/> can be
 /// used for the current <see cref="Watch"/>
 /// </summary>
 /// <param name="type"><see cref="DisplayType"/> you want to check</param>
 public bool IsDiplayTypeAvailable(DisplayType type)
 {
     return(AvailableTypes().Any(d => d == type));
 }
Exemple #35
0
        /// <summary>
        /// Is standard Period Open for specified orgs for the client. For best
        /// performance, ensure that the list of orgs does not contain duplicates.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="AD_Client_ID"></param>
        /// <param name="orgs"></param>
        /// <param name="DateAcct">accounting date</param>
        /// <param name="DocBaseType">document base type</param>
        /// <returns>error message or null</returns>
        /// <date>07-March-2011</date>
        /// <writer>raghu</writer>
        public static String IsOpen(Ctx ctx, int AD_Client_ID, List <int> orgs, DateTime?DateAcct,
                                    String DocBaseType)
        {
            if (DateAcct == null)
            {
                return("@NotFound@ @DateAcct@");
            }
            if (DocBaseType == null)
            {
                return("@NotFound@ @DocBaseType@");
            }

            MAcctSchema as1 = MClient.Get(ctx, AD_Client_ID).GetAcctSchema();

            if (as1 == null)
            {
                return("@NotFound@ @C_AcctSchema_ID@ for AD_Client_ID=" + AD_Client_ID);
            }
            if (as1.IsAutoPeriodControl())
            {
                if (as1.IsAutoPeriodControlOpen(DateAcct))
                {
                    return(null);
                }
                else
                {
                    return("@PeriodClosed@ - @AutoPeriodControl@");
                }
            }

            //	Get all Calendars in line with Organizations
            MClientInfo clientInfo   = MClientInfo.Get(ctx, AD_Client_ID, null);
            List <int>  orgCalendars = new List <int>();
            List <int>  calendars    = new List <int>();

            foreach (int org in orgs)
            {
                MOrgInfo orgInfo = MOrgInfo.Get(ctx, org, null);

                int C_Calendar_ID = orgInfo.GetC_Calendar_ID();
                if (C_Calendar_ID == 0)
                {
                    C_Calendar_ID = clientInfo.GetC_Calendar_ID();
                }
                orgCalendars.Add(C_Calendar_ID);
                if (!calendars.Contains(C_Calendar_ID))
                {
                    calendars.Add(C_Calendar_ID);
                }
            }
            //	Should not happen
            if (calendars.Count == 0)
            {
                return("@NotFound@ @C_Calendar_ID@");
            }

            //	For all Calendars get Periods
            for (int i = 0; i < calendars.Count; i++)
            {
                int     C_Calendar_ID = calendars[i];
                MPeriod period        = MPeriod.GetOfCalendar(ctx, C_Calendar_ID, DateAcct);
                //	First Org for Calendar
                int AD_Org_ID = 0;
                for (int j = 0; j < orgCalendars.Count; j++)
                {
                    if (orgCalendars[j] == C_Calendar_ID)
                    {
                        AD_Org_ID = orgs[j];
                        break;
                    }
                }
                if (period == null)
                {
                    MCalendar cal  = MCalendar.Get(ctx, C_Calendar_ID);
                    String    date = DisplayType.GetDateFormat(DisplayType.Date).Format(DateAcct);
                    if (cal != null)
                    {
                        return("@NotFound@ @C_Period_ID@: " + date
                               + " - " + MOrg.Get(ctx, AD_Org_ID).GetName()
                               + " -> " + cal.GetName());
                    }
                    else
                    {
                        return("@NotFound@ @C_Period_ID@: " + date
                               + " - " + MOrg.Get(ctx, AD_Org_ID).GetName()
                               + " -> C_Calendar_ID=" + C_Calendar_ID);
                    }
                }
                String error = period.IsOpen(DocBaseType, DateAcct);
                if (error != null)
                {
                    return(error
                           + " - " + MOrg.Get(ctx, AD_Org_ID).GetName()
                           + " -> " + MCalendar.Get(ctx, C_Calendar_ID).GetName());
                }
            }
            return(null);        //	open
        }
Exemple #36
0
        /// <summary>
        /// Generates a new <see cref="Watch"/> instance
        /// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
        /// </summary>
        /// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
        /// <param name="address">The address into the <see cref="MemoryDomain"/></param>
        /// <param name="size">The size</param>
        /// <param name="type">How the watch will be displayed</param>
        /// <param name="bigEndian">Endianess (true for big endian)</param>
        /// <param name="note">A custom note about the <see cref="Watch"/></param>
        /// <param name="value">The current watch value</param>
        /// <param name="prev">Previous value</param>
        /// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
        /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
        public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0)
        {
            switch (size)
            {
            default:
            case WatchSize.Separator:
                return(SeparatorWatch.NewSeparatorWatch(note));

            case WatchSize.Byte:
                return(new ByteWatch(domain, address, type, bigEndian, note, (byte)value, (byte)prev, changeCount));

            case WatchSize.Word:
                return(new WordWatch(domain, address, type, bigEndian, note, (ushort)value, (ushort)prev, changeCount));

            case WatchSize.DWord:
                return(new DWordWatch(domain, address, type, bigEndian, note, (uint)value, (uint)prev, changeCount));
            }
        }
Exemple #37
0
 public static Width GetLineWidth(DisplayType type)
 {
     NXOpen.Part           workPart = (NXOpen.Part)WorkPart;
     PartObject.ObjectType type2    = (PartObject.ObjectType)type;
     return((Width)ConvertLineWidthType(workPart.Preferences.ObjectPreferences.GetWidth(type2)));
 }
Exemple #38
0
 public static Font GetLineFont(DisplayType type)
 {
     NXOpen.Part           workPart = (NXOpen.Part)WorkPart;
     PartObject.ObjectType type2    = (PartObject.ObjectType)type;
     return((Font)ConvertLineFontType(workPart.Preferences.ObjectPreferences.GetLineFont(type2)));
 }
 private void rbFullSize_Click(object sender, EventArgs e)
 {
     CurrentDisplayType = DisplayType.FullSize;
 }
Exemple #40
0
 /// <summary>
 /// Generates a new <see cref="Watch"/> instance
 /// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
 /// </summary>
 /// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
 /// <param name="address">The address into the <see cref="MemoryDomain"/></param>
 /// <param name="size">The size</param>
 /// <param name="type">How the watch will be displayed</param>
 /// <param name="bigEndian">Endianess (true for big endian)</param>
 /// <param name="note">A custom note about the <see cref="Watch"/></param>
 /// <param name="value">The current watch value</param>
 /// <param name="prev">Previous value</param>
 /// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
 /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
 public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0)
 {
     return(size switch
     {
         WatchSize.Separator => SeparatorWatch.NewSeparatorWatch(note),
         WatchSize.Byte => new ByteWatch(domain, address, type, bigEndian, note, (byte)value, (byte)prev, changeCount),
         WatchSize.Word => new WordWatch(domain, address, type, bigEndian, note, (ushort)value, (ushort)prev, changeCount),
         WatchSize.DWord => new DWordWatch(domain, address, type, bigEndian, note, (uint)value, (uint)prev, changeCount),
         _ => SeparatorWatch.NewSeparatorWatch(note)
     });
Exemple #41
0
 public ScoreboardObjective(string objectiveName, ChatMessage value, DisplayType displayType)
 {
     ObjectiveName = objectiveName;
     Value         = value;
     DisplayType   = displayType;
 }
 public override void Show()
 {
     oldDisplayType = displayType;
     base.Show();
 }
 private void rbPercentage_Click(object sender, EventArgs e)
 {
     CurrentDisplayType = DisplayType.PerfectSize;
 }
Exemple #44
0
 public void SetType(DisplayType type)
 {
     _settings.Type = type;
 }
Exemple #45
0
            internal void Write(BinaryWriterEx bw, PARAMDEF def, int index)
            {
                if (def.FormatVersion >= 202)
                {
                    bw.ReserveInt64($"DisplayNameOffset{index}");
                }
                else if (def.Unicode)
                {
                    bw.WriteFixStrW(DisplayName, 0x40, (byte)(def.FormatVersion >= 104 ? 0x00 : 0x20));
                }
                else
                {
                    bw.WriteFixStr(DisplayName, 0x40, (byte)(def.FormatVersion >= 104 ? 0x00 : 0x20));
                }

                byte padding = (byte)(def.FormatVersion >= 200 ? 0x00 : 0x20);

                bw.WriteFixStr(DisplayType.ToString(), 8, padding);
                bw.WriteFixStr(DisplayFormat, 8, padding);
                bw.WriteSingle(Default);
                bw.WriteSingle(Minimum);
                bw.WriteSingle(Maximum);
                bw.WriteSingle(Increment);
                bw.WriteInt32((int)EditFlags);
                bw.WriteInt32(ParamUtil.GetValueSize(DisplayType) * (ParamUtil.IsArrayType(DisplayType) ? ArrayLength : 1));

                if (def.FormatVersion >= 200)
                {
                    bw.ReserveInt64($"DescriptionOffset{index}");
                }
                else
                {
                    bw.ReserveInt32($"DescriptionOffset{index}");
                }

                if (def.FormatVersion >= 202)
                {
                    bw.ReserveInt64($"InternalTypeOffset{index}");
                }
                else
                {
                    bw.WriteFixStr(InternalType, 0x20, padding);
                }

                if (def.FormatVersion >= 202)
                {
                    bw.ReserveInt64($"InternalNameOffset{index}");
                }
                else if (def.FormatVersion >= 102)
                {
                    bw.WriteFixStr(MakeInternalName(), 0x20, padding);
                }

                if (def.FormatVersion >= 104)
                {
                    bw.WriteInt32(SortID);
                }

                if (def.FormatVersion >= 200)
                {
                    bw.WriteInt32(0);
                    bw.ReserveInt64($"UnkB8Offset{index}");
                    bw.ReserveInt64($"UnkC0Offset{index}");
                    bw.ReserveInt64($"UnkC8Offset{index}");
                }
            }
 private void rbFullHeight_Click(object sender, EventArgs e)
 {
     CurrentDisplayType = DisplayType.FullHeight;
 }
 /// <summary>
 /// Generates a consent URL that includes a set of provided parameters.
 /// </summary>
 public string GetLoginUrl(IEnumerable <string> scopes, string redirectUrl, DisplayType display, ThemeType theme, string locale, string state)
 {
     return(LiveAuthUtility.BuildAuthorizeUrl(this.clientId, redirectUrl, scopes, ResponseType.Code, display, theme, locale, state));
 }
Exemple #48
0
        public N64(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings)
        {
            ServiceProvider = new BasicServiceProvider(this);
            InputCallbacks  = new InputCallbackSystem();
            _memorycallbacks.ActiveChanged += RefreshMemoryCallbacks;

            int SaveType = 0;

            if (game.OptionValue("SaveType") == "EEPROM_16K")
            {
                SaveType = 1;
            }

            CoreComm = comm;

            _syncSettings = (N64SyncSettings)syncSettings ?? new N64SyncSettings();
            _settings     = (N64Settings)settings ?? new N64Settings();

            _disableExpansionSlot = _syncSettings.DisableExpansionSlot;

            // Override the user's expansion slot setting if it is mentioned in the gamedb (it is mentioned but the game MUST have this setting or else not work
            if (game.OptionValue("expansionpak") != null && game.OptionValue("expansionpak") == "1")
            {
                _disableExpansionSlot = false;
                IsOverridingUserExpansionSlotSetting = true;
            }

            byte country_code = file[0x3E];

            switch (country_code)
            {
            // PAL codes
            case 0x44:
            case 0x46:
            case 0x49:
            case 0x50:
            case 0x53:
            case 0x55:
            case 0x58:
            case 0x59:
                _display_type = DisplayType.PAL;
                break;

            // NTSC codes
            case 0x37:
            case 0x41:
            case 0x45:
            case 0x4a:
            default:                     // Fallback for unknown codes
                _display_type = DisplayType.NTSC;
                break;
            }
            switch (Region)
            {
            case DisplayType.NTSC:
                comm.VsyncNum = 60000;
                comm.VsyncDen = 1001;
                break;

            default:
                comm.VsyncNum = 50;
                comm.VsyncDen = 1;
                break;
            }

            StartThreadLoop();

            var videosettings = _syncSettings.GetVPS(game, _settings.VideoSizeX, _settings.VideoSizeY);
            var coreType      = _syncSettings.Core;

            //zero 19-apr-2014 - added this to solve problem with SDL initialization corrupting the main thread (I think) and breaking subsequent emulators (for example, NES)
            //not sure why this works... if we put the plugin initializations in here, we get deadlocks in some SDL initialization. doesnt make sense to me...
            RunThreadAction(() =>
            {
                api = new mupen64plusApi(this, file, videosettings, SaveType, (int)coreType, _disableExpansionSlot);
            });

            // Order is important because the register with the mupen core
            _videoProvider = new N64VideoProvider(api, videosettings);
            _audioProvider = new N64Audio(api);
            _inputProvider = new N64Input(this.AsInputPollable(), api, comm, this._syncSettings.Controllers);
            (ServiceProvider as BasicServiceProvider).Register <IVideoProvider>(_videoProvider);

            string rsp;

            switch (_syncSettings.Rsp)
            {
            default:
            case N64SyncSettings.RspType.Rsp_Hle:
                rsp = "mupen64plus-rsp-hle.dll";
                break;

            case N64SyncSettings.RspType.Rsp_Z64_hlevideo:
                rsp = "mupen64plus-rsp-z64-hlevideo.dll";
                break;

            case N64SyncSettings.RspType.Rsp_cxd4:
                rsp = "mupen64plus-rsp-cxd4.dll";
                break;
            }

            api.AttachPlugin(mupen64plusApi.m64p_plugin_type.M64PLUGIN_RSP, rsp);

            InitMemoryDomains();
            RefreshMemoryCallbacks();
            if (_syncSettings.Core != N64SyncSettings.CoreType.Dynarec)
            {
                ConnectTracer();
            }

            api.AsyncExecuteEmulator();

            // Hack: Saving a state on frame 0 has been shown to not be sync stable. Advance past that frame to avoid the problem.
            // Advancing 2 frames was chosen to deal with a problem with the dynamic recompiler. The dynarec seems to take 2 frames to set
            // things up correctly. If a state is loaded on frames 0 or 1 mupen tries to access null pointers and the emulator crashes, so instead
            // advance past both to again avoid the problem.
            api.frame_advance();
            api.frame_advance();

            SetControllerButtons();
        }
Exemple #49
0
        private static void ReadKeys()
        {
            try
            {
                ConsoleKeyInfo key = new ConsoleKeyInfo();
                while (!Console.KeyAvailable && key.Key != ConsoleKey.Escape)
                {
                    key = Console.ReadKey(true);
                    switch (key.Key)
                    {
                    //    case ConsoleKey.R:
                    //        Client("gpurestart|N (0)", 0);
                    //        Console.WriteLine("GPU Restarted");
                    //        break;
                    //    case ConsoleKey.E:
                    //        Client("gpuenable|N (0)", 0);
                    //        Console.WriteLine("GPU Enabled");
                    //        break;
                    //    case ConsoleKey.D:
                    //        Client("gpudisable|N (0)", 0);
                    //        Console.WriteLine("GPU Disabled");
                    //        break;
                    //   case ConsoleKey.LeftArrow:
                    //       Console.WriteLine("LeftArrow was pressed");
                    //      break;
                    case ConsoleKey.Escape:
                        break;

                    case ConsoleKey.Q:
                        Environment.Exit(0);
                        break;

                    case ConsoleKey.D1:
                        DT = DisplayType.Summary;
                        Console.Clear();
                        UpdateScreenSize = true;
                        break;

                    case ConsoleKey.D2:
                        DT = DisplayType.Detail;
                        Console.Clear();
                        UpdateScreenSize = true;
                        break;

                    case ConsoleKey.M:
                        DT = DisplayType.Menu;
                        Console.Clear();
                        UpdateScreenSize = true;
                        break;

                    default:
                        if (Console.CapsLock && Console.NumberLock)
                        {
                            Console.WriteLine(key.KeyChar);
                        }
                        break;
                    }
                }
            }
            catch (Exception) { }
        }
    public void DrawButton(PaintEventArgs e, ToggleButtonState toggleState, DisplayType displayMode, Font font, ActiveStateCollection activeState, InactiveStateCollection inactiveState, RightToLeft righttoLeft, bool isMouseHover, ToggleButton togglebutton)
    {
        string    displaytext = toggleState == ToggleButtonState.Active ? activeState.Text : inactiveState.Text;
        SizeF     textsize    = e.Graphics.MeasureString(displaytext, font);
        Rectangle controlrect = new Rectangle(e.ClipRectangle.X + 1, e.ClipRectangle.Y + 1, e.ClipRectangle.Width - 4, e.ClipRectangle.Height - 4);

        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
        GraphicsPath gp = new GraphicsPath();

        using (LinearGradientBrush br = new LinearGradientBrush(e.ClipRectangle, ColorTranslator.FromHtml("#007feb"), ColorTranslator.FromHtml("#51a7f2"), LinearGradientMode.Vertical))
        {
            if (controlrect.Height > 1)
            {
                gp.AddArc(controlrect.X, controlrect.Y, controlrect.Height, controlrect.Height, 180, 90);
                gp.AddArc(controlrect.X + controlrect.Width - controlrect.Height, controlrect.Y, controlrect.Height, controlrect.Height, 270, 90);
                gp.AddArc(controlrect.X + controlrect.Width - controlrect.Height, controlrect.Y + controlrect.Height - controlrect.Height, controlrect.Height, controlrect.Height, 0, 90);
                gp.AddArc(controlrect.X, controlrect.Y + controlrect.Height - controlrect.Height, controlrect.Height, controlrect.Height, 90, 90);
                gp.CloseFigure();
                e.Graphics.DrawPath(new Pen(ColorTranslator.FromHtml("#002f69"), 2), gp);
            }
        }
        GraphicsPath gp1 = new GraphicsPath();

        using (LinearGradientBrush br = new LinearGradientBrush(e.ClipRectangle, ColorTranslator.FromHtml("#007feb"), ColorTranslator.FromHtml("#51a7f2"), LinearGradientMode.Vertical))
        {
            if (controlrect.Height > 1)
            {
                gp1.AddArc(controlrect.X, controlrect.Y + 1, controlrect.Height + 2, controlrect.Height, 180, 90);
                gp1.AddArc(controlrect.X + controlrect.Width - controlrect.Height, controlrect.Y, controlrect.Height, controlrect.Height, 270, 90);
                gp1.AddArc(controlrect.X + 1 + controlrect.Width - controlrect.Height, controlrect.Y + controlrect.Height - controlrect.Height, controlrect.Height, controlrect.Height, 0, 90);
                gp1.AddArc(controlrect.X, controlrect.Y + controlrect.Height - controlrect.Height, controlrect.Height, controlrect.Height, 90, 90);
                gp1.CloseFigure();
                e.Graphics.FillPath(br, gp1);
                gp1.Dispose();
            }
        }
        GraphicsPath gp2 = new GraphicsPath();

        using (LinearGradientBrush br = new LinearGradientBrush(e.ClipRectangle, ColorTranslator.FromHtml("#51a7f2"), ColorTranslator.FromHtml("#51a7f2"), LinearGradientMode.Vertical))
        {
            if (controlrect.Height > 1)
            {
                gp2.AddArc(controlrect.X + 5, controlrect.Y + controlrect.Height / 2, controlrect.Height - controlrect.Height / 2, controlrect.Height / 2, 180, 90);
                gp2.AddArc(controlrect.X + 5 + controlrect.Width - controlrect.Height, controlrect.Y + controlrect.Height / 2, controlrect.Height - controlrect.Height / 2, controlrect.Height / 2, 270, 90);
                gp2.AddArc(controlrect.X + 5 + controlrect.Width - controlrect.Height, controlrect.Y + controlrect.Height - controlrect.Height + controlrect.Height / 2, controlrect.Height - controlrect.Height / 2, controlrect.Height / 2, 0, 90);
                gp2.AddArc(controlrect.X + 5, controlrect.Y + controlrect.Height - controlrect.Height + controlrect.Height / 2, controlrect.Height - controlrect.Height / 2, controlrect.Height / 2, 90, 90);
                gp2.CloseFigure();
                e.Graphics.FillPath(br, gp2);
                gp2.Dispose();
            }
        }
        if (isMouseHover)
        {
            using (SolidBrush br = new SolidBrush(ColorTranslator.FromHtml("#51a7f2")))
            {
                e.Graphics.FillPath(br, gp);
            }
        }
        PointF pt1 = new PointF(e.ClipRectangle.X + e.ClipRectangle.Width / 2 - textsize.Width / 2, e.ClipRectangle.Y + e.ClipRectangle.Height / 2 - textsize.Height / 2);

        using (SolidBrush br = new SolidBrush(activeState.ForeColor))
        {
            if (displayMode == DisplayType.Text)
            {
                e.Graphics.DrawString(displaytext, font, br, pt1);
            }
        }
        gp.Dispose();
    }
Exemple #51
0
 private void CreateCommands(DisplayType dType)
 {
   this._CommandSet = new CommandSet();
   if (this.dSettings.PacketFormat)
   {
     this._CommandSet.HideDisplay = null;
     this._CommandSet.RestoreDisplay = null;
     this._CommandSet.HideCursor = new byte[] {12, 1, 0, 0xff};
     this._CommandSet.BackLight = new byte[] {14, 1, 0xff, 0xff};
     this._CommandSet.Contrast = new byte[] {13, 1, 0xff, 0xff};
     this._CommandSet.SetPosition = new byte[] {11, 2, 0xff, 0xff, 0xff};
     this._CommandSet.HorizontalBar = null;
     this._CommandSet.ScrollOff = null;
     this._CommandSet.WrapOff = null;
     this._CommandSet.SetCustomChar = new byte[] {9, 9, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff};
     this._CommandSet.SetKeyReport = new byte[] {0x17, 2, 0, 60, 0xff};
     if (Display_Parameters[(int)dType, 0] == 0x10)
     {
       this._CommandSet.SetLine = new byte[]
                                    {
                                      0x1f, 0x12, 0, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20, 0x20, 0xff
                                    };
     }
     else
     {
       this._CommandSet.SetLine = new byte[]
                                    {
                                      0x1f, 0x16, 0, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff
                                    };
     }
     byte[] buffer = new byte[3];
     buffer[0] = 6;
     buffer[2] = 0xff;
     this._CommandSet.ClearDisplay = buffer;
   }
   else
   {
     this._CommandSet.HideDisplay = new byte[] {2};
     this._CommandSet.RestoreDisplay = new byte[] {3};
     this._CommandSet.HideCursor = new byte[] {4};
     this._CommandSet.BackLight = new byte[] {14, 0xff};
     this._CommandSet.Contrast = new byte[] {15, 0xff};
     this._CommandSet.SetPosition = new byte[] {0x11, 0xff, 0xff};
     this._CommandSet.HorizontalBar = new byte[] {0x12, 0, 60, 0, 0x13, 0xff, 0xff};
     this._CommandSet.ScrollOff = new byte[] {20};
     this._CommandSet.WrapOff = new byte[] {0x18};
     byte[] buffer9 = new byte[10];
     buffer9[0] = 0x19;
     this._CommandSet.SetCustomChar = buffer9;
     this._CommandSet.SetKeyReport = null;
     if (Display_Parameters[(int)dType, 3] == 0x10)
     {
       this._CommandSet.SetLine = new byte[]
                                    {
                                      0x11, 0, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20
                                    };
       if (Display_Parameters[(int)dType, 2] == 2)
       {
         this._CommandSet.ClearDisplay = new byte[]
                                           {
                                             0x11, 0, 0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x11, 0, 1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                           };
       }
       else
       {
         this._CommandSet.ClearDisplay = new byte[]
                                           {
                                             0x11, 0, 0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x11, 0, 1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x11, 0, 2, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x11, 0, 3, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                           };
       }
     }
     else
     {
       this._CommandSet.SetLine = new byte[]
                                    {
                                      0x11, 0, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20,
                                      0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                    };
       if (Display_Parameters[(int)dType, 2] == 2)
       {
         this._CommandSet.ClearDisplay = new byte[]
                                           {
                                             0x11, 0, 0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x11, 0, 1, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20
                                           };
       }
       else
       {
         this._CommandSet.ClearDisplay = new byte[]
                                           {
                                             0x11, 0, 0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x11, 0, 1, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x11, 0,
                                             2, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x11, 0, 3, 0x20, 0x20, 0x20, 0x20, 0x20
                                             , 0x20, 0x20, 0x20,
                                             0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                                           };
       }
     }
   }
 }
        public void HardReset()
        {
            cpu = new MOS6502X <CpuLink>(new CpuLink(this))
            {
                BCD_Enabled = false
            };

            ppu   = new PPU(this);
            ram   = new byte[0x800];
            CIRAM = new byte[0x800];

            // wire controllers
            // todo: allow changing this
            ControllerDeck = ControllerSettings.Instantiate(ppu.LightGunCallback);
            // set controller definition first time only
            if (ControllerDefinition == null)
            {
                ControllerDefinition = new ControllerDefinition(ControllerDeck.GetDefinition())
                {
                    Name = "NES Controller"
                };

                // controls other than the deck
                ControllerDefinition.BoolButtons.Add("Power");
                ControllerDefinition.BoolButtons.Add("Reset");
                if (Board is FDS b)
                {
                    ControllerDefinition.BoolButtons.Add("FDS Eject");
                    for (int i = 0; i < b.NumSides; i++)
                    {
                        ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
                    }
                }

                if (_isVS)
                {
                    ControllerDefinition.BoolButtons.Add("Insert Coin P1");
                    ControllerDefinition.BoolButtons.Add("Insert Coin P2");
                    ControllerDefinition.BoolButtons.Add("Service Switch");
                }
            }

            // Add in the reset timing axis for subneshawk
            if (using_reset_timing && ControllerDefinition.Axes.Count == 0)
            {
                ControllerDefinition.AddAxis("Reset Cycle", 0.RangeTo(500000), 0);
            }

            // don't replace the magicSoundProvider on reset, as it's not needed
            // if (magicSoundProvider != null) magicSoundProvider.Dispose();

            // set up region
            switch (_display_type)
            {
            case DisplayType.PAL:
                apu           = new APU(this, apu, true);
                ppu.region    = PPU.Region.PAL;
                cpuclockrate  = 1662607;
                VsyncNum      = cpuclockrate * 2;
                VsyncDen      = 66495;
                cpu_sequence  = cpu_sequence_PAL;
                _display_type = DisplayType.PAL;
                ClockRate     = 5320342.5;
                break;

            case DisplayType.NTSC:
                apu          = new APU(this, apu, false);
                ppu.region   = PPU.Region.NTSC;
                cpuclockrate = 1789773;
                VsyncNum     = cpuclockrate * 2;
                VsyncDen     = 59561;
                cpu_sequence = cpu_sequence_NTSC;
                ClockRate    = 5369318.1818181818181818181818182;
                break;

            // this is in bootgod, but not used at all
            case DisplayType.Dendy:
                apu           = new APU(this, apu, false);
                ppu.region    = PPU.Region.Dendy;
                cpuclockrate  = 1773448;
                VsyncNum      = cpuclockrate;
                VsyncDen      = 35464;
                cpu_sequence  = cpu_sequence_NTSC;
                _display_type = DisplayType.Dendy;
                ClockRate     = 5320342.5;
                break;

            default:
                throw new Exception("Unknown displaytype!");
            }

            blip.SetRates((uint)cpuclockrate, 44100);

            BoardSystemHardReset();

            // apu has some specific power up bahaviour that we will emulate here
            apu.NESHardReset();

            if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Any())
            {
                for (int i = 0; i < 0x800; i++)
                {
                    ram[i] = SyncSettings.InitialWRamStatePattern[i % SyncSettings.InitialWRamStatePattern.Count];
                }
            }
            else
            {
                // check fceux's PowerNES and FCEU_MemoryRand function for more information:
                // relevant games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; Huang Di; and maybe mechanized attack
                for (int i = 0; i < 0x800; i++)
                {
                    if ((i & 4) != 0)
                    {
                        ram[i] = 0xFF;
                    }
                    else
                    {
                        ram[i] = 0x00;
                    }
                }
            }

            SetupMemoryDomains();

            // some boards cannot have specific values in RAM upon initialization
            // Let's hard code those cases here
            // these will be defined through the gameDB exclusively for now.

            if (cart.GameInfo != null)
            {
                if (cart.GameInfo.Hash is RomChecksums.CamericaGolden5 or RomChecksums.CamericaGolden5Overdump or RomChecksums.CamericaPegasus4in1)
                {
                    ram[0x701] = 0xFF;
                }
                else if (cart.GameInfo.Hash == RomChecksums.DancingBlocks)
                {
                    ram[0xEC] = 0;
                    ram[0xED] = 0;
                }
                else if (cart.GameInfo.Hash == RomChecksums.SilvaSaga)
                {
                    for (int i = 0; i < Board.Wram.Length; i++)
                    {
                        Board.Wram[i] = 0xFF;
                    }
                }
            }
Exemple #53
0
 public Display(DisplayType displayType, double inches, int colors)
     : this(displayType, inches)
 {
     this.Colors = colors;
     this.colorsSet = true;
 }
            public void UpdateSearch(string search, DisplayType displayType)
            {
                this.IsSearchVisible    = false;
                this.AllSubTypesVisible = true;

                this.SubTypesVisible.SetLength(this.SubTypes.Count);

                foreach (var group in this.SubGroups)
                {
                    group.UpdateSearch(search, displayType);

                    if (group.IsSearchVisible)
                    {
                        this.IsSearchVisible = true;
                    }

                    if (!group.AllSubTypesVisible)
                    {
                        this.AllSubTypesVisible = false;
                    }
                }

                bool searchIsNullOrWhitespace = search.IsNullOrWhitespace();

                if (searchIsNullOrWhitespace)
                {
                    if (displayType == DisplayType.AllUnityObjects)
                    {
                        this.IsSearchVisible    = true;
                        this.AllSubTypesVisible = true;

                        for (int i = 0; i < this.SubTypesVisible.Count; i++)
                        {
                            this.SubTypesVisible[i] = true;
                        }

                        return;
                    }
                }

                for (int i = 0; i < this.SubTypes.Count; i++)
                {
                    Type type = this.SubTypes[i].DrawnType;

                    if ((displayType == DisplayType.AllScriptableObjects && !typeof(ScriptableObject).IsAssignableFrom(type)) ||
                        (displayType == DisplayType.AllComponents && !typeof(Component).IsAssignableFrom(type)) ||
                        (displayType == DisplayType.UserScripts && !CodeGenerationUtilities.TypeIsFromUserScriptAssembly(type)))
                    {
                        this.SubTypesVisible[i] = false;
                        this.AllSubTypesVisible = false;
                        continue;
                    }

                    if (searchIsNullOrWhitespace || type.FullName.Contains(search, StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.IsSearchVisible    = true;
                        this.SubTypesVisible[i] = true;
                    }
                    else
                    {
                        this.SubTypesVisible[i] = false;
                        this.AllSubTypesVisible = false;
                    }
                }
            }
		/// <summary>
		/// Begins communication with the display.
		/// </summary>
		/// <param name="type">
		/// The display type
		/// </param>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed.
		/// </exception>
		/// <exception cref="InvalidOperationException">
		/// Cannot initialize the backlight control pin because it is configured as an input.
		/// </exception>
		public void Begin(DisplayType type) {
			this._type = type;
			this.Begin();
		}
Exemple #56
0
 public Display(DisplayType displayType)
 {
     _display = displayType;
 }
Exemple #57
0
		public void SetType(DisplayType type)
		{			
			if (_watch.IsDiplayTypeAvailable(type))
			{
				_watch.Type = type;
				Changes();
			}
		}
        }       //	getTargetColumn

        /// <summary>
        /// Execute Auto Assignment
        /// </summary>
        /// <param name="po">PO to be modified</param>
        /// <returns>true if modified</returns>
        public bool ExecuteIt(PO po)
        {
            //	Check Column
            MColumn column     = GetTargetColumn();
            String  columnName = column.GetColumnName();
            int     index      = po.Get_ColumnIndex(columnName);

            if (index == -1)
            {
                throw new Exception(ToString() + ": AD_Column_ID not found");
            }
            //	Check Value
            Object value      = po.Get_Value(index);
            String assignRule = GetAssignRule();

            if (value == null && assignRule.Equals(ASSIGNRULE_OnlyIfNOTNULL))
            {
                return(false);
            }
            else if (value != null && assignRule.Equals(ASSIGNRULE_OnlyIfNULL))
            {
                return(false);
            }

            //	Check Criteria
            if (m_criteria == null)
            {
                GetCriteria(false);
            }
            bool modified = false;

            for (int i = 0; i < m_criteria.Length; i++)
            {
                MAssignCriteria criteria = m_criteria[i];
                if (criteria.IsMet(po))
                {
                    modified = true;
                    break;
                }
            }
            if (!modified)
            {
                return(false);
            }

            //	Assignment
            String methodName    = "set" + columnName;
            Type   parameterType = null;
            Object parameter     = null;
            int    displayType   = column.GetAD_Reference_ID();
            String valueString   = GetValueString();

            if (DisplayType.IsText(displayType) || displayType == DisplayType.List)
            {
                parameterType = typeof(string);
                parameter     = valueString;
            }
            else if (DisplayType.IsID(displayType) || displayType == DisplayType.Integer)
            {
                parameterType = typeof(int);
                if (GetRecord_ID() != 0)
                {
                    parameter = GetRecord_ID();
                }
                else if (valueString != null && valueString.Length > 0)
                {
                    try
                    {
                        parameter = int.Parse(valueString);
                    }
                    catch (Exception e)
                    {
                        log.Warning(ToString() + " " + e);
                        return(false);
                    }
                }
            }
            else if (DisplayType.IsNumeric(displayType))
            {
                parameterType = typeof(Decimal);
                if (valueString != null && valueString.Length > 0)
                {
                    try
                    {
                        parameter = Decimal.Parse(valueString);
                    }
                    catch (Exception e)
                    {
                        log.Warning(ToString() + " " + e);
                        return(false);
                    }
                }
            }
            else if (DisplayType.IsDate(displayType))
            {
                parameterType = typeof(DateTime);
                if (valueString != null && valueString.Length > 0)
                {
                    try
                    {
                        parameter = DateTime.Parse(valueString);
                    }
                    catch (Exception e)
                    {
                        log.Warning(ToString() + " " + e);
                        return(false);
                    }
                }
            }
            else if (displayType == DisplayType.YesNo)
            {
                parameterType = typeof(bool);
                parameter     = "Y".Equals(valueString);
            }
            else if (displayType == DisplayType.Button)
            {
                parameterType = typeof(string);
                parameter     = GetValueString();
            }
            else if (DisplayType.IsLOB(displayType))    //	CLOB is String
            {
                parameterType = typeof(byte[]);
                //	parameter = getValueString();
            }

            //	Assignment
            try
            {
                Type clazz = po.GetType();
                System.Reflection.MethodInfo method = clazz.GetMethod(methodName, new Type[] { parameterType });
                method.Invoke(po, new Object[] { parameter });
            }
            catch (Exception e)
            {
                log.Log(Level.WARNING, ToString(), e);
                //	fallback
                if (parameter is Boolean)
                {
                    po.Set_Value(index, valueString);
                }
                else
                {
                    po.Set_Value(index, parameter);
                }
                //	modified = false;
            }
            return(modified);
        }       //	executeIt
Exemple #59
0
 internal static extern ErrorCode StickerDataSetDisplayType(SafeStickerDataHandle stickerData, DisplayType type);
Exemple #60
0
 public static float GetTargetDpi(float dpi, DisplayType displayType)
 {
     return(displayType == DisplayType.Desktop? dpi : k_TargetDPIWindows);
 }