コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string ProcessName = "Project64";

            Process[] Processes = Process.GetProcessesByName(ProcessName);

            if (Processes.Length == 0)
            {
                ProcessName = "Project64d";
                Processes   = Process.GetProcessesByName(ProcessName);
            }

            if (Processes.Length > 0)
            {
                Process process = Processes[0];
                processHandle = OpenProcess(0x1F0FFF, true, process.Id);

                baseAddress = ReadWritingMemory.GetBaseAddress(ProcessName, 0x10, 4096, 4);

                if (baseAddress != 0)
                {
                    SetStatus("Successfully hooked Project64 & found OoT's RAM Address");
                    try
                    {
                        ConstantSetThreadEnabled = false;
                        if (ConstantSetThread != null)
                        {
                            while (ConstantSetThread.IsAlive)
                            {
                            }                                     // Wait for thread to finish execution
                        }
                        else
                        {
                            ConstantSetThread = new Thread(SetConstantValues);
                        }

                        ConstantSetThreadEnabled = true;
                        ConstantSetThread.Start();
                    }
                    catch { }
                }
                else
                {
                    MessageBox.Show("Failed to find the RAM start address! Please try again at the title screen of OoT!", "Hook Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Failed to find any Project64 processes! Please make sure that Project64 is running.", "Hook Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private bool IsOoTAlive()
        {
            if (processHandle != null && baseAddress != 0)
            {
                int reference = 0;
                int vBuffer   = 0;
                ReadWritingMemory.ReadProcessMemory1((int)processHandle, baseAddress + 0x10, ref vBuffer, 4, ref reference);
                if (ReadWritingMemory.ConstVal1 == vBuffer)
                {
                    return(true);
                }
            }

            Console.WriteLine("OoT emulation has ended!");
            return(false);
        }