public CartTV8K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x1000), 0x1000); BankBaseAddr = input.ReadUInt16(); LastBankBaseAddr = input.ReadUInt16(); }
public void SetMachineAccount(MachineBase machine) { if (machine is BillElevator elevator) { if (elevator.序号 < 0) { textBox_序号.Text = "新增设备"; } else { textBox_序号.Text = elevator.序号.ToString(); } comboBox_是否已检.SelectedItem = elevator.是否已检; comboBox_设备状态.SelectedItem = elevator.设备状态; textBox_本次检验日期.Text = elevator.本次检验日期.ToString(MachineBase.DataTimeFormate); textBox_下次检验日期.Text = elevator.次检验日期.ToString(MachineBase.DataTimeFormate); textBox_产品编号.Text = elevator.产品编号; textBox_内部编号.Text = elevator.内部编号; textBox_是否移交.Text = elevator.是否移交; textBox_移交日期.Text = elevator.移交日期; textBox_安全管理人员.Text = elevator.安全管理人员; comboBox_原.SelectedItem = elevator.原; comboBox_检.SelectedItem = elevator.检; comboBox_登.SelectedItem = elevator.登; comboBox_所属分厂.SelectedItem = elevator.所属分厂; textBox_安装地址.Text = elevator.安装地址; textBox_固定资产编号.Text = elevator.固定资产编号; textBox_设备名称.Text = elevator.设备名称; textBox_设备型号.Text = elevator.设备型号; textBox_设备制造单位.Text = elevator.设备制造单位; textBox_设备代码.Text = elevator.设备代码; textBox_出厂日期.Text = elevator.出厂日期.ToString(MachineBase.DataTimeFormate); textBox_始用日期.Text = elevator.始用时间.ToString(MachineBase.DataTimeFormate); textBox_维修次数.Text = elevator.维修次数.ToString(); textBox_维修金额.Text = elevator.维修费用.ToString(); //颜色还原 RestoreAllBackcolor(); if (elevator.设备状态 == MachineStatus.停用 && elevator.序号 > 0) { label_设备状态.BackColor = Color.Tomato; } else { label_设备状态.BackColor = BackColor; } //全部禁用 if (elevator.序号 > 0) { AllEnabled(false); } else { AllEnabled(true); } } }
public CartTV8K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x1000), 0x1000); BankBaseAddr = input.ReadUInt16(); LastBankBaseAddr = input.ReadUInt16(); }
private void HardReset() { _cart = Cart.Create(_rom, _gameInfo.CartType); ILogger logger = new ConsoleLogger(); HSC7800 hsc7800 = null; if (_hsbios != null) { hsc7800 = new HSC7800(_hsbios, _hsram); } Bios7800 bios7800 = new Bios7800(_bios); _theMachine = MachineBase.Create( _gameInfo.MachineType, _cart, bios7800, hsc7800, _gameInfo.LController, _gameInfo.RController, logger); _theMachine.Reset(); _theMachine.InputState.InputPollCallback = InputCallbacks.Call; ControlAdapter = new Atari7800Control(_theMachine); ControllerDefinition = ControlAdapter.ControlType; _avProvider.ConnectToMachine(_theMachine, _gameInfo); SetupMemoryDomains(hsc7800); }
public void ConnectToMachine(MachineBase m, EMU7800.Win.GameProgram g) { framebuffer = m.CreateFrameBuffer(); BufferWidth = framebuffer.VisiblePitch; BufferHeight = framebuffer.Scanlines; vidbuffer = new int[BufferWidth * BufferHeight]; uint newsamplerate = (uint)m.SoundSampleFrequency; if (newsamplerate != samplerate) { // really shouldn't happen (after init), but if it does, we're ready if (resampler != null) { resampler.Dispose(); } resampler = new SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null); samplerate = newsamplerate; dcfilter = DCFilter.DetatchedMode(256); } if (g.MachineType == MachineType.A7800PAL || g.MachineType == MachineType.A2600PAL) { palette = TIATables.PALPalette; } else { palette = TIATables.NTSCPalette; } }
public Cart78SGP(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadBytes()); _bank = input.ReadIntegers(4); _pokeySound = input.ReadOptionalPokeySound(m); }
public Cart78AB(DeserializationContext input, MachineBase m) : base(input) { var version = input.CheckVersion(1, 2); LoadRom(input.ReadBytes()); Bank = input.ReadIntegers(4); if (version == 1) input.ReadInt32(); }
public override void Attach(MachineBase m) { base.Attach(m); if (_pokeySound == null) { _pokeySound = new PokeySound(M); } }
public CartMN16K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x4000), 0x4000); RAM = input.ReadExpectedBytes(0x800); BankBaseAddr = input.ReadUInt16(); BankBaseRAMAddr = input.ReadUInt16(); RAMBankOn = input.ReadBoolean(); }
public Cart78AB(DeserializationContext input, MachineBase m) : base(input) { var version = input.CheckVersion(1, 2); LoadRom(input.ReadBytes()); Bank = input.ReadIntegers(4); if (version == 1) { input.ReadInt32(); } }
public CartDPC(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x2800), 0x2800); BankBaseAddr = input.ReadUInt16(); Tops = input.ReadExpectedBytes(8); Bots = input.ReadExpectedBytes(8); Counters = input.ReadUnsignedShorts(8); Flags = input.ReadExpectedBytes(8); MusicMode = input.ReadBooleans(3); LastSystemClock = input.ReadUInt64(); FractionalClocks = input.ReadDouble(); _ShiftRegister = input.ReadByte(); }
public Atari7800Control(MachineBase mac) { var l = mac.InputState.LeftControllerJack; var r = mac.InputState.RightControllerJack; foreach (var a in Adapters) { if (a.Left == l && a.Right == r) { Convert = a.Convert; ControlType = a.Type; return; } } throw new Exception(string.Format("Couldn't connect Atari 7800 controls \"{0}\" and \"{1}\"", l.ToString(), r.ToString())); }
/// <summary> /// Add common parameters before calling a procedure /// </summary> /// <param name="cmd">command object, where parameters will be added</param> /// <param name="machineObject"></param> private void AddCommonParams(SqlCommand cmd, MachineBase machineObject) { AddParameter(cmd, pNVarChar(MachineBase.Property_Name, 50, machineObject.Name)); AddParameter(cmd, pNVarChar(MachineBase.Property_MachineType, 50, machineObject.MachineType)); AddParameter(cmd, pGuid(MachineBase.Property_MachineId, machineObject.MachineId)); AddParameter(cmd, pBool(MachineBase.Property_IsOn, machineObject.IsOn)); AddParameter(cmd, pNVarChar(MachineBase.Property_MachineSerialNo, 50, machineObject.MachineSerialNo)); AddParameter(cmd, pNVarChar(MachineBase.Property_SalesStatus, 50, machineObject.SalesStatus)); AddParameter(cmd, pDateTime(MachineBase.Property_SalesDate, machineObject.SalesDate)); AddParameter(cmd, pGuid(MachineBase.Property_PrimaryOwner, machineObject.PrimaryOwner)); AddParameter(cmd, pNVarChar(MachineBase.Property_Note, machineObject.Note)); AddParameter(cmd, pGuid(MachineBase.Property_AddedBy, machineObject.AddedBy)); AddParameter(cmd, pDateTime(MachineBase.Property_AddedDate, machineObject.AddedDate)); AddParameter(cmd, pGuid(MachineBase.Property_LastUpdatedBy, machineObject.LastUpdatedBy)); AddParameter(cmd, pDateTime(MachineBase.Property_LastUpdatedDate, machineObject.LastUpdatedDate)); }
public void SetMachineAccount(MachineBase machine) { if (machine is BillNormal normal) { if (normal.序号 < 0) { textBox_序号.Text = "新建"; textBox_维修次数.Text = "0"; textBox_维修经费.Text = "0"; } else { textBox_序号.Text = normal.序号.ToString(); } textBox_设备名称.Text = normal.设备名称; comboBox_设备状态.SelectedItem = normal.设备状态; textBox_内部编号.Text = normal.内部编号; comboBox_所属分厂.SelectedItem = normal.所属分厂; textBox_规格型号.Text = normal.规格型号; textBox_设备安装地址.Text = normal.设备安装地址; textBox_安装单位.Text = normal.安装单位; textBox_设备制造单位.Text = normal.设备制造单位; textBox_产品编号.Text = normal.产品编号; textBox_始用时间.Text = normal.始用时间; textBox_维修次数.Text = normal.维修次数.ToString(); textBox_维修经费.Text = normal.维修经费.ToString(); textBox_备注.Text = normal.备注; //清除颜色 RestoreAllBackcolor(); if (normal.设备状态 == "停用" && normal.序号 > 0) { label_设备状态.BackColor = Color.Tomato;//2 } else { label_设备状态.BackColor = BackColor;//2 } } }
/// <summary> /// Updates Machine /// </summary> /// <param name="machineObject">Object to be updated</param> /// <returns>Number of rows affected</returns> public long Update(MachineBase machineObject) { try { SqlCommand cmd = GetSPCommand(UPDATEMACHINE); AddParameter(cmd, pInt32(MachineBase.Property_Id, machineObject.Id)); AddCommonParams(cmd, machineObject); long result = UpdateRecord(cmd); if (result > 0) { machineObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; } return(result); } catch (SqlException x) { throw new ObjectUpdateException(machineObject, x); } }
void SyncState(Serializer ser) { byte[] core = null; if (ser.IsWriter) { var ms = new MemoryStream(); theMachine.Serialize(new BinaryWriter(ms)); ms.Close(); core = ms.ToArray(); } ser.BeginSection("Atari7800"); ser.Sync("core", ref core, false); ser.Sync("Lag", ref _lagcount); ser.Sync("Frame", ref _frame); ser.Sync("IsLag", ref _islag); ser.EndSection(); if (ser.IsReader) { theMachine = MachineBase.Deserialize(new BinaryReader(new MemoryStream(core, false))); avProvider.ConnectToMachine(theMachine, GameInfo); } }
/// <summary> /// Inserts Machine /// </summary> /// <param name="machineObject">Object to be inserted</param> /// <returns>Number of rows affected</returns> public long Insert(MachineBase machineObject) { try { SqlCommand cmd = GetSPCommand(INSERTMACHINE); AddParameter(cmd, pInt32Out(MachineBase.Property_Id)); AddCommonParams(cmd, machineObject); long result = InsertRecord(cmd); if (result > 0) { machineObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; machineObject.Id = (Int32)GetOutParameter(cmd, MachineBase.Property_Id); } return(result); } catch (SqlException x) { throw new ObjectInsertException(machineObject, x); } }
private void HardReset() { cart = Cart.Create(rom, GameInfo.CartType); ILogger logger = new ConsoleLogger(); HSC7800 hsc7800 = null; if (hsbios != null) { hsc7800 = new HSC7800(hsbios, hsram); } Bios7800 bios7800 = new Bios7800(bios); theMachine = MachineBase.Create (GameInfo.MachineType, cart, bios7800, hsc7800, GameInfo.LController, GameInfo.RController, logger); theMachine.Reset(); theMachine.InputState.InputPollCallback = InputCallbacks.Call; ControlAdapter = new Atari7800Control(theMachine); ControllerDefinition = ControlAdapter.ControlType; _avProvider.ConnectToMachine(theMachine, GameInfo); // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1 CoreComm.VsyncNum = theMachine.FrameHZ; CoreComm.VsyncDen = 1; SetupMemoryDomains(hsc7800); }
/// <summary> /// Fills Machine object /// </summary> /// <param name="machineObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> /// <param name="start">The ordinal position from which to start reading the reader</param> protected void FillObject(MachineBase machineObject, SqlDataReader reader, int start) { machineObject.Id = reader.GetInt32(start + 0); machineObject.Name = reader.GetString(start + 1); machineObject.MachineType = reader.GetString(start + 2); machineObject.MachineId = reader.GetGuid(start + 3); machineObject.IsOn = reader.GetBoolean(start + 4); machineObject.MachineSerialNo = reader.GetString(start + 5); machineObject.SalesStatus = reader.GetString(start + 6); if (!reader.IsDBNull(7)) { machineObject.SalesDate = reader.GetDateTime(start + 7); } machineObject.PrimaryOwner = reader.GetGuid(start + 8); machineObject.Note = reader.GetString(start + 9); machineObject.AddedBy = reader.GetGuid(start + 10); machineObject.AddedDate = reader.GetDateTime(start + 11); machineObject.LastUpdatedBy = reader.GetGuid(start + 12); machineObject.LastUpdatedDate = reader.GetDateTime(start + 13); FillBaseObject(machineObject, reader, (start + 14)); machineObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; }
public void ConnectToMachine(MachineBase m, GameProgram g) { _frameHz = m.FrameHZ; Framebuffer = m.CreateFrameBuffer(); BufferWidth = Framebuffer.VisiblePitch; BufferHeight = Framebuffer.Scanlines; _vidbuffer = new int[BufferWidth * BufferHeight]; uint newsamplerate = (uint)m.SoundSampleFrequency; if (newsamplerate != _samplerate) { // really shouldn't happen (after init), but if it does, we're ready _resampler?.Dispose(); _resampler = new SpeexResampler((SpeexResampler.Quality) 3, newsamplerate, 44100, newsamplerate, 44100, null, null); _samplerate = newsamplerate; _dcfilter = new DCFilter(256); } if (g.MachineType == MachineType.A2600PAL) { _palette = TIATables.PALPalette; } else if (g.MachineType == MachineType.A7800PAL) { _palette = MariaTables.PALPalette; } else if (g.MachineType == MachineType.A2600NTSC) { _palette = TIATables.NTSCPalette; } else { _palette = MariaTables.NTSCPalette; } }
public QFModule CalQuFu(SXCJModule module, List <float> list, double qfLimit, float maxForce, MachineBase machine) { List <QFModule> resultList = new List <QFModule>(); //屈服过程集合 float lastLZ = 0.0f; //上个点的力值 Boolean startQF = false; //开始进入屈服阶段标记 float upQF = 0.0f; //上屈服 float downQF = 0.0f; //下屈服 Int32 qfCount = 0; //屈服点数量 for (int i = 0; i < list.Count; i++) { float lz = list[i]; if (lz < module.SpecialSetting.QFStartValue) { continue;//如果在设定的有效力值之下,跳过 } if (lz == maxForce) { break; //如果到最大力值,结束循环 } if (!startQF) //还没记录到下降 { if (lz < lastLZ) //当前力值比上一个力值小时 { startQF = true; qfCount = 1; upQF = lastLZ; downQF = lz; } else { lastLZ = lz; } } else//进入屈服判断过程 { if (lz > upQF)//超过上屈服,表示屈服过程结束 { if (qfCount > module.SpecialSetting.PrecisionGrade)//在精度范围内的点数 { QFModule m = new QFModule(); m.QFCount = qfCount; m.UpQF = upQF; m.DownQF = downQF; resultList.Add(m); } upQF = 0.0f; downQF = 0.0f; startQF = false; } else//曲线下降,更新下屈服 { downQF = lz < downQF ? lz : downQF; } qfCount++; lastLZ = lz; } } return(GetRealQFModule(resultList)); }
public Cart78AC(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadBytes()); Bank = input.ReadIntegers(8); }
public Cart78AC(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadBytes()); Bank = input.ReadIntegers(8); }
public Cart7832P(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x8000), 0x8000); _pokeySound = input.ReadOptionalPokeySound(m); }
void HardReset() { cart = Cart.Create(rom, GameInfo.CartType); ILogger logger = new ConsoleLogger(); HSC7800 hsc7800 = null; if (hsbios != null) { hsc7800 = new HSC7800(hsbios, hsram); } Bios7800 bios7800 = new Bios7800(bios); theMachine = MachineBase.Create (GameInfo.MachineType, cart, bios7800, hsc7800, GameInfo.LController, GameInfo.RController, logger); theMachine.Reset(); theMachine.InputState.InputPollCallback = CoreComm.InputCallback.Call; ControlAdapter = new Atari7800Control(theMachine); ControllerDefinition = ControlAdapter.ControlType; avProvider.ConnectToMachine(theMachine, GameInfo); // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1 CoreComm.VsyncNum = theMachine.FrameHZ; CoreComm.VsyncDen = 1; // reset memory domains if (_MemoryDomains == null) { _MemoryDomains = new List <MemoryDomain>(); if (theMachine is Machine7800) { _MemoryDomains.Add(new MemoryDomain( "RAM1", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } return(((Machine7800)theMachine).RAM1[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } ((Machine7800)theMachine).RAM1[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "RAM2", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } return(((Machine7800)theMachine).RAM2[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } ((Machine7800)theMachine).RAM2[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(bios[addr]); }, delegate(int addr, byte val) { })); if (hsc7800 != null) { _MemoryDomains.Add(new MemoryDomain( "HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(hsbios[addr]); }, delegate(int addr, byte val) { })); _MemoryDomains.Add(new MemoryDomain( "HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(hsram[addr]); }, delegate(int addr, byte val) { hsram[addr] = val; })); } _MemoryDomains.Add(new MemoryDomain( "System Bus", 65536, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return(theMachine.Mem[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } theMachine.Mem[(ushort)addr] = val; })); } else // todo 2600? { } MemoryDomains = new MemoryDomainList(_MemoryDomains); } }
public CartPB8K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x2000), 0x2000); SegmentBase = input.ReadUnsignedShorts(); }
public void SetMachineAccount(MachineBase machine) { throw new NotImplementedException(); }
public QFModule CalQuFu(SXCJModule module, List <float> list, double qfLimit, float maxForce, MachineBase machine) { QFModule _QFModule = new QFModule(); FYUniversQF ou = machine as FYUniversQF; if (ou != null) { float downQF = 0.00f; float upQF = 0.00f; ou.GetQF(out downQF, out upQF); _QFModule.DownQF = downQF; _QFModule.UpQF = upQF; } return(_QFModule); }
public override void Attach(MachineBase m) { base.Attach(m); if (_pokeySound == null) _pokeySound = new PokeySound(M); }
public CartDC8K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x2000), 0x2000); }
public Cart7832P(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x8000), 0x8000); _pokeySound = input.ReadOptionalPokeySound(m); }
public Cart78SGP(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadBytes()); _bank = input.ReadIntegers(4); _pokeySound = input.ReadOptionalPokeySound(m); }
public CartPB8K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x2000), 0x2000); SegmentBase = input.ReadUnsignedShorts(); }
/// <summary> /// Fills Machine object /// </summary> /// <param name="machineObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> protected void FillObject(MachineBase machineObject, SqlDataReader reader) { FillObject(machineObject, reader, 0); }
/// <summary> /// Initializes a new instance of the <see cref="ErrorState"/> class. /// </summary> /// <param name="automaton">The automaton.</param> public ErrorState(MachineBase automaton) : base(automaton) { }
public override void Attach(MachineBase m) { base.Attach(m); _pokeySound = new PokeySound(M); }
public CartA4K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x1000), 0x1000); }
public static float CalQF(SXCJModule module, List <float> list, Double qfLimit, float maxForce, Logger log, MachineBase machine) { float qf = 0.0f; try { if (module.SpecialSetting.MachineType == 2 && maxForce > 0 && list != null && list.Count > 0) { QFModule m = null; QuFuBase quBase = QuFuFactory.GetQuFuModule(module.SpecialSetting.QFName); ReSet: if (quBase != null) { m = quBase.CalQuFu(module, list, qfLimit, maxForce, machine); } if (m == null)//无屈服过程,是否乘以参数? { qf = (float)(maxForce * module.SpecialSetting.QFParameter); } else { if (module.SpecialSetting.QuFuType == 1) { qf = m.UpQF; } else { qf = m.DownQF; } if (qf == 0.00f && !isRemarkQF) { if (module.SpecialSetting.IsDebug) { log.WriteLog("调用备用屈服算法通用0722!", true, false); } isRemarkQF = true; quBase = QuFuFactory.GetQuFuModule("通用0722"); goto ReSet; } } } } catch (Exception ex) { log.WriteLog(ex.Message + "\r\n" + ex.StackTrace, true, true); } isRemarkQF = false; return(qf); }
public CartDPC(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x2800), 0x2800); BankBaseAddr = input.ReadUInt16(); Tops = input.ReadExpectedBytes(8); Bots = input.ReadExpectedBytes(8); Counters = input.ReadUnsignedShorts(8); Flags = input.ReadExpectedBytes(8); MusicMode = input.ReadBooleans(3); LastSystemClock = input.ReadUInt64(); FractionalClocks = input.ReadDouble(); _ShiftRegister = input.ReadByte(); }
public CartMN16K(DeserializationContext input, MachineBase m) : base(input) { input.CheckVersion(1); LoadRom(input.ReadExpectedBytes(0x4000), 0x4000); RAM = input.ReadExpectedBytes(0x800); BankBaseAddr = input.ReadUInt16(); BankBaseRAMAddr = input.ReadUInt16(); RAMBankOn = input.ReadBoolean(); }