コード例 #1
0
        /// <summary>
        /// MouseEvent
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case 0x84:
                base.WndProc(ref m);
                if ((int)m.Result == 0x1)
                {
                    m.Result = (IntPtr)0x2;
                }
                return;
            }
            base.WndProc(ref m);

            if (m.Msg == 0x0312 && m.WParam.ToInt32() == MYACTION_HOTKEY_ID)
            {
                if (running == false)
                {
                    running         = true;
                    OnOff.BackColor = Color.FromArgb(0, 192, 0);
                    TIMER.Start();
                    //Go to AcceptQ
                    MoveCursor(new Point(960, 718));
                }
                else
                {
                    running         = false;
                    OnOff.BackColor = Color.FromArgb(192, 0, 0);
                    TIMER.Stop();
                }
            }
            base.WndProc(ref m);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: RoadJDK/Twitch-Jambot
        /// <summary>
        /// MouseEvent
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case 0x84:
                base.WndProc(ref m);
                if ((int)m.Result == 0x1)
                {
                    m.Result = (IntPtr)0x2;
                }
                return;
            }
            base.WndProc(ref m);

            if (m.Msg == 0x0312 && m.WParam.ToInt32() == MYACTION_HOTKEY_ID)
            {
                if (running == false)
                {
                    running         = true;
                    OnOff.BackColor = Color.FromArgb(0, 192, 0);
                    Jams            = JAM.Text.Split(',').ToList();
                    Delay           = DelayCount.Value;
                    TIMER.Interval  = Convert.ToInt32(Delay * 1000);///s to ms
                    TIMER.Start();
                }
                else
                {
                    running         = false;
                    OnOff.BackColor = Color.FromArgb(192, 0, 0);
                    TIMER.Stop();
                }
            }
            base.WndProc(ref m);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: perrenialprick/XAPSpy
        private void TIMER_Tick(object sender, EventArgs e)
        {
            TIMER.Stop();
            Regex        regx1 = new Regex("(\\*Type:)(?<type>.+) (method name:)(?<method>.+)");
            Regex        regx2 = new Regex("(\\*Param Name:)(?<varname>[\\w\\W]*)");
            Regex        regx3 = new Regex("(?<var>[\\w\\W]*)");
            ListViewItem item  = null;

            bool isDumpingVars = false;
            int  i             = 0;

            try
            {
                listViewXDE.BeginUpdate();
                lock (monitorQueue)
                {
                    string strTmp = "";
                    while (monitorQueue.Count > 0)
                    {
                        i++;
                        MonitorEntry entry = monitorQueue.Dequeue();

                        if (regx1.IsMatch(entry.writeBuffer))   //beginning of method dump
                        {
                            if (isDumpingVars && item != null)
                            {
                                item.SubItems.Add(strTmp);
                                isDumpingVars = false;  //close previous method dump
                                strTmp        = "";
                                listViewXDE.Items[listViewXDE.Items.Count - 1].EnsureVisible();
                            }
                            Match m1 = regx1.Match(entry.writeBuffer);
                            item = listViewXDE.Items.Add(entry.timeStamp.ToLongTimeString());
                            string strType = m1.Groups["type"].ToString();
                            item.SubItems.Add(strType);
                            string strMethodName = m1.Groups["method"].ToString();
                            item.SubItems.Add(strMethodName);
                        }
                        else if (regx2.IsMatch(entry.writeBuffer))  //beginning of var name
                        {
                            Match m2 = regx2.Match(entry.writeBuffer);
                            strTmp       += m2.Groups["varname"].ToString().Replace("\r\n", "").Replace("\r", "") + ":";
                            isDumpingVars = true;
                        }
                        else if (isDumpingVars)
                        {
                            Match m3 = regx3.Match(entry.writeBuffer);
                            strTmp += m3.Groups["var"].ToString();
                        }
                    }
                    listViewXDE.EndUpdate();
                }
            }
            finally
            {
                TIMER.Start();
            }
        }
コード例 #4
0
        public GameBoyEmu(uint width, uint height, uint x = 0, uint y = 0) : base("GameBoyEmu", width, height, x, y)
        {
            Rom = Files.TetrisRom;

            mmu    = new MMU();
            cpu    = new CPU(mmu);
            ppu    = new PPU();
            timer  = new TIMER();
            joypad = new JOYPAD();

            mmu.loadGamePak(Rom);
        }
コード例 #5
0
 private void EndOfGame()
 {
     TIMER.Stop();
     Win           = new TextBox();
     Win.Enabled   = false;;
     Win.Multiline = true; Win.Height = this.Height; Win.Width = this.Width;
     Win.BackColor = this.ForeColor = Color.Aqua; Win.BorderStyle = BorderStyle.None;
     VisibleData(false);
     Win.Parent = pictureBox1;
     gBuff.Graphics.FillRectangle(sb, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));
     Win.Location = new System.Drawing.Point(pictureBox1.Width / 3, pictureBox1.Height / 3);
     Win.Text     = "Игра окончена!\r\nРезультат:" + (plus - minus).ToString();
     Win.Font     = new Font("Microsoft Sans Serif", 24, FontStyle.Bold);
     Controls.Add(Win);
 }
コード例 #6
0
        private void TIMER_Tick(object sender, EventArgs e)
        {
            var pixel = GetColorAt(new Point(765, 190));

            DoMouseClick();

            if (pixel.R == 0 && pixel.G == 0 && pixel.B == 0)
            {
                TIMER.Stop();
                running        = false;
                this.BackColor = Color.Maroon;
                Thread.Sleep(300);
                Run();
            }
        }
コード例 #7
0
 public void agora(int ticket)
 {
     if (PASSFLAG && NUMBERFLAG && month.value != 0 && year.value != 0 || CARD.value != 0)
     {
         date = DateTime.Now.ToString("M/d/yyyy");
         if (ticket == 1)
         {
             price = 1.5f;
             type  = "Β'Ζώνη";
         }
         else if (ticket == 2)
         {
             price = 1.1f;
             type  = "Κανονικό";
         }
         else if (ticket == 3)
         {
             price = 0.8f;
             type  = "Φοιτητικό";
         }
         else
         {
             price = 0.6f;
             type  = "Μαθητικό";
         }
         if (!File.Exists(path3))
         {
             using (StreamWriter save = File.CreateText(path3))
             {
                 save.WriteLine("UserName" + ' ' + "Type" + ' ' + "price" + ' ' + "date");
                 save.WriteLine(currentusername + ' ' + type + ' ' + price + ' ' + date);
             }
         }
         else
         {
             using (StreamWriter save = File.AppendText(path3))
             {
                 save.WriteLine(currentusername + ' ' + type + ' ' + price + ' ' + date);
             }
         }
         using (StreamWriter save = File.CreateText(path4))
         {
             save.WriteLine("OK");
         }
         TIMER.SetActive(true);
     }
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: perrenialprick/XAPSpy
        private void btnStop_Click(object sender, EventArgs e)
        {
            switch (isMonitoring)
            {
            case false:
                TIMER.Start();
                isMonitoring = true;
                btnStop.Text = "Stop";
                break;

            case true:
                TIMER.Stop();
                isMonitoring = false;
                btnStop.Text = "Start";
                break;
            }
        }
コード例 #9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Objects          = new List <Ball>();
            this.Size        = pictureBox1.Size;
            Plus.Location    = new System.Drawing.Point(Plus.Location.X, 5);
            shtr.Location    = new System.Drawing.Point(shtr.Location.X, 5);
            pictureBox1.Dock = DockStyle.Fill;
            CoordinatesDelta = new Point {
                X = this.Width / 2, Y = this.Height / 2
            };
            sb = new SolidBrush(this.BackColor);
            TIMER.Start();
            Ball.acceleration_koef = 0.005;
            Cue.MaxForce           = 5;
            StartingPosition();
            context = BufferedGraphicsManager.Current;
            context.MaximumBuffer = new Size(pictureBox1.Width + 1, pictureBox1.Height + 1);

            gBuff = context.Allocate(pictureBox1.CreateGraphics(), new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

            DrawToBuffer(gBuff.Graphics, TimeSpeed);
        }
コード例 #10
0
    static int EntryPoint()
    {
        // Create and start the thread for receiving and parsing the tuple
        RX     rx   = new RX();
        Thread rxTh = new Thread(new ThreadStart(rx.start_rx));

        rxTh.Start();

        TIMER  timer   = new TIMER();
        Thread timerTh = new Thread(new ThreadStart(timer.start_timer));

        timerTh.Start();

        TABLES tables = new TABLES();

        tables.reset_tables();
        Thread bw_tmpTh = new Thread(new ThreadStart(tables.update_bw_tmp));

        bw_tmpTh.Start();
        Thread tablesTh = new Thread(new ThreadStart(tables.update_tables));

        tablesTh.Start();

        while (true)
        {
            if (rst | clear)
            {
                timer.reset_timer();
                tables.reset_raw_entry();
                tables.reset_bw_tmp();
                tables.reset_total_entries();
            }
            Kiwi.Pause();
        }
        return(0);
    }
コード例 #11
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.A)
            {
                cue.Expand(0.1);
            }
            if (e.KeyCode == Keys.D)
            {
                cue.Expand(-0.1);
            }
            if (e.KeyCode == Keys.C)
            {
                cue.ChangeOwner(NextBall(cue.Owner.Numb));
            }
            if (e.KeyCode == Keys.F)
            {
                if (HitMode)
                {
                    DoHit(); HitMode = false;
                }
                else
                {
                    bo        = new BallOut("Шары не остановились");
                    shtr.Text = shtr.Text.Replace(minus.ToString(), (minus + 50).ToString()); minus += 50;
                    bo.Owner  = this;
                    bo.Show();
                }
            }
            if (e.KeyCode == Keys.L)
            {
                EndOfGame();
            }
            if (e.KeyCode == Keys.Escape)
            {
                TIMER.Stop();

                Menu m = new Menu(pictureBox1.Image); m.Owner = this;
                m.ShowDialog();
                if (m.DialogResult == DialogResult.Cancel)
                {
                    this.Close();
                }
                if (m.DialogResult == DialogResult.Retry)
                {
                    VisibleData(true); StartingPosition(); HitMode = true;
                }

                TIMER.Start();
            }

            if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Right)
            {
                if (TimeSpeed < 5)
                {
                    timelabel.Text = timelabel.Text.Replace((char)(TimeSpeed + 48), (char)(TimeSpeed * 2 + 48)); TimeSpeed *= 2;
                }
            }
            if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Left)
            {
                if (TimeSpeed > 1)
                {
                    timelabel.Text = timelabel.Text.Replace((char)(TimeSpeed + 48), (char)(TimeSpeed / 2 + 48)); TimeSpeed /= 2;
                }
            }
        }
コード例 #12
0
ファイル: Utils.cs プロジェクト: bravesoftdz/bdtheque
    //-----------------------------------------------------------------------------
    // Name: DXUtil.Timer()
    // Desc: Performs timer opertations. Use the following commands:
    //          TIMER.RESET           - to reset the timer
    //          TIMER.START           - to start the timer
    //          TIMER.STOP            - to stop (or pause) the timer
    //          TIMER.ADVANCE         - to advance the timer by 0.001 seconds
    //          TIMER.GETABSOLUTETIME - to get the absolute system time
    //          TIMER.GETAPPTIME      - to get the current time
    //          TIMER.GETELAPSEDTIME  - to get the time that elapsed between
    //                                  TIMER_GETELAPSEDTIME calls
    //-----------------------------------------------------------------------------
    public static float Timer(TIMER command)
    {
        if (!m_bTimerInitialized)
        {
            m_bTimerInitialized = true;

            // Use QueryPerformanceFrequency() to get frequency of timer.  If QPF is
            // not supported, we will timeGetTime() which returns milliseconds.
            long qwTicksPerSec = 0;
            m_bUsingQPF = QueryPerformanceFrequency(ref qwTicksPerSec);
            if (m_bUsingQPF)
            {
                m_llQPFTicksPerSec = qwTicksPerSec;  // in msec
            }
        }
        if (m_bUsingQPF)
        {
            double fTime;
            double fElapsedTime;
            long   qwTime = 0;

            // Get either the current time or the stop time, depending
            // on whether we're stopped and what command was sent
            if (m_llStopTime != 0 && command != TIMER.START && command != TIMER.GETABSOLUTETIME)
            {
                qwTime = m_llStopTime;
            }
            else
            {
                QueryPerformanceCounter(ref qwTime);
            }

            switch (command)
            {
            case TIMER.GETELAPSEDTIME:
            {
                // Return the elapsed time
                fElapsedTime        = (double)(qwTime - m_llLastElapsedTime) / (double)m_llQPFTicksPerSec;
                m_llLastElapsedTime = qwTime;
                return((float)fElapsedTime);
            }

            case TIMER.GETAPPTIME:
            {
                // Return the current time
                double fAppTime = (double)(qwTime - m_llBaseTime) / (double)m_llQPFTicksPerSec;
                return((float)fAppTime);
            }

            case TIMER.RESET:
            {
                // Reset the timer
                m_llBaseTime        = qwTime;
                m_llLastElapsedTime = qwTime;
                m_llStopTime        = 0;
                m_bTimerStopped     = false;
                return(0.0f);
            }

            case TIMER.START:
            {
                // Start the timer
                if (m_bTimerStopped)
                {
                    m_llBaseTime += qwTime - m_llStopTime;
                }
                m_llStopTime        = 0;
                m_llLastElapsedTime = qwTime;
                m_bTimerStopped     = false;
                return(0.0f);
            }

            case TIMER.STOP:
            {
                // Stop the timer
                m_llStopTime        = qwTime;
                m_llLastElapsedTime = qwTime;
                m_bTimerStopped     = true;
                return(0.0f);
            }

            case TIMER.ADVANCE:
            {
                // Advance the timer by millisecond
                m_llStopTime += m_llQPFTicksPerSec / 1000;
                return(0.0f);
            }

            case TIMER.GETABSOLUTETIME:
            {
                fTime = qwTime / (double)m_llQPFTicksPerSec;
                return((float)fTime);
            }

            default:
                return(-1.0f);    // Invalid command specified
            }
        }
        else
        {
            // Get the time using timeGetTime()
            double fTime;
            double fElapsedTime;

            // Get either the current time or the stop time, depending
            // on whether we're stopped and what command was sent
            if (m_fStopTime != 0.0 && command != TIMER.START && command != TIMER.GETABSOLUTETIME)
            {
                fTime = m_fStopTime;
            }
            else
            {
                fTime = timeGetTime();
            }

            switch (command)
            {
            case TIMER.GETELAPSEDTIME:
            {
                // Return the elapsed time
                fElapsedTime       = (double)(fTime - m_fLastElapsedTime);
                m_fLastElapsedTime = fTime;
                return((float)fElapsedTime);
            }

            case TIMER.GETAPPTIME:
            {
                // Return the current time
                return((float)(fTime - m_fBaseTime));
            }

            case TIMER.RESET:
            {
                // Reset the timer
                m_fBaseTime        = fTime;
                m_fLastElapsedTime = fTime;
                m_fStopTime        = 0;
                m_bTimerStopped    = false;
                return(0.0f);
            }

            case TIMER.START:
            {
                // Start the timer
                if (m_bTimerStopped)
                {
                    m_fBaseTime += fTime - m_fStopTime;
                }
                m_fStopTime        = 0.0f;
                m_fLastElapsedTime = fTime;
                m_bTimerStopped    = false;
                return(0.0f);
            }

            case TIMER.STOP:
            {
                // Stop the timer
                m_fStopTime        = fTime;
                m_fLastElapsedTime = fTime;
                m_bTimerStopped    = true;
                return(0.0f);
            }

            case TIMER.ADVANCE:
            {
                // Advance the timer by 1/10th second
                m_fStopTime += 0.1f;
                return(0.0f);
            }

            case TIMER.GETABSOLUTETIME:
            {
                return((float)fTime);
            }

            default:
                return(-1.0f);    // Invalid command specified
            }
        }
    }
コード例 #13
0
        private void TIMER_Tick(object sender, EventArgs e)
        {
            TIMER.Stop();

            try
            {
                /*
                 * Add new monitoring entries...
                 */
                LIST_Accesses.BeginUpdate();

                lock (MonitorQueue)
                {
                    while (MonitorQueue.Count > 0)
                    {
                        MonitorEntry Entry = MonitorQueue.Dequeue();
                        ListViewItem Item  = LIST_Accesses.Items.Insert(0, Entry.ClientPID.ToString());

                        Item.SubItems.Add(Entry.Timestamp.ToString("hh:mm:ss." + ((Entry.Timestamp.Ticks / 10000) % 1000).ToString()));
                        Item.SubItems.Add(Entry.Access);
                    }
                }

                LIST_Accesses.EndUpdate();

                /*
                 * Update internal process list...
                 */
                lock (ProcessList)
                {
                    Boolean HasChanged = false;

                    if (ProcessList.Count == LIST_Processes.Items.Count)
                    {
                        for (int i = 0; i < ProcessList.Count; i++)
                        {
                            if (ProcessList[i].Id != Int32.Parse(LIST_Processes.Items[i].SubItems[1].Text))
                            {
                                HasChanged = true;

                                break;
                            }
                        }
                    }
                    else
                    {
                        HasChanged = true;
                    }

                    if (HasChanged)
                    {
                        Int32 SelIndex = 0;

                        if (LIST_Processes.SelectedIndices.Count > 0)
                        {
                            SelIndex = LIST_Processes.SelectedIndices[0];
                        }

                        LIST_Processes.BeginUpdate();
                        LIST_Processes.Items.Clear();

                        for (int i = 0; i < ProcessList.Count; i++)
                        {
                            ProcessInfo  Proc = ProcessList[i];
                            ListViewItem Item = LIST_Processes.Items.Add("");

                            Item.SubItems.Add(Proc.Id.ToString());

                            if (Proc.Is64Bit)
                            {
                                Item.SubItems.Add("x64");
                            }
                            else
                            {
                                Item.SubItems.Add("x86");
                            }

                            Item.SubItems.Add(System.IO.Path.GetFileName(Proc.FileName));
                            Item.SubItems.Add(Proc.User);
                            Item.SubItems.Add(Proc.FileName);

                            Item.Checked = HookedProcesses.Contains(Proc.Id);
                        }

                        if (SelIndex >= LIST_Processes.Items.Count)
                        {
                            SelIndex = LIST_Processes.Items.Count - 1;
                        }

                        LIST_Processes.Items[SelIndex].Selected = true;
                        LIST_Processes.Items[SelIndex].EnsureVisible();

                        LIST_Processes.EndUpdate();
                    }


                    /*
                     * Update list of hooked processes...
                     */
                    for (int i = 0; i < HookedProcesses.Count; i++)
                    {
                        if (!ActivePIDList.Contains(HookedProcesses[i]))
                        {
                            HookedProcesses.RemoveAt(i--);
                        }
                    }
                }
            }
            finally
            {
                TIMER.Start();
            }
        }
コード例 #14
0
        private HID HID; // TODO: HID is the same across both cores?

        public CTR()
        {
            ARM9Bus  = new Bus();
            ARM11Bus = new Bus();

            HID = new HID();

            // ARM9 exclusive memory
            ROM Boot9 = new ROM("boot9.bin", "ARM9 BootROM");
            RAM ITCM9 = new RAM(0x8000, "Instruction TCM");
            RAM DTCM9 = new RAM(0x4000, "Data TCM");
            RAM WRAM9 = new RAM(0x100000, "AHB Work RAM");

            CFG9  ARM9CFG9  = new CFG9();
            IRQ   ARM9IRQ   = new IRQ();
            NDMA  ARM9NDMA  = new NDMA();
            TIMER ARM9TIMER = new TIMER();
            XDMA  ARM9CDMA  = new XDMA();
            PRNG  ARM9PRNG  = new PRNG();
            OTP   ARM9OTP   = new OTP();

            ARM9OTP.SetOTP("otp.bin");

            PXI ARM9PXI  = new PXI(7);
            PXI ARM11PXI = new PXI(6);

            ARM9PXI.AttachEndpoint(ARM11PXI);
            ARM11PXI.AttachEndpoint(ARM9PXI);

            // Quick hack: set up the ARM9 to infinitely spin in place
            for (uint Index = 0; Index < ITCM9.Size(); Index += 4)
            {
                ITCM9.WriteWord(Index, 0xEAFFFFFE); // b .
            }
            ARM9Bus.Attach(Boot9, 0xFFFF0000);
            ARM9Bus.Attach(ITCM9, 0x00000000); // ITCM mirrors, these are a hack
            ARM9Bus.Attach(ITCM9, 0x01FF8000); // and should be moved to the
            ARM9Bus.Attach(ITCM9, 0x07FF8000); // MMU/MPU layer
            ARM9Bus.Attach(DTCM9, 0xFFF00000); // same goes to DTCM
            ARM9Bus.Attach(WRAM9, 0x08000000);

            // ARM11 exclusive memory
            ROM Boot11 = new ROM("boot11.bin", "ARM11 BootROM");
            RAM PMR11  = new RAM(0x00002000, "MPCore PMR");

            ARM11Bus.Attach(Boot11, 0x00000000);
            ARM11Bus.Attach(Boot11, 0x00010000);
            ARM11Bus.Attach(PMR11, 0x17E00000);
            ARM11Bus.Attach(Boot11, 0xFFFF0000);

            // Shared memory
            RAM AXIWRAM = new RAM(0x100000, "AXI Work RAM");
            RAM FCRAM   = new RAM(0x08000000, "Fast-Cycle RAM");
            RAM VRAM    = new RAM(0x600000, "Video RAM");

            ARM9Bus.Attach(AXIWRAM, 0x1FF00000);
            ARM9Bus.Attach(FCRAM, 0x20000000);
            ARM9Bus.Attach(VRAM, 0x18000000);

            ARM11Bus.Attach(AXIWRAM, 0x1FF00000);
            ARM11Bus.Attach(FCRAM, 0x20000000);
            ARM11Bus.Attach(VRAM, 0x18000000);

            // IO Devices
            ARM9Bus.Attach(ARM9CFG9, 0x10000000);
            ARM9Bus.Attach(ARM9IRQ, 0x10001000);
            ARM9Bus.Attach(ARM9NDMA, 0x10002000);
            ARM9Bus.Attach(ARM9TIMER, 0x10003000);
            ARM9Bus.Attach(ARM9PXI, 0x10008000);
            ARM9Bus.Attach(ARM9CDMA, 0x1000C000);
            ARM9Bus.Attach(ARM9CDMA, 0x1000CD00);  // Mirror?
            ARM9Bus.Attach(ARM9PRNG, 0x10011000);
            ARM9Bus.Attach(ARM9OTP, 0x10012000);
            ARM9Bus.Attach(HID, 0x10146000);
            ARM11Bus.Attach(HID, 0x10146000);
            ARM9Bus.Attach(ARM11PXI, 0x10163000);
            ARM11Bus.Attach(ARM11PXI, 0x10163000);

            ARM9Core  = new Interpreter(ARM9Bus, true);
            ARM11Core = new Interpreter(ARM11Bus);

            ARM9Thread  = new Thread(Run9);
            ARM11Thread = new Thread(Run11);

            ARM9Enabled  = false;
            ARM11Enabled = false;
        }